2

I have been playing around with parsing HTTP in user-space and I see with some research that there are several ways to send data following the HTTP header and \r\n\r\n. Obviously, content-length is not always used, so what are the other methods and how do you determine the size of the data being sent before hand if not streaming?

I did see content-encoding, chunking and so on, I'm just a bit lost with the overall dynamicness of the protocol in this case. What is the sure fire way of determining the amount of data to be sent (when obviously not streaming something never ending)?

Really appreciate the help.

1 Answer 1

0

The new HTTP spec describes this in http://greenbytes.de/tech/webdav/draft-ietf-httpbis-p1-messaging-26.html#message.body.

7
  • Okay, it makes sense for chunked, and/or content-length, but what about when it is neither of those two like when AJAX asks for data? Commented Feb 28, 2014 at 18:30
  • How is "AJAX asks for data" different from other HTTP requests? Commented Mar 1, 2014 at 8:33
  • It appears to be just sending data without any obvious format. There is no content-len field or other entity specified in the HTTP header. Commented Mar 1, 2014 at 21:29
  • do you have a an HTTP trace? Commented Mar 1, 2014 at 21:43
  • link Packet 41 for the first GET's server response, some use content-len and some don't for the dynamic updating content on the router's status page. Commented Mar 1, 2014 at 22:09

Not the answer you're looking for? Browse other questions tagged or ask your own question.