From 32d204c4eae4f289a1f1becc9b86efa0816dab5c Mon Sep 17 00:00:00 2001 From: linhua <5linhua5@gmail.com> Date: Sun, 6 Mar 2016 17:37:19 +0800 Subject: [PATCH] fix google.com on http in firefox --- gae_proxy/local/proxy_handler.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/gae_proxy/local/proxy_handler.py b/gae_proxy/local/proxy_handler.py index f5ac8bb337..ce74d90e65 100644 --- a/gae_proxy/local/proxy_handler.py +++ b/gae_proxy/local/proxy_handler.py @@ -116,13 +116,13 @@ def do_METHOD(self): return self.do_AGENT() if host in config.HOSTS_FWD or host in config.HOSTS_DIRECT: - return self.wfile.write(('HTTP/1.1 301\r\nLocation: %s\r\n\r\n' % self.path.replace('http://', 'https://', 1)).encode()) + return self.wfile.write(('HTTP/1.1 301\r\nLocation: %s\r\nContent-Length: 0\r\n\r\n' % self.path.replace('http://', 'https://', 1)).encode()) if host.endswith(config.HOSTS_GAE_ENDSWITH): return self.do_AGENT() if host.endswith(config.HOSTS_FWD_ENDSWITH) or host.endswith(config.HOSTS_DIRECT_ENDSWITH): - return self.wfile.write(('HTTP/1.1 301\r\nLocation: %s\r\n\r\n' % self.path.replace('http://', 'https://', 1)).encode()) + return self.wfile.write(('HTTP/1.1 301\r\nLocation: %s\r\nContent-Length: 0\r\n\r\n' % self.path.replace('http://', 'https://', 1)).encode()) return self.do_AGENT() @@ -252,7 +252,7 @@ def do_CONNECT_AGENT(self): fwd_set.append(host) config.HOSTS_DIRECT = tuple(fwd_set) xlog.warn("Method %s not support in GAE, Redirect to DIRECT for %s", self.command, self.path) - return self.wfile.write(('HTTP/1.1 301\r\nLocation: %s\r\n\r\n' % self.path).encode()) + return self.wfile.write(('HTTP/1.1 301\r\nLocation: %s\r\nContent-Length: 0\r\n\r\n' % self.path).encode()) else: xlog.warn("Method %s not support in GAEProxy for %s", self.command, self.path) return self.wfile.write(('HTTP/1.1 404 Not Found\r\n\r\n').encode())