]> git.ipfire.org Git - thirdparty/squid.git/commit
Harden and speed up HTTP request-line parser
authorAmos Jeffries <amosjeffries@squid-cache.org>
Thu, 2 Sep 2010 03:02:53 +0000 (21:02 -0600)
committerAmos Jeffries <amosjeffries@squid-cache.org>
Thu, 2 Sep 2010 03:02:53 +0000 (21:02 -0600)
commitef1ecdccb472f518dd495189e3dddbea70c1955a
tree97f4e87ffa14a65ef36917539043c731e9ea0cb7
parent15267b2209f6b7233e46d9145cb440fbe536db67
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