remove unusued method; fix exception at shutdown time

This commit is contained in:
Noah Levitt 2015-08-19 22:56:05 +00:00
parent 3073d59303
commit 0e7a7fdd69
2 changed files with 3 additions and 4 deletions

View File

@ -136,9 +136,6 @@ class MitmProxyHandler(http_server.BaseHTTPRequestHandler):
self.logger.error("exception from {}".format(self._proxy_request), exc_info=True)
raise
def _special_request(self, method, type_):
raise Exception('Not supported')
def _proxy_request(self):
raise Exception('_proxy_request() not implemented in MitmProxyHandler, must be implemented in subclass!')

View File

@ -213,6 +213,7 @@ class WarcProxyHandler(warcprox.mitmproxy.MitmProxyHandler):
if 'Content-Length' in self.headers:
req += self.rfile.read(int(self.headers['Content-Length']))
prox_rec_res = None
try:
self.logger.debug('sending to remote server req=%s', repr(req))
@ -256,7 +257,8 @@ class WarcProxyHandler(warcprox.mitmproxy.MitmProxyHandler):
self.logger.error("%s proxying %s", repr(e), self.url, exc_info=True)
finally:
# Let's close off the remote end
prox_rec_res.close()
if prox_rec_res:
prox_rec_res.close()
self._proxy_sock.close()
# XXX Close connection to proxy client. Doing this because we were