• 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
Re: Implementing proxy support
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Implementing proxy support


  • Subject: Re: Implementing proxy support
  • From: Daryle Walker <email@hidden>
  • Date: Sun, 20 Jul 2014 08:11:09 -0400

On Jul 17, 2014, at 4:48 AM, Daryle Walker <email@hidden> wrote:

Just inspected an open-source program with this need.  The code for the raw request and response is preceded by an IF block, testing if there’s proxy settings, to send the CONNECT command.  (There’s no string building; the author printfs the HTTP request block right to the stream and scanfs the response to look for the 200 and blow through the rest.)  So reuse should be possible, just need to create the CFStream before calling the CFHTTP code so I can still use the CFStream after the HTTP stuff.

I’ve been checking more of Apple’s docs, and I notice:

CFDictionaryRef proxyDict = SCDynamicStoreCopyProxies(NULL);
CFReadStreamSetProperty(readStream, kCFStreamPropertyHTTPProxy, proxyDict);

(at <https://developer.apple.com/library/mac/documentation/Networking/Conceptual/CFNetwork/CFStreamTasks/CFStreamTasks.html>) and the various parts of the CFProxySupport API. Can I use code like the above to automatically handle the HTTP-CONNECT stuff before my reads/writes?  Or do I have to manually stream the CONNECT request/response cycle?  (This new method has the benefit of working with other proxy styles too.)

If that code would work, I think I can use it for HTTP and SOCKS proxies.  (And FTP theoretically too, but I’ll skip that since native FTP proxies are specifically for FTP and aren’t usable by other protocols.)  Can this technique work for the automatic-configuration (URL/_javascript_) proxy types?

On another note, I read NSURLProtocol, and I’m wondering where the network code actually goes.  Putting it in startLoading: would cause reentry issues with stopLoading: (and blocking).  I guess I could implement with NSOperations (and queue) or NSStream delegates, doing the setup in startLoading:.

— 
Daryle Walker
Mac, Internet, and Video Game Junkie
darylew AT mac DOT com 

 _______________________________________________
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: Implementing proxy support
      • From: Jens Alfke <email@hidden>
References: 
 >Implementing proxy support (From: Daryle Walker <email@hidden>)
 >Re: Implementing proxy support (From: Jens Alfke <email@hidden>)
 >Re: Implementing proxy support (From: Daryle Walker <email@hidden>)
 >Re: Implementing proxy support (From: Jens Alfke <email@hidden>)
 >Re: Implementing proxy support (From: Daryle Walker <email@hidden>)
 >Re: Implementing proxy support (From: Daryle Walker <email@hidden>)

  • Prev by Date: Problems with authenticated background downloads involving a 301 redirect
  • Next by Date: Re: Implementing proxy support
  • Previous by thread: Re: Implementing proxy support
  • Next by thread: Re: Implementing proxy support
  • Index(es):
    • Date
    • Thread