aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMaximilian Hils <git@maximilianhils.com>2015-09-05 18:16:08 +0200
committerMaximilian Hils <git@maximilianhils.com>2015-09-05 18:16:08 +0200
commitb889e9e1a2576b0f0aadb4180dd6f4c75db204d6 (patch)
tree4705d7044e71e04f7595a541ebb5d7a5fcd9741b
parenta10acda80b7f4a1c590f012b39a7c0ee77e490b8 (diff)
downloadmitmproxy-b889e9e1a2576b0f0aadb4180dd6f4c75db204d6.tar.gz
mitmproxy-b889e9e1a2576b0f0aadb4180dd6f4c75db204d6.tar.bz2
mitmproxy-b889e9e1a2576b0f0aadb4180dd6f4c75db204d6.zip
adjust to new netlib headers
-rw-r--r--libpathod/language/http.py6
-rw-r--r--libpathod/language/http2.py7
-rw-r--r--libpathod/pathod.py5
-rw-r--r--libpathod/protocols/websockets.py2
4 files changed, 9 insertions, 11 deletions
diff --git a/libpathod/language/http.py b/libpathod/language/http.py
index 2e8d2af3..bb9db3c0 100644
--- a/libpathod/language/http.py
+++ b/libpathod/language/http.py
@@ -197,10 +197,10 @@ class Response(_HTTPMessage):
1,
Code(101)
)
- hdrs = netlib.websockets.WebsocketsProtocol.server_handshake_headers(
+ headers = netlib.websockets.WebsocketsProtocol.server_handshake_headers(
settings.websocket_key
)
- for i in hdrs.lst:
+ for i in headers.fields:
if not get_header(i[0], self.headers):
tokens.append(
Header(
@@ -309,7 +309,7 @@ class Request(_HTTPMessage):
1,
Method("get")
)
- for i in netlib.websockets.WebsocketsProtocol.client_handshake_headers().lst:
+ for i in netlib.websockets.WebsocketsProtocol.client_handshake_headers().fields:
if not get_header(i[0], self.headers):
tokens.append(
Header(
diff --git a/libpathod/language/http2.py b/libpathod/language/http2.py
index 8a82fc99..2c3f1786 100644
--- a/libpathod/language/http2.py
+++ b/libpathod/language/http2.py
@@ -1,7 +1,6 @@
import pyparsing as pp
-from netlib import odict
-from netlib.http import user_agents, semantics
+from netlib.http import user_agents, semantics, Headers
from . import base, message
"""
@@ -179,7 +178,7 @@ class Response(_HTTP2Message):
if self.rendered_values:
return self.rendered_values
else:
- headers = odict.ODictCaseless([header.values(settings) for header in self.headers])
+ headers = Headers([header.values(settings) for header in self.headers])
body = self.body
if body:
@@ -262,7 +261,7 @@ class Request(_HTTP2Message):
if self.nested_response:
path += self.nested_response.parsed.spec()
- headers = odict.ODictCaseless([header.values(settings) for header in self.headers])
+ headers = Headers([header.values(settings) for header in self.headers])
body = self.body
if body:
diff --git a/libpathod/pathod.py b/libpathod/pathod.py
index bce0b66f..4b94ec91 100644
--- a/libpathod/pathod.py
+++ b/libpathod/pathod.py
@@ -4,9 +4,8 @@ import os
import sys
import threading
import urllib
-import time
-from netlib import tcp, http, wsgi, certutils, websockets, odict
+from netlib import tcp, http, certutils, websockets
from netlib.http import http1, http2
from . import version, app, language, utils, log, protocols
@@ -160,7 +159,7 @@ class PathodHandler(tcp.BaseHandler):
request=dict(
path=path,
method=method,
- headers=headers.lst,
+ headers=headers.fields,
httpversion=httpversion,
sni=self.sni,
remote_address=self.address(),
diff --git a/libpathod/protocols/websockets.py b/libpathod/protocols/websockets.py
index 890f06c8..081a5248 100644
--- a/libpathod/protocols/websockets.py
+++ b/libpathod/protocols/websockets.py
@@ -1,6 +1,6 @@
import time
-from netlib import tcp, http, wsgi, certutils, websockets, odict
+from netlib import tcp, http, wsgi, certutils, websockets
from .. import version, app, language, utils, log
class WebsocketsProtocol: