aboutsummaryrefslogtreecommitdiffstats
path: root/libmproxy/protocol2/root_context.py
diff options
context:
space:
mode:
Diffstat (limited to 'libmproxy/protocol2/root_context.py')
-rw-r--r--libmproxy/protocol2/root_context.py12
1 files changed, 5 insertions, 7 deletions
diff --git a/libmproxy/protocol2/root_context.py b/libmproxy/protocol2/root_context.py
index a68560c2..6ba6ca9a 100644
--- a/libmproxy/protocol2/root_context.py
+++ b/libmproxy/protocol2/root_context.py
@@ -1,9 +1,11 @@
from __future__ import (absolute_import, print_function, division)
+from .messages import Kill
from .rawtcp import RawTcpLayer
from .tls import TlsLayer
from .http import Http1Layer, Http2Layer, HttpLayer
+
class RootContext(object):
"""
The outmost context provided to the root layer.
@@ -37,21 +39,17 @@ class RootContext(object):
# TODO: build is_http2_magic check here, maybe this is an easy way to detect h2c
if not d:
- return
+ return iter([])
if is_tls_client_hello:
return TlsLayer(top_layer, True, True)
- elif isinstance(top_layer, TlsLayer):
- if top_layer.client_conn.get_alpn_proto_negotiated() == 'h2':
- return Http2Layer(top_layer, 'regular') # TODO: regular correct here?
- else:
- return Http1Layer(top_layer, 'regular') # TODO: regular correct here?
+ elif isinstance(top_layer, TlsLayer) and top_layer.client_conn.get_alpn_proto_negotiated() == 'h2':
+ return Http2Layer(top_layer, 'transparent')
elif isinstance(top_layer, TlsLayer) and isinstance(top_layer.ctx, Http1Layer):
return Http1Layer(top_layer, "transparent")
else:
return RawTcpLayer(top_layer)
-
@property
def layers(self):
return []