• 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: Using CFHTTPMessage to parse response header but not body?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Using CFHTTPMessage to parse response header but not body?


  • Subject: Re: Using CFHTTPMessage to parse response header but not body?
  • From: Jeff Johnson <email@hidden>
  • Date: Mon, 14 May 2012 16:58:50 -0500

On May 14, 2012, at 3:35 PM, Jens Alfke wrote:

On May 14, 2012, at 12:50 PM, Jeff Johnson wrote:

Won't CFHTTPMessageCopyBody() give you the partial message body, after CFHTTPMessageIsHeaderComplete() returns true? I'm looking at some HTTP parsing code I wrote a while ago, and it seems to indicate that it should. I'd have to run it through the debugger to confirm, but I'm pretty sure it will.

So you’re saying to call that and parse what’s in it as body, then continue parsing data from the stream myself as the rest of the body?

I don’t think this is going to work correctly if the body is encoded, as it is in my case. What’s going to come out of CopyBody is, presumably, decoded; and it’s not going to be possible in the general case to take decoded partial output and seamlessly continue parsing encoded data. 

(For example, in the case of chunk encoding, if the current body data stops halfway through a chunk, I now have no way of knowing how many bytes remain in the chunk because the chunk byte-count was parsed by CFHTTPMessage.)

Is this the result of testing or speculation? I don't know myself, because my mini HTTP server deliberately doesn't support Transfer-Encoding. However, my assumption would be that CFHTTPMessageCopyBody() doesn't decode the data. And this (admittedly old) CFNetwork source seems to indicate it doesn't:

http://opensource.apple.com/source/CFNetwork/CFNetwork-129.9/HTTP/CFHTTPMessage.c

-Jeff

 _______________________________________________
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

References: 
 >Using CFHTTPMessage to parse response header but not body? (From: Jens Alfke <email@hidden>)
 >Re: Using CFHTTPMessage to parse response header but not body? (From: Jeff Johnson <email@hidden>)
 >Re: Using CFHTTPMessage to parse response header but not body? (From: Jens Alfke <email@hidden>)

  • Prev by Date: Re: Using CFHTTPMessage to parse response header but not body?
  • Next by Date: Re: Using CFHTTPMessage to parse response header but not body?
  • Previous by thread: Re: Using CFHTTPMessage to parse response header but not body?
  • Next by thread: Re: Using CFHTTPMessage to parse response header but not body?
  • Index(es):
    • Date
    • Thread