HTTP 1.1 parser whitespace in header value

Андрей Аладьев aladjev.andrew at gmail.com
Wed May 6 11:00:28 UTC 2020


Hello. I've read nginx HTTP parser and found the following line:

/* header value */
case sw_value:
  switch (ch) {
    case ' ':
      r->header_end = p;
      state = sw_space_after_value;
      break;

It means that nginx HTTP parser will finish header value immediately after
whitespace. But RFC 7230 declares the following:

header-field   = field-name ":" OWS field-value OWS
field-value    = *( field-content / obs-fold )
field-content  = field-vchar [ 1*( SP / HTAB ) field-vchar ]
field-vchar    = VCHAR / obs-text

"field-vchar [ 1*( SP / HTAB ) field-vchar ]" I think this ABNF means
header value can have SP or HTAB between visible chars.

So it looks like nginx HTTP parser is broken. What do you think about it?
Thank you.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.nginx.org/pipermail/nginx-devel/attachments/20200506/10d43fea/attachment.htm>


More information about the nginx-devel mailing list