mirror of
https://github.com/vee1e/mitmproxy.git
synced 2026-09-04 19:57:16 +00:00
various trailer-related fixes
This commit is contained in:
parent
c0e846b700
commit
0f7f4ba949
3 changed files with 22 additions and 9 deletions
|
|
@ -227,6 +227,8 @@ class Dumper:
|
|||
self._echo_headers(f.request.headers)
|
||||
if ctx.options.flow_detail >= 3:
|
||||
self._echo_message(f.request, f)
|
||||
if ctx.options.flow_detail >= 2:
|
||||
self._echo_trailers(f.request.trailers)
|
||||
|
||||
if f.response:
|
||||
self._echo_response_line(f)
|
||||
|
|
|
|||
|
|
@ -26,9 +26,12 @@ def run_tests(src, test, fail):
|
|||
test
|
||||
])
|
||||
|
||||
if e == 0 and fail:
|
||||
if e == 0:
|
||||
if fail:
|
||||
print("FAIL DUE TO UNEXPECTED SUCCESS:", src, "Please remove this file from setup.cfg tool:individual_coverage/exclude.")
|
||||
e = 42
|
||||
else:
|
||||
print(".")
|
||||
else:
|
||||
if fail:
|
||||
print("Ignoring allowed fail:", src)
|
||||
|
|
|
|||
|
|
@ -134,18 +134,26 @@ def test_echo_trailer():
|
|||
with taddons.context(d) as ctx:
|
||||
ctx.configure(d, flow_detail=3)
|
||||
f = tflow.tflow(client_conn=True, server_conn=True, resp=True)
|
||||
f.response.headers["content-type"] = "text/html"
|
||||
|
||||
f.request.headers["content-type"] = "text/html"
|
||||
f.request.headers["transfer-encoding"] = "chunked"
|
||||
f.request.headers["trailer"] = "my-little-request-trailer"
|
||||
f.request.content = b"some request content\n" * 100
|
||||
f.request.trailers = Headers([(b"my-little-request-trailer", b"foobar-request-trailer")])
|
||||
|
||||
f.response.headers["transfer-encoding"] = "chunked"
|
||||
f.response.headers["trailer"] = "my-little-trailer"
|
||||
f.response.content = b"foo bar voing\n" * 100
|
||||
f.response.trailers = Headers([(b"my-little-trailer", b"foobar-trailer")])
|
||||
d._echo_headers(f.response.headers)
|
||||
d._echo_message(f.response, f)
|
||||
d._echo_headers(f.response.trailers)
|
||||
f.response.headers["trailer"] = "my-little-response-trailer"
|
||||
f.response.content = b"some response content\n" * 100
|
||||
f.response.trailers = Headers([(b"my-little-response-trailer", b"foobar-response-trailer")])
|
||||
|
||||
d.echo_flow(f)
|
||||
t = sio.getvalue()
|
||||
assert "content-type" in t
|
||||
assert "cut off" in t
|
||||
assert "foobar-trailer" in t
|
||||
assert "some request content" in t
|
||||
assert "foobar-request-trailer" in t
|
||||
assert "some response content" in t
|
||||
assert "foobar-response-trailer" in t
|
||||
|
||||
|
||||
def test_echo_request_line():
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue