]> git.ipfire.org Git - thirdparty/squid.git/commit
Harden and speed up HTTP request-line parser
authorAmos Jeffries <amosjeffries@squid-cache.org>
Fri, 3 Sep 2010 05:17:22 +0000 (23:17 -0600)
committerAmos Jeffries <amosjeffries@squid-cache.org>
Fri, 3 Sep 2010 05:17:22 +0000 (23:17 -0600)
commit2f2bae0d84b4103d8ee7110e56a5acb80146217e
tree3e005f488bee8d196f30d4a24ee1761b7ed14284
parent292841a4a4bce93f97df6c9d056fa5575bf6d8d8
Harden and speed up HTTP request-line parser

An upgrade/fix to handling HTTP request-lines as specific by
section 5.1 of the RFCs. Specifically to handle a sequence of
unknown bytes up to a terminating LF (\n) octet.

* The semantics as previously documented are taken on. No changes
 there, but documentation clarified a bit. Some things previously not
 erroring are now doing so. External code impact is in the nature of
 reduced special cases to be handled. Specifically raw-CR weirdness in
 the request line fields. This occuring in URL was a vulnerability at
 least once before.

* Prior updates to HttpParser object for other parse stages opens the
 possibility of this parse action returning HTTP status code directly.
 Additions are done to make use of this (with the existing status codes
 only).

* Input permutations where the unit-tests showed the old parser was
 violating its own documentation have been fixed to produce expected
 outputs.

* Old parser operated three distinct potentially long parse loops.
 Added several local variables to remember various octets seen while
 searching for the terminal LF. This removed the need for two of the
 parse re-scans (length of method, length of URI).

* relaxed_header_parser will enable it to also skip prefix whitespace
 (space character only) and multiple-\r sequences at the end of line.

* --enable-http-violations is still required before it will accept
 non-HTTP version types 'downgraded' to HTTP/0.9
src/HttpMsg.cc
src/HttpMsg.h