Skip to content

Commit 082b5dd

Browse files
committed
aiohttp: Fix type of header's Sec-WebSocket-Key.
Signed-off-by: AuroraTea <[email protected]>
1 parent 45ead11 commit 082b5dd

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

python-ecosys/aiohttp/aiohttp/aiohttp_ws.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ def _parse_frame_header(cls, header):
8686

8787
def _process_websocket_frame(self, opcode, payload):
8888
if opcode == self.TEXT:
89-
payload = payload.decode()
89+
payload = str(payload, "utf-8")
9090
elif opcode == self.BINARY:
9191
pass
9292
elif opcode == self.CLOSE:
@@ -143,7 +143,7 @@ async def handshake(self, uri, ssl, req):
143143
headers["Host"] = f"{uri.hostname}:{uri.port}"
144144
headers["Connection"] = "Upgrade"
145145
headers["Upgrade"] = "websocket"
146-
headers["Sec-WebSocket-Key"] = key
146+
headers["Sec-WebSocket-Key"] = str(key, "utf-8")
147147
headers["Sec-WebSocket-Version"] = "13"
148148
headers["Origin"] = f"{_http_proto}://{uri.hostname}:{uri.port}"
149149

0 commit comments

Comments
 (0)