Permalink
Browse files

The final piece: netlib -> mitproxy.net

  • Loading branch information...
1 parent 853e03a commit 8430f857b504a3e7406dc36e54dc32783569d0dd @cortesi committed Oct 19, 2016
Showing with 275 additions and 282 deletions.
  1. +1 −1 .appveyor.yml
  2. +1 −1 .travis.yml
  3. +1 −2 MANIFEST.in
  4. +3 −4 README.rst
  5. +1 −4 docs/conf.py
  6. +1 −1 docs/dev/testing.rst
  7. +1 −1 docs/modd.conf
  8. +1 −1 examples/har_dump.py
  9. +1 −1 mitmproxy/addons/stickycookie.py
  10. +1 −1 mitmproxy/addons/streambodies.py
  11. +1 −1 mitmproxy/addons/wsgiapp.py
  12. +1 −1 mitmproxy/certs.py
  13. +1 −1 mitmproxy/connections.py
  14. +2 −2 mitmproxy/contentviews.py
  15. +1 −1 mitmproxy/exceptions.py
  16. +3 −3 mitmproxy/export.py
  17. +6 −6 mitmproxy/http.py
  18. +2 −2 mitmproxy/master.py
  19. 0 {test/netlib/websockets → mitmproxy/net}/__init__.py
  20. 0 {netlib → mitmproxy/net}/check.py
  21. +15 −0 mitmproxy/net/http/__init__.py
  22. 0 {netlib → mitmproxy/net}/http/authentication.py
  23. 0 {netlib → mitmproxy/net}/http/cookies.py
  24. 0 {netlib → mitmproxy/net}/http/encoding.py
  25. 0 {netlib → mitmproxy/net}/http/headers.py
  26. 0 {netlib → mitmproxy/net}/http/http1/__init__.py
  27. +4 −4 {netlib → mitmproxy/net}/http/http1/assemble.py
  28. +5 −5 {netlib → mitmproxy/net}/http/http1/read.py
  29. +8 −0 mitmproxy/net/http/http2/__init__.py
  30. 0 {netlib → mitmproxy/net}/http/http2/framereader.py
  31. +1 −1 {netlib → mitmproxy/net}/http/http2/utils.py
  32. +3 −3 {netlib → mitmproxy/net}/http/message.py
  33. +1 −1 {netlib → mitmproxy/net}/http/multipart.py
  34. +18 −18 {netlib → mitmproxy/net}/http/request.py
  35. +5 −5 {netlib → mitmproxy/net}/http/response.py
  36. 0 {netlib → mitmproxy/net}/http/status_codes.py
  37. +1 −1 {netlib → mitmproxy/net}/http/url.py
  38. 0 {netlib → mitmproxy/net}/http/user_agents.py
  39. +2 −2 {netlib → mitmproxy/net}/socks.py
  40. 0 {netlib → mitmproxy/net}/tcp.py
  41. 0 {netlib → mitmproxy/net}/websockets/__init__.py
  42. +1 −1 {netlib → mitmproxy/net}/websockets/frame.py
  43. 0 {netlib → mitmproxy/net}/websockets/masker.py
  44. +1 −1 {netlib → mitmproxy/net}/websockets/utils.py
  45. +2 −2 {netlib → mitmproxy/net}/wsgi.py
  46. +3 −3 mitmproxy/proxy/config.py
  47. +1 −1 mitmproxy/proxy/modes/socks_proxy.py
  48. +5 −5 mitmproxy/proxy/protocol/http.py
  49. +1 −1 mitmproxy/proxy/protocol/http1.py
  50. +6 −6 mitmproxy/proxy/protocol/http2.py
  51. +1 −1 mitmproxy/proxy/protocol/http_replay.py
  52. +2 −2 mitmproxy/proxy/protocol/rawtcp.py
  53. +1 −1 mitmproxy/proxy/protocol/tls.py
  54. +2 −2 mitmproxy/proxy/protocol/websockets.py
  55. +2 −2 mitmproxy/proxy/server.py
  56. +5 −5 mitmproxy/test/tutils.py
  57. +1 −1 mitmproxy/tools/cmdline.py
  58. +3 −3 mitmproxy/tools/console/common.py
  59. +2 −2 mitmproxy/tools/console/flowlist.py
  60. +2 −2 mitmproxy/tools/console/flowview.py
  61. +1 −1 mitmproxy/tools/console/grideditor/col_subgrid.py
  62. +1 −1 mitmproxy/tools/console/grideditor/editors.py
  63. +1 −1 mitmproxy/tools/console/master.py
  64. +2 −2 mitmproxy/tools/console/statusbar.py
  65. +1 −1 mitmproxy/tools/dump.py
  66. +1 −1 mitmproxy/tools/web/master.py
  67. +1 −1 mitmproxy/utils/debug.py
  68. +2 −3 mitmproxy/utils/version_check.py
  69. +0 −15 netlib/http/__init__.py
  70. +0 −8 netlib/http/http2/__init__.py
  71. +6 −6 pathod/language/http.py
  72. +2 −2 pathod/language/http2.py
  73. +9 −9 pathod/language/websockets.py
  74. +4 −4 pathod/pathoc.py
  75. +2 −2 pathod/pathoc_cmdline.py
  76. +2 −2 pathod/pathod.py
  77. +1 −1 pathod/pathod_cmdline.py
  78. +1 −1 pathod/protocols/http.py
  79. +11 −11 pathod/protocols/http2.py
  80. +1 −1 pathod/protocols/websockets.py
  81. +1 −1 release/README.mkd
  82. +1 −1 release/rtool.py
  83. +0 −1 setup.py
  84. 0 test/{netlib/http/http2 → mitmproxy/net}/__init__.py
  85. 0 test/{netlib → mitmproxy/net}/data/clientcert/.gitignore
  86. 0 test/{netlib → mitmproxy/net}/data/clientcert/client.cnf
  87. 0 test/{netlib → mitmproxy/net}/data/clientcert/client.pem
  88. 0 test/{netlib → mitmproxy/net}/data/clientcert/make
  89. BIN test/{netlib → mitmproxy/net}/data/dercert
  90. 0 test/{netlib → mitmproxy/net}/data/dhparam.pem
  91. 0 test/{netlib → mitmproxy/net}/data/htpasswd
  92. 0 test/{netlib → mitmproxy/net}/data/server.crt
  93. 0 test/{netlib → mitmproxy/net}/data/server.key
  94. 0 test/{netlib → mitmproxy/net}/data/text_cert
  95. 0 test/{netlib → mitmproxy/net}/data/text_cert_2
  96. 0 test/{netlib → mitmproxy/net}/data/text_cert_weird1
  97. 0 test/{netlib → mitmproxy/net}/data/verificationcerts/9da13359.0
  98. 0 test/{netlib → mitmproxy/net}/data/verificationcerts/generate.py
  99. 0 test/{netlib → mitmproxy/net}/data/verificationcerts/self-signed.crt
  100. 0 test/{netlib → mitmproxy/net}/data/verificationcerts/self-signed.key
  101. 0 test/{netlib → mitmproxy/net}/data/verificationcerts/trusted-leaf.crt
  102. 0 test/{netlib → mitmproxy/net}/data/verificationcerts/trusted-leaf.key
  103. 0 test/{netlib → mitmproxy/net}/data/verificationcerts/trusted-root.crt
  104. 0 test/{netlib → mitmproxy/net}/data/verificationcerts/trusted-root.key
  105. 0 test/{netlib → mitmproxy/net}/data/verificationcerts/trusted-root.srl
  106. 0 test/{netlib/http/http1 → mitmproxy/net/http}/__init__.py
  107. 0 test/{netlib/http → mitmproxy/net/http/http1}/__init__.py
  108. +2 −2 test/{netlib → mitmproxy/net}/http/http1/test_assemble.py
  109. +2 −2 test/{netlib → mitmproxy/net}/http/http1/test_read.py
  110. 0 test/{netlib → mitmproxy/net/http/http2}/__init__.py
  111. 0 test/{netlib → mitmproxy/net}/http/http2/test_framereader.py
  112. +1 −1 test/{netlib → mitmproxy/net}/http/test_authentication.py
  113. +1 −1 test/{netlib → mitmproxy/net}/http/test_cookies.py
  114. +1 −1 test/{netlib → mitmproxy/net}/http/test_encoding.py
  115. +1 −1 test/{netlib → mitmproxy/net}/http/test_headers.py
  116. +1 −1 test/{netlib → mitmproxy/net}/http/test_message.py
  117. +2 −2 test/{netlib → mitmproxy/net}/http/test_multipart.py
  118. +1 −1 test/{netlib → mitmproxy/net}/http/test_request.py
  119. +3 −3 test/{netlib → mitmproxy/net}/http/test_response.py
  120. +1 −1 test/{netlib → mitmproxy/net}/http/test_status_codes.py
  121. +1 −1 test/{netlib → mitmproxy/net}/http/test_url.py
  122. +1 −1 test/{netlib → mitmproxy/net}/http/test_user_agents.py
  123. +1 −1 test/{netlib → mitmproxy/net}/test_check.py
  124. 0 test/{netlib → mitmproxy/net}/test_imports.py
  125. +2 −2 test/{netlib → mitmproxy/net}/test_socks.py
  126. +1 −1 test/{netlib → mitmproxy/net}/test_tcp.py
  127. +2 −2 test/{netlib → mitmproxy/net}/test_wsgi.py
  128. +1 −1 test/{netlib → mitmproxy/net}/tools/getcertnames
  129. +1 −1 test/{netlib → mitmproxy/net}/tservers.py
  130. 0 {netlib → test/mitmproxy/net/websockets}/__init__.py
  131. +1 −1 test/{netlib → mitmproxy/net}/websockets/test_frame.py
  132. +1 −1 test/{netlib → mitmproxy/net}/websockets/test_masker.py
  133. +2 −2 test/{netlib → mitmproxy/net}/websockets/test_utils.py
  134. +2 −2 test/mitmproxy/protocol/test_http1.py
  135. +8 −8 test/mitmproxy/protocol/test_http2.py
  136. +7 −7 test/mitmproxy/protocol/test_websockets.py
  137. +2 −2 test/mitmproxy/test_contentview.py
  138. +1 −1 test/mitmproxy/test_custom_contentview.py
  139. +2 −2 test/mitmproxy/test_examples.py
  140. +1 −1 test/mitmproxy/test_flow.py
  141. +1 −1 test/mitmproxy/test_flow_export.py
  142. +1 −1 test/mitmproxy/test_proxy.py
  143. +9 −9 test/mitmproxy/test_server.py
  144. +2 −2 test/pathod/test_language_http2.py
  145. +6 −6 test/pathod/test_language_websocket.py
  146. +3 −3 test/pathod/test_pathoc.py
  147. +1 −1 test/pathod/test_pathod.py
  148. +13 −13 test/pathod/test_protocols_http2.py
  149. +1 −1 test/pathod/tutils.py
  150. +1 −1 tox.ini
