From: Vladimir Homutov Date: Mon, 5 Jul 2021 10:17:10 +0000 (+0300) Subject: QUIC: fixed padding calculation. X-Git-Tag: release-1.25.0~4^2~301 X-Git-Url: http://git.kaiwu.me/postgresql/log/contrib/postgres_fdw/postgres_fdw.c?a=commitdiff_plain;h=1860eda336fce3fa6a6b1d7c81a904668c7af598;p=nginx.git QUIC: fixed padding calculation. Sometimes, QUIC packets need to be of certain (or minimal) size. This is achieved by adding PADDING frames. It is possible, that adding padding will affect header size, thus forcing us to recalculate padding size once more. --- diff --git a/src/event/quic/ngx_event_quic_output.c b/src/event/quic/ngx_event_quic_output.c index 26b046b14..688ae67fe 100644 --- a/src/event/quic/ngx_event_quic_output.c +++ b/src/event/quic/ngx_event_quic_output.c @@ -368,6 +368,9 @@ ngx_quic_output_packet(ngx_connection_t *c, ngx_quic_send_ctx_t *ctx, } if (out.len < pad_len) { + /* compensate for potentially enlarged header in Length bytes */ + pad_len -= ngx_quic_create_header(&pkt, NULL, pad_len, NULL) + - ngx_quic_create_header(&pkt, NULL, out.len, NULL); ngx_memset(p, NGX_QUIC_FT_PADDING, pad_len - out.len); out.len = pad_len; }