Skip to content
This repository was archived by the owner on May 5, 2021. It is now read-only.
This repository was archived by the owner on May 5, 2021. It is now read-only.

Escaping backslashes in headers #77

@onemanclapping

Description

@onemanclapping

I have a use case where I need to send a backslash in a header of a SUBSCRIBE frame.

The STOMP specification states that:

C style string literal escapes are used to encode any colons and newlines that are found within the UTF-8 encoded headers. When decoding frame headers, the following transformations MUST be applied:

\n (octet 92 and 110) translates to newline (octet 10)
\c (octet 92 and 99) translates to : (octet 58)
\\ (octet 92 and 92) translates to \ (octet 92)

Currently, webstomp-client (as well as jmesnil's stomp-websocket) does not escape \ into \\:

Object.keys(this.headers).forEach(name => {
    let value = this.headers[name];
    lines.push(`${name}:${value}`);
});

What are your thoughts on this? Shouldn't this be implemented in the library, since it's something defined in the specification, and should therefore not a responsability of the client application?

Thanks.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions