Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iPhone Simulator - set HTTP proxy

I'm coding an iPhone app that needs to make small HTTP requests to the Internet. Within our corp LAN, all HTTP traffic has to go through Squid.

The simulator is clearly capable of using a proxy - since Mobile Safari works. But, how do I get/set the proxy settings in code?

A bunch of the headers are commented out for the simulator. For example,

CFNetworkCopySystemProxySettings

In CFProxySupport.h is not available to the simulator - only to the device. I've tried hardcoding like this:

CFReadStreamSetProperty(stream, kCFProxyHostNameKey, @"internal.proxy.servername");
CFReadStreamSetProperty(stream, kCFProxyPortNumberKey, [NSNumber numberWithInt:80]);
CFReadStreamSetProperty(stream, kCFProxyTypeKey, kCFProxyTypeHTTP);

But no joy.

Thoughts?

like image 560
Dan Bennett Avatar asked Feb 10 '09 23:02

Dan Bennett


People also ask

Should HTTP proxy be on or off on iPhone?

It should be set to off if you don't know what it does. 1) HTTP Proxy is basically a webaddress you type in to your companies proxy server so you can access the internet.


2 Answers

You can try:
"System Preferences" -> "Network" -> Select your network device -> "Advanced" -> "Proxies"

like image 153
Thomas Zoechling Avatar answered Oct 21 '22 09:10

Thomas Zoechling


You can try using Proxifier: http://www.proxifier.com/mac/ It enables you to set a proxy to any program.

Not what you asked but it should solve your problem.

like image 43
Alexandre L Telles Avatar answered Oct 21 '22 10:10

Alexandre L Telles