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.
This commit is contained in:
Christopher Faulet 2021-03-15 17:09:27 +01:00
parent e13ee703d2
commit 57e4a1bf44

View File

@ -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 */