diff options
author | Thomas Kriechbaumer <thomas@kriechbaumer.name> | 2015-07-19 17:52:10 +0200 |
---|---|---|
committer | Thomas Kriechbaumer <thomas@kriechbaumer.name> | 2015-07-22 15:30:51 +0200 |
commit | 37a0cb858cda255bac8f06749a81859c82c5177f (patch) | |
tree | 8717050bd27f4394aea7db62599c7cf2c9f14f46 /netlib/http/semantics.py | |
parent | 4617ab8a3a981f3abd8d62b561c80f9ad141e57b (diff) | |
download | mitmproxy-37a0cb858cda255bac8f06749a81859c82c5177f.tar.gz mitmproxy-37a0cb858cda255bac8f06749a81859c82c5177f.tar.bz2 mitmproxy-37a0cb858cda255bac8f06749a81859c82c5177f.zip |
introduce ConnectRequest class
Diffstat (limited to 'netlib/http/semantics.py')
-rw-r--r-- | netlib/http/semantics.py | 24 |
1 files changed, 19 insertions, 5 deletions
diff --git a/netlib/http/semantics.py b/netlib/http/semantics.py index 9a010318..664f9def 100644 --- a/netlib/http/semantics.py +++ b/netlib/http/semantics.py @@ -19,7 +19,7 @@ class Request(object): path, httpversion, headers, - content, + body, ): self.form_in = form_in self.method = method @@ -29,7 +29,7 @@ class Request(object): self.path = path self.httpversion = httpversion self.headers = headers - self.content = content + self.body = body def __eq__(self, other): return self.__dict__ == other.__dict__ @@ -38,6 +38,21 @@ class Request(object): return "Request(%s - %s, %s)" % (self.method, self.host, self.path) +class ConnectRequest(Request): + def __init__(self, host, port): + super(ConnectRequest, self).__init__( + form_in="authority", + method="CONNECT", + scheme="", + host=host, + port=port, + path="", + httpversion="", + headers="", + body="", + ) + + class Response(object): def __init__( @@ -46,14 +61,14 @@ class Response(object): status_code, msg, headers, - content, + body, sslinfo=None, ): self.httpversion = httpversion self.status_code = status_code self.msg = msg self.headers = headers - self.content = content + self.body = body self.sslinfo = sslinfo def __eq__(self, other): @@ -63,7 +78,6 @@ class Response(object): return "Response(%s - %s)" % (self.status_code, self.msg) - def is_valid_port(port): if not 0 <= port <= 65535: return False |