CFReadStreamCopyProperty() returns NULL?
CFReadStreamCopyProperty() returns NULL?
- Subject: CFReadStreamCopyProperty() returns NULL?
- From: John Michael Zorko <email@hidden>
- Date: Sun, 08 Feb 2009 12:36:22 -0800
Hello, all ...
I'm trying to make my app handle HTTP authentication, and i'm running
into problems. Right now, i'm just trying to get the HTTP status code
of the response, and CFReadStreamCopyProperty() is returning NULL:
The URL is: http://he3.magnatune.com/all/01--Tensor--Chris
Harvey.mp3 (verified to work in Safari on my Mac). This is what
i'm trying to do:
CFHTTPMessageRef message= CFHTTPMessageCreateRequest(NULL,
(CFStringRef)@"GET", (CFURLRef)url, kCFHTTPVersion1_1);
CFHTTPMessageSetHeaderFieldValue(message, CFSTR("User-Agent"),
CFSTR("My user agent"));
stream = CFReadStreamCreateForHTTPRequest(NULL, message);
if (CFReadStreamOpen(stream))
{
CFHTTPMessageRef myResponse = CFReadStreamCopyProperty(stream,
kCFStreamPropertyHTTPResponseHeader);
int resStatus = CFHTTPMessageGetResponseStatusCode(myResponse); //
crashes here because myResponse is NULL
.
.
.
}
The platform is iPhone OS 2.2.1, if that helps. The Apple
documentation for CFReadStreamCopyProperty() doesn't say anything
about why it might return NULL. Furthermore, if I comment out the
code trying to get the response, the rest of the code works and I get
the data from the URL. What am I doing wrong?
Regards,
John
Falling You - exploring the beauty of voice and sound
http://www.fallingyou.com
_______________________________________________
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