mirror of
https://github.com/Grasscutters/mitmproxy.git
synced 2024-11-23 00:01:36 +00:00
assume keep-alive for HTTP/2
This commit is contained in:
parent
9c3596219d
commit
6d8a315c5d
@ -167,7 +167,10 @@ def connection_close(http_version, headers):
|
|||||||
elif "keep-alive" in tokens:
|
elif "keep-alive" in tokens:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
return http_version != "HTTP/1.1" and http_version != b"HTTP/1.1"
|
return http_version not in (
|
||||||
|
"HTTP/1.1", b"HTTP/1.1",
|
||||||
|
"HTTP/2.0", b"HTTP/2.0",
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
def expected_http_body_size(
|
def expected_http_body_size(
|
||||||
|
@ -146,6 +146,7 @@ def test_connection_close():
|
|||||||
headers = Headers()
|
headers = Headers()
|
||||||
assert connection_close(b"HTTP/1.0", headers)
|
assert connection_close(b"HTTP/1.0", headers)
|
||||||
assert not connection_close(b"HTTP/1.1", headers)
|
assert not connection_close(b"HTTP/1.1", headers)
|
||||||
|
assert not connection_close(b"HTTP/2.0", headers)
|
||||||
|
|
||||||
headers["connection"] = "keep-alive"
|
headers["connection"] = "keep-alive"
|
||||||
assert not connection_close(b"HTTP/1.1", headers)
|
assert not connection_close(b"HTTP/1.1", headers)
|
||||||
|
Loading…
Reference in New Issue
Block a user