Only serve proxy.pac when hostname is localhost.
This commit is contained in:
parent
e92e31b41b
commit
65ff21f4e1
@ -14,12 +14,15 @@ class ExtensionReplacer(http.server.BaseHTTPRequestHandler):
|
|||||||
self.do_GET()
|
self.do_GET()
|
||||||
|
|
||||||
def do_GET(self):
|
def do_GET(self):
|
||||||
if self.path == '/proxy.pac':
|
if self.headers.get('Host', '').split(':')[0] == 'localhost':
|
||||||
self.send_response(200, 'OK')
|
if self.path == '/proxy.pac':
|
||||||
self.send_header('Content-Length', len(proxyConfig))
|
self.send_response(200)
|
||||||
self.end_headers()
|
self.send_header('Content-Length', len(proxyConfig))
|
||||||
if self.command != 'HEAD':
|
self.end_headers()
|
||||||
self.wfile.write(proxyConfig)
|
if self.command != 'HEAD':
|
||||||
|
self.wfile.write(proxyConfig)
|
||||||
|
else:
|
||||||
|
self.send_error(404)
|
||||||
else:
|
else:
|
||||||
del self.headers['Accept-Encoding']
|
del self.headers['Accept-Encoding']
|
||||||
conn = http.client.HTTPConnection('boards.4chan.org')
|
conn = http.client.HTTPConnection('boards.4chan.org')
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user