Q:

How does a HTTP/1.1 client know where a message ends in presence of `Connection: keep-alive` header field but absence of `Content-Length`?

In particular, I have this response header from an nginx server:
HTTP/1.1 200 OK
Server: nginx/1.10.3 (Ubuntu)
Date: Tue, 20 Mar 2018 10:28:24 GMT
Content-Type: text/html
Last-Modified: Thu, 28 Jan 2016 10:50:21 GMT
Connection: keep-alive
ETag: W/"56a9f26d-2d97"
Content-Encoding: gzip

Followed by some 3352 Bytes of compressed data. I'm trying to find out how does the client know where the body of this message ends and a new response begins.

A:

It doesn't. The response requires either a Content-Length response header field, or it has to use "Transfer-Encoding: chunked".

