From 57e4a1bf44598bc0f62e10da8778d762c976d9dc Mon Sep 17 00:00:00 2001 From: Christopher Faulet Date: Mon, 15 Mar 2021 17:09:27 +0100 Subject: [PATCH] MINOR: stream: Be sure to set HTTP analysers when creating an HTX stream Always set frontend HTTP analysers when an HTX stream is created. It is only useful in case a destructive HTTP upgrades (TCP>H2) because the frontend is a TCP proxy. In fact, to be strict, we must only set these analysers when the upgrade is performed before setting the backend (it is not supported yet, but this patch is required to do so), in the frontend part. If the upgrade happens when the backend is set, it means the HTTP processing is just the backend buisness. But there is no way to make the difference when a stream is created, at least for now. --- src/stream.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/stream.c b/src/stream.c index 9ef292d92..58fd5718e 100644 --- a/src/stream.c +++ b/src/stream.c @@ -504,6 +504,14 @@ struct stream *stream_new(struct session *sess, enum obj_type *origin, struct bu s->req.flags |= CF_READ_ATTACHED; /* the producer is already connected */ s->req.analysers = sess->listener ? sess->listener->analysers : 0; + if (IS_HTX_STRM(s)) { + /* Be sure to have HTTP analysers because in case of + * "destructive" stream upgrade, they may be missing (e.g + * TCP>H2) + */ + s->req.analysers |= AN_REQ_WAIT_HTTP|AN_REQ_HTTP_PROCESS_FE; + } + if (!sess->fe->fe_req_ana) { channel_auto_connect(&s->req); /* don't wait to establish connection */ channel_auto_close(&s->req); /* let the producer forward close requests */