[core] reject Transfer-Encoding + Content-Length (#2985)
commit66624b375b6f1ceae446ba09d55f123683506337
authorGlenn Strauss <gstrauss@gluelogic.com>
Sun, 6 Oct 2019 19:14:05 +0000 (6 15:14 -0400)
committerGlenn Strauss <gstrauss@gluelogic.com>
Sun, 26 Jan 2020 05:41:04 +0000 (26 00:41 -0500)
treedaa1164dd120c1805746ff6ff2d15a0db83f990e
parent61f85d14ee4444755e0771495b97af11162448dd
[core] reject Transfer-Encoding + Content-Length (#2985)

reject requests with both Transfer-Encoding and Content-Length
as recommended in RFC 7230 Section 3.3.3.

strict header parsing is enabled by default in lighttpd.  However,
if explicitly disabled in lighttpd.conf, lighttpd will continue to
accept Transfer-Encoding and Content-Length in the same request,
and will ignore (and remove) Content-Length before passing to backend.
  UNSAFE: server.http-parseopts = ( "header-strict" => "disable" )
  This is NOT RECOMMENDED since doing so disables other protections
  provided by lighttpd strict http header parsing.

RFC7230 Hypertext Transfer Protocol (HTTP/1.1): Message Syntax and Routing
  3.3.3.  Message Body Length
  [...]
  If a message is received with both a Transfer-Encoding and a
  Content-Length header field, the Transfer-Encoding overrides the
  Content-Length.  Such a message might indicate an attempt to
  perform request smuggling (Section 9.5) or response splitting
  (Section 9.4) and ought to be handled as an error.  A sender MUST
  remove the received Content-Length field prior to forwarding such
  a message downstream.

x-ref:
  stricter request header parsing
  https://redmine.lighttpd.net/issues/2985
src/request.c