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( setuptools.setup(
name='warcprox', name='warcprox',
version='2.1b1.dev47', version='2.1b1.dev48',
description='WARC writing MITM HTTP/S proxy', description='WARC writing MITM HTTP/S proxy',
url='https://github.com/internetarchive/warcprox', url='https://github.com/internetarchive/warcprox',
author='Noah Levitt', author='Noah Levitt',

View File

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