]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: h2: add new stream flag H2_SF_OUTGOING_DATA
authorWilly Tarreau <w@1wt.eu>
Tue, 7 Nov 2017 11:01:53 +0000 (12:01 +0100)
committerWilly Tarreau <w@1wt.eu>
Tue, 7 Nov 2017 13:47:04 +0000 (14:47 +0100)
This one indicates whether we've received data to mux out. It helps
make the difference between a clean close and a an erroneous one.

src/mux_h2.c

index 70dd8ef94c2e9dadb9537cde9f38b5d16e2f2a68..71d194415e59e2cc64e658b5f9c1913b2ac793c6 100644 (file)
@@ -155,6 +155,7 @@ enum h2_ss {
 #define H2_SF_CHNK_MASK         0x00000C00 // trying to send chunk size
 
 #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
 
 /* 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).
@@ -2944,7 +2945,9 @@ static int h2_snd_buf(struct conn_stream *cs, struct buffer *buf, int flags)
        struct h2s *h2s = cs->ctx;
        int total = 0;
 
-       //fprintf(stderr, "cs=%p h2s=%p rqst=%d rsst=%d\n", cs, h2s, h2s->req.state, h2s->res.state);
+       if (!(h2s->flags & H2_SF_OUTGOING_DATA) && buf->o)
+               h2s->flags |= H2_SF_OUTGOING_DATA;
+
        while (h2s->res.state < HTTP_MSG_DONE && buf->o) {
                if (h2s->res.state < HTTP_MSG_BODY) {
                        total += h2s_frt_make_resp_headers(h2s, buf);