aboutsummaryrefslogtreecommitdiffstats
path: root/libmproxy/protocol
diff options
context:
space:
mode:
authorThomas Kriechbaumer <thomas@kriechbaumer.name>2016-01-26 20:44:53 +0100
committerThomas Kriechbaumer <thomas@kriechbaumer.name>2016-02-04 09:52:27 +0100
commit44f83b594701f9756418cf8208c30a9ba5ac4aad (patch)
tree0fa653e2497897fe1faf447c507437f1eefb8689 /libmproxy/protocol
parentbd1d9e28e4aa942b6fdaac0d327d9147ee911ab1 (diff)
downloadmitmproxy-44f83b594701f9756418cf8208c30a9ba5ac4aad.tar.gz
mitmproxy-44f83b594701f9756418cf8208c30a9ba5ac4aad.tar.bz2
mitmproxy-44f83b594701f9756418cf8208c30a9ba5ac4aad.zip
add more tests, improve coverage
Diffstat (limited to 'libmproxy/protocol')
-rw-r--r--libmproxy/protocol/http2.py26
1 files changed, 11 insertions, 15 deletions
diff --git a/libmproxy/protocol/http2.py b/libmproxy/protocol/http2.py
index 23004497..20321d53 100644
--- a/libmproxy/protocol/http2.py
+++ b/libmproxy/protocol/http2.py
@@ -105,18 +105,19 @@ class Http2Layer(Layer):
self.server_conn.send(self.server_conn.h2.data_to_send())
self.active_conns.append(self.server_conn.connection)
- def connect(self):
- self.ctx.connect()
- self.server_conn.connect()
- self._initiate_server_conn()
+ def connect(self): # pragma: no cover
+ raise ValueError("CONNECT inside an HTTP2 stream is not supported.")
+ # self.ctx.connect()
+ # self.server_conn.connect()
+ # self._initiate_server_conn()
- def set_server(self):
+ def set_server(self): # pragma: no cover
raise NotImplementedError("Cannot change server for HTTP2 connections.")
- def disconnect(self):
+ def disconnect(self): # pragma: no cover
raise NotImplementedError("Cannot dis- or reconnect in HTTP2 connections.")
- def next_layer(self):
+ def next_layer(self): # pragma: no cover
# WebSockets over HTTP/2?
# CONNECT for proxying?
raise NotImplementedError()
@@ -257,13 +258,8 @@ class Http2SingleStreamLayer(_HttpTransmissionLayer, threading.Thread):
if path == '*' or path.startswith("/"):
form_in = "relative"
elif method == 'CONNECT': # pragma: no cover
- # form_in = "authority"
- # if ":" in authority:
- # host, port = authority.split(":", 1)
- # else:
- # host = authority
raise NotImplementedError("CONNECT over HTTP/2 is not implemented.")
- else:
+ else: # pragma: no cover
form_in = "absolute"
# FIXME: verify if path or :host contains what we need
scheme, host, port, _ = utils.parse_url(path)
@@ -359,10 +355,10 @@ class Http2SingleStreamLayer(_HttpTransmissionLayer, threading.Thread):
# RFC 7540 8.1: An HTTP request/response exchange fully consumes a single stream.
return True
- def connect(self):
+ def connect(self): # pragma: no cover
raise ValueError("CONNECT inside an HTTP2 stream is not supported.")
- def set_server(self, *args, **kwargs):
+ def set_server(self, *args, **kwargs): # pragma: no cover
# do not mess with the server connection - all streams share it.
pass