comment out unused code that fails in py2

This commit is contained in:
Noah Levitt 2017-02-01 15:42:02 -08:00
parent ddb60876a3
commit 859c93f390
2 changed files with 16 additions and 16 deletions

View File

@ -51,7 +51,7 @@ except:
setuptools.setup(
name='warcprox',
version='2.1b1.dev47',
version='2.1b1.dev48',
description='WARC writing MITM HTTP/S proxy',
url='https://github.com/internetarchive/warcprox',
author='Noah Levitt',

View File

@ -60,21 +60,21 @@ import certauth.certauth
import warcprox
import http.client
orig_send = http.client.HTTPConnection.send
def _send(self, data):
if isinstance(data, bytes):
logging.info('sending data (bytes): ')
logging.root.handlers[0].stream.buffer.write(data)
logging.root.handlers[0].stream.buffer.write(b'\n')
elif isinstance(data, str):
logging.info('sending data (str): ')
logging.root.handlers[0].stream.write(data)
logging.root.handlers[0].stream.write('\n')
else:
logging.info('sending data from %s', repr(data))
orig_send(self, data)
### uncomment this to see raw requests going over the wire
### uncomment this to block see raw requests going over the wire
# import http.client
# orig_send = http.client.HTTPConnection.send
# def _send(self, data):
# if isinstance(data, bytes):
# logging.info('sending data (bytes): ')
# logging.root.handlers[0].stream.buffer.write(data)
# logging.root.handlers[0].stream.buffer.write(b'\n')
# elif isinstance(data, str):
# logging.info('sending data (str): ')
# logging.root.handlers[0].stream.write(data)
# logging.root.handlers[0].stream.write('\n')
# else:
# logging.info('sending data from %s', repr(data))
# orig_send(self, data)
# http.client.HTTPConnection.send = _send
logging.basicConfig(