What byte[] concludes a HTTP server response?
-
22-08-2019 - |
Question
what byte/bytes do you send to conclude a HTTP server response?
Solution
The response length is determined by closing the connection (HTTP/1.0), the Content-Length response header, or the use of Chunked Encoding.
OTHER TIPS
There is no such byte. The connection may be terminated by either side.
There is the optional Content-Length header, but it's a kind of hint for the client to know the size of the response.
There is no marker -- rather, in the HTTP response header there is a Content-Length field describing the length of the response body
If you're interested in examining and learning about the HTTP protocol, I would download the tool Fiddler at http://www.fiddler2.com/fiddler2/
You can then look "behind the scenes" at what happens when you visit a web page and see the request and response text.
From RFC 2616(HTTP 1.1)
HTTP/1.1 defines the sequence CR LF as the end-of-line marker for all protocol elements except the entity-body (see appendix 19.3 for tolerant applications). The end-of-line marker within an entity-body is defined by its associated media type, as described in section 3.7.