]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MEDIUM: stream: Don't immediatly ack the TCP to H1 upgrades
authorChristopher Faulet <cfaulet@haproxy.com>
Thu, 21 Jan 2021 16:31:04 +0000 (17:31 +0100)
committerChristopher Faulet <cfaulet@haproxy.com>
Thu, 28 Jan 2021 15:27:48 +0000 (16:27 +0100)
Instead of switching the stream to HTX mode, the request channel is only
reset (the request buffer is xferred to the mux) and the SF_IGNORE flag is
set on the stream. This flag prevent any processing in case of abort. Once
the upgrade confirmed, the flag is removed, in stream_upgrade_from_cs().

It is only the first part of the fix. The next one ("BUG/MAJOR: mux-h1:
Properly handle TCP to H1 upgrades") is also required. Both rely on the
following series of patches :

* MEDIUM: http-ana: Do nothing in wait-for-request analyzer if not htx
* MINOR: stream: Add a function to validate TCP to H1 upgrades
* MEDIUM: mux-h1: Add ST_READY state for the H1 connections
* MINOR: mux-h1: Wake up instead of subscribe for reads after H1C creation
* MINOR: mux-h1: Try to wake up data layer first before calling its wake callback
* MINOR: stream-int: Take care of EOS in the SI wake callback function
* BUG/MINOR: stream: Don't update counters when TCP to H2 upgrades are performed

This fix is specific for 2.4. No backport needed.

src/proxy.c

index 8b2cf4f14d33afd24c934fc4f46b2d25097ccbaa..0b1909974fdb2564128bb01f9b900a3b4130fe4b 100644 (file)
@@ -1457,7 +1457,9 @@ int stream_set_backend(struct stream *s, struct proxy *be)
                                        s->flags |= SF_IGNORE;
                                        return 0;
                                }
-                               s->flags |= SF_HTX;
+                               s->req.flags &= ~(CF_READ_PARTIAL|CF_AUTO_CONNECT);
+                               s->req.total = 0;
+                               s->flags |= SF_IGNORE;
                        }
                }
                else if (IS_HTX_STRM(s) && be->mode != PR_MODE_HTTP) {