From: Christopher Faulet Date: Mon, 15 Mar 2021 16:09:27 +0000 (+0100) Subject: MINOR: stream: Be sure to set HTTP analysers when creating an HTX stream X-Git-Tag: v2.4-dev15~59 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=57e4a1bf44598bc0f62e10da8778d762c976d9dc;p=thirdparty%2Fhaproxy.git 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. --- diff --git a/src/stream.c b/src/stream.c index 9ef292d928..58fd5718e7 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 */