Skip to content

Commit

Permalink
Changing both encoding and decoding of the Host, from ascii to idna
Browse files Browse the repository at this point in the history
  • Loading branch information
Nadir Ghoul authored and pgjones committed Aug 23, 2022
1 parent 76fc847 commit 2afeb33
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/wsproto/handshake.py
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ def _process_connection_request( # noqa: MC0001
if name == b"connection":
connection_tokens = split_comma_header(value)
elif name == b"host":
host = value.decode("ascii")
host = value.decode("idna")
continue # Skip appending to headers
elif name == b"sec-websocket-extensions":
extensions = split_comma_header(value)
Expand Down Expand Up @@ -324,7 +324,7 @@ def _initiate_connection(self, request: Request) -> bytes:
self._nonce = generate_nonce()

headers = [
(b"Host", request.host.encode("ascii")),
(b"Host", request.host.encode("idna")),
(b"Upgrade", b"WebSocket"),
(b"Connection", b"Upgrade"),
(b"Sec-WebSocket-Key", self._nonce),
Expand Down

0 comments on commit 2afeb33

Please sign in to comment.