mirror of
https://github.com/Grasscutters/mitmproxy.git
synced 2024-11-27 02:24:18 +00:00
Merge branch 'master' into tcp_proxy
This commit is contained in:
commit
1b566869de
14
.travis.yml
14
.travis.yml
@ -3,12 +3,18 @@ python:
|
|||||||
- "2.7"
|
- "2.7"
|
||||||
# command to install dependencies, e.g. pip install -r requirements.txt --use-mirrors
|
# command to install dependencies, e.g. pip install -r requirements.txt --use-mirrors
|
||||||
install:
|
install:
|
||||||
- "pip install coveralls --use-mirrors"
|
|
||||||
- "pip install nose-cov --use-mirrors"
|
|
||||||
- "pip install -r requirements.txt --use-mirrors"
|
|
||||||
- "pip install --upgrade git+https://github.com/mitmproxy/netlib.git"
|
- "pip install --upgrade git+https://github.com/mitmproxy/netlib.git"
|
||||||
|
- "pip install -r requirements.txt --use-mirrors"
|
||||||
|
- "pip install -r test/requirements.txt --use-mirrors"
|
||||||
# command to run tests, e.g. python setup.py test
|
# command to run tests, e.g. python setup.py test
|
||||||
script:
|
script:
|
||||||
- "nosetests --with-cov --cov-report term-missing"
|
- "nosetests --with-cov --cov-report term-missing"
|
||||||
after_success:
|
after_success:
|
||||||
- coveralls
|
- coveralls
|
||||||
|
notifications:
|
||||||
|
irc:
|
||||||
|
channels:
|
||||||
|
- "irc.oftc.net#mitmproxy"
|
||||||
|
on_success: change
|
||||||
|
on_failure: always
|
||||||
|
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
import sys, os
|
import sys, os
|
||||||
import json
|
|
||||||
from netlib import tcp, http
|
from netlib import tcp, http
|
||||||
import netlib.utils
|
import netlib.utils
|
||||||
import language, utils
|
import language, utils
|
||||||
@ -45,7 +44,7 @@ class Pathoc(tcp.TCPClient):
|
|||||||
parsed = http.parse_response_line(l)
|
parsed = http.parse_response_line(l)
|
||||||
if not parsed[1] == 200:
|
if not parsed[1] == 200:
|
||||||
raise PathocError("Proxy CONNECT failed: %s - %s"%(parsed[1], parsed[2]))
|
raise PathocError("Proxy CONNECT failed: %s - %s"%(parsed[1], parsed[2]))
|
||||||
headers = http.read_headers(self.rfile)
|
http.read_headers(self.rfile)
|
||||||
|
|
||||||
def connect(self, connect_to=None):
|
def connect(self, connect_to=None):
|
||||||
"""
|
"""
|
||||||
@ -69,7 +68,7 @@ class Pathoc(tcp.TCPClient):
|
|||||||
language.FileAccessDenied.
|
language.FileAccessDenied.
|
||||||
"""
|
"""
|
||||||
r = language.parse_request(self.settings, spec)
|
r = language.parse_request(self.settings, spec)
|
||||||
ret = language.serve(r, self.wfile, self.settings, self.host)
|
language.serve(r, self.wfile, self.settings, self.host)
|
||||||
self.wfile.flush()
|
self.wfile.flush()
|
||||||
return Response(*http.read_response(self.rfile, r.method, None))
|
return Response(*http.read_response(self.rfile, r.method, None))
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import urllib, threading, re, logging, socket, sys, base64
|
import urllib, threading, re, logging
|
||||||
from netlib import tcp, http, odict, wsgi, certutils
|
from netlib import tcp, http, wsgi, certutils
|
||||||
import netlib.utils
|
import netlib.utils
|
||||||
import version, app, language, utils
|
import version, app, language, utils
|
||||||
|
|
||||||
@ -158,13 +158,13 @@ class PathodHandler(tcp.BaseHandler):
|
|||||||
cc = wsgi.ClientConn(self.client_address)
|
cc = wsgi.ClientConn(self.client_address)
|
||||||
req = wsgi.Request(cc, "http", method, path, headers, content)
|
req = wsgi.Request(cc, "http", method, path, headers, content)
|
||||||
sn = self.connection.getsockname()
|
sn = self.connection.getsockname()
|
||||||
app = wsgi.WSGIAdaptor(
|
a = wsgi.WSGIAdaptor(
|
||||||
self.server.app,
|
self.server.app,
|
||||||
sn[0],
|
sn[0],
|
||||||
self.server.port,
|
self.server.port,
|
||||||
version.NAMEVERSION
|
version.NAMEVERSION
|
||||||
)
|
)
|
||||||
app.serve(req, self.wfile)
|
a.serve(req, self.wfile)
|
||||||
return True, None
|
return True, None
|
||||||
|
|
||||||
def _log_bytes(self, header, data, hexdump):
|
def _log_bytes(self, header, data, hexdump):
|
||||||
@ -257,7 +257,7 @@ class Pathod(tcp.TCPServer):
|
|||||||
except re.error:
|
except re.error:
|
||||||
raise PathodError("Invalid regex in anchor: %s"%i[0])
|
raise PathodError("Invalid regex in anchor: %s"%i[0])
|
||||||
try:
|
try:
|
||||||
aresp = language.parse_response(self.request_settings, i[1])
|
language.parse_response(self.request_settings, i[1])
|
||||||
except language.ParseException, v:
|
except language.ParseException, v:
|
||||||
raise PathodError("Invalid page spec in anchor: '%s', %s"%(i[1], str(v)))
|
raise PathodError("Invalid page spec in anchor: '%s', %s"%(i[1], str(v)))
|
||||||
self.anchors.append((arex, i[1]))
|
self.anchors.append((arex, i[1]))
|
||||||
@ -268,7 +268,7 @@ class Pathod(tcp.TCPServer):
|
|||||||
"""
|
"""
|
||||||
try:
|
try:
|
||||||
l = req.maximum_length(settings)
|
l = req.maximum_length(settings)
|
||||||
except language.FileAccessDenied, v:
|
except language.FileAccessDenied:
|
||||||
return "File access denied."
|
return "File access denied."
|
||||||
if self.sizelimit and l > self.sizelimit:
|
if self.sizelimit and l > self.sizelimit:
|
||||||
return "Response too large."
|
return "Response too large."
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import json, threading, Queue
|
import threading, Queue
|
||||||
import requests
|
import requests
|
||||||
import pathod, utils
|
import pathod
|
||||||
|
|
||||||
|
|
||||||
class Daemon:
|
class Daemon:
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import os, re
|
import os
|
||||||
|
|
||||||
SIZE_UNITS = dict(
|
SIZE_UNITS = dict(
|
||||||
b = 1024**0,
|
b = 1024**0,
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
IVERSION = (0, 9, 2)
|
IVERSION = (0, 10)
|
||||||
VERSION = ".".join(str(i) for i in IVERSION)
|
VERSION = ".".join(str(i) for i in IVERSION)
|
||||||
NAME = "pathod"
|
NAME = "pathod"
|
||||||
NAMEVERSION = NAME + " " + VERSION
|
NAMEVERSION = NAME + " " + VERSION
|
||||||
|
@ -3,8 +3,7 @@ Jinja2>=2.7.1
|
|||||||
MarkupSafe>=0.18
|
MarkupSafe>=0.18
|
||||||
Werkzeug>=0.9.4
|
Werkzeug>=0.9.4
|
||||||
itsdangerous>=0.23
|
itsdangerous>=0.23
|
||||||
nose>=1.3.0
|
|
||||||
pyOpenSSL>=0.13.1
|
pyOpenSSL>=0.13.1
|
||||||
pyasn1>=0.1.7
|
pyasn1>=0.1.7
|
||||||
requests>=2.1.0
|
requests>=2.1.0
|
||||||
netlib>=0.9.2
|
netlib>=0.10
|
4
test/requirements.txt
Normal file
4
test/requirements.txt
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
mock>=1.0.1
|
||||||
|
nose>=1.3.0
|
||||||
|
nose-cov>=1.6
|
||||||
|
coveralls>=0.4.1
|
Loading…
Reference in New Issue
Block a user