Skip to content

Websocket Close Frame Doesn't Contain Status Code #545

@ntosta

Description

@ntosta

Per https://www.rfc-editor.org/rfc/rfc6455#section-5.5.1, when a websocket connection is closed, if the closing frame contains a body it should also contain a 2-byte 'closing status code'.

Currently, the code in question (https://github.com/CrowCpp/Crow/blob/master/include/crow/websocket.h#L169) just accepts a 'msg' parameter, but according to the RFC the signature for this function should be something like void close(uint16_t code, std::string const& reason)

With the current implementation, the first two bytes of the msg string are interpreted as the closing code and are missing from the reason string, as interpreted by standards-compliant implementations (like web browsers).

Metadata

Metadata

Assignees

No one assigned

    Labels

    featureCode based project improvement

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions