From: khamidou Date: Tue, 8 Dec 2009 16:42:45 +0000 (+0100) Subject: the command-line proxy now works X-Git-Url: http://git.khamidou.com/?a=commitdiff_plain;h=7ab8f3bfd47458d5e786a3b65c9b81b8783e06f5;p=tunnel.git the command-line proxy now works --- 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