Re: Using CFHTTPMessage to help read incoming server-side request?
Re: Using CFHTTPMessage to help read incoming server-side request?
- Subject: Re: Using CFHTTPMessage to help read incoming server-side request?
- From: James Berry <email@hidden>
- Date: Mon, 09 Dec 2002 09:53:49 -0800
On 12/9/02 9:29 AM, "Becky Willrich" <email@hidden> wrote:
>
> I'm interested in using CFHTTPMessage to help implement http request
>
> processing (from the server side). On the surface, it looked like I
>
> could
>
> call CFHTTPMessageCreateEmpty to create a message, then build up the
>
> message
>
> by calling CFHTTPMessageAppendBytes as bytes are streamed in.
>
>
Yes, that will work.
>
>
> But how do I know when I've received the entire http request? There
>
> appears
>
> to be no API to tell me that I've got a complete message. Do I need to
>
> handle all the message parsing myself? In particular, there's no
>
> "intuitively obvious" means of detecting the end of a chunked body.
>
>
You can determine when you're past the headers via
>
CFHTTPMessageIsHeaderComplete. After that, you're right that it's up
>
to you to determine the message length, and that means decoding chunked
>
transfers yourself (in fact, if you just continue calling AppendBytes
>
with chunked data, CFHTTPMessage will do the wrong thing). If this is
>
a custom server where you have control of the clients, I'd have the
>
clients set a Content-Length header instead of transferring chunked.
>
If you don't have that luxury, you'll have to add the code to parse the
>
chunked response....
>
>
REW
Which in reality means that you have to parse everything (or at least snoop
for end of headers yourself in the datastream) because if you just start
passing bytes into CFHTTPMessageAppendBytes , you'll likely have gone past
the start of the chunked body by the time HTTPMessage
CFHTTPMessageIsHeaderComplete???
-jdb
_______________________________________________
macnetworkprog mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/macnetworkprog
Do not post admin requests to the list. They will be ignored.