diff --git a/warcprox/mitmproxy.py b/warcprox/mitmproxy.py index 3c3f95b..532c221 100644 --- a/warcprox/mitmproxy.py +++ b/warcprox/mitmproxy.py @@ -15,11 +15,14 @@ except ImportError: import socket import logging import ssl +import warcprox +import threading class MitmProxyHandler(http_server.BaseHTTPRequestHandler): logger = logging.getLogger("warcprox.mitmproxy.MitmProxyHandler") def __init__(self, request, client_address, server): + threading.current_thread.name = 'MitmProxyHandler-thread(tid={})'.format(warcprox.gettid()) self.is_connect = False self._headers_buffer = [] http_server.BaseHTTPRequestHandler.__init__(self, request, client_address, server) diff --git a/warcprox/writerthread.py b/warcprox/writerthread.py index f0c7d25..c69e514 100644 --- a/warcprox/writerthread.py +++ b/warcprox/writerthread.py @@ -41,7 +41,7 @@ class WarcWriterThread(threading.Thread): def _run(self): while not self.stop.is_set(): try: - self.setName('WarcWriterThread(tid={})'.format(warcprox.gettid())) + self.name = 'WarcWriterThread(tid={})'.format(warcprox.gettid()) while True: try: recorded_url = self.recorded_url_q.get(block=True, timeout=0.5)