aboutsummaryrefslogtreecommitdiffstats
path: root/pathod/language
diff options
context:
space:
mode:
authorAldo Cortesi <aldo@corte.si>2016-10-20 12:36:26 +1300
committerGitHub <noreply@github.com>2016-10-20 12:36:26 +1300
commit711078ba3f63257df745bb3edd80a85717e94b20 (patch)
treed3116cd540faf01f272a0892fc6a9b83b4f6de8a /pathod/language
parentee56d3fae0baeef1f31a83db122dd832d4c0e07e (diff)
parent8430f857b504a3e7406dc36e54dc32783569d0dd (diff)
downloadmitmproxy-711078ba3f63257df745bb3edd80a85717e94b20.tar.gz
mitmproxy-711078ba3f63257df745bb3edd80a85717e94b20.tar.bz2
mitmproxy-711078ba3f63257df745bb3edd80a85717e94b20.zip
Merge pull request #1637 from cortesi/tatanetlib
This PR merges netlib into mitmproxy
Diffstat (limited to 'pathod/language')
-rw-r--r--pathod/language/base.py4
-rw-r--r--pathod/language/http.py12
-rw-r--r--pathod/language/http2.py4
-rw-r--r--pathod/language/message.py2
-rw-r--r--pathod/language/websockets.py20
-rw-r--r--pathod/language/writer.py4
6 files changed, 23 insertions, 23 deletions
diff --git a/pathod/language/base.py b/pathod/language/base.py
index 11f0899d..44a888c0 100644
--- a/pathod/language/base.py
+++ b/pathod/language/base.py
@@ -4,8 +4,8 @@ import abc
import functools
import pyparsing as pp
-from netlib import strutils
-from netlib import human
+from mitmproxy.utils import strutils
+from mitmproxy.utils import human
from . import generators, exceptions
diff --git a/pathod/language/http.py b/pathod/language/http.py
index 32f990bb..8fcf9edc 100644
--- a/pathod/language/http.py
+++ b/pathod/language/http.py
@@ -2,12 +2,12 @@ import abc
import pyparsing as pp
-from netlib.http import url
-import netlib.websockets
-from netlib.http import status_codes, user_agents
+from mitmproxy.net.http import url
+import mitmproxy.net.websockets
+from mitmproxy.net.http import status_codes, user_agents
from . import base, exceptions, actions, message
-# TODO: use netlib.semantics.protocol assemble method,
+# TODO: use mitmproxy.net.semantics.protocol assemble method,
# instead of duplicating the HTTP on-the-wire representation here.
# see http2 language for an example
@@ -198,7 +198,7 @@ class Response(_HTTPMessage):
1,
StatusCode(101)
)
- headers = netlib.websockets.server_handshake_headers(
+ headers = mitmproxy.net.websockets.server_handshake_headers(
settings.websocket_key
)
for i in headers.fields:
@@ -310,7 +310,7 @@ class Request(_HTTPMessage):
1,
Method("get")
)
- for i in netlib.websockets.client_handshake_headers().fields:
+ for i in mitmproxy.net.websockets.client_handshake_headers().fields:
if not get_header(i[0], self.headers):
tokens.append(
Header(
diff --git a/pathod/language/http2.py b/pathod/language/http2.py
index 35fc5ba8..08c5f6d7 100644
--- a/pathod/language/http2.py
+++ b/pathod/language/http2.py
@@ -1,7 +1,7 @@
import pyparsing as pp
-from netlib import http
-from netlib.http import user_agents, Headers
+from mitmproxy.net import http
+from mitmproxy.net.http import user_agents, Headers
from . import base, message
"""
diff --git a/pathod/language/message.py b/pathod/language/message.py
index 03b4a2cf..6cdaaa0b 100644
--- a/pathod/language/message.py
+++ b/pathod/language/message.py
@@ -1,6 +1,6 @@
import abc
from . import actions, exceptions
-from netlib import strutils
+from mitmproxy.utils import strutils
LOG_TRUNCATE = 1024
diff --git a/pathod/language/websockets.py b/pathod/language/websockets.py
index 417944af..a237381c 100644
--- a/pathod/language/websockets.py
+++ b/pathod/language/websockets.py
@@ -1,7 +1,7 @@
import random
import string
-import netlib.websockets
-from netlib import strutils
+import mitmproxy.net.websockets
+from mitmproxy.utils import strutils
import pyparsing as pp
from . import base, generators, actions, message
@@ -14,12 +14,12 @@ class WF(base.CaselessLiteral):
class OpCode(base.IntField):
names = {
- "continue": netlib.websockets.OPCODE.CONTINUE,
- "text": netlib.websockets.OPCODE.TEXT,
- "binary": netlib.websockets.OPCODE.BINARY,
- "close": netlib.websockets.OPCODE.CLOSE,
- "ping": netlib.websockets.OPCODE.PING,
- "pong": netlib.websockets.OPCODE.PONG,
+ "continue": mitmproxy.net.websockets.OPCODE.CONTINUE,
+ "text": mitmproxy.net.websockets.OPCODE.TEXT,
+ "binary": mitmproxy.net.websockets.OPCODE.BINARY,
+ "close": mitmproxy.net.websockets.OPCODE.CLOSE,
+ "ping": mitmproxy.net.websockets.OPCODE.PING,
+ "pong": mitmproxy.net.websockets.OPCODE.PONG,
}
max = 15
preamble = "c"
@@ -215,11 +215,11 @@ class WebsocketFrame(message.Message):
v = getattr(self, i, None)
if v is not None:
frameparts[i] = v.value
- frame = netlib.websockets.FrameHeader(**frameparts)
+ frame = mitmproxy.net.websockets.FrameHeader(**frameparts)
vals = [bytes(frame)]
if bodygen:
if frame.masking_key and not self.rawbody:
- masker = netlib.websockets.Masker(frame.masking_key)
+ masker = mitmproxy.net.websockets.Masker(frame.masking_key)
vals.append(
generators.TransformGenerator(
bodygen,
diff --git a/pathod/language/writer.py b/pathod/language/writer.py
index b8081989..ac0f44da 100644
--- a/pathod/language/writer.py
+++ b/pathod/language/writer.py
@@ -1,5 +1,5 @@
import time
-from netlib.exceptions import TcpDisconnect
+from mitmproxy import exceptions
BLOCKSIZE = 1024
# It's not clear what the upper limit for time.sleep is. It's lower than the
@@ -62,5 +62,5 @@ def write_values(fp, vals, actions, sofar=0, blocksize=BLOCKSIZE):
return True
elif a[1] == "inject":
send_chunk(fp, a[2], blocksize, 0, len(a[2]))
- except TcpDisconnect: # pragma: no cover
+ except exceptions.TcpDisconnect: # pragma: no cover
return True