summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWilly Tarreau <w@1wt.eu>2017-07-31 18:00:58 +0200
committerWilly Tarreau <w@1wt.eu>2017-08-18 13:42:04 +0200
commit81519dd2b0c296139e688c7de8406b290e1babfa (patch)
tree1f9c6f09fdd8647e79ac019c98a4b293a67ce10c
parent770ec399a1e065c89710739b525f268f888a4dc7 (diff)
downloadhaproxy-81519dd2b0c296139e688c7de8406b290e1babfa.tar.gz
MINOR: h2: add a max_frame_size setting to the connection.
This is used to respect the peer's parameters advertised in the SETTINGS frame. Default value is 16384.
-rw-r--r--include/types/proto_h2.h1
-rw-r--r--src/proto_h2.c8
2 files changed, 9 insertions, 0 deletions
diff --git a/include/types/proto_h2.h b/include/types/proto_h2.h
index 691403b02..c98ef388d 100644
--- a/include/types/proto_h2.h
+++ b/include/types/proto_h2.h
@@ -181,6 +181,7 @@ struct h2c {
int mft; /* mux frame type (+ flags) (if dsi >= 0) */
int miw; /* mux initial window size for all new streams */
int mws; /* mux window size. Can be negative. */
+ int mfs; /* mux's max frame size */
};
/* H2 message descriptor */
diff --git a/src/proto_h2.c b/src/proto_h2.c
index 0e0ae57b2..3a3a118d5 100644
--- a/src/proto_h2.c
+++ b/src/proto_h2.c
@@ -530,6 +530,13 @@ static int h2c_frt_handle_settings(struct h2c *h2c, const char *payload, int ple
h2c_update_all_ws(h2c, arg - h2c->miw);
h2c->miw = arg;
break;
+ case H2_SETTINGS_MAX_FRAME_SIZE:
+ if (arg < 16384 || arg > 16777215) { // RFC7540#6.5.2
+ h2c_error(h2c, H2_ERR_PROTOCOL_ERROR);
+ return -1;
+ }
+ h2c->mfs = arg;
+ break;
}
payload += 6;
plen -= 6;
@@ -1671,6 +1678,7 @@ int h2c_frt_init(struct stream *s)
h2c->msi = -1;
h2c->miw = 65535; /* mux initial window size */
h2c->mws = 65535; /* mux window size */
+ h2c->mfs = 16384; /* initial max frame size */
h2c->streams_by_id = EB_ROOT_UNIQUE;
LIST_INIT(&h2c->active_list);