Re: Problem with connection via Proxy using CFNetwork in TCP stream
Re: Problem with connection via Proxy using CFNetwork in TCP stream
- Subject: Re: Problem with connection via Proxy using CFNetwork in TCP stream
- From: "Quinn \"The Eskimo!\"" <email@hidden>
- Date: Thu, 03 Dec 2015 18:11:02 +0000
On 3 Dec 2015, at 12:38, Motti Shneor <email@hidden> wrote:
> We are looking for ways to use the machinery already in the OS for establishing our secure connection (tunnel) with the server, then continue with our proprietary protocol.
Have you thought about WebSockets? It doesn't seem like much of a leap to move your server on to WebSockets, at which point your client is much more HTTP-like, and hence much more compatible with weird environments.
> 1. Is there a way to start the negotiation and open the connection to the server using CFHTTPStream, then “rewrap” the bsd socket with a CFSocketStream and continue on?
No. CFHTTPStream can handle arbitrary data streams, both up and down, but it does that via the chunked transfer encoding, which won't help you.
OTOH, NSURLSession supports something like this. See NSURLSessionResponseBecomeStream. This won't work for a pure binary protocol, but it'd work well if you were on a WebSocket base.
> 2. Otherwise - is there a lower-level API we can employ for just the Proxy authentication and negotiation ?
You can use CFHTTPMessage, but it's not without its quirks. Specifically, it doesn't support the more complex authentication schemes because a critical API, _CFHTTPMessageSetResponseURL, is not public. You can search the list archives for the backstory to that.
Share and Enjoy
--
Quinn "The Eskimo!" <http://www.apple.com/developer/>
Apple Developer Relations, Developer Technical Support, Core OS/Hardware
_______________________________________________
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