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

Escaping backslashes in headers #77

Open
onemanclapping opened this issue Oct 11, 2018 · 3 comments
Open

Escaping backslashes in headers #77

onemanclapping opened this issue Oct 11, 2018 · 3 comments

Comments

@onemanclapping
Copy link

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.

@JSteunou
Copy link
Owner

I agree. Up to make a PR ?

@leandrogaspar
Copy link

@JSteunou @onemanclapping do you guys mind if I give it a try?

@JSteunou
Copy link
Owner

You are more than welcome

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants