mirror of
https://github.com/Grasscutters/mitmproxy.git
synced 2024-11-27 02:24:18 +00:00
cleanup code with autoflake
run the following command: $ autoflake -r -i --remove-all-unused-imports --remove-unused-variables .
This commit is contained in:
parent
e3d390e036
commit
161bc2cfaa
@ -1,10 +1,6 @@
|
|||||||
import base64
|
|
||||||
import hashlib
|
|
||||||
import os
|
|
||||||
import struct
|
import struct
|
||||||
import io
|
|
||||||
|
|
||||||
from .. import utils, odict, tcp
|
from .. import utils
|
||||||
from functools import reduce
|
from functools import reduce
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,8 +1,3 @@
|
|||||||
import base64
|
|
||||||
import hashlib
|
|
||||||
import os
|
|
||||||
import struct
|
|
||||||
import io
|
|
||||||
|
|
||||||
# "PRI * HTTP/2.0\r\n\r\nSM\r\n\r\n"
|
# "PRI * HTTP/2.0\r\n\r\nSM\r\n\r\n"
|
||||||
CLIENT_CONNECTION_PREFACE = '505249202a20485454502f322e300d0a0d0a534d0d0a0d0a'
|
CLIENT_CONNECTION_PREFACE = '505249202a20485454502f322e300d0a0d0a534d0d0a0d0a'
|
||||||
|
@ -16,7 +16,6 @@ class NullProxyAuth(object):
|
|||||||
"""
|
"""
|
||||||
Clean up authentication headers, so they're not passed upstream.
|
Clean up authentication headers, so they're not passed upstream.
|
||||||
"""
|
"""
|
||||||
pass
|
|
||||||
|
|
||||||
def authenticate(self, headers):
|
def authenticate(self, headers):
|
||||||
"""
|
"""
|
||||||
|
@ -67,7 +67,6 @@ def _read_quoted_string(s, start):
|
|||||||
break
|
break
|
||||||
elif s[i] == "\\":
|
elif s[i] == "\\":
|
||||||
escaping = True
|
escaping = True
|
||||||
pass
|
|
||||||
else:
|
else:
|
||||||
ret.append(s[i])
|
ret.append(s[i])
|
||||||
return "".join(ret), i + 1
|
return "".join(ret), i + 1
|
||||||
|
@ -7,7 +7,6 @@ import threading
|
|||||||
import time
|
import time
|
||||||
import traceback
|
import traceback
|
||||||
from OpenSSL import SSL
|
from OpenSSL import SSL
|
||||||
import OpenSSL
|
|
||||||
|
|
||||||
from . import certutils
|
from . import certutils
|
||||||
|
|
||||||
@ -650,4 +649,3 @@ class TCPServer(object):
|
|||||||
"""
|
"""
|
||||||
Called after server shutdown.
|
Called after server shutdown.
|
||||||
"""
|
"""
|
||||||
pass
|
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
import os
|
import os
|
||||||
from netlib import certutils, certffi
|
from netlib import certutils, certffi
|
||||||
import OpenSSL
|
|
||||||
import tutils
|
import tutils
|
||||||
|
|
||||||
# class TestDNTree:
|
# class TestDNTree:
|
||||||
@ -57,13 +56,13 @@ class TestCertStore:
|
|||||||
|
|
||||||
def test_add_cert(self):
|
def test_add_cert(self):
|
||||||
with tutils.tmpdir() as d:
|
with tutils.tmpdir() as d:
|
||||||
ca = certutils.CertStore.from_store(d, "test")
|
certutils.CertStore.from_store(d, "test")
|
||||||
|
|
||||||
def test_sans(self):
|
def test_sans(self):
|
||||||
with tutils.tmpdir() as d:
|
with tutils.tmpdir() as d:
|
||||||
ca = certutils.CertStore.from_store(d, "test")
|
ca = certutils.CertStore.from_store(d, "test")
|
||||||
c1 = ca.get_cert("foo.com", ["*.bar.com"])
|
c1 = ca.get_cert("foo.com", ["*.bar.com"])
|
||||||
c2 = ca.get_cert("foo.bar.com", [])
|
ca.get_cert("foo.bar.com", [])
|
||||||
# assert c1 == c2
|
# assert c1 == c2
|
||||||
c3 = ca.get_cert("bar.com", [])
|
c3 = ca.get_cert("bar.com", [])
|
||||||
assert not c1 == c3
|
assert not c1 == c3
|
||||||
@ -71,7 +70,7 @@ class TestCertStore:
|
|||||||
def test_sans_change(self):
|
def test_sans_change(self):
|
||||||
with tutils.tmpdir() as d:
|
with tutils.tmpdir() as d:
|
||||||
ca = certutils.CertStore.from_store(d, "test")
|
ca = certutils.CertStore.from_store(d, "test")
|
||||||
_ = ca.get_cert("foo.com", ["*.bar.com"])
|
ca.get_cert("foo.com", ["*.bar.com"])
|
||||||
cert, key, chain_file = ca.get_cert("foo.bar.com", ["*.baz.com"])
|
cert, key, chain_file = ca.get_cert("foo.bar.com", ["*.baz.com"])
|
||||||
assert "*.baz.com" in cert.altnames
|
assert "*.baz.com" in cert.altnames
|
||||||
|
|
||||||
|
@ -1,7 +1,4 @@
|
|||||||
import binascii
|
|
||||||
import cStringIO
|
|
||||||
from netlib import odict, http_auth, http
|
from netlib import odict, http_auth, http
|
||||||
import mock
|
|
||||||
import tutils
|
import tutils
|
||||||
|
|
||||||
|
|
||||||
@ -22,7 +19,7 @@ class TestPassManHtpasswd:
|
|||||||
pm = http_auth.PassManHtpasswd(tutils.test_data.path("data/htpasswd"))
|
pm = http_auth.PassManHtpasswd(tutils.test_data.path("data/htpasswd"))
|
||||||
|
|
||||||
vals = ("basic", "test", "test")
|
vals = ("basic", "test", "test")
|
||||||
p = http.assemble_http_basic_auth(*vals)
|
http.assemble_http_basic_auth(*vals)
|
||||||
assert pm.test("test", "test")
|
assert pm.test("test", "test")
|
||||||
assert not pm.test("test", "foo")
|
assert not pm.test("test", "foo")
|
||||||
assert not pm.test("foo", "test")
|
assert not pm.test("foo", "test")
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
import pprint
|
|
||||||
import nose.tools
|
import nose.tools
|
||||||
|
|
||||||
from netlib import http_cookies, odict
|
from netlib import http_cookies
|
||||||
|
|
||||||
|
|
||||||
def test_read_token():
|
def test_read_token():
|
||||||
|
@ -1,3 +1 @@
|
|||||||
# These are actually tests!
|
# These are actually tests!
|
||||||
import netlib.http_status
|
|
||||||
import netlib.version
|
|
||||||
|
@ -56,7 +56,7 @@ class TestWSGI:
|
|||||||
f.request.host = "foo"
|
f.request.host = "foo"
|
||||||
f.request.port = 80
|
f.request.port = 80
|
||||||
wfile = cStringIO.StringIO()
|
wfile = cStringIO.StringIO()
|
||||||
err = w.serve(f, wfile)
|
w.serve(f, wfile)
|
||||||
return wfile.getvalue()
|
return wfile.getvalue()
|
||||||
|
|
||||||
def test_serve_empty_body(self):
|
def test_serve_empty_body(self):
|
||||||
@ -72,7 +72,7 @@ class TestWSGI:
|
|||||||
try:
|
try:
|
||||||
raise ValueError("foo")
|
raise ValueError("foo")
|
||||||
except:
|
except:
|
||||||
ei = sys.exc_info()
|
sys.exc_info()
|
||||||
status = '200 OK'
|
status = '200 OK'
|
||||||
response_headers = [('Content-type', 'text/plain')]
|
response_headers = [('Content-type', 'text/plain')]
|
||||||
start_response(status, response_headers)
|
start_response(status, response_headers)
|
||||||
|
Loading…
Reference in New Issue
Block a user