Skip to content

Kaazing WebSocket client doesn't enforce invalid Sec-WebSocket-Protocol #34

@robinzimmermann

Description

@robinzimmermann

Gateway with version:

Gateway 5.0

Can the bug be reproduced in a Kaazing demo out-of-the-box?

No.

Steps to reproduce:

Follow the instructions specified in Gateway sends response with invalid Sec-WebSocket-Protocol header #472

WebSocket connection to 'ws://localhost:8080/mqtt' failed: Error during WebSocket handshake: Sent non-empty 'Sec-WebSocket-Protocol' header but no response was received

Now, modify mqtt.html by adding the following lines above the <script src="mqttws31.js"></script> line:

<script src="http://cache.kaazing.net/bower/kaazing-websocket-client-javascript/5.0.0-50/WebSocket.js"></script>
<script>
    window.WebSocket = Kaazing.Gateway.WebSocket;
</script>

Open mqtt.html in a browser: http://localhost:8000/mqtt.html. Notice that the app succeeds, and the echoed message is written to the screen.

However this should not succeed because the server never send a Sec-WebSocket-Protocol header with the value of "mqtt". But it should have because the request contained the Sec-WebSocket-Protocol header with the value of "mqtt".

In the first case, the browser is enforcing the RFC 6455 spec. In the second case, the Kaazing client library should be doing the same enforcement, but is not.

Expected behavior:

In both cases, the handshake should fail.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions