mirror of
https://github.com/Grasscutters/mitmproxy.git
synced 2024-11-22 15:37:45 +00:00
Correct flow-detail documentation (#4909)
* Fix #4902 * Update type signature * Switch to None check * Fix spacing * Skip URL shortening when flow-detail is 0 * Sync docs with implementation * Update URL shortening test
This commit is contained in:
parent
39fa242e25
commit
888ce66f90
@ -38,10 +38,10 @@ class Dumper:
|
|||||||
loader.add_option(
|
loader.add_option(
|
||||||
"flow_detail", int, 1,
|
"flow_detail", int, 1,
|
||||||
"""
|
"""
|
||||||
The display detail level for flows in mitmdump: 0 (almost quiet) to 3 (very verbose).
|
The display detail level for flows in mitmdump: 0 (quiet) to 4 (very verbose).
|
||||||
0: shortened request URL, response status code, WebSocket and TCP message notifications.
|
0: no output
|
||||||
1: full request URL with response status code
|
1: shortened request URL with response status code
|
||||||
2: 1 + HTTP headers
|
2: full request URL with response status code and HTTP headers
|
||||||
3: 2 + truncated response content, content of WebSocket and TCP messages
|
3: 2 + truncated response content, content of WebSocket and TCP messages
|
||||||
4: 3 + nothing is truncated
|
4: 3 + nothing is truncated
|
||||||
"""
|
"""
|
||||||
@ -156,7 +156,7 @@ class Dumper:
|
|||||||
else:
|
else:
|
||||||
url = flow.request.url
|
url = flow.request.url
|
||||||
|
|
||||||
if ctx.options.flow_detail <= 1:
|
if ctx.options.flow_detail == 1:
|
||||||
# We need to truncate before applying styles, so we just focus on the URL.
|
# We need to truncate before applying styles, so we just focus on the URL.
|
||||||
terminal_width_limit = max(shutil.get_terminal_size()[0] - 25, 50)
|
terminal_width_limit = max(shutil.get_terminal_size()[0] - 25, 50)
|
||||||
if len(url) > terminal_width_limit:
|
if len(url) > terminal_width_limit:
|
||||||
|
@ -158,7 +158,7 @@ def test_echo_request_line():
|
|||||||
assert "nonstandard" in sio.getvalue()
|
assert "nonstandard" in sio.getvalue()
|
||||||
sio.truncate(0)
|
sio.truncate(0)
|
||||||
|
|
||||||
ctx.configure(d, flow_detail=0, showhost=True)
|
ctx.configure(d, flow_detail=1, showhost=True)
|
||||||
f = tflow.tflow(resp=True)
|
f = tflow.tflow(resp=True)
|
||||||
terminalWidth = max(shutil.get_terminal_size()[0] - 25, 50)
|
terminalWidth = max(shutil.get_terminal_size()[0] - 25, 50)
|
||||||
f.request.url = "http://address:22/" + ("x" * terminalWidth) + "textToBeTruncated"
|
f.request.url = "http://address:22/" + ("x" * terminalWidth) + "textToBeTruncated"
|
||||||
|
Loading…
Reference in New Issue
Block a user