Mercurial > hg > nginx
diff src/event/quic/ngx_event_quic_output.c @ 9072:def8e398d7c5 quic
QUIC: fixed broken token in NEW_TOKEN (ticket #2446).
Previously, since 3550b00d9dc8, the token was allocated on stack, to get
rid of pool usage. Now the token is allocated by ngx_quic_copy_buffer()
in QUIC buffers, also used for STREAM, CRYPTO and ACK frames.
author | Roman Arutyunyan <arut@nginx.com> |
---|---|
date | Tue, 31 Jan 2023 15:26:33 +0400 |
parents | 3550b00d9dc8 |
children | 12b756caaf16 |
line wrap: on
line diff
--- a/src/event/quic/ngx_event_quic_output.c +++ b/src/event/quic/ngx_event_quic_output.c @@ -1076,6 +1076,7 @@ ngx_quic_send_new_token(ngx_connection_t { time_t expires; ngx_str_t token; + ngx_chain_t *out; ngx_quic_frame_t *frame; ngx_quic_connection_t *qc; @@ -1095,6 +1096,11 @@ ngx_quic_send_new_token(ngx_connection_t return NGX_ERROR; } + out = ngx_quic_copy_buffer(c, token.data, token.len); + if (out == NGX_CHAIN_ERROR) { + return NGX_ERROR; + } + frame = ngx_quic_alloc_frame(c); if (frame == NULL) { return NGX_ERROR; @@ -1102,8 +1108,8 @@ ngx_quic_send_new_token(ngx_connection_t frame->level = ssl_encryption_application; frame->type = NGX_QUIC_FT_NEW_TOKEN; + frame->data = out; frame->u.token.length = token.len; - frame->u.token.data = token.data; ngx_quic_queue_frame(qc, frame);