Use a space to separate header name and contents for forwarded headers

This commit is contained in:
Juhani Krekelä 2021-10-17 19:02:51 +03:00
parent 0ac0006a63
commit 636cb9b92d
1 changed files with 2 additions and 2 deletions

View File

@ -230,7 +230,7 @@ def proxy(sock, host):
# Remove headers that don't need forwarding or are overwritten
headers = dict((key, value) for key, value in headers.items() if not key.startswith(b'proxy-') and not key in (b'connection', b'keep-alive'))
headers[b'connection'] = b' close'
headers[b'connection'] = b'close'
# Split url into its constituents
fields = url.split(b'://', 1)
@ -275,7 +275,7 @@ def proxy(sock, host):
try:
remote_sock.sendall(method + b' ' + path + b' ' + protocol + b'\r\n')
for key, value in headers.items():
remote_sock.sendall(key + b':' + value + b'\r\n')
remote_sock.sendall(key + b': ' + value + b'\r\n')
remote_sock.sendall(b'\r\n')
remote_sock.sendall(request_data)
except (ConnectionResetError, BrokenPipeError):