diff options
Diffstat (limited to 'dummyserver/proxy.py')
-rwxr-xr-x | dummyserver/proxy.py | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/dummyserver/proxy.py b/dummyserver/proxy.py index aca92a7..5b9984d 100755 --- a/dummyserver/proxy.py +++ b/dummyserver/proxy.py @@ -45,14 +45,14 @@ class ProxyHandler(tornado.web.RequestHandler): def handle_response(response): if response.error and not isinstance(response.error, - tornado.httpclient.HTTPError): + tornado.httpclient.HTTPError): self.set_status(500) self.write('Internal server error:\n' + str(response.error)) self.finish() else: self.set_status(response.code) for header in ('Date', 'Cache-Control', 'Server', - 'Content-Type', 'Location'): + 'Content-Type', 'Location'): v = response.headers.get(header) if v: self.set_header(header, v) @@ -60,7 +60,8 @@ class ProxyHandler(tornado.web.RequestHandler): self.write(response.body) self.finish() - req = tornado.httpclient.HTTPRequest(url=self.request.uri, + req = tornado.httpclient.HTTPRequest( + url=self.request.uri, method=self.request.method, body=self.request.body, headers=self.request.headers, follow_redirects=False, allow_nonstandard_methods=True) @@ -133,5 +134,5 @@ if __name__ == '__main__': 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) |