• 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
Re: CFNetwork?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: CFNetwork?


  • Subject: Re: CFNetwork?
  • From: Dustin Mierau <email@hidden>
  • Date: Fri, 28 Dec 2001 03:44:36 -0800

Well I have some code that kinda works, it uses CFStream directly to send the HTTP message. Obviously this shouldn't be such a pain, it seems this CFHTTPMessaging stuff was created for a reason. Also, if you need to go to CFStream directly, I recommend just using sockets (simple, flexible, portable and fast) and CFHTTPMessage to construct the message...or not, whatever.

Oh btw, I just watched the MC Hammer Behind the Music special which was preceded by MC Hammer's life story "Too Legit," it was very entertaining and I highly recommend it!
-mc dustin

On Thursday, December 27, 2001, at 11:46 PM, Bila Kiss wrote:

You're right. Constructing the CFHTTPMessageRef your way seems to make
CFHTTPMessageIsHeaderComplete() happy. However (and there is always a
however), if one uses that constructed CFHTTPMessageRef for calling

readStream = CFReadStreamCreateForHTTPRequest(kCFAllocatorDefault, request);
openReadStreamSucceeded = CFReadStreamOpen(readStream);

causes CFReadStreamOpen() to crash inside _CFStreamGetCallbackPtr.

If one constructs the CFHTTPMessageRef the long way, this crash doesn't
happen (but nothing much seems to happen - maybe because
CFHTTPMessageIsHeaderComplete() isn't happy).

Grrr...

bk

on 2001.12.27 13.31, Dustin Mierau at email@hidden wrote:

Well alrighty then. Yea I just looked at the rfc, you're right...

So this works:

CFHTTPMessageRef request;
NSString* requestString;

request = CFHTTPMessageCreateEmpty( kCFAllocatorDefault, TRUE );
requestString = [NSString stringWithString:@"GET / HTTP/1.1\nHost:
www.apple.com\nUser-Agent: Mozilla/4.0\n\n"];

CFHTTPMessageAppendBytes( request, [requestString cString],
[requestString cStringLength] );

if( CFHTTPMessageIsHeaderComplete( request ) )
NSLog( @"Header is complete" );
else
NSLog( @"Header is NOT complete" );

CFRelease( request );

Output is:

"Header is complete"

I tried it the other way, and sure enough, I get "Header is NOT
complete"..odd.

--
Bila Kiss telno. 604.264.6113
Arborealis Research email. email@hidden
3322 W 36th Avenue
Vancouver, BC, CANADA V6N 2R9
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.


References: 
 >Re: CFNetwork? (From: Béla Kiss <email@hidden>)

  • Prev by Date: elementary question
  • Next by Date: NSInvocation help
  • Previous by thread: Re: CFNetwork?
  • Next by thread: Re: CFNetwork?
  • Index(es):
    • Date
    • Thread