Merge pull request #1246 from cortesi/version

Fold mitmproxy.version and pathod.version into netlib.version
This commit is contained in:
Aldo Cortesi 2016-06-12 10:40:10 +12:00 committed by GitHub
commit 1d44030963
16 changed files with 34 additions and 51 deletions

View File

@ -21,7 +21,7 @@ import shlex
# documentation root, use os.path.abspath to make it absolute, like shown here.
sys.path.insert(0, os.path.abspath('..'))
import mitmproxy.version
import netlib.version
# -- General configuration ------------------------------------------------
@ -69,9 +69,9 @@ author = u'The mitmproxy project'
# built documents.
#
# The short X.Y version.
version = mitmproxy.version.VERSION
version = netlib.version.VERSION
# 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
# for a list of supported languages.

View File

@ -7,10 +7,10 @@ import re
import configargparse
from mitmproxy import filt
from mitmproxy import version
from mitmproxy.proxy import config
from netlib import human
from netlib import tcp
from netlib import version
from netlib.http import url
APP_HOST = "mitm.it"

View File

@ -3,10 +3,11 @@ from __future__ import absolute_import, print_function, division
import urwid
from mitmproxy import filt
from mitmproxy import version
from mitmproxy.console import common
from mitmproxy.console import signals
from netlib import version
footer = [
("heading", 'mitmproxy v%s ' % version.VERSION),
('heading_key', "q"), ":back ",

View File

@ -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 mitmproxy import version
from netlib import version
def convert_013_014(data):
@ -66,6 +66,6 @@ def migrate_flow(flow_data):
else:
v = ".".join(str(i) for i in flow_data["version"])
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

View File

@ -9,8 +9,8 @@ from six.moves import urllib
from mitmproxy import controller
from mitmproxy import filt
from mitmproxy import version
from netlib import wsgi
from netlib import version
from netlib.http import cookies
from netlib.http import http1
@ -28,7 +28,7 @@ class AppRegistry:
app,
domain,
port,
version.NAMEVERSION
version.MITMPROXY
)
def get(self, request):

View File

@ -5,10 +5,11 @@ import copy
import uuid
from mitmproxy import stateobject
from mitmproxy import version
from mitmproxy.models.connections import ClientConnection
from mitmproxy.models.connections import ServerConnection
from netlib import version
class Error(stateobject.StateObject):

View File

@ -2,9 +2,9 @@ from __future__ import absolute_import, print_function, division
import cgi
from mitmproxy import version
from mitmproxy.models.flow import Flow
from netlib import encoding
from netlib import version
from netlib.http import Headers
from netlib.http import Request
from netlib.http import Response
@ -258,7 +258,7 @@ def make_error_response(status_code, message, headers=None):
if not headers:
headers = Headers(
Server=version.NAMEVERSION,
Server=version.MITMPROXY,
Connection="close",
Content_Length=str(len(body)),
Content_Type="text/html"

View File

@ -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",
]

View File

@ -12,7 +12,7 @@ from io import BytesIO
from mitmproxy.flow import FlowWriter, FlowReader
from mitmproxy import filt
from mitmproxy import version
from netlib import version
def _strip_content(flow_state):
@ -72,7 +72,7 @@ class RequestHandler(BasicAuth, tornado.web.RequestHandler):
def set_default_headers(self):
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.add_header("X-XSS-Protection", "1; mode=block")
self.add_header("X-Content-Type-Options", "nosniff")

View File

@ -2,5 +2,5 @@ from __future__ import (absolute_import, print_function, division)
IVERSION = (0, 18)
VERSION = ".".join(str(i) for i in IVERSION)
NAME = "netlib"
NAMEVERSION = NAME + " " + VERSION
PATHOD = "pathod " + VERSION
MITMPROXY = "mitmproxy " + VERSION

View File

@ -5,8 +5,9 @@ import os
import os.path
from netlib import tcp
from netlib import version
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):

View File

@ -6,11 +6,14 @@ import sys
import threading
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, \
TlsException
from . import version, language, utils, log, protocols
from . import language, utils, log, protocols
DEFAULT_CERT_DOMAIN = "pathod.net"
@ -486,7 +489,7 @@ def main(args): # pragma: no cover
try:
print("%s listening on %s" % (
version.NAMEVERSION,
version.PATHOD,
repr(pd.address)
))
pd.serve_forever()

View File

@ -4,8 +4,10 @@ import os
import os.path
import re
from netlib import tcp, human
from . import pathod, version
from netlib import tcp
from netlib import human
from netlib import version
from . import pathod
def parse_anchor_spec(s):

View File

@ -1,6 +1,7 @@
from netlib import version
from netlib.exceptions import TlsException
from netlib.http import http1
from .. import version, language
from .. import language
class HTTPProtocol(object):
@ -17,7 +18,7 @@ class HTTPProtocol(object):
self.pathod_handler.wfile.write(
'HTTP/1.1 200 Connection established\r\n' +
('Proxy-agent: %s\r\n' % version.NAMEVERSION) +
('Proxy-agent: %s\r\n' % version.PATHOD) +
'\r\n'
)
self.pathod_handler.wfile.flush()

View File

@ -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",
]

View File

@ -7,7 +7,7 @@ import os
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:
long_description = f.read()