Re: CFHTTPRequest issue
Re: CFHTTPRequest issue
- Subject: Re: CFHTTPRequest issue
- From: "Quinn \"The Eskimo!\"" <email@hidden>
- Date: Mon, 29 Apr 2013 10:47:49 +0100
On 29 Apr 2013, at 07:44, Arjun SM <email@hidden> wrote:
> CFReadStreamRef readStream = CFReadStreamCreateForHTTPRequest(kCFAllocatorDefault, cfHttpReq);
Hmmm, I'm confused what you're trying to achieve here. You have two choices:
A. If you want to use CFHTTPStream (that is, have CFNetwork take care of the fiddly HTTP details), you should open your stream using CFReadStreamCreateForHTTPRequest and then you can get the response via the kCFStreamPropertyHTTPResponseHeader property.
B. If you want to use CFSocketStream (that is, take care of the low-level HTTP stuff yourself), you should open your stream using one of the socket stream APIs (typically CFStreamCreatePairWithSocketToHost) then use CFHTTPMessage to create and serialise the outgoing request and parse the incoming response.
Using the combination of CFReadStreamCreateForHTTPRequest (from A) and CFHTTPMessageAppendBytes (from B) is very strange, unless you have nested HTTP responses.
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