Re: CFNetwork with multiple persistent HTTP connections
Re: CFNetwork with multiple persistent HTTP connections
- Subject: Re: CFNetwork with multiple persistent HTTP connections
- From: Jens Alfke <email@hidden>
- Date: Thu, 16 Jul 2009 08:04:39 -0700
On Jul 16, 2009, at 6:26 AM, Joe Ranieri wrote:
What I'm aiming for is having several persistent connections to a
given HTTPS server, and just have requests queue up if all
connections are processing requests. What's the best way to do this
with CFNetwork?
Well, you can create multiple CFStreams, and for each one keep track
of whether you've received a response to every request you've sent
over it. This won't allow the streams to do any HTTP pipelining, but I
don't believe CFNetwork supports that anyway.
Also, I need to do custom SSL certificate verification - where is
the best place to do this? I tried doing it in
kCFStreamEventOpenCompleted, but the stream (created via
CFReadStreamCreateForHTTPRequest) never calls back for that event...
IIRC, there isn't a CFNetwork callback that lets you inspect the cert
before the connection opens. If you want that level of control, you'd
have to roll your own SSL support using the lower-level
SecureTransport API.
What you could do is wait till after the SSL handshake, and then look
at the cert and immediately close the connection if you don't like it.
You can do this the first time the CFStream notifies you that there
are bytes available to read. (The open-completed callback occurs
before the SSL handshake, and in the case of an HTTP stream you don't
get it at all.)
—Jens
Attachment:
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________
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