diff options
author | Sergey Kandaurov <pluknet@nginx.com> | 2020-10-21 12:03:23 +0100 |
---|---|---|
committer | Sergey Kandaurov <pluknet@nginx.com> | 2020-10-21 12:03:23 +0100 |
commit | e1982a1abafda2e1e541dc6d6516d4087c0e5bd8 (patch) | |
tree | 4cb8d7d1cc06e9c150e69439770c7b8c6a3d264a /src | |
parent | fe2c392551ca4b88b8f1ec35f97994928e2303c9 (diff) | |
download | nginx-e1982a1abafda2e1e541dc6d6516d4087c0e5bd8.tar.gz nginx-e1982a1abafda2e1e541dc6d6516d4087c0e5bd8.zip |
QUIC: teach how to compute only the length of created QUIC headers.
It will be used for precise expansion of UDP datagram payload.
Diffstat (limited to 'src')
-rw-r--r-- | src/event/ngx_event_quic_transport.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/event/ngx_event_quic_transport.c b/src/event/ngx_event_quic_transport.c index cea69ab7a..93b3bae78 100644 --- a/src/event/ngx_event_quic_transport.c +++ b/src/event/ngx_event_quic_transport.c @@ -420,6 +420,12 @@ ngx_quic_create_long_header(ngx_quic_header_t *pkt, u_char *out, { u_char *p, *start; + if (out == NULL) { + return 5 + 2 + pkt->dcid.len + pkt->scid.len + + ngx_quic_varint_len(pkt_len + pkt->num_len) + pkt->num_len + + (pkt->level == ssl_encryption_initial ? 1 : 0); + } + p = start = out; *p++ = pkt->flags; @@ -465,6 +471,10 @@ ngx_quic_create_short_header(ngx_quic_header_t *pkt, u_char *out, { u_char *p, *start; + if (out == NULL) { + return 1 + pkt->dcid.len + pkt->num_len; + } + p = start = out; *p++ = pkt->flags; |