aboutsummaryrefslogtreecommitdiffstats
path: root/libmproxy/protocol/http.py
diff options
context:
space:
mode:
authorMaximilian Hils <git@maximilianhils.com>2015-09-11 00:00:00 +0200
committerMaximilian Hils <git@maximilianhils.com>2015-09-11 00:00:00 +0200
commitd1bc966e5b7e2ef822443f3ad28a5f3d40965e75 (patch)
tree3468125e5579adce3295b4055012c329ebc6d27a /libmproxy/protocol/http.py
parent33c0d3653077c9e6834034ec03a42beeba3ca7d7 (diff)
downloadmitmproxy-d1bc966e5b7e2ef822443f3ad28a5f3d40965e75.tar.gz
mitmproxy-d1bc966e5b7e2ef822443f3ad28a5f3d40965e75.tar.bz2
mitmproxy-d1bc966e5b7e2ef822443f3ad28a5f3d40965e75.zip
polish for release: introduce http2 and rawtcp as command line switches
Diffstat (limited to 'libmproxy/protocol/http.py')
-rw-r--r--libmproxy/protocol/http.py10
1 files changed, 8 insertions, 2 deletions
diff --git a/libmproxy/protocol/http.py b/libmproxy/protocol/http.py
index 52164241..308fa0a0 100644
--- a/libmproxy/protocol/http.py
+++ b/libmproxy/protocol/http.py
@@ -16,7 +16,7 @@ from ..models import (
HTTPFlow, HTTPRequest, HTTPResponse, make_error_response, make_connect_response, Error
)
from .base import Layer, Kill
-
+from .rawtcp import RawTCPLayer
class _HttpLayer(Layer):
supports_streaming = False
@@ -364,7 +364,13 @@ class HttpLayer(Layer):
if self.check_close_connection(flow):
return
- # TODO: Implement HTTP Upgrade
+ # Handle 101 Switching Protocols
+ # It may be useful to pass additional args (such as the upgrade header)
+ # to next_layer in the future
+ if flow.response.status_code == 101:
+ layer = self.ctx.next_layer(self)
+ layer()
+ return
# Upstream Proxy Mode: Handle CONNECT
if flow.request.form_in == "authority" and flow.response.code == 200: