• 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: Thu, 27 Dec 2001 13:31:08 -0800

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.

-dustin

On Thursday, December 27, 2001, at 06:50 AM, Gus Mueller wrote:

No, he had it right the first time-
Every line in the http header ends with a CRLF (\r\n), and then a single
empty line ending with a CRLF marks the end of the headers.

check out http://www.w3.org/Protocols/rfc2068/rfc2068 for more info on
http 1.1

-gus

Dustin Mierau (email@hidden) wrote:
shouldn't the request look like this:

GET / HTTP/1.1n\n\n
Accept: text/html\n\n
User-Agent: Mozilla/4.0\n\n
Host: www.apple.com\n\n
Connection: close\n\n

? I haven't used CFNetwork, but I think you are terminating your lines
incorrectly, and I don't think there is need for the double \n at the
end of your request.

lates,
-dustin

On Wednesday, December 26, 2001, at 11:55 PM, Bila Kiss wrote:

Has anybody been able to get the CFNetwork stuff to work? No matter
what I
put in my request header, CFHTTPMessageIsHeaderComplete() keeps
returning
false.

A sample HTTP request that doesn't work for me is:

GET / HTTP/1.1\r\n
Accept: text/html\r\n
User-Agent: Mozilla/4.0\r\n
Host: www.apple.com\r\n
Connection: close\r\n
\r\n

(FWIW, it serializes correctly using
CFHTTPMessageCopySerializedMessage().)

If I then try to stream the request out as demonstrated in the
CFNetwork.pdf, CFReadStreamForHTTPRequest() seems to return a valid
stream
and CFReadStreamOpen() returns true but
CFReadStreamCopyProperty(myReadStream,
kCFStreamPropertyHTTPResponseHeader)
returns NULL.

Any pointers would be much appreciated.

Cheers,

Bila
--
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.
_______________________________________________
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.

-gus

--
"Christmas means carnage!" -- Ferdinand, the duck
"Convenience kills." -- August the Conqueror
_______________________________________________
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.


  • Follow-Ups:
    • Re: CFNetwork?
      • From: Béla Kiss <email@hidden>
    • Re: CFNetwork?
      • From: email@hidden
References: 
 >Re: CFNetwork? (From: Gus Mueller <email@hidden>)

  • Prev by Date: Re: Unexpected behavior of NSNumberFormatter
  • Next by Date: Re: Turning off Text Wrapping in NSTextView
  • Previous by thread: Re: CFNetwork?
  • Next by thread: Re: CFNetwork?
  • Index(es):
    • Date
    • Thread