Using cfhttp authentication functions when the response was constructed with CFHTTPMessageAppendBytes
Using cfhttp authentication functions when the response was constructed with CFHTTPMessageAppendBytes
- Subject: Using cfhttp authentication functions when the response was constructed with CFHTTPMessageAppendBytes
- From: Frederick Cheung <email@hidden>
- Date: Fri, 20 Oct 2006 20:34:22 +0100
Hi,
I've got a situation where I'm using CFHTTPMessage, but i'm sending
the request and receiving the response myself (mainly because I am
streaming the data in a way that doesn't let me use CFNetwork
directly). I build up the response using CFHTTPMessageCreateEmpty &
CFHTTPMessageAppendBytes
However passing this response to
CFHTTPAuthenticationCreateFromResponse or using it as the second
parameter to CFHTTPMessageAddAuthentication causes a crash inside
CFHTTPMessageCopyRequestURL, because the url for my CFHTTPMessageRef
is NULL (and that's fair enough, there's no way CFHTTP could have
guessed it)
It's rather naughty that CFHTTPMessageCopyRequestURL crashes rather
than just returning NULL (and in the more general case it would be a
real pain if you had to track which CFHTTPMessages it was safe to
call CFHTTPMessageCopyRequestURL), looking at the source it doesn't
check that the CFHTTPMessage's is not null before calling CFRetain on
it.
As far as I can tell, the only way that I can use
CFHTTPAuthenticationCreateFromResponse is to be exceedingly naughty
and call _CFHTTPMessageSetResponseURL so that subsequent calls to
CFHTTPMessageCopyRequestURL don't crash. Any other ideas ?
Fred
_______________________________________________
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