http icon indicating copy to clipboard operation
http copied to clipboard

Deny leading/trailing whitespace in HeaderValue ( fixes #245 ).

Open hannesg opened this issue 7 years ago • 5 comments

According to rfc7230 http parsers are expected to ignore space around header values. Trying to construct a HeaderValue with leading or trailing whitespace is therefore clearly an error.

hannesg avatar Sep 22 '18 22:09 hannesg

I don't know if I agree that extra work should be done to make it an error. I could probably be convinced either way. Maybe @seanmonstar has thoughts on this?

carllerche avatar Sep 25 '18 05:09 carllerche

I guess it depends on how the additional checks affect performance. Is it possible to see some benchmark results of before and after?

seanmonstar avatar Sep 25 '18 18:09 seanmonstar

It's kind of understandable for from_static but sort of a shame to add this on try_from_generic (up-to-date method) since httparse already makes sure that leading and trailing spaces are not part of the header values it parses.

robjtede avatar Apr 27 '22 00:04 robjtede