diff --git a/pywb/framework/proxy.py b/pywb/framework/proxy.py index ab322374..76cd8843 100644 --- a/pywb/framework/proxy.py +++ b/pywb/framework/proxy.py @@ -300,8 +300,7 @@ class ProxyRouter(object): # Proxy Auto-Config (PAC) script for the proxy def make_pac_response(self, env): - import os - hostname = os.environ.get('PYWB_HOST_NAME') + hostname = env.get('HTTP_HOST') if not hostname: server_hostport = env['SERVER_NAME'] + ':' + env['SERVER_PORT'] hostonly = env['SERVER_NAME'] @@ -319,7 +318,6 @@ class ProxyRouter(object): buff += direct.format(hostonly) - #buff += '\n return "PROXY {0}";\n}}\n'.format(self.hostpaths[0]) buff += '\n return "PROXY {0}";\n}}\n'.format(server_hostport) content_type = 'application/x-ns-proxy-autoconfig' diff --git a/pywb/rewrite/test/test_header_rewriter.py b/pywb/rewrite/test/test_header_rewriter.py index 1a2b2cea..0b22d533 100644 --- a/pywb/rewrite/test/test_header_rewriter.py +++ b/pywb/rewrite/test/test_header_rewriter.py @@ -40,17 +40,19 @@ HTTP Headers Rewriting 'removed_header_dict': {'content-encoding': 'gzip', 'transfer-encoding': 'chunked'}, 'status_headers': StatusAndHeaders(protocol = '', statusline = '200 OK', headers = [ ('X-Archive-Orig-Content-Length', '199999'), - ('Content-Type', 'text/javascript')]), + ('Content-Type', 'text/javascript'), + ('X-Archive-Orig-Transfer-Encoding', 'chunked')]), 'text_type': 'js'} -# Binary -- transfer-encoding removed +# Binary -- transfer-encoding rewritten >>> _test_headers([('Content-Length', '200000'), ('Content-Type', 'image/png'), ('Set-Cookie', 'foo=bar; Path=/;'), ('Content-Encoding', 'gzip'), ('Transfer-Encoding', 'chunked')]) {'charset': None, 'removed_header_dict': {'transfer-encoding': 'chunked'}, 'status_headers': StatusAndHeaders(protocol = '', statusline = '200 OK', headers = [ ('Content-Length', '200000'), ('Content-Type', 'image/png'), ('Set-Cookie', 'foo=bar; Path=/web/20131010/http://example.com/'), - ('Content-Encoding', 'gzip')]), + ('Content-Encoding', 'gzip'), + ('X-Archive-Orig-Transfer-Encoding', 'chunked')]), 'text_type': None} """