mirror of
https://github.com/mitmproxy/mitmproxy.git
synced 2024-11-23 21:30:04 +00:00
temporary fix for unhandled AlternativeServiceAvailable event (#5898)
* temporary fix for unhandled AlternativeServiceAvailable event * [autofix.ci] apply automated fixes * better log message for AlternativeServiceAvailable service * [autofix.ci] apply automated fixes --------- Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
This commit is contained in:
parent
e3a7941913
commit
89d688e9fc
@ -275,6 +275,10 @@ class Http2Connection(HttpConnection):
|
|||||||
# https://http2.github.io/http2-spec/#rfc.section.4.1
|
# https://http2.github.io/http2-spec/#rfc.section.4.1
|
||||||
# Implementations MUST ignore and discard any frame that has a type that is unknown.
|
# Implementations MUST ignore and discard any frame that has a type that is unknown.
|
||||||
yield Log(f"Ignoring unknown HTTP/2 frame type: {event.frame.type}")
|
yield Log(f"Ignoring unknown HTTP/2 frame type: {event.frame.type}")
|
||||||
|
elif isinstance(event, h2.events.AlternativeServiceAvailable):
|
||||||
|
yield Log(
|
||||||
|
"Received HTTP/2 Alt-Svc frame, which will not be forwarded.", DEBUG
|
||||||
|
)
|
||||||
else:
|
else:
|
||||||
raise AssertionError(f"Unexpected event: {event!r}")
|
raise AssertionError(f"Unexpected event: {event!r}")
|
||||||
return False
|
return False
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
import time
|
import time
|
||||||
|
from logging import DEBUG
|
||||||
|
|
||||||
import h2.settings
|
import h2.settings
|
||||||
import hpack
|
import hpack
|
||||||
@ -1191,3 +1192,31 @@ def test_keepalive_disconnect(tctx, monkeypatch):
|
|||||||
>> reply(to=wakeup_command, side_effect=advance_time)
|
>> reply(to=wakeup_command, side_effect=advance_time)
|
||||||
<< None
|
<< None
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def test_alt_svc(tctx):
|
||||||
|
playbook, cff = start_h2_client(tctx)
|
||||||
|
flow = Placeholder(HTTPFlow)
|
||||||
|
server = Placeholder(Server)
|
||||||
|
initial = Placeholder(bytes)
|
||||||
|
|
||||||
|
assert (
|
||||||
|
playbook
|
||||||
|
>> DataReceived(
|
||||||
|
tctx.client,
|
||||||
|
cff.build_headers_frame(
|
||||||
|
example_request_headers, flags=["END_STREAM"]
|
||||||
|
).serialize(),
|
||||||
|
)
|
||||||
|
<< http.HttpRequestHeadersHook(flow)
|
||||||
|
>> reply()
|
||||||
|
<< http.HttpRequestHook(flow)
|
||||||
|
>> reply()
|
||||||
|
<< OpenConnection(server)
|
||||||
|
>> reply(None, side_effect=make_h2)
|
||||||
|
<< SendData(server, initial)
|
||||||
|
>> DataReceived(
|
||||||
|
server, cff.build_alt_svc_frame(0, b"example.com", b'h3=":443"').serialize()
|
||||||
|
)
|
||||||
|
<< Log("Received HTTP/2 Alt-Svc frame, which will not be forwarded.", DEBUG)
|
||||||
|
)
|
||||||
|
Loading…
Reference in New Issue
Block a user