aboutsummaryrefslogtreecommitdiffstats
path: root/libmproxy/proxy.py
diff options
context:
space:
mode:
authorAldo Cortesi <aldo@nullcube.com>2014-01-19 18:16:24 +1300
committerAldo Cortesi <aldo@nullcube.com>2014-01-19 18:16:24 +1300
commit7ddc941116852b191d80643af70af90a6fd8849c (patch)
tree2baafd3e82de6e056f6290d457d770dcc9814db2 /libmproxy/proxy.py
parentcabd848b1e349242d611aa581fe04b1192dab7e8 (diff)
downloadmitmproxy-7ddc941116852b191d80643af70af90a6fd8849c.tar.gz
mitmproxy-7ddc941116852b191d80643af70af90a6fd8849c.tar.bz2
mitmproxy-7ddc941116852b191d80643af70af90a6fd8849c.zip
Silence pyflakes
And pick up one bug as a consequence.
Diffstat (limited to 'libmproxy/proxy.py')
-rw-r--r--libmproxy/proxy.py15
1 files changed, 6 insertions, 9 deletions
diff --git a/libmproxy/proxy.py b/libmproxy/proxy.py
index f2dcc43f..0d53aef8 100644
--- a/libmproxy/proxy.py
+++ b/libmproxy/proxy.py
@@ -1,8 +1,7 @@
-import sys, os, string, socket, time
-import shutil, tempfile, threading
-import SocketServer
+import os, socket, time
+import threading
from OpenSSL import SSL
-from netlib import odict, tcp, http, certutils, http_status, http_auth
+from netlib import tcp, http, certutils, http_status, http_auth
import utils, flow, version, platform, controller
@@ -91,7 +90,6 @@ class RequestReplayThread(threading.Thread):
server = ServerConnection(self.config, r.scheme, r.host, r.port, r.host)
server.connect()
server.send(r)
- tsstart = utils.timestamp()
httpversion, code, msg, headers, content = http.read_response(
server.rfile, r.method, self.config.body_size_limit
)
@@ -123,7 +121,7 @@ class HandleSNI:
self.handler.sni = sn.decode("utf8").encode("idna")
# An unhandled exception in this method will core dump PyOpenSSL, so
# make dang sure it doesn't happen.
- except Exception, e: # pragma: no cover
+ except Exception: # pragma: no cover
pass
@@ -240,7 +238,6 @@ class ProxyHandler(tcp.BaseHandler):
request.ssl_setup_timestamp = sc.ssl_setup_timestamp
sc.rfile.reset_timestamps()
try:
- tsstart = utils.timestamp()
peername = sc.connection.getpeername()
if peername:
request.ip = peername[0]
@@ -249,13 +246,13 @@ class ProxyHandler(tcp.BaseHandler):
request.method,
self.config.body_size_limit
)
- except http.HttpErrorConnClosed, v:
+ except http.HttpErrorConnClosed:
self.del_server_connection()
if sc.requestcount > 1:
continue
else:
raise
- except http.HttpError, v:
+ except http.HttpError:
raise ProxyError(502, "Invalid server response.")
else:
break