View
@@ -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: |
View
@@ -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:
- |
View
@@ -1,4 +1,3 @@
graft mitmproxy
graft pathod
-graft netlib
-recursive-exclude * *.pyc *.pyo *.swo *.swp *.map
+recursive-exclude * *.pyc *.pyo *.swo *.swp *.map
View
@@ -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
View
@@ -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:
@@ -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:
View
@@ -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
}
@@ -16,7 +16,7 @@
from mitmproxy import version
from mitmproxy.utils import strutils
-from netlib.http import cookies
+from mitmproxy.net.http import cookies
HAR = {}
@@ -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
@@ -1,4 +1,4 @@
-from netlib.http import http1
+from mitmproxy.net.http import http1
from mitmproxy import exceptions
from mitmproxy import ctx
@@ -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
View
@@ -193,7 +193,7 @@ def expire(self, entry):
@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:
@@ -5,7 +5,7 @@
from mitmproxy import stateobject
from mitmproxy import certs
-from netlib import tcp
+from mitmproxy.net import tcp
class ClientConnection(tcp.BaseHandler, stateobject.StateObject):
@@ -33,10 +33,10 @@
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
@@ -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)
View
@@ -3,7 +3,7 @@
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"))
View
@@ -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 @@ def set_state(self, state):
@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 @@ def __init__(
@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,
View
@@ -15,7 +15,7 @@
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 @@ def create_request(self, method, scheme, host, port, path):
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",
File renamed without changes.
File renamed without changes.
@@ -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",
+]
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -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
@@ -2,11 +2,11 @@
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
@@ -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",
+]
@@ -1,4 +1,4 @@
-from netlib.http import url
+from mitmproxy.net.http import url
def parse_headers(headers):
@@ -3,9 +3,9 @@
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 @@ def headers(self):
Message headers object
Returns:
- netlib.http.Headers
+ mitmproxy.net.http.Headers
"""
return self.data.headers
@@ -1,6 +1,6 @@
import re
-from netlib.http import headers
+from mitmproxy.net.http import headers
def decode(hdrs, content):
Oops, something went wrong.

0 comments on commit 8430f85

Please sign in to comment.