Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Baggage header parsing regex missing whitespace #77

Closed
x48zhu opened this issue May 17, 2023 · 2 comments
Closed

Baggage header parsing regex missing whitespace #77

x48zhu opened this issue May 17, 2023 · 2 comments

Comments

@x48zhu
Copy link

x48zhu commented May 17, 2023

Hello,
While I'm looking at how key-value pairs are parsed from the baggage header here, I think it include the space and tab, which are valid characters according to the doc, in the key or value.

For example, if I have a baggage header whose content is "key = value", the current behavior returns "key " and " value" (including the whitespace).

I think a better Regex expression could be (%S+)%s*=%s*(%S+)

@yangxikun
Copy link
Owner

Leading and trailing whitespaces (OWS) are allowed and are not considered to be a part of the key.
Leading and trailing whitespaces (OWS) are allowed and are not considered to be a part of the value.

I think we can trim the key and value after split.

@x48zhu
Copy link
Author

x48zhu commented May 18, 2023

Yeah, that should work too.
Or you could try the Regex expression (%S+)%s*=%s*(%S+) I think it works correctly for me.
Either way is fine!

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

No branches or pull requests

2 participants