views:

116

answers:

1

Can I be sure that a chunked HTTP response will be sent uninterrupted by anything else? I need to differentiate responses (and requests) and this isn't a simple case of reading content length, seeing a closed connection or a no-body response code.

Can I read each chunk and once chunk-size is 0 I will have read exactly one response (or request)? i.e. is it possible for part of any other response to have been sent interleaved? I suspect it is sent consecutively and uninterrupted as there doesn't appear to be any kind of identification in the spec for chunked transfer, so how could more than one be reassembled?

Finally, if a response is sent chunked, does the client send anything more than its original request? I'm thinking along the lines of flow control and error checking but that is all handled at lower layers, so I suspect that the client does not send anything more.

Thanks!

+2  A: 

"Interleaved" with what exactly? HTTP doesn't allow to send several responses concurrently on the same connection. Even with pipelining responses are still sent after each other. That is, you will see all the chunks coming in order before the response to any other request.

As for your final question, no, the client doesn't send anything more than the original request.

Antoine P.
Thanks, as I had hoped!
Ray2k
Well, technically, if the request was pipelined, it might send the next request.Furthermore, it's possible that the client sends Trailer headers, but I don't know that any client actually does.
EricLaw -MSFT-