Skip to content

Commit a69cd95

Browse files
authored
Merge pull request #106 from ValdikSS/master
Use Host header for host name, transparent proxy compatibility
2 parents 629b430 + d2eb695 commit a69cd95

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

pproxy/proto.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -310,9 +310,11 @@ async def accept(self, reader, user, writer, users, authtable, httpget=None, **k
310310
url = urllib.parse.urlparse(path)
311311
if ':' in url.netloc:
312312
host_name, port = url.netloc.rsplit(':', 1)
313+
host_name = headers.get("Host", host_name)
313314
port = int(port)
314315
else:
315316
host_name, port = url.netloc, 80
317+
host_name = headers.get("Host", host_name)
316318
newpath = url._replace(netloc='', scheme='').geturl()
317319
return user, host_name, port, b'', f'{method} {newpath} {ver}\r\n{lines}\r\n\r\n'.encode()
318320
async def connect(self, reader_remote, writer_remote, rauth, host_name, port, myhost, **kw):

0 commit comments

Comments
 (0)