mirror of
https://github.com/nginx/nginx.git
synced 2024-12-04 22:09:01 +08:00
QUIC: teach how to compute only the length of created QUIC headers.
It will be used for precise expansion of UDP datagram payload.
This commit is contained in:
parent
fe2c392551
commit
e1982a1aba
@ -420,6 +420,12 @@ ngx_quic_create_long_header(ngx_quic_header_t *pkt, u_char *out,
|
|||||||
{
|
{
|
||||||
u_char *p, *start;
|
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 = start = out;
|
||||||
|
|
||||||
*p++ = pkt->flags;
|
*p++ = pkt->flags;
|
||||||
@ -465,6 +471,10 @@ ngx_quic_create_short_header(ngx_quic_header_t *pkt, u_char *out,
|
|||||||
{
|
{
|
||||||
u_char *p, *start;
|
u_char *p, *start;
|
||||||
|
|
||||||
|
if (out == NULL) {
|
||||||
|
return 1 + pkt->dcid.len + pkt->num_len;
|
||||||
|
}
|
||||||
|
|
||||||
p = start = out;
|
p = start = out;
|
||||||
|
|
||||||
*p++ = pkt->flags;
|
*p++ = pkt->flags;
|
||||||
|
Loading…
Reference in New Issue
Block a user