Skip to content

Incorrect whitespace handling in header parsing #301

@zaphoyd

Description

@zaphoyd

Per Wolfram Schroers on the mailing list:

The header in a HTTP response from the server contains key-value pairs, e.g.

HTTP/1.1 101 Switching Protocols
Upgrade: websocket
Connection: Upgrade
Sec-WebSocket-Accept:ne1Cn3Pig3Bqgn6+CUWjDKC8/LE=

According to section 1.3 in RFC6455 the syntax of header fields follows the specification in section 4.2 in RFC 2616. The latter says

[...] Each header field consists

of a name followed by a colon (":") and the field value. Field names
are case-insensitive. The field value MAY be preceded by any amount
of LWS, though a single SP is preferred.

Expected behavior: The above HTTP response is valid.

Observed behavior: The above response causes the connection to fail. Only after adding a space after the colon in the last line (Sec-WebSocket-Accept: ne1Cn3Pig3Bqgn6+CUWjDKC8/LE=) a valid connection is established.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions