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 10:01:27 -0800
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???
No. You can always recover the excess bytes by calling
CFHTTPMessageCopyBody - all the bytes past the end of the header will
be there. Just do something like this:
while (!CFHTTPMessageIsHeaderComplete(hdr)) {
int len = myGetBytes(buf);
if (!CFHTTPMessageAppendBytes(hdr, buf, len)) {
// parse error....
}
}
excessData = CFHTTPMessageCopyBody(hdr);
CFRetain(excessData);
CFHTTPMessageSetBody(hdr, NULL);
// Now hdr contains only the headers, and the first bytes of the body
are in excessData....
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.