You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As can be seen in this playground, it doesn't handle whitespace around the comma properly. (The playground isn't working consistently, I think because of back-end weirdness. But the code works.)
If the header is like 1.1.1.1,2.2.2.2, 3.3.3.3, the resulting addr will be 1.1.1.1,2.2.2.2. If the header is like 1.1.1.1 , 2.2.2.2, the resulting addr will be 1.1.1.1<space>.
RFC 2616 states that there can be "linear white space" (LWS; space or tab) around the values and commas. For example:
each separated by one or more commas (",") and OPTIONAL linear white space (LWS). This makes the usual form of lists very easy; a rule such as ( *LWS element *( *LWS "," *LWS element ))
And:
Except where noted otherwise, linear white space (LWS) can be included between any two adjacent words (token or quoted-string), and between adjacent words and separators, without changing the interpretation of a field.
Describe the bug
The current code looks like this:
As can be seen in this playground, it doesn't handle whitespace around the comma properly. (The playground isn't working consistently, I think because of back-end weirdness. But the code works.)
If the header is like
1.1.1.1,2.2.2.2, 3.3.3.3
, the resultingaddr
will be1.1.1.1,2.2.2.2
. If the header is like1.1.1.1 , 2.2.2.2
, the resultingaddr
will be1.1.1.1<space>
.RFC 2616 states that there can be "linear white space" (LWS; space or tab) around the values and commas. For example:
And:
I will submit a PR shortly.
Versions
go1.18
master HEAD
Steps to Reproduce
Code here: https://go.dev/play/p/uTO1eaTRsbx
Expected behavior
Proper handling of whitespace.
The text was updated successfully, but these errors were encountered: