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
A field value might be preceded and/or followed by optional whitespace (OWS); a single SP preceding the field-value is preferred for consistent readability by humans. The field value does not include any leading or trailing whitespace: OWS occurring before the first non-whitespace octet of the field value or after the last non-whitespace octet of the field value ought to be excluded by parsers when extracting the field value from a header field.
And yet, getHeader currently preserves any trailing optional whitespace (and doesn't even contain a stern warning about this in its Haddock docstring), which can easily result in subtle bugs when not taken into account when processing the field-value as returned by getHeader
I currently have to workaround this via helpers such as
--| Helper to workaround 'getHeader' currently not stripping trailing WSgetHeaderTrimmed::HasHeadersa=>CIByteString->a->MaybeByteString
getHeaderTrimmed n rq = rtrim <$> getHeader n rq
where
rtrim =fst.BS.spanEnd isWS
isWS 0x09=True
isWS 0x20=True
isWS _ =False
but it would be helpful in making getHeader less error-prone if it stripped trailing OWS by default.
The text was updated successfully, but these errors were encountered:
RFC7230 says (emphasis added):
And yet,
getHeader
currently preserves any trailing optional whitespace (and doesn't even contain a stern warning about this in its Haddock docstring), which can easily result in subtle bugs when not taken into account when processing the field-value as returned bygetHeader
I currently have to workaround this via helpers such as
but it would be helpful in making
getHeader
less error-prone if it stripped trailing OWS by default.The text was updated successfully, but these errors were encountered: