• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
How to get proxy settings for use with CFStream?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

How to get proxy settings for use with CFStream?


  • Subject: How to get proxy settings for use with CFStream?
  • From: Jens Alfke <email@hidden>
  • Date: Tue, 28 May 2013 12:51:02 -0700

I have some code that uses CFReadStreamCreateForHTTPRequest to send an HTTP request. I have a bug report that this fails with a POSIX error 60 (ECONN) in an environment where a proxy server has to be used to reach outside HTTP servers. I looked at the docs and sure ‘nuf, CFStream doesn’t use the system proxy settings the way NSURLConnection does. Crap.

I added the following code, but the user reports that it still doesn’t work for him:

    CFDictionaryRef proxySettings = CFNetworkCopySystemProxySettings();
    if (proxySettings) {
        CFArrayRef proxies = CFNetworkCopyProxiesForURL((__bridge CFURLRef)url, proxySettings);
        if (CFArrayGetCount(proxies) > 0) {
            CFTypeRef proxy = CFArrayGetValueAtIndex(proxies, 0);
            NSLog(@"Changes feed using proxy %@", proxy);
            bool ok = CFReadStreamSetProperty(cfInputStream, kCFStreamPropertyHTTPProxy, proxy);
            Assert(ok);
            CFRelease(proxies);
        }
        CFRelease(proxySettings);
    }

The output of that NSLog shows that the proxy dictionary he’s getting is:

{ kCFProxyAutoConfigurationURLKey = "http://bgproxy.XXXX/wpad.dat";
  kCFProxyTypeKey = kCFProxyTypeAutoConfigurationURL; }

This doesn’t look right. It’s a specification of where to read the proxy settings from, not an actual proxy setting, and it doesn’t match the proxy keys defined in the CFStream documentation (i.e. “kCFStreamPropertySOCKS*”.) So how do I get the actual proxy settings?

(This is complicated by the fact that I don’t have access to a firewalled network that uses an HTTP proxy, so I can’t reproduce the problem directly.)

—Jens
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Macnetworkprog mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: How to get proxy settings for use with CFStream?
      • From: "Anluan O'Brien" <email@hidden>
    • Re: How to get proxy settings for use with CFStream?
      • From: Josh Graessley <email@hidden>
  • Prev by Date: Need your help! create pptp vpn on mac unsuccessfully!
  • Next by Date: Re: How to get proxy settings for use with CFStream?
  • Previous by thread: Need your help! create pptp vpn on mac unsuccessfully!
  • Next by thread: Re: How to get proxy settings for use with CFStream?
  • Index(es):
    • Date
    • Thread