2012-02-25 4 views
4

저는 libevent에 websocket 서버를 구현했고, Chrome이나 Firefox에는 문제가 없었습니다. IE10에서는 연결을 설정할 수조차 없었습니다. 여기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 : 웹 소켓 오류 : 잘못된 HTTP 응답. 상태 코드 101

누구나 내가 뭘 잘못하고 있는지 알 수 있습니까?

감사

답변

5

클라이언트는 하위 프로토콜 목록을 보내지 않았지만, 서버가 다시 전송 서브 - 프로토콜 값으로 "채팅"했다. IETF 6455 WebSocket spec의 19 페이지에 따르면 (섹션의 끝 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_. 

단지 "초 - 웹 소켓 프로토콜을 : 서브 프로토콜은"보내야 서버 클라이언트가 "초 -를 보낸 경우 다시 클라이언트로 헤더 WebSocket-Protocol : SUBPROTOCOL, ... "헤더를 서버에 추가하십시오. 클라이언트는 하위 프로토콜 목록을 보낼 수 있으며, 해당되는 경우 서버는 응답 할 목록에서 하나를 선택해야합니다.

Firefox와 Chrome이 너무 관대해서 현재 버전의 사양을 따르지 않았을 수 있습니다.

+1

해결했습니다. 감사! –