On Jul 15, 2014, at 2:10 AM, Jens Alfke <email@hidden> wrote:
On Jul 14, 2014, at 10:34 PM, Daryle Walker < email@hidden> wrote: I’m in the middle. It’s a NSURLProtocol subclass, which NSURLConnection/Session use to do their dirty work. So I have to implement the “automatic" check and proxy setting following, probably involving CFStream or BSD sockets. Hopefully not the latter, since I’m a newbie.
You can actually do the dirty work using NSURLConnection/Session. You just have to avoid infinite regress...
I don’t know which one(s) I need yet. What proxy styles were the Networking authors envisioning for the entries in the control panel?
I imagine it supports all of them, since any missing support would lead to some enterprise IT department banning Macs because “they don’t work on our network”. :-p
Checking on another forum, this time about the protocol, the protocol doesn’t have direct proxy primitives, it just piggybacks on a HTTP 1.1 CONNECT command. So I guess I send the command, check if the response has a success code, keeping a persistent connection (so my next steps can use the just-authorized link), then send my key string and wait for the proxied response. I haven’t read the CONNECT spec yet; so is the second request/respond round a raw transaction, or do I wrap the request in another HTTP command (and get response as a HTTP response)? I’m guessing that the CF/NS-Stream APIs support whichever way I’m supposed to do it, otherwise Apple’s own FTP and HTTP code couldn’t handle proxies.
If the second request/response round is not raw, then I can’t reuse the code I need for non-proxy transactions.
How am I supposed to test the subclass, proxy or not? My guess so far is to make a quick web-browser app and hook my NSURLProtocol subclass to it, then enter an appropriate URL. It’ll have to always return text/plain data at first so I can see what happens.
— Daryle Walker Mac, Internet, and Video Game Junkie darylew AT mac DOT com
|