]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: mux-h2: set H2_SF_HEADERS_RCVD when a HEADERS frame was decoded
authorWilly Tarreau <w@1wt.eu>
Wed, 2 Jan 2019 14:49:20 +0000 (15:49 +0100)
committerWilly Tarreau <w@1wt.eu>
Thu, 3 Jan 2019 17:45:38 +0000 (18:45 +0100)
Doing this will be needed to be able to tell the difference between a
headers block and a trailers block.

src/mux_h2.c

index 416f3ec6912530583c81f45082b4e6d10555fcdc..6b79e0ceefea26d769912f3301c8d01b0c9fc61e 100644 (file)
@@ -173,6 +173,8 @@ enum h2_ss {
 #define H2_SF_HEADERS_SENT      0x00001000  // a HEADERS frame was sent for this stream
 #define H2_SF_OUTGOING_DATA     0x00002000  // set whenever we've seen outgoing data
 
+#define H2_SF_HEADERS_RCVD      0x00004000  // a HEADERS frame was received for this stream
+
 /* H2 stream descriptor, describing the stream as it appears in the H2C, and as
  * it is being processed in the internal HTTP representation (H1 for now).
  */
@@ -3201,6 +3203,12 @@ static void h2_shutw(struct conn_stream *cs, enum cs_shw_mode mode)
  * Please note that the HEADERS frame is always deprived from its PADLEN byte
  * however it may start with the 5 stream-dep+weight bytes in case of PRIORITY
  * bit.
+ *
+ * The <flags> field must point to either the stream's flags or to a copy of it
+ * so that the function can update the following flags :
+ *   - H2_SF_DATA_CLEN when content-length is seen
+ *   - H2_SF_DATA_CHNK when chunking should be used for the H1 conversion
+ *   - H2_SF_HEADERS_RCVD once the frame is successfully decoded
  */
 static int h2c_decode_headers(struct h2c *h2c, struct buffer *rxbuf, uint32_t *flags)
 {
@@ -3376,6 +3384,9 @@ next_frame:
                        *flags |= H2_SF_DATA_CHNK;
        }
 
+       /* indicate that a HEADERS frame was received for this stream */
+       *flags |= H2_SF_HEADERS_RCVD;
+
        if (htx && h2c->dff & H2_F_HEADERS_END_STREAM)
                if (!htx_add_endof(htx, HTX_BLK_EOM))
                        goto fail;