Re: Setting Web Proxy programmatically
Re: Setting Web Proxy programmatically
- Subject: Re: Setting Web Proxy programmatically
- From: "parag vibhute" <email@hidden>
- Date: Wed, 19 Mar 2008 12:00:08 +0530
Following is a part of preferences.plist:
<key>Proxies</key>
<dict>
<key>AppleProxyConfigurationSelected</key>
<integer>1</integer>
<key>ExcludeSimpleHostnames</key>
<integer>0</integer>
<key>FTPPassive</key>
<integer>1</integer>
<key>HTTPEnable</key>
<integer>1</integer>
<key>HTTPPort</key>
<integer>808</integer>
<key>HTTPProxy</key>
<string>192.168.20.107</string>
<key>HTTPSEnable</key>
<integer>1</integer>
<key>HTTPSPort</key>
<integer>808</integer>
<key>HTTPSProxy</key>
<string>192.168.20.107</string>
<key>ProxyAutoConfigEnable</key>
<integer>1</integer>
<key>ProxyAutoConfigURLString</key>
<string>http://www.re.com</string>
<key>ProxyAutoDiscoveryEnable</key>
<integer>0</integer>
</dict>
As you can see that for ProxyAutoConfigEnable, ProxyAutoConfigURLString &
ProxyAutoDiscoveryEnable keys respective keys are present in System
Configuration Framework as follows.
* kSCPropNetProxiesProxyAutoConfigEnable
"ProxyAutoConfigEnable" CFNumber (0 or 1)
* kSCPropNetProxiesProxyAutoConfigURLString
"ProxyAutoConfigURLString" CFString
* kSCPropNetProxiesProxyAutoDiscoveryEnable
"ProxyAutoDiscoveryEnable" CFNumber (0 or 1)
But for AppleProxyConfigurationSelected key in plist there is no respective
key is present in System Configuration Framework. The key which you have
mentioned is for "ProxyAutoConfigEnable" & not for
"AppleProxyConfigurationSelected".
Thanks,
Palav
On Tue, Mar 18, 2008 at 9:40 PM, Jean-Daniel Dupas <email@hidden>
wrote:
> And the kSCPropNetProxiesProxyAutoConfigEnable key does not do that?
>
> Le 18 mars 08 à 16:50, parag vibhute a écrit :
> > Thanks for URL.
> >
> > I went through code & system configuation framework. There I found
> > that you can set HTTP(HTTPS etc.) proxy and also PAC file URL (using
> > kSCPropNetProxiesProxyAutoConfigURLString key) but I want to
> > configure proxies using PAC file. When I analyzed network pane of
> > system preferences & preferences.plist (path is /Library/Preferences/
> > SystemConfiguration/preferences.plist), I noticed that in order to
> > set PAC file, there is a key "AppleProxyConfigurationSelected" in
> > plist which should be 1. I have not found equivalent key for this in
> > SystemConfiguration framework.
> >
> > Thanks again,
> > Palav
> >
> >
> > There is a bunch of helper to retreive and change configuration.
> >
> >
> > Le 18 mars 08 à 14:38, parag vibhute a écrit :
> >
> >> Thank for reply.
> >>
> >> As you said, they are accessible but are they writable? Through
> >> search, I think they are only readable or for getting notification.
> >> But my requirement is to change it.
> >>
> >> Thanks,
> >> Palav
> >>
> >> On Tue, Mar 18, 2008 at 6:29 PM, Jean-Daniel Dupas <
> email@hidden
> >> > wrote:
> >> As already said by Basavaraj, all proxy settings are accessible using
> >> the "SystemConfiguration" Framework.
> >>
> >>
> >> Le 18 mars 08 à 13:37, parag vibhute a écrit :
> >>
> >> > My requirement is to set proxy via selecting "Using a PAC file" in
> >> > Configure
> >> > proxy drop-down button of Network pane of system preferences.
> >> >
> >> > I have to achieve this programmatically. How to do this?
> >> >
> >> > Thanks,
> >> > Palav
> >> >
> >> > On Tue, Mar 18, 2008 at 2:39 PM, Cocoa Developer <
> email@hidden
> >> > >
> >> > wrote:
> >> >
> >> >>
> >> >> Hi Palav,
> >> >> Yes it is possible.
> >> >>
> >> >> You need to use SystemConfiguration framework. You can get all
> >> proxy
> >> >> information except authentication. So don't try to get proxy
> >> >> information
> >> >> from network pane. Its useless.
> >> >> If you want to use network pane in system preference then use
> >> >> CFSocket.
> >> >> (Best option)
> >> >>
> >> >> CFSocket will take care of proxy handling before setting up a new
> >> >> connection.
> >> >>
> >> >> For BSD sockets you need to have all information and need to work
> >> >> on proxy
> >> >> manually.
> >> >> If u have to use BSD sockets, then have ur own proxy settings in
> >> your
> >> >> application preference pane and use them.
> >> >>
> >> >> Regards,
> >> >> Basavaraj
> >> >>
> >> >>
> >> >>
> >> >> On Tue, Mar 18, 2008 at 2:22 PM, parag vibhute <
> email@hidden
> >> >> >
> >> >> wrote:
> >> >>
> >> >>>
> >>
> >>
> >>
> >>
> >> --
> >>
> >> There are many things in your life that will catch your eye but
> >> only a few will catch your heart....pursue those'.
> >
> >
> >
> >
> > --
> >
> > There are many things in your life that will catch your eye but only
> > a few will catch your heart....pursue those'.
>
>
--
There are many things in your life that will catch your eye but only a few
will catch your heart....pursue those'.
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden