]> git.ipfire.org Git - thirdparty/haproxy.git/commit
[MEDIUM] http: fix space handling in the request cookie parser
authorWilly Tarreau <w@1wt.eu>
Tue, 31 Aug 2010 14:45:02 +0000 (16:45 +0200)
committerWilly Tarreau <w@1wt.eu>
Tue, 31 Aug 2010 22:02:21 +0000 (00:02 +0200)
commiteb7b0a2b56e9b9cb9df170589699b53c1f0a7350
treefa8fd4e400c5e8c0509404aec7fdbaaa3d2532ae
parenta79094d3e41e9f8e64b709c5dd1cb5bf6fdae93d
[MEDIUM] http: fix space handling in the request cookie parser

The request cookie parser did not allow spaces to appear in cookie
values nor around the equal sign. The various RFCs on the subject
say different things, some suggesting that a space is allowed after
the equal sign and being worded in a way that lets one believe it
is allowed before too. Some spaces may appear inside values and be
part of the values. The quotes allow delimiters to be embedded in
values. The spaces before and after attributes should be trimmed.

The new parser addresses all those points and has been carefully tested.
It fixes misplaced spaces around equal signs before processing the cookies
or forwarding them. It also tries its best to perform clean removals by
always keeping the delimiter after the value being removed and leaving one
space after it.

The variable inside the parser have been renamed to make the code a lot
more understandable, and one multi-function pointer has been eliminated.

Since this patch fixes real possible issues, it should be backported to 1.4
and possibly 1.3, since one (single) case of wrong spaces has been reported
in 1.3.

The code handling the Set-Cookie has not been touched yet.
src/proto_http.c
tests/test-cookie-appsess.cfg [new file with mode: 0644]
tests/test-cookie-indirect.cfg [new file with mode: 0644]
tests/test-cookie-insert.cfg [new file with mode: 0644]
tests/test-cookie-passive.cfg [new file with mode: 0644]
tests/test-cookie-prefix.cfg [new file with mode: 0644]
tests/test-cookie-rewrite.cfg [new file with mode: 0644]