As found in #22931, if an invalid cookie value is found while parsing, the rest of the cookie is silently ignored. The expected behavior is undefined in RFC 6265, but does state that if unexpected values are encountered that user agents MAY ignore an entire set-cookie string (not just a subsection of it). Given that, invalid cookie portions should likely be handled by either: 1. Ignore the cookie string in its entirety and log an error message, or 2. Ignore invalid cookie-pairs but still parse the rest of the string The latter would likely be the best path (Postel's law and all)
Sure, but this is in regards to the initial matching, not the parsing. Because the pattern expects RFC conformity, in this cookie string: Cookie: a=b; c=[; d=r; f=h The only matching parts will be: Cookie: a=b; The rest will be discarded. What I'm proposing is that this should instead result in: Cookie: a=b; d=r; f=h The recent changes would stay intact.