IE10はハンドシェイクの後に接続を閉じます
-
12-11-2019 - |
質問
私はLibeventにWebSocketサーバーを実装しましたが、私はChromeやFirefoxに問題がない間、IE10では接続を確立できません。
ここにハンドシェイク:
IE10 Request:
GET /echo HTTP/1.1
Origin: 95.115.195.4
Sec-WebSocket-Key: rgPWUlUtk+h3CPWqk99OtA==
Connection: Upgrade
Upgrade: Websocket
Sec-WebSocket-Version: 8
User-Agent: Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.2; Trident/6.0)
Host: 95.115.195.4:5555
Cache-Control: no-cache
Server Response:
HTTP/1.1 101 Switching Protocols
Upgrade: Websocket
Connection: Upgrade
Sec-WebSocket-Accept: jGmgQ/jOvew8MU9o3bbqPG9PHlY=
Sec-WebSocket-Protocol: chat
.
IE10デバッガは次のとおりです。 Script12152:WebSocketエラー:誤ったHTTP応答。ステータスコード101
誰かが私が間違っていることを知っていますか?
ありがとう
解決
クライアントはサブプロトコルのリストを送信しませんでしたが、サーバーはサブプロトコル値として「チャット」を送り返しました。 IETF 6455 WebSocket Spec (セクションの終わり4.1クライアント要件):
6. If the response includes a |Sec-WebSocket-Protocol| header field
and this header field indicates the use of a subprotocol that was
not present in the client's handshake (the server has indicated a
subprotocol not requested by the client), the client MUST _Fail
the WebSocket Connection_.
.
サーバは、クライアントが「sec-websocket-protocol:subprotocol、...」ヘッダーをサーバーに送信した場合にのみ「sec-websocket-protocol:subprotocol」ヘッダーのみをクライアントに送信する必要があります。クライアントはサブプロトコルのリストを送信できることに注意してください。そうすると、サーバーはリストから1つを選択して応答して選択する必要があります。
FirefoxとChromeがあまりにも遅すぎて仕様の現在のバージョンに付着していない可能性があります。
所属していません StackOverflow