From 7ab8f3bfd47458d5e786a3b65c9b81b8783e06f5 Mon Sep 17 00:00:00 2001 From: khamidou Date: Tue, 8 Dec 2009 17:42:45 +0100 Subject: [PATCH] the command-line proxy now works --- tunnel.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/tunnel.py b/tunnel.py index b7b73ff..4f562e0 100755 --- a/tunnel.py +++ b/tunnel.py @@ -26,8 +26,15 @@ class ProxyHandler (BaseHTTPServer.BaseHTTPRequestHandler): headers = {"Proxy-Connection" : "", } req = urllib2.Request(self.path, headers=headers) - data = urllib2.urlopen(req) - s.wfile.write(data.read()) + try: + data = urllib2.urlopen(req) + self.send_response(200) + self.end_headers() + self.wfile.write(data.read()) + + except IOError: + self.send_response(500) + self.end_headers() do_HEAD = do_GET do_POST = do_GET -- 2.43.0