From: Christopher Faulet Date: Wed, 15 Dec 2021 10:42:23 +0000 (+0100) Subject: MINOR: stream: Handle appctx case first when creating a new stream X-Git-Tag: v2.6-dev2~58 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a742293ec968468b4120a4cb96953a25b5821d2a;p=thirdparty%2Fhaproxy.git MINOR: stream: Handle appctx case first when creating a new stream In the same way the previous commit, when a stream is created, the appctx case is now handled before the conn-stream one. The purpose of this change is to limit bugs during the SI/CS refactoring. --- diff --git a/src/stream.c b/src/stream.c index 98e34a993b..1b554cb49a 100644 --- a/src/stream.c +++ b/src/stream.c @@ -460,24 +460,26 @@ struct stream *stream_new(struct session *sess, enum obj_type *origin, struct bu si_set_state(&s->si[0], SI_ST_EST); s->si[0].hcto = sess->fe->timeout.clientfin; - if (cs_conn(cs) && cs->conn->mux) { - if (cs->conn->mux->flags & MX_FL_CLEAN_ABRT) - s->si[0].flags |= SI_FL_CLEAN_ABRT; - if (cs->conn->mux->flags & MX_FL_HTX) - s->flags |= SF_HTX; - - if (cs->flags & CS_FL_WEBSOCKET) - s->flags |= SF_WEBSOCKET; - } /* Set SF_HTX flag for HTTP frontends. */ if (sess->fe->mode == PR_MODE_HTTP) s->flags |= SF_HTX; - /* attach the incoming connection to the stream interface now. */ - if (cs) - si_attach_cs(&s->si[0], cs); - else if (appctx) + if (appctx) si_attach_appctx(&s->si[0], appctx); + else if (cs) { + if (cs_conn(cs) && cs->conn->mux) { + if (cs->conn->mux->flags & MX_FL_CLEAN_ABRT) + s->si[0].flags |= SI_FL_CLEAN_ABRT; + if (cs->conn->mux->flags & MX_FL_HTX) + s->flags |= SF_HTX; + + if (cs->flags & CS_FL_WEBSOCKET) + s->flags |= SF_WEBSOCKET; + } + /* attach the incoming connection to the stream interface now. */ + si_attach_cs(&s->si[0], cs); + } + if (likely(sess->fe->options2 & PR_O2_INDEPSTR)) s->si[0].flags |= SI_FL_INDEP_STR;