[vlc-commits] [Git][videolan/vlc][master] http: fix closing HTTP 1.x connection
Hugo Beauzée-Luyssen (@chouquette)
gitlab at videolan.org
Fri Sep 10 08:05:46 UTC 2021
Hugo Beauzée-Luyssen pushed to branch master at VideoLAN / VLC
Commits:
113e98f6 by Rémi Denis-Courmont at 2021-09-10T07:34:02+00:00
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.
- - - - -
1 changed file:
- modules/access/http/h1conn.c
Changes:
=====================================
modules/access/http/h1conn.c
=====================================
@@ -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;
View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/113e98f6665e86f10aac53dcbe50fa2689ae6659
--
View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/113e98f6665e86f10aac53dcbe50fa2689ae6659
You're receiving this email because of your account on code.videolan.org.
More information about the vlc-commits
mailing list