Mercurial > hg > nginx
changeset 8808:5b0c229ba5fe quic
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.
author | Vladimir Homutov <vl@nginx.com> |
---|---|
date | Mon, 05 Jul 2021 13:17:10 +0300 |
parents | 0ac25efb2da3 |
children | 6f434af59257 |
files | src/event/quic/ngx_event_quic_output.c |
diffstat | 1 files changed, 3 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/src/event/quic/ngx_event_quic_output.c Thu Jul 01 15:37:53 2021 +0300 +++ b/src/event/quic/ngx_event_quic_output.c Mon Jul 05 13:17:10 2021 +0300 @@ -368,6 +368,9 @@ } 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; }