Skip to content

Commit

Permalink
Added python 3.2 compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
stanvit committed Jan 8, 2013
1 parent f9c2b48 commit ca4fe79
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions tornado_proxy/proxy.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ def handle_response(response):
client = tornado.httpclient.AsyncHTTPClient()
try:
client.fetch(req, handle_response)
except tornado.httpclient.HTTPError, e:
except tornado.httpclient.HTTPError as e:
if hasattr(e, 'response') and e.response:
self.handle_response(e.response)
else:
Expand Down Expand Up @@ -108,7 +108,7 @@ def upstream_close(data=None):
def start_tunnel():
client.read_until_close(client_close, read_from_client)
upstream.read_until_close(upstream_close, read_from_upstream)
client.write('HTTP/1.0 200 Connection established\r\n\r\n')
client.write(b'HTTP/1.0 200 Connection established\r\n\r\n')

s = socket.socket(socket.AF_INET, socket.SOCK_STREAM, 0)
upstream = tornado.iostream.IOStream(s)
Expand All @@ -133,5 +133,5 @@ def run_proxy(port, start_ioloop=True):
if len(sys.argv) > 1:
port = int(sys.argv[1])

print "Starting HTTP proxy on port %d" % port
print ("Starting HTTP proxy on port %d" % port)
run_proxy(port)

0 comments on commit ca4fe79

Please sign in to comment.