-
-
Notifications
You must be signed in to change notification settings - Fork 167
Description
This library isn't compliant to the HTTP/1.1 RFC currently regarding header parsing. I wanted to open an issue for https://github.com/ringcentral/psr7, but issues are not available there.
There's no whitespace allowed before the colon (:) that separates field name and field value as defined in https://tools.ietf.org/html/rfc7230#section-3.2. This is further elaborated in https://tools.ietf.org/html/rfc7230#section-3.2.4.
I noticed this while I had a look at the regex we use in Aerys. That regex is also wrong, because it allows duplicate and optional \r and doesn't trim trailing whitespace correctly. Further post-processing isn't done, so trailing whitespace is included in the header value. We probably keep ignoring a missing \r, but will fix the latter issue in our code. I therefore built an optimized regex that you might want to use. If you use that regex, you must add a check that the number of lines is equal to the number of matches of preg_match_all().