Skip to content

Commit c2114e3

Browse files
authored
Merge pull request #157 from croservices/cookie-parser-fix
Fix a misunderstanding of BNF syntax 4 years ago
2 parents f54aae8 + aad3e80 commit c2114e3

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

lib/Cro/HTTP/Cookie.pm6

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ my regex octet { <[\x21
1515
\x2D..\x3A
1616
\x3C..\x5B
1717
\x5D..\x7E]>*};
18-
my regex cookie-value { [ <octet> || '("' <octet> '")' ] };
18+
my regex cookie-value { [ <octet> || '"' <octet> '"' ] };
1919
my subset CookieValue of Str is export where /^ <cookie-value> $/;
2020

2121
my regex name { <[\w\d]> (<[\w\d-]>* <[\w\d]>)* };

t/http-cookie.t

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@ lives-ok { my CookieName $cn = "GoodName"; }, 'Correct cookie names are into the
55

66
dies-ok { my CookieName $cn = ""; }, "Empty cookie name is now allowed";
77

8+
dies-ok { my CookieValue $cv = '("cookie-octet")'; }, 'No parens allowed in a cookie';
9+
10+
lives-ok { my CookieValue $cv = '"cookie-octet"'; }, 'Cookie octet can be wrapped in double quotes';
11+
812
my @bad-chars = "\x00"..."\x1F", "\x7F", '(', ')',
913
'<', '>', '@', ',', ';', ':', '\\',
1014
'"', '/', '[', ']', '?', '=', '{',

0 commit comments

Comments
 (0)