aboutsummaryrefslogtreecommitdiffstats
path: root/mitmproxy/proxy
diff options
context:
space:
mode:
authorMaximilian Hils <git@maximilianhils.com>2020-02-28 20:00:15 +0100
committerGitHub <noreply@github.com>2020-02-28 20:00:15 +0100
commit6d3b8c9716a274fdcc72c4dc9a841f2e8fa4d1e9 (patch)
treec5c192c9e03401d5fe499ed50cc96348e1790567 /mitmproxy/proxy
parentc284d595a34a16d76e18fa4e8654b4c14ea327fd (diff)
parent9387f0b28203779aa4d18368ebf0f92eee93b6e1 (diff)
downloadmitmproxy-6d3b8c9716a274fdcc72c4dc9a841f2e8fa4d1e9.tar.gz
mitmproxy-6d3b8c9716a274fdcc72c4dc9a841f2e8fa4d1e9.tar.bz2
mitmproxy-6d3b8c9716a274fdcc72c4dc9a841f2e8fa4d1e9.zip
Merge pull request #3841 from mhils/sans-io-adjustments
Minor code style improvements, sync sans-io changes
Diffstat (limited to 'mitmproxy/proxy')
-rw-r--r--mitmproxy/proxy/protocol/http.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/mitmproxy/proxy/protocol/http.py b/mitmproxy/proxy/protocol/http.py
index 4c20617b..37e1669e 100644
--- a/mitmproxy/proxy/protocol/http.py
+++ b/mitmproxy/proxy/protocol/http.py
@@ -1,3 +1,5 @@
+import textwrap
+
import h2.exceptions
import time
import enum
@@ -142,13 +144,13 @@ def validate_request_form(mode, request):
allowed_request_forms = MODE_REQUEST_FORMS[mode]
if request.first_line_format not in allowed_request_forms:
if mode == HTTPMode.transparent:
- err_message = (
+ err_message = textwrap.dedent((
"""
Mitmproxy received an {} request even though it is not running
in regular mode. This usually indicates a misconfiguration,
please see the mitmproxy mode documentation for details.
"""
- ).format("HTTP CONNECT" if request.first_line_format == "authority" else "absolute-form")
+ )).strip().format("HTTP CONNECT" if request.first_line_format == "authority" else "absolute-form")
else:
err_message = "Invalid HTTP request form (expected: %s, got: %s)" % (
" or ".join(allowed_request_forms), request.first_line_format