From a72ae4d85c08b5716cd88715081be0f1ecaeb9d4 Mon Sep 17 00:00:00 2001 From: Maximilian Hils Date: Tue, 11 Feb 2014 12:09:58 +0100 Subject: [PATCH 1/2] Bump version Do it now already so that mitmproxy will warn the user if netlib is not from master. --- netlib/version.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/netlib/version.py b/netlib/version.py index 9b2e037e9..1d3250e10 100644 --- a/netlib/version.py +++ b/netlib/version.py @@ -1,4 +1,4 @@ -IVERSION = (0, 10) +IVERSION = (0, 11) VERSION = ".".join(str(i) for i in IVERSION) NAME = "netlib" NAMEVERSION = NAME + " " + VERSION From c276b4294cac97c1281ce9bb4934e49d0ba970a2 Mon Sep 17 00:00:00 2001 From: Maximilian Hils Date: Sat, 15 Feb 2014 23:16:28 +0100 Subject: [PATCH 2/2] allow super() on TCPServer, add thread names for better debugging --- netlib/http_auth.py | 2 +- netlib/tcp.py | 9 ++++++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/netlib/http_auth.py b/netlib/http_auth.py index be99fb3d4..b0451e3b0 100644 --- a/netlib/http_auth.py +++ b/netlib/http_auth.py @@ -1,4 +1,4 @@ -import contrib.md5crypt as md5crypt +from .contrib import md5crypt import http from argparse import Action, ArgumentTypeError diff --git a/netlib/tcp.py b/netlib/tcp.py index 34e479999..5c351baeb 100644 --- a/netlib/tcp.py +++ b/netlib/tcp.py @@ -380,7 +380,7 @@ class BaseHandler(SocketCloseMixin): -class TCPServer: +class TCPServer(object): request_queue_size = 20 def __init__(self, address): self.address = Address.wrap(address) @@ -416,7 +416,10 @@ class TCPServer: connection, client_address = self.socket.accept() t = threading.Thread( target = self.connection_thread, - args = (connection, client_address) + args = (connection, client_address), + name = "ConnectionThread (%s:%s -> %s:%s)" % + (client_address[0], client_address[1], + self.address.host, self.address.port) ) t.setDaemon(1) t.start() @@ -443,7 +446,7 @@ class TCPServer: print >> fp, exc print >> fp, '-'*40 - def handle_client_connection(self, conn, client_address): # pragma: no cover + def handle_client_connection(self, conn, client_address): # pragma: no cover """ Called after client connection. """