diff options
author | Aldo Cortesi <aldo@nullcube.com> | 2016-10-20 11:56:38 +1300 |
---|---|---|
committer | Aldo Cortesi <aldo@nullcube.com> | 2016-10-20 11:56:38 +1300 |
commit | 8430f857b504a3e7406dc36e54dc32783569d0dd (patch) | |
tree | d3116cd540faf01f272a0892fc6a9b83b4f6de8a | |
parent | 853e03a5e753354fad3a3fa5384ef3a09384ef43 (diff) | |
download | mitmproxy-8430f857b504a3e7406dc36e54dc32783569d0dd.tar.gz mitmproxy-8430f857b504a3e7406dc36e54dc32783569d0dd.tar.bz2 mitmproxy-8430f857b504a3e7406dc36e54dc32783569d0dd.zip |
The final piece: netlib -> mitproxy.net
-rw-r--r-- | .appveyor.yml | 2 | ||||
-rw-r--r-- | .travis.yml | 2 | ||||
-rw-r--r-- | MANIFEST.in | 3 | ||||
-rw-r--r-- | README.rst | 7 | ||||
-rw-r--r-- | docs/conf.py | 5 | ||||
-rw-r--r-- | docs/dev/testing.rst | 2 | ||||
-rw-r--r-- | docs/modd.conf | 2 | ||||
-rw-r--r-- | examples/har_dump.py | 2 | ||||
-rw-r--r-- | mitmproxy/addons/stickycookie.py | 2 | ||||
-rw-r--r-- | mitmproxy/addons/streambodies.py | 2 | ||||
-rw-r--r-- | mitmproxy/addons/wsgiapp.py | 2 | ||||
-rw-r--r-- | mitmproxy/certs.py | 2 | ||||
-rw-r--r-- | mitmproxy/connections.py | 2 | ||||
-rw-r--r-- | mitmproxy/contentviews.py | 4 | ||||
-rw-r--r-- | mitmproxy/exceptions.py | 2 | ||||
-rw-r--r-- | mitmproxy/export.py | 6 | ||||
-rw-r--r-- | mitmproxy/http.py | 12 | ||||
-rw-r--r-- | mitmproxy/master.py | 4 | ||||
-rw-r--r-- | mitmproxy/net/__init__.py (renamed from netlib/__init__.py) | 0 | ||||
-rw-r--r-- | mitmproxy/net/check.py (renamed from netlib/check.py) | 0 | ||||
-rw-r--r-- | mitmproxy/net/http/__init__.py | 15 | ||||
-rw-r--r-- | mitmproxy/net/http/authentication.py (renamed from netlib/http/authentication.py) | 0 | ||||
-rw-r--r-- | mitmproxy/net/http/cookies.py (renamed from netlib/http/cookies.py) | 0 | ||||
-rw-r--r-- | mitmproxy/net/http/encoding.py (renamed from netlib/http/encoding.py) | 0 | ||||
-rw-r--r-- | mitmproxy/net/http/headers.py (renamed from netlib/http/headers.py) | 0 | ||||
-rw-r--r-- | mitmproxy/net/http/http1/__init__.py (renamed from netlib/http/http1/__init__.py) | 0 | ||||
-rw-r--r-- | mitmproxy/net/http/http1/assemble.py (renamed from netlib/http/http1/assemble.py) | 8 | ||||
-rw-r--r-- | mitmproxy/net/http/http1/read.py (renamed from netlib/http/http1/read.py) | 10 | ||||
-rw-r--r-- | mitmproxy/net/http/http2/__init__.py | 8 | ||||
-rw-r--r-- | mitmproxy/net/http/http2/framereader.py (renamed from netlib/http/http2/framereader.py) | 0 | ||||
-rw-r--r-- | mitmproxy/net/http/http2/utils.py (renamed from netlib/http/http2/utils.py) | 2 | ||||
-rw-r--r-- | mitmproxy/net/http/message.py (renamed from netlib/http/message.py) | 6 | ||||
-rw-r--r-- | mitmproxy/net/http/multipart.py (renamed from netlib/http/multipart.py) | 2 | ||||
-rw-r--r-- | mitmproxy/net/http/request.py (renamed from netlib/http/request.py) | 36 | ||||
-rw-r--r-- | mitmproxy/net/http/response.py (renamed from netlib/http/response.py) | 10 | ||||
-rw-r--r-- | mitmproxy/net/http/status_codes.py (renamed from netlib/http/status_codes.py) | 0 | ||||
-rw-r--r-- | mitmproxy/net/http/url.py (renamed from netlib/http/url.py) | 2 | ||||
-rw-r--r-- | mitmproxy/net/http/user_agents.py (renamed from netlib/http/user_agents.py) | 0 | ||||
-rw-r--r-- | mitmproxy/net/socks.py (renamed from netlib/socks.py) | 4 | ||||
-rw-r--r-- | mitmproxy/net/tcp.py (renamed from netlib/tcp.py) | 0 | ||||
-rw-r--r-- | mitmproxy/net/websockets/__init__.py (renamed from netlib/websockets/__init__.py) | 0 | ||||
-rw-r--r-- | mitmproxy/net/websockets/frame.py (renamed from netlib/websockets/frame.py) | 2 | ||||
-rw-r--r-- | mitmproxy/net/websockets/masker.py (renamed from netlib/websockets/masker.py) | 0 | ||||
-rw-r--r-- | mitmproxy/net/websockets/utils.py (renamed from netlib/websockets/utils.py) | 2 | ||||
-rw-r--r-- | mitmproxy/net/wsgi.py (renamed from netlib/wsgi.py) | 4 | ||||
-rw-r--r-- | mitmproxy/proxy/config.py | 6 | ||||
-rw-r--r-- | mitmproxy/proxy/modes/socks_proxy.py | 2 | ||||
-rw-r--r-- | mitmproxy/proxy/protocol/http.py | 10 | ||||
-rw-r--r-- | mitmproxy/proxy/protocol/http1.py | 2 | ||||
-rw-r--r-- | mitmproxy/proxy/protocol/http2.py | 12 | ||||
-rw-r--r-- | mitmproxy/proxy/protocol/http_replay.py | 2 | ||||
-rw-r--r-- | mitmproxy/proxy/protocol/rawtcp.py | 4 | ||||
-rw-r--r-- | mitmproxy/proxy/protocol/tls.py | 2 | ||||
-rw-r--r-- | mitmproxy/proxy/protocol/websockets.py | 4 | ||||
-rw-r--r-- | mitmproxy/proxy/server.py | 4 | ||||
-rw-r--r-- | mitmproxy/test/tutils.py | 10 | ||||
-rw-r--r-- | mitmproxy/tools/cmdline.py | 2 | ||||
-rw-r--r-- | mitmproxy/tools/console/common.py | 6 | ||||
-rw-r--r-- | mitmproxy/tools/console/flowlist.py | 4 | ||||
-rw-r--r-- | mitmproxy/tools/console/flowview.py | 4 | ||||
-rw-r--r-- | mitmproxy/tools/console/grideditor/col_subgrid.py | 2 | ||||
-rw-r--r-- | mitmproxy/tools/console/grideditor/editors.py | 2 | ||||
-rw-r--r-- | mitmproxy/tools/console/master.py | 2 | ||||
-rw-r--r-- | mitmproxy/tools/console/statusbar.py | 4 | ||||
-rw-r--r-- | mitmproxy/tools/dump.py | 2 | ||||
-rw-r--r-- | mitmproxy/tools/web/master.py | 2 | ||||
-rw-r--r-- | mitmproxy/utils/debug.py | 2 | ||||
-rw-r--r-- | mitmproxy/utils/version_check.py | 5 | ||||
-rw-r--r-- | netlib/http/__init__.py | 15 | ||||
-rw-r--r-- | netlib/http/http2/__init__.py | 8 | ||||
-rw-r--r-- | pathod/language/http.py | 12 | ||||
-rw-r--r-- | pathod/language/http2.py | 4 | ||||
-rw-r--r-- | pathod/language/websockets.py | 18 | ||||
-rw-r--r-- | pathod/pathoc.py | 8 | ||||
-rw-r--r-- | pathod/pathoc_cmdline.py | 4 | ||||
-rw-r--r-- | pathod/pathod.py | 4 | ||||
-rw-r--r-- | pathod/pathod_cmdline.py | 2 | ||||
-rw-r--r-- | pathod/protocols/http.py | 2 | ||||
-rw-r--r-- | pathod/protocols/http2.py | 22 | ||||
-rw-r--r-- | pathod/protocols/websockets.py | 2 | ||||
-rw-r--r-- | release/README.mkd | 2 | ||||
-rwxr-xr-x | release/rtool.py | 2 | ||||
-rw-r--r-- | setup.py | 1 | ||||
-rw-r--r-- | test/mitmproxy/net/__init__.py (renamed from test/netlib/__init__.py) | 0 | ||||
-rw-r--r-- | test/mitmproxy/net/data/clientcert/.gitignore (renamed from test/netlib/data/clientcert/.gitignore) | 0 | ||||
-rw-r--r-- | test/mitmproxy/net/data/clientcert/client.cnf (renamed from test/netlib/data/clientcert/client.cnf) | 0 | ||||
-rw-r--r-- | test/mitmproxy/net/data/clientcert/client.pem (renamed from test/netlib/data/clientcert/client.pem) | 0 | ||||
-rw-r--r-- | test/mitmproxy/net/data/clientcert/make (renamed from test/netlib/data/clientcert/make) | 0 | ||||
-rw-r--r-- | test/mitmproxy/net/data/dercert (renamed from test/netlib/data/dercert) | bin | 1838 -> 1838 bytes | |||
-rw-r--r-- | test/mitmproxy/net/data/dhparam.pem (renamed from test/netlib/data/dhparam.pem) | 0 | ||||
-rw-r--r-- | test/mitmproxy/net/data/htpasswd (renamed from test/netlib/data/htpasswd) | 0 | ||||
-rw-r--r-- | test/mitmproxy/net/data/server.crt (renamed from test/netlib/data/server.crt) | 0 | ||||
-rw-r--r-- | test/mitmproxy/net/data/server.key (renamed from test/netlib/data/server.key) | 0 | ||||
-rw-r--r-- | test/mitmproxy/net/data/text_cert (renamed from test/netlib/data/text_cert) | 0 | ||||
-rw-r--r-- | test/mitmproxy/net/data/text_cert_2 (renamed from test/netlib/data/text_cert_2) | 0 | ||||
-rw-r--r-- | test/mitmproxy/net/data/text_cert_weird1 (renamed from test/netlib/data/text_cert_weird1) | 0 | ||||
-rw-r--r-- | test/mitmproxy/net/data/verificationcerts/9da13359.0 (renamed from test/netlib/data/verificationcerts/9da13359.0) | 0 | ||||
-rw-r--r-- | test/mitmproxy/net/data/verificationcerts/generate.py (renamed from test/netlib/data/verificationcerts/generate.py) | 0 | ||||
-rw-r--r-- | test/mitmproxy/net/data/verificationcerts/self-signed.crt (renamed from test/netlib/data/verificationcerts/self-signed.crt) | 0 | ||||
-rw-r--r-- | test/mitmproxy/net/data/verificationcerts/self-signed.key (renamed from test/netlib/data/verificationcerts/self-signed.key) | 0 | ||||
-rw-r--r-- | test/mitmproxy/net/data/verificationcerts/trusted-leaf.crt (renamed from test/netlib/data/verificationcerts/trusted-leaf.crt) | 0 | ||||
-rw-r--r-- | test/mitmproxy/net/data/verificationcerts/trusted-leaf.key (renamed from test/netlib/data/verificationcerts/trusted-leaf.key) | 0 | ||||
-rw-r--r-- | test/mitmproxy/net/data/verificationcerts/trusted-root.crt (renamed from test/netlib/data/verificationcerts/trusted-root.crt) | 0 | ||||
-rw-r--r-- | test/mitmproxy/net/data/verificationcerts/trusted-root.key (renamed from test/netlib/data/verificationcerts/trusted-root.key) | 0 | ||||
-rw-r--r-- | test/mitmproxy/net/data/verificationcerts/trusted-root.srl (renamed from test/netlib/data/verificationcerts/trusted-root.srl) | 0 | ||||
-rw-r--r-- | test/mitmproxy/net/http/__init__.py (renamed from test/netlib/http/__init__.py) | 0 | ||||
-rw-r--r-- | test/mitmproxy/net/http/http1/__init__.py (renamed from test/netlib/http/http1/__init__.py) | 0 | ||||
-rw-r--r-- | test/mitmproxy/net/http/http1/test_assemble.py (renamed from test/netlib/http/http1/test_assemble.py) | 4 | ||||
-rw-r--r-- | test/mitmproxy/net/http/http1/test_read.py (renamed from test/netlib/http/http1/test_read.py) | 4 | ||||
-rw-r--r-- | test/mitmproxy/net/http/http2/__init__.py (renamed from test/netlib/http/http2/__init__.py) | 0 | ||||
-rw-r--r-- | test/mitmproxy/net/http/http2/test_framereader.py (renamed from test/netlib/http/http2/test_framereader.py) | 0 | ||||
-rw-r--r-- | test/mitmproxy/net/http/test_authentication.py (renamed from test/netlib/http/test_authentication.py) | 2 | ||||
-rw-r--r-- | test/mitmproxy/net/http/test_cookies.py (renamed from test/netlib/http/test_cookies.py) | 2 | ||||
-rw-r--r-- | test/mitmproxy/net/http/test_encoding.py (renamed from test/netlib/http/test_encoding.py) | 2 | ||||
-rw-r--r-- | test/mitmproxy/net/http/test_headers.py (renamed from test/netlib/http/test_headers.py) | 2 | ||||
-rw-r--r-- | test/mitmproxy/net/http/test_message.py (renamed from test/netlib/http/test_message.py) | 2 | ||||
-rw-r--r-- | test/mitmproxy/net/http/test_multipart.py (renamed from test/netlib/http/test_multipart.py) | 4 | ||||
-rw-r--r-- | test/mitmproxy/net/http/test_request.py (renamed from test/netlib/http/test_request.py) | 2 | ||||
-rw-r--r-- | test/mitmproxy/net/http/test_response.py (renamed from test/netlib/http/test_response.py) | 6 | ||||
-rw-r--r-- | test/mitmproxy/net/http/test_status_codes.py (renamed from test/netlib/http/test_status_codes.py) | 2 | ||||
-rw-r--r-- | test/mitmproxy/net/http/test_url.py (renamed from test/netlib/http/test_url.py) | 2 | ||||
-rw-r--r-- | test/mitmproxy/net/http/test_user_agents.py (renamed from test/netlib/http/test_user_agents.py) | 2 | ||||
-rw-r--r-- | test/mitmproxy/net/test_check.py (renamed from test/netlib/test_check.py) | 2 | ||||
-rw-r--r-- | test/mitmproxy/net/test_imports.py (renamed from test/netlib/test_imports.py) | 0 | ||||
-rw-r--r-- | test/mitmproxy/net/test_socks.py (renamed from test/netlib/test_socks.py) | 4 | ||||
-rw-r--r-- | test/mitmproxy/net/test_tcp.py (renamed from test/netlib/test_tcp.py) | 2 | ||||
-rw-r--r-- | test/mitmproxy/net/test_wsgi.py (renamed from test/netlib/test_wsgi.py) | 4 | ||||
-rw-r--r-- | test/mitmproxy/net/tools/getcertnames (renamed from test/netlib/tools/getcertnames) | 2 | ||||
-rw-r--r-- | test/mitmproxy/net/tservers.py (renamed from test/netlib/tservers.py) | 2 | ||||
-rw-r--r-- | test/mitmproxy/net/websockets/__init__.py (renamed from test/netlib/websockets/__init__.py) | 0 | ||||
-rw-r--r-- | test/mitmproxy/net/websockets/test_frame.py (renamed from test/netlib/websockets/test_frame.py) | 2 | ||||
-rw-r--r-- | test/mitmproxy/net/websockets/test_masker.py (renamed from test/netlib/websockets/test_masker.py) | 2 | ||||
-rw-r--r-- | test/mitmproxy/net/websockets/test_utils.py (renamed from test/netlib/websockets/test_utils.py) | 4 | ||||
-rw-r--r-- | test/mitmproxy/protocol/test_http1.py | 4 | ||||
-rw-r--r-- | test/mitmproxy/protocol/test_http2.py | 16 | ||||
-rw-r--r-- | test/mitmproxy/protocol/test_websockets.py | 14 | ||||
-rw-r--r-- | test/mitmproxy/test_contentview.py | 4 | ||||
-rw-r--r-- | test/mitmproxy/test_custom_contentview.py | 2 | ||||
-rw-r--r-- | test/mitmproxy/test_examples.py | 4 | ||||
-rw-r--r-- | test/mitmproxy/test_flow.py | 2 | ||||
-rw-r--r-- | test/mitmproxy/test_flow_export.py | 2 | ||||
-rw-r--r-- | test/mitmproxy/test_proxy.py | 2 | ||||
-rw-r--r-- | test/mitmproxy/test_server.py | 18 | ||||
-rw-r--r-- | test/pathod/test_language_http2.py | 4 | ||||
-rw-r--r-- | test/pathod/test_language_websocket.py | 12 | ||||
-rw-r--r-- | test/pathod/test_pathoc.py | 6 | ||||
-rw-r--r-- | test/pathod/test_pathod.py | 2 | ||||
-rw-r--r-- | test/pathod/test_protocols_http2.py | 26 | ||||
-rw-r--r-- | test/pathod/tutils.py | 2 | ||||
-rw-r--r-- | tox.ini | 2 |
150 files changed, 275 insertions, 282 deletions
diff --git a/.appveyor.yml b/.appveyor.yml index 38868628..746e0fd1 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -23,7 +23,7 @@ install: - "pip install -U tox" test_script: - - ps: "tox -- --cov netlib --cov mitmproxy --cov pathod -v" + - ps: "tox -- --cov mitmproxy --cov pathod -v" deploy_script: ps: | diff --git a/.travis.yml b/.travis.yml index d160a96e..d7cb7027 100644 --- a/.travis.yml +++ b/.travis.yml @@ -49,7 +49,7 @@ install: fi - pip install tox -script: tox -- --cov netlib --cov mitmproxy --cov pathod -v +script: tox -- --cov mitmproxy --cov pathod -v after_success: - | diff --git a/MANIFEST.in b/MANIFEST.in index 440a14ed..404936e8 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1,4 +1,3 @@ graft mitmproxy graft pathod -graft netlib -recursive-exclude * *.pyc *.pyo *.swo *.swp *.map
\ No newline at end of file +recursive-exclude * *.pyc *.pyo *.swo *.swp *.map @@ -3,8 +3,7 @@ mitmproxy |travis| |appveyor| |coverage| |latest_release| |python_versions| -This repository contains the **mitmproxy** and **pathod** projects, as well as -their shared networking library, **netlib**. +This repository contains the **mitmproxy** and **pathod** projects. ``mitmproxy`` is an interactive, SSL-capable intercepting proxy with a console interface. @@ -64,7 +63,7 @@ virtualenv_ installed (you can find installation instructions for virtualenv The *dev* script will create a virtualenv environment in a directory called "venv", and install all mandatory and optional dependencies into it. The -primary mitmproxy components - mitmproxy, netlib and pathod - are installed as +primary mitmproxy components - mitmproxy and pathod - are installed as "editable", so any changes to the source in the repository will be reflected live in the virtualenv. @@ -144,7 +143,7 @@ PR checks will fail and block merging. We are using this command to check for st .. code-block:: text - flake8 --jobs 8 --count mitmproxy netlib pathod examples test + flake8 --jobs 8 --count mitmproxy pathod examples test .. |mitmproxy_site| image:: https://shields.mitmproxy.org/api/https%3A%2F%2F-mitmproxy.org-blue.svg diff --git a/docs/conf.py b/docs/conf.py index ce942aa9..d7793b79 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -231,10 +231,7 @@ def linkcode_resolve(domain, info): _, line = inspect.getsourcelines(obj) except (TypeError, IOError): return None - if spath.rfind("netlib") > -1: - off = spath.rfind("netlib") - mpath = spath[off:] - elif spath.rfind("mitmproxy") > -1: + if spath.rfind("mitmproxy") > -1: off = spath.rfind("mitmproxy") mpath = spath[off:] else: diff --git a/docs/dev/testing.rst b/docs/dev/testing.rst index 315b9bc9..b86efce1 100644 --- a/docs/dev/testing.rst +++ b/docs/dev/testing.rst @@ -10,7 +10,7 @@ suitable extension to the test suite. Our tests are written for the `py.test`_ or nose_ test frameworks. At the point where you send your pull request, a command like this: ->>> py.test --cov mitmproxy --cov netlib +>>> py.test --cov mitmproxy Should give output something like this: diff --git a/docs/modd.conf b/docs/modd.conf index bc91238c..0e8f0dce 100644 --- a/docs/modd.conf +++ b/docs/modd.conf @@ -1,6 +1,6 @@ @build = ./_build -** !_build/** ../netlib/**/*.py ../mitmproxy/**/*.py { +** !_build/** ../mitmproxy/**/*.py { prep: sphinx-build -W -d @build/doctrees -b html . @build/html daemon: devd -m @build/html } diff --git a/examples/har_dump.py b/examples/har_dump.py index d01e6cdd..560b9adc 100644 --- a/examples/har_dump.py +++ b/examples/har_dump.py @@ -16,7 +16,7 @@ import mitmproxy from mitmproxy import version from mitmproxy.utils import strutils -from netlib.http import cookies +from mitmproxy.net.http import cookies HAR = {} diff --git a/mitmproxy/addons/stickycookie.py b/mitmproxy/addons/stickycookie.py index d89bd92d..27d78646 100644 --- a/mitmproxy/addons/stickycookie.py +++ b/mitmproxy/addons/stickycookie.py @@ -1,7 +1,7 @@ import collections from http import cookiejar -from netlib.http import cookies +from mitmproxy.net.http import cookies from mitmproxy import exceptions from mitmproxy import flowfilter diff --git a/mitmproxy/addons/streambodies.py b/mitmproxy/addons/streambodies.py index bd8958b0..88cb74f3 100644 --- a/mitmproxy/addons/streambodies.py +++ b/mitmproxy/addons/streambodies.py @@ -1,4 +1,4 @@ -from netlib.http import http1 +from mitmproxy.net.http import http1 from mitmproxy import exceptions from mitmproxy import ctx diff --git a/mitmproxy/addons/wsgiapp.py b/mitmproxy/addons/wsgiapp.py index 0879a87b..85d09a0a 100644 --- a/mitmproxy/addons/wsgiapp.py +++ b/mitmproxy/addons/wsgiapp.py @@ -1,7 +1,7 @@ from mitmproxy import ctx from mitmproxy import exceptions -from netlib import wsgi +from mitmproxy.net import wsgi from mitmproxy import version diff --git a/mitmproxy/certs.py b/mitmproxy/certs.py index 9cb8a40e..83db4e6e 100644 --- a/mitmproxy/certs.py +++ b/mitmproxy/certs.py @@ -193,7 +193,7 @@ class CertStore: @staticmethod def load_dhparam(path): - # netlib<=0.10 doesn't generate a dhparam file. + # mitmproxy<=0.10 doesn't generate a dhparam file. # Create it now if neccessary. if not os.path.exists(path): with open(path, "wb") as f: diff --git a/mitmproxy/connections.py b/mitmproxy/connections.py index 6b39ac20..015d0689 100644 --- a/mitmproxy/connections.py +++ b/mitmproxy/connections.py @@ -5,7 +5,7 @@ import os from mitmproxy import stateobject from mitmproxy import certs -from netlib import tcp +from mitmproxy.net import tcp class ClientConnection(tcp.BaseHandler, stateobject.StateObject): diff --git a/mitmproxy/contentviews.py b/mitmproxy/contentviews.py index a171f36b..b7f15d8d 100644 --- a/mitmproxy/contentviews.py +++ b/mitmproxy/contentviews.py @@ -33,10 +33,10 @@ from PIL import ExifTags from PIL import Image from mitmproxy import exceptions from mitmproxy.contrib.wbxml import ASCommandResponse -from netlib import http +from mitmproxy.net import http from mitmproxy.types import multidict from mitmproxy.utils import strutils -from netlib.http import url +from mitmproxy.net.http import url try: import pyamf diff --git a/mitmproxy/exceptions.py b/mitmproxy/exceptions.py index a7ecf17f..309b8189 100644 --- a/mitmproxy/exceptions.py +++ b/mitmproxy/exceptions.py @@ -112,7 +112,7 @@ class AddonHalt(MitmproxyException): class NetlibException(MitmproxyException): """ - Base class for all exceptions thrown by netlib. + Base class for all exceptions thrown by mitmproxy.net. """ def __init__(self, message=None): super().__init__(message) diff --git a/mitmproxy/export.py b/mitmproxy/export.py index e5f4d34a..d9a88849 100644 --- a/mitmproxy/export.py +++ b/mitmproxy/export.py @@ -3,7 +3,7 @@ import re import textwrap import urllib -import netlib.http +import mitmproxy.net.http def _native(s): @@ -89,9 +89,9 @@ def python_code(flow): return code -def is_json(headers: netlib.http.Headers, content: bytes) -> bool: +def is_json(headers: mitmproxy.net.http.Headers, content: bytes) -> bool: if headers: - ct = netlib.http.parse_content_type(headers.get("content-type", "")) + ct = mitmproxy.net.http.parse_content_type(headers.get("content-type", "")) if ct and "%s/%s" % (ct[0], ct[1]) == "application/json": try: return json.loads(content.decode("utf8", "surrogateescape")) diff --git a/mitmproxy/http.py b/mitmproxy/http.py index 4474ca3b..99e126fe 100644 --- a/mitmproxy/http.py +++ b/mitmproxy/http.py @@ -1,9 +1,9 @@ import cgi from mitmproxy import flow -from netlib import http +from mitmproxy.net import http from mitmproxy import version -from netlib import tcp +from mitmproxy.net import tcp class HTTPRequest(http.Request): @@ -12,7 +12,7 @@ class HTTPRequest(http.Request): A mitmproxy HTTP request. """ - # This is a very thin wrapper on top of :py:class:`netlib.http.Request` and + # This is a very thin wrapper on top of :py:class:`mitmproxy.net.http.Request` and # may be removed in the future. def __init__( @@ -73,7 +73,7 @@ class HTTPRequest(http.Request): @classmethod def wrap(self, request): """ - Wraps an existing :py:class:`netlib.http.Request`. + Wraps an existing :py:class:`mitmproxy.net.http.Request`. """ req = HTTPRequest( first_line_format=request.data.first_line_format, @@ -99,7 +99,7 @@ class HTTPResponse(http.Response): """ A mitmproxy HTTP response. """ - # This is a very thin wrapper on top of :py:class:`netlib.http.Response` and + # This is a very thin wrapper on top of :py:class:`mitmproxy.net.http.Response` and # may be removed in the future. def __init__( @@ -131,7 +131,7 @@ class HTTPResponse(http.Response): @classmethod def wrap(self, response): """ - Wraps an existing :py:class:`netlib.http.Response`. + Wraps an existing :py:class:`mitmproxy.net.http.Response`. """ resp = HTTPResponse( http_version=response.data.http_version, diff --git a/mitmproxy/master.py b/mitmproxy/master.py index 2e57e57d..31ce17a3 100644 --- a/mitmproxy/master.py +++ b/mitmproxy/master.py @@ -15,7 +15,7 @@ from mitmproxy import log from mitmproxy import io from mitmproxy.proxy.protocol import http_replay from mitmproxy.types import basethread -import netlib.http +import mitmproxy.net.http from . import ctx as mitmproxy_ctx @@ -122,7 +122,7 @@ class Master: s = connections.ServerConnection.make_dummy((host, port)) f = http.HTTPFlow(c, s) - headers = netlib.http.Headers() + headers = mitmproxy.net.http.Headers() req = http.HTTPRequest( "absolute", diff --git a/netlib/__init__.py b/mitmproxy/net/__init__.py index e69de29b..e69de29b 100644 --- a/netlib/__init__.py +++ b/mitmproxy/net/__init__.py diff --git a/netlib/check.py b/mitmproxy/net/check.py index 7b007cb5..7b007cb5 100644 --- a/netlib/check.py +++ b/mitmproxy/net/check.py diff --git a/mitmproxy/net/http/__init__.py b/mitmproxy/net/http/__init__.py new file mode 100644 index 00000000..7e290bdc --- /dev/null +++ b/mitmproxy/net/http/__init__.py @@ -0,0 +1,15 @@ +from mitmproxy.net.http.request import Request +from mitmproxy.net.http.response import Response +from mitmproxy.net.http.message import Message +from mitmproxy.net.http.headers import Headers, parse_content_type +from mitmproxy.net.http.message import decoded +from mitmproxy.net.http import http1, http2, status_codes, multipart + +__all__ = [ + "Request", + "Response", + "Message", + "Headers", "parse_content_type", + "decoded", + "http1", "http2", "status_codes", "multipart", +] diff --git a/netlib/http/authentication.py b/mitmproxy/net/http/authentication.py index a65279e4..a65279e4 100644 --- a/netlib/http/authentication.py +++ b/mitmproxy/net/http/authentication.py diff --git a/netlib/http/cookies.py b/mitmproxy/net/http/cookies.py index 9f32fa5e..9f32fa5e 100644 --- a/netlib/http/cookies.py +++ b/mitmproxy/net/http/cookies.py diff --git a/netlib/http/encoding.py b/mitmproxy/net/http/encoding.py index e123a033..e123a033 100644 --- a/netlib/http/encoding.py +++ b/mitmproxy/net/http/encoding.py diff --git a/netlib/http/headers.py b/mitmproxy/net/http/headers.py index 8fc0cd43..8fc0cd43 100644 --- a/netlib/http/headers.py +++ b/mitmproxy/net/http/headers.py diff --git a/netlib/http/http1/__init__.py b/mitmproxy/net/http/http1/__init__.py index e4bf01c5..e4bf01c5 100644 --- a/netlib/http/http1/__init__.py +++ b/mitmproxy/net/http/http1/__init__.py diff --git a/netlib/http/http1/assemble.py b/mitmproxy/net/http/http1/assemble.py index e0a91ad8..d718589f 100644 --- a/netlib/http/http1/assemble.py +++ b/mitmproxy/net/http/http1/assemble.py @@ -1,4 +1,4 @@ -import netlib.http.url +import mitmproxy.net.http.url from mitmproxy import exceptions @@ -44,7 +44,7 @@ def assemble_body(headers, body_chunks): def _assemble_request_line(request_data): """ Args: - request_data (netlib.http.request.RequestData) + request_data (mitmproxy.net.http.request.RequestData) """ form = request_data.first_line_format if form == "relative": @@ -76,11 +76,11 @@ def _assemble_request_line(request_data): def _assemble_request_headers(request_data): """ Args: - request_data (netlib.http.request.RequestData) + request_data (mitmproxy.net.http.request.RequestData) """ headers = request_data.headers.copy() if "host" not in headers and request_data.scheme and request_data.host and request_data.port: - headers["host"] = netlib.http.url.hostport( + headers["host"] = mitmproxy.net.http.url.hostport( request_data.scheme, request_data.host, request_data.port diff --git a/netlib/http/http1/read.py b/mitmproxy/net/http/http1/read.py index e6b22863..6eb30709 100644 --- a/netlib/http/http1/read.py +++ b/mitmproxy/net/http/http1/read.py @@ -2,11 +2,11 @@ import time import sys import re -from netlib.http import request -from netlib.http import response -from netlib.http import headers -from netlib.http import url -from netlib import check +from mitmproxy.net.http import request +from mitmproxy.net.http import response +from mitmproxy.net.http import headers +from mitmproxy.net.http import url +from mitmproxy.net import check from mitmproxy import exceptions diff --git a/mitmproxy/net/http/http2/__init__.py b/mitmproxy/net/http/http2/__init__.py new file mode 100644 index 00000000..7027006b --- /dev/null +++ b/mitmproxy/net/http/http2/__init__.py @@ -0,0 +1,8 @@ +from mitmproxy.net.http.http2.framereader import read_raw_frame, parse_frame +from mitmproxy.net.http.http2.utils import parse_headers + +__all__ = [ + "read_raw_frame", + "parse_frame", + "parse_headers", +] diff --git a/netlib/http/http2/framereader.py b/mitmproxy/net/http/http2/framereader.py index 6a164919..6a164919 100644 --- a/netlib/http/http2/framereader.py +++ b/mitmproxy/net/http/http2/framereader.py diff --git a/netlib/http/http2/utils.py b/mitmproxy/net/http/http2/utils.py index 164bacc8..62a59c72 100644 --- a/netlib/http/http2/utils.py +++ b/mitmproxy/net/http/http2/utils.py @@ -1,4 +1,4 @@ -from netlib.http import url +from mitmproxy.net.http import url def parse_headers(headers): diff --git a/netlib/http/message.py b/mitmproxy/net/http/message.py index 772a124e..af1d16be 100644 --- a/netlib/http/message.py +++ b/mitmproxy/net/http/message.py @@ -3,9 +3,9 @@ import warnings from typing import Optional from mitmproxy.utils import strutils -from netlib.http import encoding +from mitmproxy.net.http import encoding from mitmproxy.types import serializable -from netlib.http import headers +from mitmproxy.net.http import headers # While headers _should_ be ASCII, it's not uncommon for certain headers to be utf-8 encoded. @@ -69,7 +69,7 @@ class Message(serializable.Serializable): Message headers object Returns: - netlib.http.Headers + mitmproxy.net.http.Headers """ return self.data.headers diff --git a/netlib/http/multipart.py b/mitmproxy/net/http/multipart.py index 536b2809..a854d47f 100644 --- a/netlib/http/multipart.py +++ b/mitmproxy/net/http/multipart.py @@ -1,6 +1,6 @@ import re -from netlib.http import headers +from mitmproxy.net.http import headers def decode(hdrs, content): diff --git a/netlib/http/request.py b/mitmproxy/net/http/request.py index 16b0c986..c3d85363 100644 --- a/netlib/http/request.py +++ b/mitmproxy/net/http/request.py @@ -3,11 +3,11 @@ import urllib from mitmproxy.types import multidict from mitmproxy.utils import strutils -from netlib.http import multipart -from netlib.http import cookies -from netlib.http import headers as nheaders -from netlib.http import message -import netlib.http.url +from mitmproxy.net.http import multipart +from mitmproxy.net.http import cookies +from mitmproxy.net.http import headers as nheaders +from mitmproxy.net.http import message +import mitmproxy.net.http.url # This regex extracts & splits the host header into host and port. # Handles the edge case of IPv6 addresses containing colons. @@ -203,11 +203,11 @@ class Request(message.Message): """ if self.first_line_format == "authority": return "%s:%d" % (self.host, self.port) - return netlib.http.url.unparse(self.scheme, self.host, self.port, self.path) + return mitmproxy.net.http.url.unparse(self.scheme, self.host, self.port, self.path) @url.setter def url(self, url): - self.scheme, self.host, self.port, self.path = netlib.http.url.parse(url) + self.scheme, self.host, self.port, self.path = mitmproxy.net.http.url.parse(url) def _parse_host_header(self): """Extract the host and port from Host header""" @@ -243,12 +243,12 @@ class Request(message.Message): """ if self.first_line_format == "authority": return "%s:%d" % (self.pretty_host, self.port) - return netlib.http.url.unparse(self.scheme, self.pretty_host, self.port, self.path) + return mitmproxy.net.http.url.unparse(self.scheme, self.pretty_host, self.port, self.path) @property def query(self) -> multidict.MultiDictView: """ - The request query string as an :py:class:`~netlib.multidict.MultiDictView` object. + The request query string as an :py:class:`~mitmproxy.net.multidict.MultiDictView` object. """ return multidict.MultiDictView( self._get_query, @@ -257,10 +257,10 @@ class Request(message.Message): def _get_query(self): query = urllib.parse.urlparse(self.url).query - return tuple(netlib.http.url.decode(query)) + return tuple(mitmproxy.net.http.url.decode(query)) def _set_query(self, query_data): - query = netlib.http.url.encode(query_data) + query = mitmproxy.net.http.url.encode(query_data) _, _, path, params, _, fragment = urllib.parse.urlparse(self.url) self.path = urllib.parse.urlunparse(["", "", path, params, query, fragment]) @@ -273,7 +273,7 @@ class Request(message.Message): """ The request cookies. - An empty :py:class:`~netlib.multidict.MultiDictView` object if the cookie monster ate them all. + An empty :py:class:`~mitmproxy.net.multidict.MultiDictView` object if the cookie monster ate them all. """ return multidict.MultiDictView( self._get_cookies, @@ -301,11 +301,11 @@ class Request(message.Message): # This needs to be a tuple so that it's immutable. # Otherwise, this would fail silently: # request.path_components.append("foo") - return tuple(netlib.http.url.unquote(i) for i in path.split("/") if i) + return tuple(mitmproxy.net.http.url.unquote(i) for i in path.split("/") if i) @path_components.setter def path_components(self, components): - components = map(lambda x: netlib.http.url.quote(x, safe=""), components) + components = map(lambda x: mitmproxy.net.http.url.quote(x, safe=""), components) path = "/" + "/".join(components) _, _, _, params, query, fragment = urllib.parse.urlparse(self.url) self.path = urllib.parse.urlunparse(["", "", path, params, query, fragment]) @@ -347,7 +347,7 @@ class Request(message.Message): @property def urlencoded_form(self): """ - The URL-encoded form data as an :py:class:`~netlib.multidict.MultiDictView` object. + The URL-encoded form data as an :py:class:`~mitmproxy.net.multidict.MultiDictView` object. An empty multidict.MultiDictView if the content-type indicates non-form data or the content could not be parsed. """ @@ -360,7 +360,7 @@ class Request(message.Message): is_valid_content_type = "application/x-www-form-urlencoded" in self.headers.get("content-type", "").lower() if is_valid_content_type: try: - return tuple(netlib.http.url.decode(self.content)) + return tuple(mitmproxy.net.http.url.decode(self.content)) except ValueError: pass return () @@ -371,7 +371,7 @@ class Request(message.Message): This will overwrite the existing content if there is one. """ self.headers["content-type"] = "application/x-www-form-urlencoded" - self.content = netlib.http.url.encode(form_data).encode() + self.content = mitmproxy.net.http.url.encode(form_data).encode() @urlencoded_form.setter def urlencoded_form(self, value): @@ -380,7 +380,7 @@ class Request(message.Message): @property def multipart_form(self): """ - The multipart form data as an :py:class:`~netlib.multidict.MultiDictView` object. + The multipart form data as an :py:class:`~mitmproxy.net.multidict.MultiDictView` object. None if the content-type indicates non-form data. """ return multidict.MultiDictView( diff --git a/netlib/http/response.py b/mitmproxy/net/http/response.py index 4d1d5d24..b458a3d8 100644 --- a/netlib/http/response.py +++ b/mitmproxy/net/http/response.py @@ -2,10 +2,10 @@ import time from email.utils import parsedate_tz, formatdate, mktime_tz from mitmproxy.utils import human from mitmproxy.types import multidict -from netlib.http import cookies -from netlib.http import headers as nheaders -from netlib.http import message -from netlib.http import status_codes +from mitmproxy.net.http import cookies +from mitmproxy.net.http import headers as nheaders +from mitmproxy.net.http import message +from mitmproxy.net.http import status_codes from typing import AnyStr from typing import Dict from typing import Iterable @@ -131,7 +131,7 @@ class Response(message.Message): def cookies(self) -> multidict.MultiDictView: """ The response cookies. A possibly empty - :py:class:`~netlib.multidict.MultiDictView`, where the keys are cookie + :py:class:`~mitmproxy.net.multidict.MultiDictView`, where the keys are cookie name strings, and values are (value, attr) tuples. Value is a string, and attr is an MultiDictView containing cookie attributes. Within attrs, unary attributes (e.g. HTTPOnly) are indicated by a Null value. diff --git a/netlib/http/status_codes.py b/mitmproxy/net/http/status_codes.py index 5a83cd73..5a83cd73 100644 --- a/netlib/http/status_codes.py +++ b/mitmproxy/net/http/status_codes.py diff --git a/netlib/http/url.py b/mitmproxy/net/http/url.py index 3ca58120..ff3d5264 100644 --- a/netlib/http/url.py +++ b/mitmproxy/net/http/url.py @@ -2,7 +2,7 @@ import urllib from typing import Sequence from typing import Tuple -from netlib import check +from mitmproxy.net import check # PY2 workaround diff --git a/netlib/http/user_agents.py b/mitmproxy/net/http/user_agents.py index d0ca2f21..d0ca2f21 100644 --- a/netlib/http/user_agents.py +++ b/mitmproxy/net/http/user_agents.py diff --git a/netlib/socks.py b/mitmproxy/net/socks.py index 377308a8..115949f5 100644 --- a/netlib/socks.py +++ b/mitmproxy/net/socks.py @@ -2,8 +2,8 @@ import struct import array import ipaddress -from netlib import tcp -from netlib import check +from mitmproxy.net import tcp +from mitmproxy.net import check from mitmproxy.types import bidi diff --git a/netlib/tcp.py b/mitmproxy/net/tcp.py index ac368a9c..ac368a9c 100644 --- a/netlib/tcp.py +++ b/mitmproxy/net/tcp.py diff --git a/netlib/websockets/__init__.py b/mitmproxy/net/websockets/__init__.py index 2d6f0a0c..2d6f0a0c 100644 --- a/netlib/websockets/__init__.py +++ b/mitmproxy/net/websockets/__init__.py diff --git a/netlib/websockets/frame.py b/mitmproxy/net/websockets/frame.py index bc4ae43a..bd5f67dd 100644 --- a/netlib/websockets/frame.py +++ b/mitmproxy/net/websockets/frame.py @@ -2,7 +2,7 @@ import os import struct import io -from netlib import tcp +from mitmproxy.net import tcp from mitmproxy.utils import strutils from mitmproxy.utils import bits from mitmproxy.utils import human diff --git a/netlib/websockets/masker.py b/mitmproxy/net/websockets/masker.py index 47b1a688..47b1a688 100644 --- a/netlib/websockets/masker.py +++ b/mitmproxy/net/websockets/masker.py diff --git a/netlib/websockets/utils.py b/mitmproxy/net/websockets/utils.py index 98043662..d0b168ce 100644 --- a/netlib/websockets/utils.py +++ b/mitmproxy/net/websockets/utils.py @@ -8,7 +8,7 @@ import base64 import hashlib import os -from netlib import http +from mitmproxy.net import http from mitmproxy.utils import strutils MAGIC = b'258EAFA5-E914-47DA-95CA-C5AB0DC85B11' diff --git a/netlib/wsgi.py b/mitmproxy/net/wsgi.py index 5a54cd70..b2705ea1 100644 --- a/netlib/wsgi.py +++ b/mitmproxy/net/wsgi.py @@ -3,8 +3,8 @@ import traceback import urllib import io -from netlib import http -from netlib import tcp +from mitmproxy.net import http +from mitmproxy.net import tcp from mitmproxy.utils import strutils diff --git a/mitmproxy/proxy/config.py b/mitmproxy/proxy/config.py index 86b68ee5..7df9e692 100644 --- a/mitmproxy/proxy/config.py +++ b/mitmproxy/proxy/config.py @@ -11,9 +11,9 @@ from OpenSSL import SSL, crypto from mitmproxy import exceptions from mitmproxy import options as moptions from mitmproxy import certs -from netlib import tcp -from netlib.http import authentication -from netlib.http import url +from mitmproxy.net import tcp +from mitmproxy.net.http import authentication +from mitmproxy.net.http import url CONF_BASENAME = "mitmproxy" diff --git a/mitmproxy/proxy/modes/socks_proxy.py b/mitmproxy/proxy/modes/socks_proxy.py index 175453b0..adcd8fc1 100644 --- a/mitmproxy/proxy/modes/socks_proxy.py +++ b/mitmproxy/proxy/modes/socks_proxy.py @@ -1,6 +1,6 @@ from mitmproxy import exceptions from mitmproxy.proxy import protocol -from netlib import socks +from mitmproxy.net import socks class Socks5Proxy(protocol.Layer, protocol.ServerConnectionMixin): diff --git a/mitmproxy/proxy/protocol/http.py b/mitmproxy/proxy/protocol/http.py index 6bc06502..a47fb455 100644 --- a/mitmproxy/proxy/protocol/http.py +++ b/mitmproxy/proxy/protocol/http.py @@ -6,9 +6,9 @@ from mitmproxy import http from mitmproxy import flow from mitmproxy.proxy.protocol import base from mitmproxy.proxy.protocol import websockets as pwebsockets -import netlib.http -from netlib import tcp -from netlib import websockets +import mitmproxy.net.http +from mitmproxy.net import tcp +from mitmproxy.net import websockets class _HttpTransmissionLayer(base.Layer): @@ -422,13 +422,13 @@ class HttpLayer(base.Layer): self.send_response(http.make_error_response( 401, "Authentication Required", - netlib.http.Headers(**self.config.authenticator.auth_challenge_headers()) + mitmproxy.net.http.Headers(**self.config.authenticator.auth_challenge_headers()) )) else: self.send_response(http.make_error_response( 407, "Proxy Authentication Required", - netlib.http.Headers(**self.config.authenticator.auth_challenge_headers()) + mitmproxy.net.http.Headers(**self.config.authenticator.auth_challenge_headers()) )) return False return True diff --git a/mitmproxy/proxy/protocol/http1.py b/mitmproxy/proxy/protocol/http1.py index 968d3249..713c48a7 100644 --- a/mitmproxy/proxy/protocol/http1.py +++ b/mitmproxy/proxy/protocol/http1.py @@ -1,6 +1,6 @@ from mitmproxy import http from mitmproxy.proxy.protocol import http as httpbase -from netlib.http import http1 +from mitmproxy.net.http import http1 class Http1Layer(httpbase._HttpTransmissionLayer): diff --git a/mitmproxy/proxy/protocol/http2.py b/mitmproxy/proxy/protocol/http2.py index d0b0720d..f635e710 100644 --- a/mitmproxy/proxy/protocol/http2.py +++ b/mitmproxy/proxy/protocol/http2.py @@ -12,10 +12,10 @@ from mitmproxy import exceptions from mitmproxy import http from mitmproxy.proxy.protocol import base from mitmproxy.proxy.protocol import http as httpbase -import netlib.http -from netlib import tcp +import mitmproxy.net.http +from mitmproxy.net import tcp from mitmproxy.types import basethread -from netlib.http import http2 +from mitmproxy.net.http import http2 class SafeH2Connection(connection.H2Connection): @@ -148,7 +148,7 @@ class Http2Layer(base.Layer): return True def _handle_request_received(self, eid, event, h2_connection): - headers = netlib.http.Headers([[k, v] for k, v in event.headers]) + headers = mitmproxy.net.http.Headers([[k, v] for k, v in event.headers]) self.streams[eid] = Http2SingleStreamLayer(self, h2_connection, eid, headers) self.streams[eid].timestamp_start = time.time() self.streams[eid].no_body = (event.stream_ended is not None) @@ -162,7 +162,7 @@ class Http2Layer(base.Layer): return True def _handle_response_received(self, eid, event): - headers = netlib.http.Headers([[k, v] for k, v in event.headers]) + headers = mitmproxy.net.http.Headers([[k, v] for k, v in event.headers]) self.streams[eid].queued_data_length = 0 self.streams[eid].timestamp_start = time.time() self.streams[eid].response_headers = headers @@ -239,7 +239,7 @@ class Http2Layer(base.Layer): self.client_conn.h2.push_stream(parent_eid, event.pushed_stream_id, event.headers) self.client_conn.send(self.client_conn.h2.data_to_send()) - headers = netlib.http.Headers([[k, v] for k, v in event.headers]) + headers = mitmproxy.net.http.Headers([[k, v] for k, v in event.headers]) self.streams[event.pushed_stream_id] = Http2SingleStreamLayer(self, h2_connection, event.pushed_stream_id, headers) self.streams[event.pushed_stream_id].timestamp_start = time.time() self.streams[event.pushed_stream_id].pushed = True diff --git a/mitmproxy/proxy/protocol/http_replay.py b/mitmproxy/proxy/protocol/http_replay.py index 7efb0782..c37badd3 100644 --- a/mitmproxy/proxy/protocol/http_replay.py +++ b/mitmproxy/proxy/protocol/http_replay.py @@ -6,7 +6,7 @@ from mitmproxy import exceptions from mitmproxy import http from mitmproxy import flow from mitmproxy import connections -from netlib.http import http1 +from mitmproxy.net.http import http1 from mitmproxy.types import basethread diff --git a/mitmproxy/proxy/protocol/rawtcp.py b/mitmproxy/proxy/protocol/rawtcp.py index 8230c50b..0ec50594 100644 --- a/mitmproxy/proxy/protocol/rawtcp.py +++ b/mitmproxy/proxy/protocol/rawtcp.py @@ -2,7 +2,7 @@ import socket from OpenSSL import SSL -import netlib.tcp +import mitmproxy.net.tcp from mitmproxy import tcp from mitmproxy import flow from mitmproxy import exceptions @@ -31,7 +31,7 @@ class RawTCPLayer(base.Layer): try: while not self.channel.should_exit.is_set(): - r = netlib.tcp.ssl_read_select(conns, 10) + r = mitmproxy.net.tcp.ssl_read_select(conns, 10) for conn in r: dst = server if conn == client else client diff --git a/mitmproxy/proxy/protocol/tls.py b/mitmproxy/proxy/protocol/tls.py index b106aa0c..8a344faf 100644 --- a/mitmproxy/proxy/protocol/tls.py +++ b/mitmproxy/proxy/protocol/tls.py @@ -6,7 +6,7 @@ import construct from mitmproxy import exceptions from mitmproxy.contrib.tls import _constructs from mitmproxy.proxy.protocol import base -from netlib import check +from mitmproxy.net import check # taken from https://testssl.sh/openssl-rfc.mappping.html diff --git a/mitmproxy/proxy/protocol/websockets.py b/mitmproxy/proxy/protocol/websockets.py index f84a1dc5..ca1d05cb 100644 --- a/mitmproxy/proxy/protocol/websockets.py +++ b/mitmproxy/proxy/protocol/websockets.py @@ -4,8 +4,8 @@ from OpenSSL import SSL from mitmproxy import exceptions from mitmproxy.proxy.protocol import base from mitmproxy.utils import strutils -from netlib import tcp -from netlib import websockets +from mitmproxy.net import tcp +from mitmproxy.net import websockets class WebSocketsLayer(base.Layer): diff --git a/mitmproxy/proxy/server.py b/mitmproxy/proxy/server.py index 8472660a..232d7038 100644 --- a/mitmproxy/proxy/server.py +++ b/mitmproxy/proxy/server.py @@ -8,8 +8,8 @@ from mitmproxy import http from mitmproxy import log from mitmproxy.proxy import modes from mitmproxy.proxy import root_context -from netlib import tcp -from netlib.http import http1 +from mitmproxy.net import tcp +from mitmproxy.net.http import http1 class DummyServer: diff --git a/mitmproxy/test/tutils.py b/mitmproxy/test/tutils.py index fc7c0eb9..e925b282 100644 --- a/mitmproxy/test/tutils.py +++ b/mitmproxy/test/tutils.py @@ -7,8 +7,8 @@ from contextlib import contextmanager import sys from mitmproxy.utils import data -from netlib import tcp -from netlib import http +from mitmproxy.net import tcp +from mitmproxy.net import http def treader(bytes): @@ -89,13 +89,13 @@ class RaisesContext: return True -test_data = data.Data(__name__).push("../../test/netlib") +test_data = data.Data(__name__).push("../../test/mitmproxy/net") def treq(**kwargs): """ Returns: - netlib.http.Request + mitmproxy.net.http.Request """ default = dict( first_line_format="relative", @@ -115,7 +115,7 @@ def treq(**kwargs): def tresp(**kwargs): """ Returns: - netlib.http.Response + mitmproxy.net.http.Response """ default = dict( http_version=b"HTTP/1.1", diff --git a/mitmproxy/tools/cmdline.py b/mitmproxy/tools/cmdline.py index b83694ef..2f9ea15c 100644 --- a/mitmproxy/tools/cmdline.py +++ b/mitmproxy/tools/cmdline.py @@ -6,7 +6,7 @@ from mitmproxy import flowfilter from mitmproxy import options from mitmproxy import platform from mitmproxy.utils import human -from netlib import tcp +from mitmproxy.net import tcp from mitmproxy import version diff --git a/mitmproxy/tools/console/common.py b/mitmproxy/tools/console/common.py index 53411d17..90dce5ae 100644 --- a/mitmproxy/tools/console/common.py +++ b/mitmproxy/tools/console/common.py @@ -6,7 +6,7 @@ import os import urwid import urwid.util -import netlib +import mitmproxy.net from mitmproxy.utils import lrucache from mitmproxy.tools.console import signals from mitmproxy import export @@ -226,7 +226,7 @@ def format_flow_data(key, scope, flow): if request.content is None: return None, "Request content is missing" if key == "h": - data += netlib.http.http1.assemble_request(request) + data += mitmproxy.net.http.http1.assemble_request(request) elif key == "c": data += request.get_content(strict=False) else: @@ -240,7 +240,7 @@ def format_flow_data(key, scope, flow): if response.content is None: return None, "Response content is missing" if key == "h": - data += netlib.http.http1.assemble_response(response) + data += mitmproxy.net.http.http1.assemble_response(response) elif key == "c": data += response.get_content(strict=False) else: diff --git a/mitmproxy/tools/console/flowlist.py b/mitmproxy/tools/console/flowlist.py index 31624229..d33348a0 100644 --- a/mitmproxy/tools/console/flowlist.py +++ b/mitmproxy/tools/console/flowlist.py @@ -1,6 +1,6 @@ import urwid -import netlib.http.url +import mitmproxy.net.http.url from mitmproxy import exceptions from mitmproxy.tools.console import common from mitmproxy.tools.console import signals @@ -325,7 +325,7 @@ class FlowListBox(urwid.ListBox): ) def new_request(self, url, method): - parts = netlib.http.url.parse(str(url)) + parts = mitmproxy.net.http.url.parse(str(url)) if not parts: signals.status_message.send(message="Invalid Url") return diff --git a/mitmproxy/tools/console/flowview.py b/mitmproxy/tools/console/flowview.py index afebf44e..4e886ee4 100644 --- a/mitmproxy/tools/console/flowview.py +++ b/mitmproxy/tools/console/flowview.py @@ -16,8 +16,8 @@ from mitmproxy.tools.console import searchable from mitmproxy.tools.console import signals from mitmproxy.tools.console import tabs from mitmproxy import export -from netlib.http import Headers -from netlib.http import status_codes +from mitmproxy.net.http import Headers +from mitmproxy.net.http import status_codes class SearchError(Exception): diff --git a/mitmproxy/tools/console/grideditor/col_subgrid.py b/mitmproxy/tools/console/grideditor/col_subgrid.py index 3147e63d..4db37462 100644 --- a/mitmproxy/tools/console/grideditor/col_subgrid.py +++ b/mitmproxy/tools/console/grideditor/col_subgrid.py @@ -1,7 +1,7 @@ import urwid from mitmproxy.tools.console.grideditor import base from mitmproxy.tools.console import signals -from netlib.http import cookies +from mitmproxy.net.http import cookies class Column(base.Column): diff --git a/mitmproxy/tools/console/grideditor/editors.py b/mitmproxy/tools/console/grideditor/editors.py index 64361af7..5e3f3d42 100644 --- a/mitmproxy/tools/console/grideditor/editors.py +++ b/mitmproxy/tools/console/grideditor/editors.py @@ -9,7 +9,7 @@ from mitmproxy.tools.console.grideditor import col_bytes from mitmproxy.tools.console.grideditor import col_text from mitmproxy.tools.console.grideditor import col_subgrid from mitmproxy.tools.console import signals -from netlib.http import user_agents +from mitmproxy.net.http import user_agents class QueryEditor(base.GridEditor): diff --git a/mitmproxy/tools/console/master.py b/mitmproxy/tools/console/master.py index 7ff0026e..af43c53b 100644 --- a/mitmproxy/tools/console/master.py +++ b/mitmproxy/tools/console/master.py @@ -37,7 +37,7 @@ from mitmproxy.tools.console import window from mitmproxy.flowfilter import FMarked from mitmproxy.utils import strutils -from netlib import tcp +from mitmproxy.net import tcp EVENTLOG_SIZE = 500 diff --git a/mitmproxy/tools/console/statusbar.py b/mitmproxy/tools/console/statusbar.py index ac41b213..74382677 100644 --- a/mitmproxy/tools/console/statusbar.py +++ b/mitmproxy/tools/console/statusbar.py @@ -2,7 +2,7 @@ import os.path import urwid -import netlib.http.url +import mitmproxy.net.http.url from mitmproxy.tools.console import common from mitmproxy.tools.console import pathedit from mitmproxy.tools.console import signals @@ -208,7 +208,7 @@ class StatusBar(urwid.WidgetWrap): if self.master.options.mode in ["reverse", "upstream"]: dst = self.master.server.config.upstream_server - r.append("[dest:%s]" % netlib.http.url.unparse( + r.append("[dest:%s]" % mitmproxy.net.http.url.unparse( dst.scheme, dst.address.host, dst.address.port diff --git a/mitmproxy/tools/dump.py b/mitmproxy/tools/dump.py index 47f69303..e92482f3 100644 --- a/mitmproxy/tools/dump.py +++ b/mitmproxy/tools/dump.py @@ -8,7 +8,7 @@ from mitmproxy import io from mitmproxy import options from mitmproxy import master from mitmproxy.addons import dumper, termlog -from netlib import tcp +from mitmproxy.net import tcp class DumpError(Exception): diff --git a/mitmproxy/tools/web/master.py b/mitmproxy/tools/web/master.py index 2bca4555..619582f3 100644 --- a/mitmproxy/tools/web/master.py +++ b/mitmproxy/tools/web/master.py @@ -13,7 +13,7 @@ from mitmproxy.addons import state from mitmproxy import options from mitmproxy import master from mitmproxy.tools.web import app -from netlib.http import authentication +from mitmproxy.net.http import authentication class Stop(Exception): diff --git a/mitmproxy/utils/debug.py b/mitmproxy/utils/debug.py index 147fe4b1..ac8fedd7 100644 --- a/mitmproxy/utils/debug.py +++ b/mitmproxy/utils/debug.py @@ -84,7 +84,7 @@ def dump_info(signal=None, frame=None, file=sys.stdout, testing=False): # pragm d = {} for i in gc.get_objects(): t = str(type(i)) - if "mitmproxy" in t or "netlib" in t: + if "mitmproxy" in t: d[t] = d.setdefault(t, 0) + 1 itms = list(d.items()) itms.sort(key=lambda x: x[1]) diff --git a/mitmproxy/utils/version_check.py b/mitmproxy/utils/version_check.py index 547c031c..4cf2b9e6 100644 --- a/mitmproxy/utils/version_check.py +++ b/mitmproxy/utils/version_check.py @@ -1,7 +1,6 @@ """ -Having installed a wrong version of pyOpenSSL or netlib is unfortunately a -very common source of error. Check before every start that both versions -are somewhat okay. +Having installed a wrong version of pyOpenSSL is unfortunately a very common +source of error. Check before every start that both versions are somewhat okay. """ import sys import inspect diff --git a/netlib/http/__init__.py b/netlib/http/__init__.py deleted file mode 100644 index 315f61ac..00000000 --- a/netlib/http/__init__.py +++ /dev/null @@ -1,15 +0,0 @@ -from netlib.http.request import Request -from netlib.http.response import Response -from netlib.http.message import Message -from netlib.http.headers import Headers, parse_content_type -from netlib.http.message import decoded -from netlib.http import http1, http2, status_codes, multipart - -__all__ = [ - "Request", - "Response", - "Message", - "Headers", "parse_content_type", - "decoded", - "http1", "http2", "status_codes", "multipart", -] diff --git a/netlib/http/http2/__init__.py b/netlib/http/http2/__init__.py deleted file mode 100644 index 20cc63a0..00000000 --- a/netlib/http/http2/__init__.py +++ /dev/null @@ -1,8 +0,0 @@ -from netlib.http.http2.framereader import read_raw_frame, parse_frame -from netlib.http.http2.utils import parse_headers - -__all__ = [ - "read_raw_frame", - "parse_frame", - "parse_headers", -] 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/websockets.py b/pathod/language/websockets.py index d2291f82..a237381c 100644 --- a/pathod/language/websockets.py +++ b/pathod/language/websockets.py @@ -1,6 +1,6 @@ import random import string -import netlib.websockets +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/pathoc.py b/pathod/pathoc.py index 0978277a..066c330c 100644 --- a/pathod/pathoc.py +++ b/pathod/pathoc.py @@ -13,12 +13,12 @@ import logging from mitmproxy.test.tutils import treq from mitmproxy.utils import strutils -from netlib import tcp +from mitmproxy.net import tcp from mitmproxy import certs -from netlib import websockets -from netlib import socks +from mitmproxy.net import websockets +from mitmproxy.net import socks from mitmproxy import exceptions -from netlib.http import http1 +from mitmproxy.net.http import http1 from mitmproxy.types import basethread from pathod import log diff --git a/pathod/pathoc_cmdline.py b/pathod/pathoc_cmdline.py index 2b4b9f9c..3b738d47 100644 --- a/pathod/pathoc_cmdline.py +++ b/pathod/pathoc_cmdline.py @@ -3,9 +3,9 @@ import argparse import os import os.path -from netlib import tcp +from mitmproxy.net import tcp from mitmproxy import version -from netlib.http import user_agents +from mitmproxy.net.http import user_agents from . import pathoc, language diff --git a/pathod/pathod.py b/pathod/pathod.py index 746998c5..a8658361 100644 --- a/pathod/pathod.py +++ b/pathod/pathod.py @@ -4,9 +4,9 @@ import os import sys import threading -from netlib import tcp +from mitmproxy.net import tcp from mitmproxy import certs as mcerts -from netlib import websockets +from mitmproxy.net import websockets from mitmproxy import version import urllib diff --git a/pathod/pathod_cmdline.py b/pathod/pathod_cmdline.py index 8d6ee2b6..ef1e983f 100644 --- a/pathod/pathod_cmdline.py +++ b/pathod/pathod_cmdline.py @@ -4,7 +4,7 @@ import os import os.path import re -from netlib import tcp +from mitmproxy.net import tcp from mitmproxy.utils import human from mitmproxy import version from . import pathod diff --git a/pathod/protocols/http.py b/pathod/protocols/http.py index a20a58a1..4387b4fb 100644 --- a/pathod/protocols/http.py +++ b/pathod/protocols/http.py @@ -1,6 +1,6 @@ from mitmproxy import version from mitmproxy import exceptions -from netlib.http import http1 +from mitmproxy.net.http import http1 from .. import language diff --git a/pathod/protocols/http2.py b/pathod/protocols/http2.py index 838469d6..118163d2 100644 --- a/pathod/protocols/http2.py +++ b/pathod/protocols/http2.py @@ -4,10 +4,10 @@ import time import hyperframe.frame from hpack.hpack import Encoder, Decoder -from netlib.http import http2 -import netlib.http.headers -import netlib.http.response -import netlib.http.request +from mitmproxy.net.http import http2 +import mitmproxy.net.http.headers +import mitmproxy.net.http.response +import mitmproxy.net.http.request from mitmproxy.types import bidi from .. import language @@ -100,7 +100,7 @@ class HTTP2StateProtocol: first_line_format, method, scheme, host, port, path = http2.parse_headers(headers) - request = netlib.http.request.Request( + request = mitmproxy.net.http.request.Request( first_line_format, method, scheme, @@ -148,7 +148,7 @@ class HTTP2StateProtocol: else: timestamp_end = None - response = netlib.http.response.Response( + response = mitmproxy.net.http.response.Response( b"HTTP/2.0", int(headers.get(':status', 502)), b'', @@ -162,15 +162,15 @@ class HTTP2StateProtocol: return response def assemble(self, message): - if isinstance(message, netlib.http.request.Request): + if isinstance(message, mitmproxy.net.http.request.Request): return self.assemble_request(message) - elif isinstance(message, netlib.http.response.Response): + elif isinstance(message, mitmproxy.net.http.response.Response): return self.assemble_response(message) else: raise ValueError("HTTP message not supported.") def assemble_request(self, request): - assert isinstance(request, netlib.http.request.Request) + assert isinstance(request, mitmproxy.net.http.request.Request) authority = self.tcp_handler.sni if self.tcp_handler.sni else self.tcp_handler.address.host if self.tcp_handler.address.port != 443: @@ -194,7 +194,7 @@ class HTTP2StateProtocol: self._create_body(request.body, stream_id))) def assemble_response(self, response): - assert isinstance(response, netlib.http.response.Response) + assert isinstance(response, mitmproxy.net.http.response.Response) headers = response.headers.copy() @@ -394,7 +394,7 @@ class HTTP2StateProtocol: else: self._handle_unexpected_frame(frm) - headers = netlib.http.headers.Headers( + headers = mitmproxy.net.http.headers.Headers( [[k, v] for k, v in self.decoder.decode(header_blocks, raw=True)] ) diff --git a/pathod/protocols/websockets.py b/pathod/protocols/websockets.py index 585a48e3..00ae5aa8 100644 --- a/pathod/protocols/websockets.py +++ b/pathod/protocols/websockets.py @@ -1,6 +1,6 @@ import time -from netlib import websockets +from mitmproxy.net import websockets from pathod import language from mitmproxy import exceptions diff --git a/release/README.mkd b/release/README.mkd index db2ef970..c5505431 100644 --- a/release/README.mkd +++ b/release/README.mkd @@ -7,7 +7,7 @@ - Only if an emergency bugfix is needed, we push a new `0.x.y` bugfix release for a single project. This matches with what we do in `setup.py`: - "netlib>=%s, <%s" % (version.MINORVERSION, version.NEXT_MINORVERSION) + "mitmproxy>=%s, <%s" % (version.MINORVERSION, version.NEXT_MINORVERSION) # Release Checklist diff --git a/release/rtool.py b/release/rtool.py index 3ed9157e..fbca40e2 100755 --- a/release/rtool.py +++ b/release/rtool.py @@ -48,7 +48,7 @@ VENV_PIP = join(VENV_DIR, VENV_BIN, "pip") VENV_PYINSTALLER = join(VENV_DIR, VENV_BIN, "pyinstaller") # Project Configuration -VERSION_FILE = join(ROOT_DIR, "netlib", "version.py") +VERSION_FILE = join(ROOT_DIR, "mitmproxy", "version.py") PROJECT_NAME = "mitmproxy" PYTHON_VERSION = "py2.py3" BDISTS = { @@ -44,7 +44,6 @@ setup( packages=find_packages(include=[ "mitmproxy", "mitmproxy.*", "pathod", "pathod.*", - "netlib", "netlib.*" ]), include_package_data=True, entry_points={ diff --git a/test/netlib/__init__.py b/test/mitmproxy/net/__init__.py index e69de29b..e69de29b 100644 --- a/test/netlib/__init__.py +++ b/test/mitmproxy/net/__init__.py diff --git a/test/netlib/data/clientcert/.gitignore b/test/mitmproxy/net/data/clientcert/.gitignore index 07bc53d2..07bc53d2 100644 --- a/test/netlib/data/clientcert/.gitignore +++ b/test/mitmproxy/net/data/clientcert/.gitignore diff --git a/test/netlib/data/clientcert/client.cnf b/test/mitmproxy/net/data/clientcert/client.cnf index 5046a944..5046a944 100644 --- a/test/netlib/data/clientcert/client.cnf +++ b/test/mitmproxy/net/data/clientcert/client.cnf diff --git a/test/netlib/data/clientcert/client.pem b/test/mitmproxy/net/data/clientcert/client.pem index 4927bca2..4927bca2 100644 --- a/test/netlib/data/clientcert/client.pem +++ b/test/mitmproxy/net/data/clientcert/client.pem diff --git a/test/netlib/data/clientcert/make b/test/mitmproxy/net/data/clientcert/make index d1caea81..d1caea81 100644 --- a/test/netlib/data/clientcert/make +++ b/test/mitmproxy/net/data/clientcert/make diff --git a/test/netlib/data/dercert b/test/mitmproxy/net/data/dercert Binary files differindex 370252af..370252af 100644 --- a/test/netlib/data/dercert +++ b/test/mitmproxy/net/data/dercert diff --git a/test/netlib/data/dhparam.pem b/test/mitmproxy/net/data/dhparam.pem index afb41672..afb41672 100644 --- a/test/netlib/data/dhparam.pem +++ b/test/mitmproxy/net/data/dhparam.pem diff --git a/test/netlib/data/htpasswd b/test/mitmproxy/net/data/htpasswd index 54c95b8c..54c95b8c 100644 --- a/test/netlib/data/htpasswd +++ b/test/mitmproxy/net/data/htpasswd diff --git a/test/netlib/data/server.crt b/test/mitmproxy/net/data/server.crt index 68f61bac..68f61bac 100644 --- a/test/netlib/data/server.crt +++ b/test/mitmproxy/net/data/server.crt diff --git a/test/netlib/data/server.key b/test/mitmproxy/net/data/server.key index b1b658ab..b1b658ab 100644 --- a/test/netlib/data/server.key +++ b/test/mitmproxy/net/data/server.key diff --git a/test/netlib/data/text_cert b/test/mitmproxy/net/data/text_cert index 36ca33b9..36ca33b9 100644 --- a/test/netlib/data/text_cert +++ b/test/mitmproxy/net/data/text_cert diff --git a/test/netlib/data/text_cert_2 b/test/mitmproxy/net/data/text_cert_2 index ffe8faae..ffe8faae 100644 --- a/test/netlib/data/text_cert_2 +++ b/test/mitmproxy/net/data/text_cert_2 diff --git a/test/netlib/data/text_cert_weird1 b/test/mitmproxy/net/data/text_cert_weird1 index 72b09dcb..72b09dcb 100644 --- a/test/netlib/data/text_cert_weird1 +++ b/test/mitmproxy/net/data/text_cert_weird1 diff --git a/test/netlib/data/verificationcerts/9da13359.0 b/test/mitmproxy/net/data/verificationcerts/9da13359.0 index b22e4d20..b22e4d20 100644 --- a/test/netlib/data/verificationcerts/9da13359.0 +++ b/test/mitmproxy/net/data/verificationcerts/9da13359.0 diff --git a/test/netlib/data/verificationcerts/generate.py b/test/mitmproxy/net/data/verificationcerts/generate.py index 6d4d8550..6d4d8550 100644 --- a/test/netlib/data/verificationcerts/generate.py +++ b/test/mitmproxy/net/data/verificationcerts/generate.py diff --git a/test/netlib/data/verificationcerts/self-signed.crt b/test/mitmproxy/net/data/verificationcerts/self-signed.crt index dce2a7e0..dce2a7e0 100644 --- a/test/netlib/data/verificationcerts/self-signed.crt +++ b/test/mitmproxy/net/data/verificationcerts/self-signed.crt diff --git a/test/netlib/data/verificationcerts/self-signed.key b/test/mitmproxy/net/data/verificationcerts/self-signed.key index 71a6ad6a..71a6ad6a 100644 --- a/test/netlib/data/verificationcerts/self-signed.key +++ b/test/mitmproxy/net/data/verificationcerts/self-signed.key diff --git a/test/netlib/data/verificationcerts/trusted-leaf.crt b/test/mitmproxy/net/data/verificationcerts/trusted-leaf.crt index 6a92de92..6a92de92 100644 --- a/test/netlib/data/verificationcerts/trusted-leaf.crt +++ b/test/mitmproxy/net/data/verificationcerts/trusted-leaf.crt diff --git a/test/netlib/data/verificationcerts/trusted-leaf.key b/test/mitmproxy/net/data/verificationcerts/trusted-leaf.key index 783ebf1c..783ebf1c 100644 --- a/test/netlib/data/verificationcerts/trusted-leaf.key +++ b/test/mitmproxy/net/data/verificationcerts/trusted-leaf.key diff --git a/test/netlib/data/verificationcerts/trusted-root.crt b/test/mitmproxy/net/data/verificationcerts/trusted-root.crt index b22e4d20..b22e4d20 100644 --- a/test/netlib/data/verificationcerts/trusted-root.crt +++ b/test/mitmproxy/net/data/verificationcerts/trusted-root.crt diff --git a/test/netlib/data/verificationcerts/trusted-root.key b/test/mitmproxy/net/data/verificationcerts/trusted-root.key index 05483f77..05483f77 100644 --- a/test/netlib/data/verificationcerts/trusted-root.key +++ b/test/mitmproxy/net/data/verificationcerts/trusted-root.key diff --git a/test/netlib/data/verificationcerts/trusted-root.srl b/test/mitmproxy/net/data/verificationcerts/trusted-root.srl index 4ad962ba..4ad962ba 100644 --- a/test/netlib/data/verificationcerts/trusted-root.srl +++ b/test/mitmproxy/net/data/verificationcerts/trusted-root.srl diff --git a/test/netlib/http/__init__.py b/test/mitmproxy/net/http/__init__.py index e69de29b..e69de29b 100644 --- a/test/netlib/http/__init__.py +++ b/test/mitmproxy/net/http/__init__.py diff --git a/test/netlib/http/http1/__init__.py b/test/mitmproxy/net/http/http1/__init__.py index e69de29b..e69de29b 100644 --- a/test/netlib/http/http1/__init__.py +++ b/test/mitmproxy/net/http/http1/__init__.py diff --git a/test/netlib/http/http1/test_assemble.py b/test/mitmproxy/net/http/http1/test_assemble.py index dac5fdad..e80376e8 100644 --- a/test/netlib/http/http1/test_assemble.py +++ b/test/mitmproxy/net/http/http1/test_assemble.py @@ -1,6 +1,6 @@ from mitmproxy import exceptions -from netlib.http import Headers -from netlib.http.http1.assemble import ( +from mitmproxy.net.http import Headers +from mitmproxy.net.http.http1.assemble import ( assemble_request, assemble_request_head, assemble_response, assemble_response_head, _assemble_request_line, _assemble_request_headers, _assemble_response_headers, diff --git a/test/netlib/http/http1/test_read.py b/test/mitmproxy/net/http/http1/test_read.py index eb96968c..20997259 100644 --- a/test/netlib/http/http1/test_read.py +++ b/test/mitmproxy/net/http/http1/test_read.py @@ -3,8 +3,8 @@ from mock import Mock import pytest from mitmproxy import exceptions -from netlib.http import Headers -from netlib.http.http1.read import ( +from mitmproxy.net.http import Headers +from mitmproxy.net.http.http1.read import ( read_request, read_response, read_request_head, read_response_head, read_body, connection_close, expected_http_body_size, _get_first_line, _read_request_line, _parse_authority_form, _read_response_line, _check_http_version, diff --git a/test/netlib/http/http2/__init__.py b/test/mitmproxy/net/http/http2/__init__.py index e69de29b..e69de29b 100644 --- a/test/netlib/http/http2/__init__.py +++ b/test/mitmproxy/net/http/http2/__init__.py diff --git a/test/netlib/http/http2/test_framereader.py b/test/mitmproxy/net/http/http2/test_framereader.py index 41b73189..41b73189 100644 --- a/test/netlib/http/http2/test_framereader.py +++ b/test/mitmproxy/net/http/http2/test_framereader.py diff --git a/test/netlib/http/test_authentication.py b/test/mitmproxy/net/http/test_authentication.py index 5e04bbc5..11b6e2e0 100644 --- a/test/netlib/http/test_authentication.py +++ b/test/mitmproxy/net/http/test_authentication.py @@ -1,7 +1,7 @@ import binascii from mitmproxy.test import tutils -from netlib.http import authentication, Headers +from mitmproxy.net.http import authentication, Headers def test_parse_http_basic_auth(): diff --git a/test/netlib/http/test_cookies.py b/test/mitmproxy/net/http/test_cookies.py index ca10a69c..8c9c0c32 100644 --- a/test/netlib/http/test_cookies.py +++ b/test/mitmproxy/net/http/test_cookies.py @@ -1,6 +1,6 @@ import time -from netlib.http import cookies +from mitmproxy.net.http import cookies from mitmproxy.test.tutils import raises import mock diff --git a/test/netlib/http/test_encoding.py b/test/mitmproxy/net/http/test_encoding.py index 89600709..d8fa5e76 100644 --- a/test/netlib/http/test_encoding.py +++ b/test/mitmproxy/net/http/test_encoding.py @@ -1,7 +1,7 @@ import mock import pytest -from netlib.http import encoding +from mitmproxy.net.http import encoding from mitmproxy.test import tutils diff --git a/test/netlib/http/test_headers.py b/test/mitmproxy/net/http/test_headers.py index cac77d57..8e0f770d 100644 --- a/test/netlib/http/test_headers.py +++ b/test/mitmproxy/net/http/test_headers.py @@ -1,6 +1,6 @@ import collections -from netlib.http.headers import Headers, parse_content_type, assemble_content_type +from mitmproxy.net.http.headers import Headers, parse_content_type, assemble_content_type from mitmproxy.test.tutils import raises diff --git a/test/netlib/http/test_message.py b/test/mitmproxy/net/http/test_message.py index 2bc8824f..69d029d9 100644 --- a/test/netlib/http/test_message.py +++ b/test/mitmproxy/net/http/test_message.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- from mitmproxy.test import tutils -from netlib import http +from mitmproxy.net import http def _test_passthrough_attr(message, attr): diff --git a/test/netlib/http/test_multipart.py b/test/mitmproxy/net/http/test_multipart.py index 1d7e0062..68ae6bbd 100644 --- a/test/netlib/http/test_multipart.py +++ b/test/mitmproxy/net/http/test_multipart.py @@ -1,5 +1,5 @@ -from netlib.http import Headers -from netlib.http import multipart +from mitmproxy.net.http import Headers +from mitmproxy.net.http import multipart def test_decode(): diff --git a/test/netlib/http/test_request.py b/test/mitmproxy/net/http/test_request.py index ecfc1ba6..9c0ec333 100644 --- a/test/netlib/http/test_request.py +++ b/test/mitmproxy/net/http/test_request.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -from netlib.http import Headers +from mitmproxy.net.http import Headers from mitmproxy.test.tutils import treq, raises from .test_message import _test_decoded_attr, _test_passthrough_attr diff --git a/test/netlib/http/test_response.py b/test/mitmproxy/net/http/test_response.py index 4a6fac62..239fb6ef 100644 --- a/test/netlib/http/test_response.py +++ b/test/mitmproxy/net/http/test_response.py @@ -2,9 +2,9 @@ import email import time -from netlib.http import Headers -from netlib.http import Response -from netlib.http.cookies import CookieAttrs +from mitmproxy.net.http import Headers +from mitmproxy.net.http import Response +from mitmproxy.net.http.cookies import CookieAttrs from mitmproxy.test.tutils import raises, tresp from .test_message import _test_passthrough_attr, _test_decoded_attr diff --git a/test/netlib/http/test_status_codes.py b/test/mitmproxy/net/http/test_status_codes.py index 9fea6b70..098f8eef 100644 --- a/test/netlib/http/test_status_codes.py +++ b/test/mitmproxy/net/http/test_status_codes.py @@ -1,4 +1,4 @@ -from netlib.http import status_codes +from mitmproxy.net.http import status_codes def test_simple(): diff --git a/test/netlib/http/test_url.py b/test/mitmproxy/net/http/test_url.py index 7cea6c58..94b2eacc 100644 --- a/test/netlib/http/test_url.py +++ b/test/mitmproxy/net/http/test_url.py @@ -1,5 +1,5 @@ from mitmproxy.test import tutils -from netlib.http import url +from mitmproxy.net.http import url def test_parse(): diff --git a/test/netlib/http/test_user_agents.py b/test/mitmproxy/net/http/test_user_agents.py index 0bf1bba7..9e391447 100644 --- a/test/netlib/http/test_user_agents.py +++ b/test/mitmproxy/net/http/test_user_agents.py @@ -1,4 +1,4 @@ -from netlib.http import user_agents +from mitmproxy.net.http import user_agents def test_get_shortcut(): diff --git a/test/netlib/test_check.py b/test/mitmproxy/net/test_check.py index 6a1388f4..18a50157 100644 --- a/test/netlib/test_check.py +++ b/test/mitmproxy/net/test_check.py @@ -1,6 +1,6 @@ # coding=utf-8 -from netlib import check +from mitmproxy.net import check def test_is_valid_host(): diff --git a/test/netlib/test_imports.py b/test/mitmproxy/net/test_imports.py index b88ef26d..b88ef26d 100644 --- a/test/netlib/test_imports.py +++ b/test/mitmproxy/net/test_imports.py diff --git a/test/netlib/test_socks.py b/test/mitmproxy/net/test_socks.py index 0603f34b..b6551faa 100644 --- a/test/netlib/test_socks.py +++ b/test/mitmproxy/net/test_socks.py @@ -1,7 +1,7 @@ import ipaddress from io import BytesIO -from netlib import socks -from netlib import tcp +from mitmproxy.net import socks +from mitmproxy.net import tcp from mitmproxy.test import tutils diff --git a/test/netlib/test_tcp.py b/test/mitmproxy/net/test_tcp.py index 594ee21c..8a7c692a 100644 --- a/test/netlib/test_tcp.py +++ b/test/mitmproxy/net/test_tcp.py @@ -10,7 +10,7 @@ import mock from OpenSSL import SSL from mitmproxy import certs -from netlib import tcp +from mitmproxy.net import tcp from mitmproxy.test import tutils from mitmproxy import exceptions diff --git a/test/netlib/test_wsgi.py b/test/mitmproxy/net/test_wsgi.py index 5c61f81c..b4d6b53f 100644 --- a/test/netlib/test_wsgi.py +++ b/test/mitmproxy/net/test_wsgi.py @@ -1,7 +1,7 @@ from io import BytesIO import sys -from netlib import wsgi -from netlib.http import Headers +from mitmproxy.net import wsgi +from mitmproxy.net.http import Headers def tflow(): diff --git a/test/netlib/tools/getcertnames b/test/mitmproxy/net/tools/getcertnames index 0882fccd..d64e5ff5 100644 --- a/test/netlib/tools/getcertnames +++ b/test/mitmproxy/net/tools/getcertnames @@ -1,7 +1,7 @@ #!/usr/bin/env python import sys sys.path.insert(0, "../../") -from netlib import tcp +from mitmproxy.net import tcp def get_remote_cert(host, port, sni): diff --git a/test/netlib/tservers.py b/test/mitmproxy/net/tservers.py index 2fae8ba6..ba10ef5e 100644 --- a/test/netlib/tservers.py +++ b/test/mitmproxy/net/tservers.py @@ -3,7 +3,7 @@ import queue import io import OpenSSL -from netlib import tcp +from mitmproxy.net import tcp from mitmproxy.test import tutils diff --git a/test/netlib/websockets/__init__.py b/test/mitmproxy/net/websockets/__init__.py index e69de29b..e69de29b 100644 --- a/test/netlib/websockets/__init__.py +++ b/test/mitmproxy/net/websockets/__init__.py diff --git a/test/netlib/websockets/test_frame.py b/test/mitmproxy/net/websockets/test_frame.py index 3b7c9ed4..198be3d5 100644 --- a/test/netlib/websockets/test_frame.py +++ b/test/mitmproxy/net/websockets/test_frame.py @@ -2,7 +2,7 @@ import os import codecs import pytest -from netlib import websockets +from mitmproxy.net import websockets from mitmproxy.test import tutils diff --git a/test/netlib/websockets/test_masker.py b/test/mitmproxy/net/websockets/test_masker.py index 23a9b876..88360c3b 100644 --- a/test/netlib/websockets/test_masker.py +++ b/test/mitmproxy/net/websockets/test_masker.py @@ -1,7 +1,7 @@ import codecs import pytest -from netlib import websockets +from mitmproxy.net import websockets class TestMasker: diff --git a/test/netlib/websockets/test_utils.py b/test/mitmproxy/net/websockets/test_utils.py index f6f1e40a..6704d39d 100644 --- a/test/netlib/websockets/test_utils.py +++ b/test/mitmproxy/net/websockets/test_utils.py @@ -1,7 +1,7 @@ import pytest -from netlib import http -from netlib import websockets +from mitmproxy.net import http +from mitmproxy.net import websockets class TestUtils: diff --git a/test/mitmproxy/protocol/test_http1.py b/test/mitmproxy/protocol/test_http1.py index d18ff411..43c903f3 100644 --- a/test/mitmproxy/protocol/test_http1.py +++ b/test/mitmproxy/protocol/test_http1.py @@ -1,5 +1,5 @@ -from netlib.http import http1 -from netlib.tcp import TCPClient +from mitmproxy.net.http import http1 +from mitmproxy.net.tcp import TCPClient from mitmproxy.test.tutils import treq from .. import tutils, tservers diff --git a/test/mitmproxy/protocol/test_http2.py b/test/mitmproxy/protocol/test_http2.py index b624489f..4629d109 100644 --- a/test/mitmproxy/protocol/test_http2.py +++ b/test/mitmproxy/protocol/test_http2.py @@ -11,10 +11,10 @@ import h2 from mitmproxy import options from mitmproxy.proxy.config import ProxyConfig -import netlib -from ...netlib import tservers as netlib_tservers +import mitmproxy.net +from ...mitmproxy.net import tservers as net_tservers from mitmproxy import exceptions -from netlib.http import http1, http2 +from mitmproxy.net.http import http1, http2 from .. import tservers @@ -28,7 +28,7 @@ logging.getLogger("PIL.PngImagePlugin").setLevel(logging.WARNING) requires_alpn = pytest.mark.skipif( - not netlib.tcp.HAS_ALPN, + not mitmproxy.net.tcp.HAS_ALPN, reason='requires OpenSSL with ALPN support') @@ -37,10 +37,10 @@ requires_alpn = pytest.mark.skipif( # print(msg) -class _Http2ServerBase(netlib_tservers.ServerTestBase): +class _Http2ServerBase(net_tservers.ServerTestBase): ssl = dict(alpn_select=b'h2') - class handler(netlib.tcp.BaseHandler): + class handler(mitmproxy.net.tcp.BaseHandler): def handle(self): h2_conn = h2.connection.H2Connection(client_side=False, header_encoding=False) @@ -122,11 +122,11 @@ class _Http2TestBase: self.server.server.handle_server_event = self.handle_server_event def _setup_connection(self): - client = netlib.tcp.TCPClient(("127.0.0.1", self.proxy.port)) + client = mitmproxy.net.tcp.TCPClient(("127.0.0.1", self.proxy.port)) client.connect() # send CONNECT request - client.wfile.write(http1.assemble_request(netlib.http.Request( + client.wfile.write(http1.assemble_request(mitmproxy.net.http.Request( 'authority', b'CONNECT', b'', diff --git a/test/mitmproxy/protocol/test_websockets.py b/test/mitmproxy/protocol/test_websockets.py index f22e95d5..71cbb5f4 100644 --- a/test/mitmproxy/protocol/test_websockets.py +++ b/test/mitmproxy/protocol/test_websockets.py @@ -7,17 +7,17 @@ from mitmproxy import options from mitmproxy import exceptions from mitmproxy.proxy.config import ProxyConfig -import netlib -from netlib import http -from ...netlib import tservers as netlib_tservers +import mitmproxy.net +from mitmproxy.net import http +from ...mitmproxy.net import tservers as net_tservers from .. import tservers -from netlib import websockets +from mitmproxy.net import websockets -class _WebSocketsServerBase(netlib_tservers.ServerTestBase): +class _WebSocketsServerBase(net_tservers.ServerTestBase): - class handler(netlib.tcp.BaseHandler): + class handler(mitmproxy.net.tcp.BaseHandler): def handle(self): try: @@ -78,7 +78,7 @@ class _WebSocketsTestBase: self.server.server.handle_websockets = self.handle_websockets def _setup_connection(self): - client = netlib.tcp.TCPClient(("127.0.0.1", self.proxy.port)) + client = mitmproxy.net.tcp.TCPClient(("127.0.0.1", self.proxy.port)) client.connect() request = http.Request( diff --git a/test/mitmproxy/test_contentview.py b/test/mitmproxy/test_contentview.py index 2c5e1c85..b0e77ce1 100644 --- a/test/mitmproxy/test_contentview.py +++ b/test/mitmproxy/test_contentview.py @@ -1,7 +1,7 @@ import mock from mitmproxy.exceptions import ContentViewException -from netlib.http import Headers -from netlib.http import url +from mitmproxy.net.http import Headers +from mitmproxy.net.http import url from mitmproxy.types import multidict import mitmproxy.contentviews as cv diff --git a/test/mitmproxy/test_custom_contentview.py b/test/mitmproxy/test_custom_contentview.py index 889fb8b3..28f7fb33 100644 --- a/test/mitmproxy/test_custom_contentview.py +++ b/test/mitmproxy/test_custom_contentview.py @@ -1,5 +1,5 @@ import mitmproxy.contentviews as cv -from netlib.http import Headers +from mitmproxy.net.http import Headers def test_custom_views(): diff --git a/test/mitmproxy/test_examples.py b/test/mitmproxy/test_examples.py index 48193fe7..6972da0c 100644 --- a/test/mitmproxy/test_examples.py +++ b/test/mitmproxy/test_examples.py @@ -10,8 +10,8 @@ from mitmproxy.utils import data from mitmproxy import master from mitmproxy.test import tutils as netutils -from netlib.http import Headers -from netlib.http import cookies +from mitmproxy.net.http import Headers +from mitmproxy.net.http import cookies from . import tutils, mastertest diff --git a/test/mitmproxy/test_flow.py b/test/mitmproxy/test_flow.py index 14899be1..5b9f3835 100644 --- a/test/mitmproxy/test_flow.py +++ b/test/mitmproxy/test_flow.py @@ -2,7 +2,7 @@ import mock import io import mitmproxy.test.tutils -from netlib.http import Headers +from mitmproxy.net.http import Headers import mitmproxy.io from mitmproxy import flowfilter, options from mitmproxy.addons import state diff --git a/test/mitmproxy/test_flow_export.py b/test/mitmproxy/test_flow_export.py index 8ef2b7ee..df0ccb77 100644 --- a/test/mitmproxy/test_flow_export.py +++ b/test/mitmproxy/test_flow_export.py @@ -1,7 +1,7 @@ import re import mitmproxy.test.tutils -from netlib.http import Headers +from mitmproxy.net.http import Headers from mitmproxy import export # heh from . import tutils diff --git a/test/mitmproxy/test_proxy.py b/test/mitmproxy/test_proxy.py index c0d978d2..a9d9bb87 100644 --- a/test/mitmproxy/test_proxy.py +++ b/test/mitmproxy/test_proxy.py @@ -10,7 +10,7 @@ from mitmproxy.proxy.server import DummyServer, ProxyServer, ConnectionHandler from mitmproxy.proxy import config from mitmproxy import exceptions from pathod import test -from netlib.http import http1 +from mitmproxy.net.http import http1 from . import tutils diff --git a/test/mitmproxy/test_server.py b/test/mitmproxy/test_server.py index f7f13443..7dd738f4 100644 --- a/test/mitmproxy/test_server.py +++ b/test/mitmproxy/test_server.py @@ -8,14 +8,14 @@ from mitmproxy import options from mitmproxy.addons import script from mitmproxy import http from mitmproxy.proxy.config import HostMatcher, parse_server_spec -import netlib.http -from netlib import tcp -from netlib import socks +import mitmproxy.net.http +from mitmproxy.net import tcp +from mitmproxy.net import socks from mitmproxy import certs from mitmproxy import exceptions -from netlib.http import authentication -from netlib.http import http1 -from netlib.tcp import Address +from mitmproxy.net.http import authentication +from mitmproxy.net.http import http1 +from mitmproxy.net.tcp import Address from mitmproxy.test.tutils import raises from pathod import pathoc from pathod import pathod @@ -297,7 +297,7 @@ class TestHTTPAuth(tservers.HTTPProxyTest): h'%s'='%s' """ % ( self.server.port, - netlib.http.authentication.BasicProxyAuth.AUTH_HEADER, + mitmproxy.net.http.authentication.BasicProxyAuth.AUTH_HEADER, authentication.assemble_http_basic_auth("basic", "test", "test") )) assert ret.status_code == 202 @@ -314,7 +314,7 @@ class TestHTTPReverseAuth(tservers.ReverseProxyTest): '/p/202' h'%s'='%s' """ % ( - netlib.http.authentication.BasicWebsiteAuth.AUTH_HEADER, + mitmproxy.net.http.authentication.BasicWebsiteAuth.AUTH_HEADER, authentication.assemble_http_basic_auth("basic", "test", "test") )) assert ret.status_code == 202 @@ -438,7 +438,7 @@ class TestHTTPSUpstreamServerVerificationWBadCert(tservers.HTTPProxyTest): def test_verification_w_bad_cert(self): # We only test for a single invalid cert here. # Actual testing of different root-causes (invalid hostname, expired, ...) - # is done in netlib. + # is done in mitmproxy.net. self.config.options.ssl_insecure = False r = self._request() assert r.status_code == 502 diff --git a/test/pathod/test_language_http2.py b/test/pathod/test_language_http2.py index 11e100ac..7d3a8e60 100644 --- a/test/pathod/test_language_http2.py +++ b/test/pathod/test_language_http2.py @@ -1,7 +1,7 @@ import io -from netlib import tcp -from netlib.http import user_agents +from mitmproxy.net import tcp +from mitmproxy.net.http import user_agents from pathod import language from pathod.language import http2 diff --git a/test/pathod/test_language_websocket.py b/test/pathod/test_language_websocket.py index 9d533d98..49fbd4e6 100644 --- a/test/pathod/test_language_websocket.py +++ b/test/pathod/test_language_websocket.py @@ -1,6 +1,6 @@ from pathod import language from pathod.language import websockets -import netlib.websockets +import mitmproxy.net.websockets from . import tutils @@ -62,7 +62,7 @@ class TestWebsocketFrame: def test_flags(self): wf = parse_request("wf:fin:mask:rsv1:rsv2:rsv3") - frm = netlib.websockets.Frame.from_bytes(tutils.render(wf)) + frm = mitmproxy.net.websockets.Frame.from_bytes(tutils.render(wf)) assert frm.header.fin assert frm.header.mask assert frm.header.rsv1 @@ -70,7 +70,7 @@ class TestWebsocketFrame: assert frm.header.rsv3 wf = parse_request("wf:-fin:-mask:-rsv1:-rsv2:-rsv3") - frm = netlib.websockets.Frame.from_bytes(tutils.render(wf)) + frm = mitmproxy.net.websockets.Frame.from_bytes(tutils.render(wf)) assert not frm.header.fin assert not frm.header.mask assert not frm.header.rsv1 @@ -80,15 +80,15 @@ class TestWebsocketFrame: def fr(self, spec, **kwargs): settings = language.base.Settings(**kwargs) wf = parse_request(spec) - return netlib.websockets.Frame.from_bytes(tutils.render(wf, settings)) + return mitmproxy.net.websockets.Frame.from_bytes(tutils.render(wf, settings)) def test_construction(self): assert self.fr("wf:c1").header.opcode == 1 assert self.fr("wf:c0").header.opcode == 0 assert self.fr("wf:cbinary").header.opcode ==\ - netlib.websockets.OPCODE.BINARY + mitmproxy.net.websockets.OPCODE.BINARY assert self.fr("wf:ctext").header.opcode ==\ - netlib.websockets.OPCODE.TEXT + mitmproxy.net.websockets.OPCODE.TEXT def test_rawbody(self): frm = self.fr("wf:mask:r'foo'") diff --git a/test/pathod/test_pathoc.py b/test/pathod/test_pathoc.py index 98dc9825..90177ff6 100644 --- a/test/pathod/test_pathoc.py +++ b/test/pathod/test_pathoc.py @@ -1,9 +1,9 @@ import io from mock import Mock -from netlib import http -from netlib import tcp -from netlib.http import http1 +from mitmproxy.net import http +from mitmproxy.net import tcp +from mitmproxy.net.http import http1 from mitmproxy.test.tutils import raises from mitmproxy import exceptions diff --git a/test/pathod/test_pathod.py b/test/pathod/test_pathod.py index 402cd638..8ee7a2fd 100644 --- a/test/pathod/test_pathod.py +++ b/test/pathod/test_pathod.py @@ -1,7 +1,7 @@ import io from pathod import pathod -from netlib import tcp +from mitmproxy.net import tcp from mitmproxy import exceptions from . import tutils diff --git a/test/pathod/test_protocols_http2.py b/test/pathod/test_protocols_http2.py index a7303115..d77702a3 100644 --- a/test/pathod/test_protocols_http2.py +++ b/test/pathod/test_protocols_http2.py @@ -2,12 +2,12 @@ import mock import codecs import hyperframe -from netlib import tcp, http +from mitmproxy.net import tcp, http from mitmproxy.test.tutils import raises -from netlib.http import http2 +from mitmproxy.net.http import http2 from mitmproxy import exceptions -from ..netlib import tservers as netlib_tservers +from ..mitmproxy.net import tservers as net_tservers from pathod.protocols.http2 import HTTP2StateProtocol, TCPHandler @@ -66,7 +66,7 @@ class TestProtocol: assert mock_server_method.called -class TestCheckALPNMatch(netlib_tservers.ServerTestBase): +class TestCheckALPNMatch(net_tservers.ServerTestBase): handler = EchoHandler ssl = dict( alpn_select=b'h2', @@ -82,7 +82,7 @@ class TestCheckALPNMatch(netlib_tservers.ServerTestBase): assert protocol.check_alpn() -class TestCheckALPNMismatch(netlib_tservers.ServerTestBase): +class TestCheckALPNMismatch(net_tservers.ServerTestBase): handler = EchoHandler ssl = dict( alpn_select=None, @@ -99,7 +99,7 @@ class TestCheckALPNMismatch(netlib_tservers.ServerTestBase): protocol.check_alpn() -class TestPerformServerConnectionPreface(netlib_tservers.ServerTestBase): +class TestPerformServerConnectionPreface(net_tservers.ServerTestBase): class handler(tcp.BaseHandler): def handle(self): @@ -136,7 +136,7 @@ class TestPerformServerConnectionPreface(netlib_tservers.ServerTestBase): protocol.perform_server_connection_preface(force=True) -class TestPerformClientConnectionPreface(netlib_tservers.ServerTestBase): +class TestPerformClientConnectionPreface(net_tservers.ServerTestBase): class handler(tcp.BaseHandler): def handle(self): @@ -197,7 +197,7 @@ class TestserverstreamIds: assert self.protocol.current_stream_id == 6 -class TestApplySettings(netlib_tservers.ServerTestBase): +class TestApplySettings(net_tservers.ServerTestBase): class handler(tcp.BaseHandler): def handle(self): # check settings acknowledgement @@ -290,7 +290,7 @@ class TestCreateBody: assert bytes[2] == codecs.decode('0000020001000000013432', 'hex_codec') -class TestReadRequest(netlib_tservers.ServerTestBase): +class TestReadRequest(net_tservers.ServerTestBase): class handler(tcp.BaseHandler): def handle(self): @@ -320,7 +320,7 @@ class TestReadRequest(netlib_tservers.ServerTestBase): assert req.content == b'foobar' -class TestReadRequestRelative(netlib_tservers.ServerTestBase): +class TestReadRequestRelative(net_tservers.ServerTestBase): class handler(tcp.BaseHandler): def handle(self): self.wfile.write( @@ -343,7 +343,7 @@ class TestReadRequestRelative(netlib_tservers.ServerTestBase): assert req.path == "*" -class TestReadRequestAbsolute(netlib_tservers.ServerTestBase): +class TestReadRequestAbsolute(net_tservers.ServerTestBase): class handler(tcp.BaseHandler): def handle(self): self.wfile.write( @@ -367,7 +367,7 @@ class TestReadRequestAbsolute(netlib_tservers.ServerTestBase): assert req.port == 22 -class TestReadResponse(netlib_tservers.ServerTestBase): +class TestReadResponse(net_tservers.ServerTestBase): class handler(tcp.BaseHandler): def handle(self): self.wfile.write( @@ -396,7 +396,7 @@ class TestReadResponse(netlib_tservers.ServerTestBase): assert resp.timestamp_end -class TestReadEmptyResponse(netlib_tservers.ServerTestBase): +class TestReadEmptyResponse(net_tservers.ServerTestBase): class handler(tcp.BaseHandler): def handle(self): self.wfile.write( diff --git a/test/pathod/tutils.py b/test/pathod/tutils.py index 16dec187..ccc3df43 100644 --- a/test/pathod/tutils.py +++ b/test/pathod/tutils.py @@ -7,7 +7,7 @@ import urllib from mitmproxy.utils import data -from netlib import tcp +from mitmproxy.net import tcp from mitmproxy.test import tutils from pathod import language @@ -19,4 +19,4 @@ commands = sphinx-build -W -b html -d {envtmpdir}/doctrees . {envtmpdir}/html [testenv:lint] deps = flake8>=2.6.2, <3.1 -commands = flake8 --jobs 8 --count mitmproxy netlib pathod examples test +commands = flake8 --jobs 8 --count mitmproxy pathod examples test |