Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WebSocket draft-00 / hixie-76 doesn't work when request headers are attached in the query string #1403

Closed
slovdahl opened this issue Dec 17, 2013 · 1 comment

Comments

@slovdahl
Copy link
Contributor

The problem is:

  • Client opens initial WebSocket handshake with request URI: /chat?X-Atmosphere-tracking-id=0&X-Atmosphere-Framework=2.1.1-jquery&X-Atmosphere-Transport=websocket&X-Cache-Date=0&Content-Type=application%2Fjson&X-atmo-protocol=true
  • Atmosphere parses all query string parameters belonging to Atmosphere and resets the query string without those parameters ( )
  • Jetty creates a Sec-WebSocket-Location header (http://tools.ietf.org/html/draft-hixie-thewebsocketprotocol-76#section-8.5) with the complete request URI including query string. In this case the Sec-WebSocket-Location header does NOT contain the Atmosphere query string parameters.
  • The client compares the requested URI (/chat?X-Atmosphere-tracking-id=0&X-Atmosphere-Framework=2.1.1-jquery&X-Atmosphere-Transport=websocket&X-Cache-Date=0&Content-Type=application%2Fjson&X-atmo-protocol=true) with the Sec-WebSocket-Location header (/chat) and notices that they differ -> connection failed.
@slovdahl
Copy link
Contributor Author

ngrep:

T 2013/12/10 14:59:14.353396 127.0.0.1:35886 -> 127.0.0.1:8080 [AP]
  GET /chat?X-Atmosphere-tracking-id=0&X-Atmosphere-Framework=2.1.1-jquery&X-Atmosphere-Transport=websocket&X-Cache-Date=0&Content-Type=application%2Fjson&X-atmo-protocol=true HTTP/1.1..
  Upgrade: WebSocket..
  Connection: Upgrade..
  Host: 127.0.0.1:8080..
  Origin: http://127.0.0.1:8080..
  Sec-WebSocket-Key1: 3C9 ^2Z119 QP,9& 9 96%=..
  Sec-WebSocket-Key2: 4t>D089 co807 81 K....E...X...                   
###
T 2013/12/10 14:59:14.370107 127.0.0.1:8080 -> 127.0.0.1:35886 [AP]
  HTTP/1.1 101 WebSocket Protocol Handshake..
  X-Atmosphere-tracking-id: 8c18b3b5-2c90-4a87-9219-11823c11a50d..
  Upgrade: WebSocket..
  Connection: Upgrade..
  Sec-WebSocket-Origin: http://127.0.0.1:8080..
  Sec-WebSocket-Location: ws://127.0.0.1:8080/chat....

Log from old WebKit based browser that uses draft-00 / hixie-76:

Error during WebSocket handshake: location mismatch: ws://127.0.0.1:8080/chat?X-Atmosphere-tracking-id=0&X-Atmosphere-Framework=2.1.1-jquery&X-Atmosphere-Transport=websocket&X-Cache-Date=0&Content-Type=application%2Fjson&X-atmo-protocol=true != ws://127.0.0.1:8080/chat

The error message clearly comes from line 600 in http://trac.webkit.org/browser/branches/safari-534.51-branch/Source/WebCore/websockets/WebSocketHandshake.cpp#L600.

The problem can also be verified with Opera 12.00 (http://www.opera.com/download/guide/?custom=yes) with WebSocket enabled.

slovdahl added a commit that referenced this issue Dec 17, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant