I am wondering how a client that has requested a webpage froma get request for example knows exactly when it has received all the requested data and that there is no more data to come using both https and http examples ?
Super User is a question and answer site for computer enthusiasts and power users. It only takes a minute to sign up.Sign up to join this community
There's no difference between HTTP and HTTPS, since HTTPS is just HTTP tunneled through a TLS tunnel.
To answer your question: if the server sends the
Content-Lenght: x header, then the response body should be exactly of dimension x octects(bytes)
If the server doesn't send this header, than it varies:
for HTTP 1.0, the response body is definitely terminated after the server closes the connection. For HTTP 1.1 it's more complicated because the server could use chunked encoding: http://greenbytes.de/tech/webdav/rfc2616.html#rfc.section.3.6.1
Reference Sample HTTP Exchange
Sample HTTP Exchange
To retrieve the file at the URL
first open a socket to the host www.somehost.com, port 80 (use the default port of 80 because none is specified in the URL). Then, send something like the following through the socket:
GET /path/file.html HTTP/1.0 From: email@example.com User-Agent: HTTPTool/1.0 [blank line here]
The server should respond with something like the following, sent back through the same socket:
HTTP/1.0 200 OK Date: Fri, 31 Dec 1999 23:59:59 GMT Content-Type: text/html Content-Length: 1354 <html> <body> <h1>Happy New Millennium!</h1> (more file contents) . . . </body> </html>
After sending the response, the server closes the socket.