]> git.ipfire.org Git - thirdparty/haproxy.git/commit
MINOR: stream: Add a function to validate TCP to H1 upgrades
authorChristopher Faulet <cfaulet@haproxy.com>
Thu, 21 Jan 2021 16:36:12 +0000 (17:36 +0100)
committerChristopher Faulet <cfaulet@haproxy.com>
Thu, 28 Jan 2021 15:27:48 +0000 (16:27 +0100)
commit4ef84c9c41108038381bd3d03787fea304af4364
tree7691f32be9eaf304f85837c92fa6dbbf6c399404
parent39c7b6b09d205bccfdc7f2bb153153c25491c4a6
MINOR: stream: Add a function to validate TCP to H1 upgrades

TCP to H1 upgrades are buggy for now. When such upgrade is performed, a
crash is experienced. The bug is the result of the recent H1 mux
refactoring, and more specifically because of the commit c4bfa59f1 ("MAJOR:
mux-h1: Create the client stream as later as possible"). Indeed, now the H1
mux is responsible to create the frontend conn-stream once the request
headers are fully received. Thus the TCP to H1 upgrade is a problem because
the frontend conn-stream already exists.

To fix the bug, we must keep this conn-stream and the associate stream and
use it in the H1 mux. To do so, the upgrade will be performed in two
steps. First, the mux is upgraded from mux-pt to mux-h1. Then, the mux-h1
performs the stream upgrade, once the request headers are fully received and
parsed. To do so, stream_upgrade_from_cs() must be used. This function set
the SF_HTX flags to switch the stream to HTX mode, it removes the SF_IGNORE
flags and eventually it fills the request channel with some input data.

This patch is required to fix the TCP to H1 upgrades and is intimately
linked with the next commits.
include/haproxy/stream.h
src/stream.c