Skip to content

Commit

Permalink
fix google.com on http in firefox
Browse files Browse the repository at this point in the history
  • Loading branch information
linhua55 committed Mar 6, 2016
1 parent 9fcb0b8 commit 32d204c
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions gae_proxy/local/proxy_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand Down Expand Up @@ -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())
Expand Down

0 comments on commit 32d204c

Please sign in to comment.