mirror of
https://github.com/Grasscutters/mitmproxy.git
synced 2024-11-26 18:18:25 +00:00
Merge pull request #1246 from cortesi/version
Fold mitmproxy.version and pathod.version into netlib.version
This commit is contained in:
commit
1d44030963
@ -21,7 +21,7 @@ import shlex
|
|||||||
# documentation root, use os.path.abspath to make it absolute, like shown here.
|
# documentation root, use os.path.abspath to make it absolute, like shown here.
|
||||||
sys.path.insert(0, os.path.abspath('..'))
|
sys.path.insert(0, os.path.abspath('..'))
|
||||||
|
|
||||||
import mitmproxy.version
|
import netlib.version
|
||||||
|
|
||||||
# -- General configuration ------------------------------------------------
|
# -- General configuration ------------------------------------------------
|
||||||
|
|
||||||
@ -69,9 +69,9 @@ author = u'The mitmproxy project'
|
|||||||
# built documents.
|
# built documents.
|
||||||
#
|
#
|
||||||
# The short X.Y version.
|
# The short X.Y version.
|
||||||
version = mitmproxy.version.VERSION
|
version = netlib.version.VERSION
|
||||||
# The full version, including alpha/beta/rc tags.
|
# The full version, including alpha/beta/rc tags.
|
||||||
release = mitmproxy.version.VERSION
|
release = netlib.version.VERSION
|
||||||
|
|
||||||
# The language for content autogenerated by Sphinx. Refer to documentation
|
# The language for content autogenerated by Sphinx. Refer to documentation
|
||||||
# for a list of supported languages.
|
# for a list of supported languages.
|
||||||
|
@ -7,10 +7,10 @@ import re
|
|||||||
import configargparse
|
import configargparse
|
||||||
|
|
||||||
from mitmproxy import filt
|
from mitmproxy import filt
|
||||||
from mitmproxy import version
|
|
||||||
from mitmproxy.proxy import config
|
from mitmproxy.proxy import config
|
||||||
from netlib import human
|
from netlib import human
|
||||||
from netlib import tcp
|
from netlib import tcp
|
||||||
|
from netlib import version
|
||||||
from netlib.http import url
|
from netlib.http import url
|
||||||
|
|
||||||
APP_HOST = "mitm.it"
|
APP_HOST = "mitm.it"
|
||||||
|
@ -3,10 +3,11 @@ from __future__ import absolute_import, print_function, division
|
|||||||
import urwid
|
import urwid
|
||||||
|
|
||||||
from mitmproxy import filt
|
from mitmproxy import filt
|
||||||
from mitmproxy import version
|
|
||||||
from mitmproxy.console import common
|
from mitmproxy.console import common
|
||||||
from mitmproxy.console import signals
|
from mitmproxy.console import signals
|
||||||
|
|
||||||
|
from netlib import version
|
||||||
|
|
||||||
footer = [
|
footer = [
|
||||||
("heading", 'mitmproxy v%s ' % version.VERSION),
|
("heading", 'mitmproxy v%s ' % version.VERSION),
|
||||||
('heading_key', "q"), ":back ",
|
('heading_key', "q"), ":back ",
|
||||||
|
@ -3,7 +3,7 @@ This module handles the import of mitmproxy flows generated by old versions.
|
|||||||
"""
|
"""
|
||||||
from __future__ import absolute_import, print_function, division
|
from __future__ import absolute_import, print_function, division
|
||||||
|
|
||||||
from mitmproxy import version
|
from netlib import version
|
||||||
|
|
||||||
|
|
||||||
def convert_013_014(data):
|
def convert_013_014(data):
|
||||||
@ -66,6 +66,6 @@ def migrate_flow(flow_data):
|
|||||||
else:
|
else:
|
||||||
v = ".".join(str(i) for i in flow_data["version"])
|
v = ".".join(str(i) for i in flow_data["version"])
|
||||||
raise ValueError(
|
raise ValueError(
|
||||||
"{} cannot read files serialized with version {}.".format(version.NAMEVERSION, v)
|
"{} cannot read files serialized with version {}.".format(version.MITMPROXY, v)
|
||||||
)
|
)
|
||||||
return flow_data
|
return flow_data
|
||||||
|
@ -9,8 +9,8 @@ from six.moves import urllib
|
|||||||
|
|
||||||
from mitmproxy import controller
|
from mitmproxy import controller
|
||||||
from mitmproxy import filt
|
from mitmproxy import filt
|
||||||
from mitmproxy import version
|
|
||||||
from netlib import wsgi
|
from netlib import wsgi
|
||||||
|
from netlib import version
|
||||||
from netlib.http import cookies
|
from netlib.http import cookies
|
||||||
from netlib.http import http1
|
from netlib.http import http1
|
||||||
|
|
||||||
@ -28,7 +28,7 @@ class AppRegistry:
|
|||||||
app,
|
app,
|
||||||
domain,
|
domain,
|
||||||
port,
|
port,
|
||||||
version.NAMEVERSION
|
version.MITMPROXY
|
||||||
)
|
)
|
||||||
|
|
||||||
def get(self, request):
|
def get(self, request):
|
||||||
|
@ -5,10 +5,11 @@ import copy
|
|||||||
import uuid
|
import uuid
|
||||||
|
|
||||||
from mitmproxy import stateobject
|
from mitmproxy import stateobject
|
||||||
from mitmproxy import version
|
|
||||||
from mitmproxy.models.connections import ClientConnection
|
from mitmproxy.models.connections import ClientConnection
|
||||||
from mitmproxy.models.connections import ServerConnection
|
from mitmproxy.models.connections import ServerConnection
|
||||||
|
|
||||||
|
from netlib import version
|
||||||
|
|
||||||
|
|
||||||
class Error(stateobject.StateObject):
|
class Error(stateobject.StateObject):
|
||||||
|
|
||||||
|
@ -2,9 +2,9 @@ from __future__ import absolute_import, print_function, division
|
|||||||
|
|
||||||
import cgi
|
import cgi
|
||||||
|
|
||||||
from mitmproxy import version
|
|
||||||
from mitmproxy.models.flow import Flow
|
from mitmproxy.models.flow import Flow
|
||||||
from netlib import encoding
|
from netlib import encoding
|
||||||
|
from netlib import version
|
||||||
from netlib.http import Headers
|
from netlib.http import Headers
|
||||||
from netlib.http import Request
|
from netlib.http import Request
|
||||||
from netlib.http import Response
|
from netlib.http import Response
|
||||||
@ -258,7 +258,7 @@ def make_error_response(status_code, message, headers=None):
|
|||||||
|
|
||||||
if not headers:
|
if not headers:
|
||||||
headers = Headers(
|
headers = Headers(
|
||||||
Server=version.NAMEVERSION,
|
Server=version.MITMPROXY,
|
||||||
Connection="close",
|
Connection="close",
|
||||||
Content_Length=str(len(body)),
|
Content_Length=str(len(body)),
|
||||||
Content_Type="text/html"
|
Content_Type="text/html"
|
||||||
|
@ -1,13 +0,0 @@
|
|||||||
from __future__ import absolute_import, print_function, division
|
|
||||||
|
|
||||||
from netlib.version import VERSION, IVERSION
|
|
||||||
|
|
||||||
NAME = "mitmproxy"
|
|
||||||
NAMEVERSION = NAME + " " + VERSION
|
|
||||||
|
|
||||||
__all__ = [
|
|
||||||
"NAME",
|
|
||||||
"NAMEVERSION",
|
|
||||||
"VERSION",
|
|
||||||
"IVERSION",
|
|
||||||
]
|
|
@ -12,7 +12,7 @@ from io import BytesIO
|
|||||||
from mitmproxy.flow import FlowWriter, FlowReader
|
from mitmproxy.flow import FlowWriter, FlowReader
|
||||||
|
|
||||||
from mitmproxy import filt
|
from mitmproxy import filt
|
||||||
from mitmproxy import version
|
from netlib import version
|
||||||
|
|
||||||
|
|
||||||
def _strip_content(flow_state):
|
def _strip_content(flow_state):
|
||||||
@ -72,7 +72,7 @@ class RequestHandler(BasicAuth, tornado.web.RequestHandler):
|
|||||||
|
|
||||||
def set_default_headers(self):
|
def set_default_headers(self):
|
||||||
super(RequestHandler, self).set_default_headers()
|
super(RequestHandler, self).set_default_headers()
|
||||||
self.set_header("Server", version.NAMEVERSION)
|
self.set_header("Server", version.MITMPROXY)
|
||||||
self.set_header("X-Frame-Options", "DENY")
|
self.set_header("X-Frame-Options", "DENY")
|
||||||
self.add_header("X-XSS-Protection", "1; mode=block")
|
self.add_header("X-XSS-Protection", "1; mode=block")
|
||||||
self.add_header("X-Content-Type-Options", "nosniff")
|
self.add_header("X-Content-Type-Options", "nosniff")
|
||||||
|
@ -2,5 +2,5 @@ from __future__ import (absolute_import, print_function, division)
|
|||||||
|
|
||||||
IVERSION = (0, 18)
|
IVERSION = (0, 18)
|
||||||
VERSION = ".".join(str(i) for i in IVERSION)
|
VERSION = ".".join(str(i) for i in IVERSION)
|
||||||
NAME = "netlib"
|
PATHOD = "pathod " + VERSION
|
||||||
NAMEVERSION = NAME + " " + VERSION
|
MITMPROXY = "mitmproxy " + VERSION
|
||||||
|
@ -5,8 +5,9 @@ import os
|
|||||||
import os.path
|
import os.path
|
||||||
|
|
||||||
from netlib import tcp
|
from netlib import tcp
|
||||||
|
from netlib import version
|
||||||
from netlib.http import user_agents
|
from netlib.http import user_agents
|
||||||
from . import pathoc, version, language
|
from . import pathoc, language
|
||||||
|
|
||||||
|
|
||||||
def args_pathoc(argv, stdout=sys.stdout, stderr=sys.stderr):
|
def args_pathoc(argv, stdout=sys.stdout, stderr=sys.stderr):
|
||||||
|
@ -6,11 +6,14 @@ import sys
|
|||||||
import threading
|
import threading
|
||||||
import urllib
|
import urllib
|
||||||
|
|
||||||
from netlib import tcp, certutils, websockets
|
from netlib import tcp
|
||||||
|
from netlib import certutils
|
||||||
|
from netlib import websockets
|
||||||
|
from netlib import version
|
||||||
from netlib.exceptions import HttpException, HttpReadDisconnect, TcpTimeout, TcpDisconnect, \
|
from netlib.exceptions import HttpException, HttpReadDisconnect, TcpTimeout, TcpDisconnect, \
|
||||||
TlsException
|
TlsException
|
||||||
|
|
||||||
from . import version, language, utils, log, protocols
|
from . import language, utils, log, protocols
|
||||||
|
|
||||||
|
|
||||||
DEFAULT_CERT_DOMAIN = "pathod.net"
|
DEFAULT_CERT_DOMAIN = "pathod.net"
|
||||||
@ -486,7 +489,7 @@ def main(args): # pragma: no cover
|
|||||||
|
|
||||||
try:
|
try:
|
||||||
print("%s listening on %s" % (
|
print("%s listening on %s" % (
|
||||||
version.NAMEVERSION,
|
version.PATHOD,
|
||||||
repr(pd.address)
|
repr(pd.address)
|
||||||
))
|
))
|
||||||
pd.serve_forever()
|
pd.serve_forever()
|
||||||
|
@ -4,8 +4,10 @@ import os
|
|||||||
import os.path
|
import os.path
|
||||||
import re
|
import re
|
||||||
|
|
||||||
from netlib import tcp, human
|
from netlib import tcp
|
||||||
from . import pathod, version
|
from netlib import human
|
||||||
|
from netlib import version
|
||||||
|
from . import pathod
|
||||||
|
|
||||||
|
|
||||||
def parse_anchor_spec(s):
|
def parse_anchor_spec(s):
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
|
from netlib import version
|
||||||
from netlib.exceptions import TlsException
|
from netlib.exceptions import TlsException
|
||||||
from netlib.http import http1
|
from netlib.http import http1
|
||||||
from .. import version, language
|
from .. import language
|
||||||
|
|
||||||
|
|
||||||
class HTTPProtocol(object):
|
class HTTPProtocol(object):
|
||||||
@ -17,7 +18,7 @@ class HTTPProtocol(object):
|
|||||||
|
|
||||||
self.pathod_handler.wfile.write(
|
self.pathod_handler.wfile.write(
|
||||||
'HTTP/1.1 200 Connection established\r\n' +
|
'HTTP/1.1 200 Connection established\r\n' +
|
||||||
('Proxy-agent: %s\r\n' % version.NAMEVERSION) +
|
('Proxy-agent: %s\r\n' % version.PATHOD) +
|
||||||
'\r\n'
|
'\r\n'
|
||||||
)
|
)
|
||||||
self.pathod_handler.wfile.flush()
|
self.pathod_handler.wfile.flush()
|
||||||
|
@ -1,13 +0,0 @@
|
|||||||
from __future__ import (absolute_import, print_function, division)
|
|
||||||
|
|
||||||
from netlib.version import VERSION, IVERSION
|
|
||||||
|
|
||||||
NAME = "pathod"
|
|
||||||
NAMEVERSION = NAME + " " + VERSION
|
|
||||||
|
|
||||||
__all__ = [
|
|
||||||
"NAME",
|
|
||||||
"NAMEVERSION",
|
|
||||||
"VERSION",
|
|
||||||
"IVERSION",
|
|
||||||
]
|
|
2
setup.py
2
setup.py
@ -7,7 +7,7 @@ import os
|
|||||||
|
|
||||||
here = os.path.abspath(os.path.dirname(__file__))
|
here = os.path.abspath(os.path.dirname(__file__))
|
||||||
|
|
||||||
from mitmproxy import version
|
from netlib import version
|
||||||
|
|
||||||
with open(os.path.join(here, 'README.rst'), encoding='utf-8') as f:
|
with open(os.path.join(here, 'README.rst'), encoding='utf-8') as f:
|
||||||
long_description = f.read()
|
long_description = f.read()
|
||||||
|
Loading…
Reference in New Issue
Block a user