• 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: email@hidden
  • Date: Thu, 27 Dec 2001 21:26:21 -0500

On Thursday, December 27, 2001, at 04:31 PM, Dustin Mierau 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.

From 19.3 of rfc2068:

The line terminator for message-header fields is the sequence CRLF. However, we recommend that applications, when parsing such headers, recognize a single LF as a line terminator and ignore the leading CR.

This rules out what I'm about to suggest, and I'm not familiar
with this use of HTTP, but . . .

IF this thing were interpreting EITHER \r or \n as a line end,
then it would see no headers at all since the \r\n after the
GET line would mean "end of headers". And I know you must have
a Host header for 1.1, at least, for a valid request.

Maybe you could put a \r\n after the Host and see if that is the
only header to get through?


Chris Hamlin


  • Follow-Ups:
    • Re: CFNetwork?
      • From: Dustin Mierau <email@hidden>
    • Re: CFNetwork?
      • From: Andy <email@hidden>
References: 
 >Re: CFNetwork? (From: Dustin Mierau <email@hidden>)

  • Prev by Date: Re: UserDefaults (Java)
  • Next by Date: OpenStep Storage and DPSContext replacements?
  • Previous by thread: Re: CFNetwork?
  • Next by thread: Re: CFNetwork?
  • Index(es):
    • Date
    • Thread