Skip to content
Snippets Groups Projects
Commit 113e98f6 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont Committed by Hugo Beauzée-Luyssen
Browse files

http: fix closing HTTP 1.x connection

When the client closes the stream, then underlying HTTP 1.x
connection must be terminated in any of the following cases:
- The server uses HTTP version 1.0.
- The server specified the "close" token in the Connection header line
  of the HTTP response header.
- Fewer bytes than specified in the Content-Length header line of the
  HTTP response header were read.
- The response body is encoded with chunked encoding and the end of the
  body has not been reached.

In the first two cases, flag `connection_close` will be set. It was
write-only before this patch.

In the third case, the `content_length` will be non-zero but not
unknown (`UINTMAX_MAX`).

The last case is already handled by the chunked encoding decoder.

Fixes #26084.
parent b9441b5b
No related branches found
No related tags found
1 merge request!594http: fix closing HTTP 1.x connection
Pipeline #136446 passed with stage
in 27 minutes and 38 seconds
......@@ -290,7 +290,16 @@ static void vlc_h1_stream_close(struct vlc_http_stream *stream, bool abort)
assert(conn->active);
if (conn->connection_close)
/* Server requested closing the connection after this stream. */
abort = true;
if (conn->content_length > 0 && conn->content_length != UINTMAX_MAX)
/* Client left some data to be read, so pipelining is impossible. */
abort = true;
if (abort)
/* Shut the underlying connection down and prevent reuse. */
vlc_h1_stream_fatal(conn);
conn->active = false;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment