gimite / web-socket-js

HTML5 Web Socket implementation powered by Flash
BSD 3-Clause "New" or "Revised" License
2.73k stars 489 forks source link

Digest doesn't match error in IE9. #128

Open piotrfilipiuk opened 11 years ago

piotrfilipiuk commented 11 years ago

I have an error during the handshake with the WebSocket server from IE 9. Everything works well when using Chrome.

I use the following setup: WebSocket server: XSocket 2.0.3.1 (http://xsockets.net/) Web browser: IE 9

The output from the IE Console:

LOG: [WebSocket] policy file: xmlsocket://127.0.0.1:843 LOG: [WebSocket] policy file: xmlsocket://127.0.0.1:843 LOG: [WebSocket] policy file: xmlsocket://127.0.0.1:843 LOG: [WebSocket] policy file: xmlsocket://127.0.0.1:843 LOG: [WebSocket] policy file: xmlsocket://127.0.0.1:843 LOG: [WebSocket] connected LOG: [WebSocket] request header: GET /MyController HTTP/1.1 Host: 127.0.0.1:4502 Upgrade: websocket Connection: Upgrade Sec-WebSocket-Key: U3lCeF4hFmMaDwseWTgPOQ== Origin: https://localhost:44300 Sec-WebSocket-Version: 13 Cookie:

LOG: [WebSocket] connected LOG: [WebSocket] request header: GET /MyController HTTP/1.1 Host: 127.0.0.1:4502 Upgrade: websocket Connection: Upgrade Sec-WebSocket-Key: FQRkLCkFVg9HaQxkNG4KPg== Origin: https://localhost:44300 Sec-WebSocket-Version: 13 Cookie:

LOG: [WebSocket] connected LOG: [WebSocket] request header: GET /MyController HTTP/1.1 Host: 127.0.0.1:4502 Upgrade: websocket Connection: Upgrade Sec-WebSocket-Key: NhomaWR9KHRPAwNrMikiNQ== Origin: https://localhost:44300 Sec-WebSocket-Version: 13 Cookie:

LOG: [WebSocket] connected LOG: [WebSocket] request header: GET /MyController HTTP/1.1 Host: 127.0.0.1:4502 Upgrade: websocket Connection: Upgrade Sec-WebSocket-Key: ai8EM0VQEnMZLUJqJwpoNQ== Origin: https://localhost:44300 Sec-WebSocket-Version: 13 Cookie:

LOG: [WebSocket] connected LOG: [WebSocket] request header: GET /MyController HTTP/1.1 Host: 127.0.0.1:4502 Upgrade: websocket Connection: Upgrade Sec-WebSocket-Key: B2l3YCQHBBxXSFMLAAp2Vw== Origin: https://localhost:44300 Sec-WebSocket-Version: 13 Cookie:

LOG: [WebSocket] connected LOG: [WebSocket] request header: GET /MyController HTTP/1.1 Host: 127.0.0.1:4502 Upgrade: websocket Connection: Upgrade Sec-WebSocket-Key: I2RJJgBdHllYTWYUDT9ObQ== Origin: https://localhost:44300 Sec-WebSocket-Version: 13 Cookie:

LOG: [WebSocket] connected LOG: [WebSocket] request header: GET /MyController HTTP/1.1 Host: 127.0.0.1:4502 Upgrade: websocket Connection: Upgrade Sec-WebSocket-Key: cCE+TCYRd3hiFiJbMB4HGg== Origin: https://localhost:44300 Sec-WebSocket-Version: 13 Cookie:

LOG: [WebSocket] connected LOG: [WebSocket] request header: GET /MyController HTTP/1.1 Host: 127.0.0.1:4502 Upgrade: websocket Connection: Upgrade Sec-WebSocket-Key: CHZMMSYqLgh3GG92TU9+dw== Origin: https://localhost:44300 Sec-WebSocket-Version: 13 Cookie:

LOG: [WebSocket] connected LOG: [WebSocket] request header: GET /MyController HTTP/1.1 Host: 127.0.0.1:4502 Upgrade: websocket Connection: Upgrade Sec-WebSocket-Key: WARoEGJ2dyE7OQ8PQyMjQg== Origin: https://localhost:44300 Sec-WebSocket-Version: 13 Cookie:

LOG: [WebSocket] response header: HTTP/1.1 101 Switching Protocols Upgrade: websocket Connection: Upgrade Sec-WebSocket-Accept:IAaEngje8CsI0IRzkV4DzXpMk6E=

[WebSocket] digest doesn't match: IAaEngje8CsI0IRzkV4DzXpMk6E= != 0oKtH5cBPzkZy+zpump4VG1Tk1E= LOG: [WebSocket] closed LOG: onclose LOG: [object Object]

I have the Flash socket policy file provided (I am using http://socketpolicyfile.codeplex.com/). I use the following javascript code:

This error happens only in the situation when many simultainous connections are made i.e. as in the logs above.

Regards, Piotr

gimite commented 11 years ago

Thanks for the report. I didn't test much using multiple WebSocket objects, so it may have bug handling such a case. But at a glance, I cannot find it.

piotrfilipiuk commented 11 years ago

Actually, neither can I. I read the specification and it seems that the implementation is correct. I will try to look into it myself as well.

On 18 December 2012 14:09, Hiroshi Ichikawa notifications@github.comwrote:

Thanks for the report. I didn't test much using multiple WebSocket objects, so it may have bug handling such a case. But at a glance, I cannot find it.

— Reply to this email directly or view it on GitHubhttps://github.com/gimite/web-socket-js/issues/128#issuecomment-11487195.

Best regards, Piotr

brunofrank commented 11 years ago

I'm with the same problem, but this only broke in production, in my development machine works like a charm!

send> "GET /socket.io/1/websocket/-lT4D1TkQvKNDuaIXfyB HTTP/1.1\r\n" send> "Upgrade: WebSocket\r\n" send> "Connection: Upgrade\r\n" send> "Host: 127.0.0.1:8080\r\n" send> "Origin: http://127.0.0.1:8080\r\n" send> "Sec-WebSocket-Key1: 1 21\"A 9Dk188 \"Yn3\r\n" send> "Sec-WebSocket-Key2: 1\ 21I 16 6 3 ;) nk6 8o=4=\r\n" send> "\r\n" send> "O\xDCHHj\xFFP\xE5" recv> "HTTP/1.1 101 WebSocket Protocol Handshake\r\n" recv> "Upgrade: WebSocket\r\n" recv> "Connection: Upgrade\r\n" recv> "Sec-WebSocket-Origin: http://127.0.0.1:8080\r\n" recv> "Sec-WebSocket-Location: ws://127.0.0.1:8080/socket.io/1/websocket/-lT4D1TkQvKNDuaIXfyB\r\n" recv> "\r\n" recv> "~\xE0\x06.A\xE0\xA0\xC3\xCE6\x81lH\r\xF1g" WebSocket::Error: security digest doesn't match: "~\xE0\x06.A\xE0\xA0\xC3\xCE6\x81lH\r\xF1g" != "\xC7\xA4\x82}\xDB\xC1\x04\xBBL~n\xD9\xB1/\xE78"

I thin that is anything with encoding.

gimite commented 11 years ago

It looks like you use web-socket-ruby, not web-socket-js. Right?