diff --git a/mitmproxy/net/http/http1/read.py b/mitmproxy/net/http/http1/read.py index 6eb30709b..d0493da4f 100644 --- a/mitmproxy/net/http/http1/read.py +++ b/mitmproxy/net/http/http1/read.py @@ -158,8 +158,9 @@ def connection_close(http_version, headers): """ Checks the message to see if the client connection should be closed according to RFC 2616 Section 8.1. + If we don't have a Connection header, HTTP 1.1 connections are assumed + to be persistent. """ - # At first, check if we have an explicit Connection header. if "connection" in headers: tokens = get_header_tokens(headers, "connection") if "close" in tokens: @@ -167,9 +168,7 @@ def connection_close(http_version, headers): elif "keep-alive" in tokens: return False - # If we don't have a Connection header, HTTP 1.1 connections are assumed to - # be persistent - return http_version != "HTTP/1.1" and http_version != b"HTTP/1.1" # FIXME: Remove one case. + return http_version != "HTTP/1.1" and http_version != b"HTTP/1.1" def expected_http_body_size(request, response=None):