CLEANUP: mux-h2: Remove the h1 parser state from the h2 stream
authorChristopher Faulet <cfaulet@haproxy.com>
Tue, 3 Nov 2020 17:25:52 +0000 (18:25 +0100)
committerWilly Tarreau <w@1wt.eu>
Wed, 4 Nov 2020 15:47:37 +0000 (16:47 +0100)
Since the h2 multiplexer no longer relies on the legacy HTTP representation, and
uses exclusively the HTX, the H1 parser state (h1m) is no longer used by the h2
streams. Thus it can be removed.

This patch may be backported as far as 2.1.

(cherry picked from commit fafd1b0a5b3b6ee0c7d7dd288629c992fc63ef10)
Signed-off-by: Christopher Faulet <cfaulet@haproxy.com>
(cherry picked from commit aa3c7001cb32cd9c5bb7b5258459bb971e956438)
[wt: include file is in common/h1.h in 2.1]
Signed-off-by: Willy Tarreau <w@1wt.eu>

src/mux_h2.c

index 4604416..1a97fd3 100644 (file)
@@ -12,7 +12,6 @@
 
 #include <common/cfgparse.h>
 #include <common/config.h>
-#include <common/h1.h>
 #include <common/h2.h>
 #include <common/hpack-dec.h>
 #include <common/hpack-enc.h>
@@ -191,13 +190,12 @@ enum h2_ss {
 
 
 /* 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).
+ * it is being processed in the internal HTTP representation (HTX).
  */
 struct h2s {
        struct conn_stream *cs;
        struct session *sess;
        struct h2c *h2c;
-       struct h1m h1m;         /* request or response parser state for H1 */
        struct eb32_node by_id; /* place in h2c's streams_by_id */
        int32_t id; /* stream ID */
        uint32_t flags;      /* H2_SF_* */
@@ -1337,16 +1335,6 @@ static struct h2s *h2s_new(struct h2c *h2c, int id)
        h2s->body_len  = 0;
        h2s->rxbuf     = BUF_NULL;
 
-       if (h2c->flags & H2_CF_IS_BACK) {
-               h1m_init_req(&h2s->h1m);
-               h2s->h1m.err_pos = -1; // don't care about errors on the request path
-               h2s->h1m.flags |= H1_MF_TOLOWER;
-       } else {
-               h1m_init_res(&h2s->h1m);
-               h2s->h1m.err_pos = -1; // don't care about errors on the response path
-               h2s->h1m.flags |= H1_MF_TOLOWER;
-       }
-
        h2s->by_id.key = h2s->id = id;
        if (id > 0)
                h2c->max_id      = id;