• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
CFReadStreamCopyProperty() returns NULL?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • Follow-Ups:
    • Re: CFReadStreamCopyProperty() returns NULL?
      • From: Frederick Cheung <email@hidden>
    • Re: CFReadStreamCopyProperty() returns NULL?
      • From: Jens Alfke <email@hidden>
  • Prev by Date: NSMutableURLRequest bypassing proxy
  • Next by Date: Re: CFReadStreamCopyProperty() returns NULL?
  • Previous by thread: Re: NSMutableURLRequest bypassing proxy
  • Next by thread: Re: CFReadStreamCopyProperty() returns NULL?
  • Index(es):
    • Date
    • Thread