[vlc-commits] http: track max send frame size
Rémi Denis-Courmont
git at videolan.org
Sat Oct 3 19:28:42 CEST 2020
vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Sat Oct 3 18:44:58 2020 +0300| [5b82cfd607c038a8f6e7328a43afdb6c5af9a5d4] | committer: Rémi Denis-Courmont
http: track max send frame size
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=5b82cfd607c038a8f6e7328a43afdb6c5af9a5d4
---
modules/access/http/h2conn.c | 7 +++++++
modules/access/http/h2frame.c | 2 +-
modules/access/http/h2frame.h | 2 ++
3 files changed, 10 insertions(+), 1 deletion(-)
diff --git a/modules/access/http/h2conn.c b/modules/access/http/h2conn.c
index 3b0e9d6d6e..809d559bda 100644
--- a/modules/access/http/h2conn.c
+++ b/modules/access/http/h2conn.c
@@ -56,6 +56,7 @@ struct vlc_h2_conn
uint32_t next_id; /**< Next free stream identifier */
bool released; /**< Connection released by owner */
+ uint32_t max_send_frame; /**< Maximum sent frame size */
uint32_t init_send_cwnd; /**< Initial send congestion window */
uint64_t send_cwnd; /**< Send congestion window */
@@ -494,6 +495,11 @@ static void vlc_h2_setting(void *ctx, uint_fast16_t id, uint_fast32_t value)
case VLC_H2_SETTING_INITIAL_WINDOW_SIZE:
vlc_h2_initial_window_update(conn, value);
break;
+ case VLC_H2_SETTING_MAX_FRAME_SIZE:
+ if (value >= VLC_H2_MIN_MAX_FRAME
+ && value <= VLC_H2_MAX_MAX_FRAME)
+ conn->max_send_frame = value;
+ break;
}
}
@@ -781,6 +787,7 @@ struct vlc_http_conn *vlc_h2_conn_create(void *ctx, struct vlc_tls *tls)
conn->streams = NULL;
conn->next_id = 1; /* TODO: server side */
conn->released = false;
+ conn->max_send_frame = VLC_H2_DEFAULT_MAX_FRAME;
conn->init_send_cwnd = VLC_H2_DEFAULT_INIT_WINDOW;
conn->send_cwnd = VLC_H2_DEFAULT_INIT_WINDOW;
diff --git a/modules/access/http/h2frame.c b/modules/access/http/h2frame.c
index dac0fbf659..434330deea 100644
--- a/modules/access/http/h2frame.c
+++ b/modules/access/http/h2frame.c
@@ -41,7 +41,7 @@ vlc_h2_frame_alloc(uint_fast8_t type, uint_fast8_t flags,
{
assert((stream_id >> 31) == 0);
- if (unlikely(length >= (1u << 24)))
+ if (unlikely(length > VLC_H2_MAX_MAX_FRAME))
{
errno = EINVAL;
return NULL;
diff --git a/modules/access/http/h2frame.h b/modules/access/http/h2frame.h
index 9738a32e42..b49567025c 100644
--- a/modules/access/http/h2frame.h
+++ b/modules/access/http/h2frame.h
@@ -94,7 +94,9 @@ const char *vlc_h2_setting_name(uint_fast16_t);
/* Protocol default settings */
#define VLC_H2_DEFAULT_MAX_HEADER_TABLE 4096
#define VLC_H2_DEFAULT_INIT_WINDOW 65535
+#define VLC_H2_MIN_MAX_FRAME 16384
#define VLC_H2_DEFAULT_MAX_FRAME 16384
+#define VLC_H2_MAX_MAX_FRAME 16777215
struct vlc_h2_parser;
struct vlc_h2_parser_cbs
More information about the vlc-commits
mailing list