[Webkit-unassigned] [Bug 85737] New: [Qt] WebSocket-Protocol header not implemented correctly

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Sun May 6 09:58:15 PDT 2012


https://bugs.webkit.org/show_bug.cgi?id=85737

           Summary: [Qt] WebSocket-Protocol header not implemented
                    correctly
           Product: WebKit
           Version: 528+ (Nightly build)
          Platform: PC
        OS/Version: Linux
            Status: UNCONFIRMED
          Severity: Normal
          Priority: P3
         Component: WebKit Qt
        AssignedTo: webkit-unassigned at lists.webkit.org
        ReportedBy: fenske at iblue-consulting.de


Hi,

I am reporting a bug in qt-everywhere-opensource-src-4.7.4.tar.gz. I am not quite sure, if this belongs in this bug tracker. 

I am using capybara-webkit (ruby stuff) to test against jetty websocket server. I am using the following javascript:

    socket = new WebSocket("ws://localhost:8888/api/v1/driver", "myprotocol");

The console returns: "Error during WebSocket handshake: protocol mismatch: myprotocol != "

If I look in the packet dumps, I see, that Qt Websocket is sending:

GET /api/v1/driver HTTP/1.1
Upgrade: WebSocket
Connection: Upgrade
Host: 127.0.0.1:8888
Origin: http://127.0.0.1:59227
WebSocket-Protocol: myprotocol


And the Server is responding:

HTTP/1.1 101 Web Socket Protocol Handshake
Upgrade: WebSocket
Connection: Upgrade
WebSocket-Origin: http://127.0.0.1:59227
WebSocket-Location: ws://127.0.0.1:8888/api/v1/driver

There is no WebSocket-Protocol Header from the server, because according to the RFCs I found, it is only needed if the server does use a protocol not specified by the client. In this case, the Server uses the "myprotocol" protocol, so no WebSocket-Protocol header is needed. I tracked down the issue to qt-everywhere-opensource-src-4.7.4/src/3rdparty/webkit/WebCore/websockets/WebSocketHandshake.cpp. The following patch fixes it.


--- WebSocketHandshake.cpp.old    2012-05-06 18:35:33.659494866 +0200
+++ WebSocketHandshake.cpp    2012-05-06 18:35:36.179513204 +0200
@@ -491,7 +491,7 @@
         m_context->addMessage(ConsoleDestination, JSMessageSource, LogMessageType, ErrorMessageLevel, "Error during WebSocket handshake: location mismatch: " + clientLocation() + " != " + m_wsLocation, 0, clientOrigin());
         return;
     }
-    if (!m_clientProtocol.isEmpty() && m_clientProtocol != m_wsProtocol) {
+    if (!m_wsProtocol.isEmpty() && m_clientProtocol != m_wsProtocol) {
         m_context->addMessage(ConsoleDestination, JSMessageSource, LogMessageType, ErrorMessageLevel, "Error during WebSocket handshake: protocol mismatch: " + m_clientProtocol + " != " + m_wsProtocol, 0, clientOrigin());
         return;
     }

-- 
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.



More information about the webkit-unassigned mailing list