Fix WebSocket request header formatting

This commit is contained in:
Miroslav Štampar 2026-06-02 13:54:48 +02:00
parent fadf5bb753
commit bfe39d010f
3 changed files with 4 additions and 4 deletions

View file

@ -520,7 +520,7 @@ class Connect(object):
if webSocket:
ws = websocket.WebSocket()
ws.settimeout(WEBSOCKET_INITIAL_TIMEOUT if kb.webSocketRecvCount is None else timeout)
wsHeaders = tuple("%s: %s" % _ for _ in headers.items() if _[0] not in ("Host",))
wsHeaders = tuple("%s: %s" % (getUnicode(key), getUnicode(value)) for key, value in headers.items() if getUnicode(key).upper() != HTTP_HEADER.HOST.upper())
ws.connect(url, header=wsHeaders, cookie=cookie) # WebSocket will add Host field of headers automatically
ws.send(urldecode(post or ""))