Learning Question

How can a single HTTP message be processed gradually over time?

An HTTP message can be logically one request or response while its body is sent, received, and processed incrementally. Streaming at the body level does not automatically mean there are many HTTP requests or many completed HTTP responses.

Uploads

A file upload is commonly one HTTP request whose body contains file data.

Client -> Server
 
POST /upload
headers
 
file body bytes...

The file body can be read from disk, written to the socket, transmitted in pieces, and parsed by the server over time. It is still one HTTP request unless the application deliberately splits the upload into multiple protocol-level requests.

Downloads

A file download is commonly one HTTP request and one HTTP response whose body contains file data.

Client -> Server:
GET /big-file.zip
 
Server -> Client:
200 OK
headers
 
file body bytes...

The client can start receiving the body before the full file has arrived. The body may be displayed, buffered, saved, or processed incrementally.

Streaming Body Versus Many Messages

The word “streaming” can mean different things.

At the transport level, bytes are naturally sent over time. At the HTTP level, one message body may be written over time. At the application level, the body may contain records, events, chunks, media data, or file data.

Those are different layers:

TCP stream
-> ordered byte transport
 
HTTP body stream
-> one request or response body produced over time
 
application stream
-> meaningful units inside that body

Core Mental Model

One HTTP message can have a body that arrives gradually.

Do not count lower-layer pieces as HTTP messages. Ask instead:

Is this a new HTTP request or response?
Or is it more body data for an existing message?

That question prevents the common mistake of treating every network chunk as a separate application message.