Re: How to reuse session for CFHTTP?
Re: How to reuse session for CFHTTP?
- Subject: Re: How to reuse session for CFHTTP?
- From: Michael Ledford <email@hidden>
- Date: Fri, 15 Feb 2008 17:47:15 -0500
Hello Dave,
I did find this message, http://lists.apple.com/archives/
Macnetworkprog/2004/Nov/msg00048.html but I think I can give a more
through answer.
Basically CFHTTP is just a way to send messages back a forth to a web
server. It doesn't parse out the headers that are sent back and forth
and retain them for the next call. Persistence is just for the actual
socket connection to the web server itself. You would basically have
to implement cookie handling by reading set-cookie headers and then
sending cookies using cookie headers.
You could do this by using NSHTTPCookie and giving it a dictionary of
the header fields given back by CFHTTPMessageCopyAllHeaderFields from
a HTTP request. Then adding the header fields back when creating a
new message obtained from requestHeaderFieldsWithCookies:.
Hope this helps!
Sincerely,
Michael Ledford
On Feb 15, 2008, at 5:14 PM, Dave Hersey wrote:
Hi,
I'm making HTTP POST requests to a server that takes/returns XML
and I've been using the approached that's demonstrated in the POST
Example from the /Developer/Examples/Networking folder. Basically,
this approach uses CFHTTPMessageCreateRequest,
CFHTTPMessageSetBody, CFReadStreamCreateForHTTPRequest and so on.
It all works great, but on the server end, a new session ID is
being set up every time I send a POST request. Is there a way to
extract the session cookie and reuse it with this approach or do I
need to change APIs? I can't find anything of relevance in the
archives or docs, but maybe the session ID is being called
something else.
Thanks,
Dave
_______________________________________________
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