diff options
| author | Roman Arutyunyan <arut@nginx.com> | 2023-01-31 15:26:33 +0400 |
|---|---|---|
| committer | Roman Arutyunyan <arut@nginx.com> | 2023-01-31 15:26:33 +0400 |
| commit | b7ccca0eb07ebf5f0a78c21cc45f7ac865dda986 (patch) | |
| tree | 5c46b98592d5b5a4053fd5c84b918a008d34a38f /src/event/quic/ngx_event_quic_output.c | |
| parent | 341c21c9f6373ceeb0ad2513e14c5cd97e958b28 (diff) | |
| download | nginx-b7ccca0eb07ebf5f0a78c21cc45f7ac865dda986.tar.gz nginx-b7ccca0eb07ebf5f0a78c21cc45f7ac865dda986.tar.bz2 | |
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.
Diffstat (limited to 'src/event/quic/ngx_event_quic_output.c')
| -rw-r--r-- | src/event/quic/ngx_event_quic_output.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/event/quic/ngx_event_quic_output.c b/src/event/quic/ngx_event_quic_output.c index ee64d555e..940432a45 100644 --- 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 *c, ngx_quic_path_t *path) { 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 *c, ngx_quic_path_t *path) 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 *c, ngx_quic_path_t *path) 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); |
