WebSocket - Safari 9 - Invalid UTF-8 Sequence in Header Value

I am creating a WebSocket that works in Chrome version 47.0.2526.106 (64-bit) but does not work in Safari version 9.0.2 (11601.3.9). The error Invalid UTF-8 sequence in header value. It seems that Safari requires the inclusion of certain headers and in certain formats, but I can not find that.

I used an open source string WebSocketHandshake

if (valueStr.isNull()) {
    m_context->addMessage(JSMessageSource, LogMessageType, ErrorMessageLevel, "invalid UTF-8 sequence in header value", 0, clientOrigin(), 0);
    return 0;
}

The request is as follows:

General

Request URL:wss://example.server.io/query?string=test
Request Method:GET
Status Code:101 Switching Protocols

Answer Headers

Connection:Upgrade
Sec-WebSocket-Accept:R3JnbOI454z48aMONLd+8HP6Asg=
Set-Cookie:
Upgrade:websocket

Request Headers

Accept-Encoding:gzip, deflate, sdch
Accept-Language:en-US,en;q=0.8,fr;q=0.6,fr-CA;q=0.4
Cache-Control:no-cache
Connection:Upgrade
DNT:1
Host:example.server.io
Origin:http://localhost:3000
Pragma:no-cache
Sec-WebSocket-Extensions:permessage-deflate; client_max_window_bits
Sec-WebSocket-Key:QUuX6/L23NIezYa4aZJbFw==
Sec-WebSocket-Version:13
Upgrade:websocket
User-Agent:Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/47.0.2526.106 Safari/537.36

Query String Parameters

string:test
+4
source share
1 answer

Safari/WebKit . Set-Cookie:. Webkit. Chrome , Blink.
, .

+2

Source: https://habr.com/ru/post/1623430/


All Articles