]> git.ipfire.org Git - thirdparty/haproxy.git/commit
BUG/MEDIUM: h2: improve handling of frames received on closed streams
authorWilly Tarreau <w@1wt.eu>
Wed, 27 Dec 2017 14:07:30 +0000 (15:07 +0100)
committerWilly Tarreau <w@1wt.eu>
Wed, 27 Dec 2017 17:44:22 +0000 (18:44 +0100)
commitab83750a29191ea841c80ed7c170630d45bfea43
tree6bfaa6757775eac45b2a22d5a3871872e4eeb28a
parenta20a519b8f6d56b95f7f6b5e2b88087ac5889b2e
BUG/MEDIUM: h2: improve handling of frames received on closed streams

The h2spec utility found certain situations where we're returning an
RST_STREAM while a GOAWAY is expected. While we can't always reliably
decide which one to use (eg: after a stream has been closed for a long
time), in practice we often still have the stream available until it's
destroyed at the application level. This provides the flags we need to
verify the conditions that led to its closure, namely if RST was sent
or received, or if it was regularly closed using a double ES.

The first step consists in marking all closed streams as having already
sent an RST_STREAM frame. This will ensure that we can send an RST_STREAM
for a late transmission on a stream we have forgotten about instead of
risking to break the connection. The next steps consist in re-arranging
the H2_SS_CLOSED checks so that we can deliver a GOAWAY frame for the
few cases where an unexpected frame was received after a double ES.

By carefully taking care of these specificities, we can reduce by 4 the
number of remaining compliance issues.

Note: some tests start to become a bit long and to be repeated at various
places. Probably that adding a bitmask of allowed/forbidden frame types
per state and/or per situation could significantly help. It's likely
that some deeper tests in the frame handlers could also be removed now
as they can't be triggered anymore.

This fix should be backported to 1.8.
src/mux_h2.c