Skip to content

Commit

Permalink
Merge pull request #2237 from linhua55/fix-google-http
Browse files Browse the repository at this point in the history
fix google.com on http for firefox
  • Loading branch information
xxnet committed Mar 7, 2016
2 parents 9fcb0b8 + 32d204c commit a4fa001
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 a4fa001

Please sign in to comment.