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: Becky Willrich <email@hidden>
- Date: Mon, 9 Dec 2002 09:29:25 -0800
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
_______________________________________________
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.