Skip to content

Parsing of Sec-WebSocket-Protocol doesn't handle space after comma #632

@sbc100

Description

@sbc100

I'm not sure if the spec is clear on this but the example shown in https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/Sec-WebSocket-Protocol seems to show a space after the comma.

e.g. Sec-WebSocket-Protocol: soap, wamp

But websockify does not seem to handle this in protocols = headers.get('Sec-WebSocket-Protocol', '').split(',') and will produce a list of protocols that looks like ['soap', ' wamp'] in this case.

I noticed this in emscripten when trying to switch from the ws npm module to node's builtin WebSocket client: emscripten-core/emscripten#26682.

It seems like the builtin node WebSocket client will always produce this list with a space after each comma.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions