]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: stream: Set a flag when the stream uses the HTX
authorChristopher Faulet <cfaulet@haproxy.com>
Wed, 3 Apr 2019 08:01:07 +0000 (10:01 +0200)
committerChristopher Faulet <cfaulet@haproxy.com>
Fri, 12 Apr 2019 20:06:53 +0000 (22:06 +0200)
The flag SF_HTX has been added to know when a stream uses the HTX or not. It is
set when an HTX stream is created. There are 2 conditions to set it. The first
one is when the HTTP frontend enables the HTX. The second one is when the attached
conn_stream uses an HTX multiplexer.

include/types/stream.h
src/stream.c

index 5e854c54bb29d94bd841b97321068afd105305e7..93a39a3ecc7bb3a216cbcaf5bf7e19a66c077567 100644 (file)
@@ -58,7 +58,7 @@
 #define SF_REDISP      0x00000100      /* set if this stream was redispatched from one server to another */
 /* unused: 0x00000200 */
 #define SF_REDIRECTABLE        0x00000400      /* set if this stream is redirectable (GET or HEAD) */
-/* unused: 0x00000800 */
+#define SF_HTX          0x00000800      /* set if this stream is an htx stream */
 
 /* stream termination conditions, bits values 0x1000 to 0x7000 (0-9 shift 12) */
 #define SF_ERR_NONE     0x00000000     /* normal end of request */
index 764c5f32ecec4bc6d1d9cdab7671bca0f8242c93..551f8e2ccfa300e5f6239a6a7d54c6b3cc51e791 100644 (file)
@@ -236,8 +236,15 @@ struct stream *stream_new(struct session *sess, enum obj_type *origin)
        si_set_state(&s->si[0], SI_ST_EST);
        s->si[0].hcto = sess->fe->timeout.clientfin;
 
-       if (cs && cs->conn->mux && cs->conn->mux->flags & MX_FL_CLEAN_ABRT)
-               s->si[0].flags |= SI_FL_CLEAN_ABRT;
+       if (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;
+       }
+       /* Set SF_HTX flag for HTX frontends. */
+       if (sess->fe->mode == PR_MODE_HTTP && sess->fe->options2 & PR_O2_USE_HTX)
+               s->flags |= SF_HTX;
 
        /* attach the incoming connection to the stream interface now. */
        if (cs)