git: f9a2f32279b0 - main - www/nginx-devel: update HTTPv3/QUIC patch to the recent commit
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Wed, 19 Jan 2022 13:31:33 UTC
The branch main has been updated by osa: URL: https://cgit.FreeBSD.org/ports/commit/?id=f9a2f32279b075d36a16ae85664c4b7ead61410c commit f9a2f32279b075d36a16ae85664c4b7ead61410c Author: Sergey A. Osokin <osa@FreeBSD.org> AuthorDate: 2022-01-19 13:30:48 +0000 Commit: Sergey A. Osokin <osa@FreeBSD.org> CommitDate: 2022-01-19 13:31:27 +0000 www/nginx-devel: update HTTPv3/QUIC patch to the recent commit Bump PORTREVISION. --- www/nginx-devel/Makefile | 2 +- www/nginx-devel/files/extra-patch-httpv3 | 130 +++++++++++++++---------------- 2 files changed, 64 insertions(+), 68 deletions(-) diff --git a/www/nginx-devel/Makefile b/www/nginx-devel/Makefile index 8ef92331e4f2..2ce4b8b4fce2 100644 --- a/www/nginx-devel/Makefile +++ b/www/nginx-devel/Makefile @@ -2,7 +2,7 @@ PORTNAME?= nginx PORTVERSION= 1.21.5 -PORTREVISION= 9 +PORTREVISION= 10 CATEGORIES= www MASTER_SITES= https://nginx.org/download/ \ LOCAL/osa diff --git a/www/nginx-devel/files/extra-patch-httpv3 b/www/nginx-devel/files/extra-patch-httpv3 index 492a7272a828..4c5a4cae03df 100644 --- a/www/nginx-devel/files/extra-patch-httpv3 +++ b/www/nginx-devel/files/extra-patch-httpv3 @@ -6432,7 +6432,7 @@ diff --git a/src/event/quic/ngx_event_quic_frames.c b/src/event/quic/ngx_event_q new file mode 100644 --- /dev/null +++ b/src/event/quic/ngx_event_quic_frames.c -@@ -0,0 +1,806 @@ +@@ -0,0 +1,811 @@ + +/* + * Copyright (C) Nginx, Inc. @@ -6456,6 +6456,8 @@ new file mode 100644 +static ngx_buf_t *ngx_quic_alloc_buf(ngx_connection_t *c); +static void ngx_quic_free_buf(ngx_connection_t *c, ngx_buf_t *b); +static ngx_buf_t *ngx_quic_clone_buf(ngx_connection_t *c, ngx_buf_t *b); ++static ngx_int_t ngx_quic_split_chain(ngx_connection_t *c, ngx_chain_t *cl, ++ off_t offset); + + +static ngx_buf_t * @@ -6594,6 +6596,38 @@ new file mode 100644 +} + + ++static ngx_int_t ++ngx_quic_split_chain(ngx_connection_t *c, ngx_chain_t *cl, off_t offset) ++{ ++ ngx_buf_t *b, *tb; ++ ngx_chain_t *tail; ++ ++ b = cl->buf; ++ ++ tail = ngx_alloc_chain_link(c->pool); ++ if (tail == NULL) { ++ return NGX_ERROR; ++ } ++ ++ tb = ngx_quic_clone_buf(c, b); ++ if (tb == NULL) { ++ return NGX_ERROR; ++ } ++ ++ tail->buf = tb; ++ ++ tb->pos += offset; ++ ++ b->last = tb->pos; ++ b->last_buf = 0; ++ ++ tail->next = cl->next; ++ cl->next = tail; ++ ++ return NGX_OK; ++} ++ ++ +ngx_quic_frame_t * +ngx_quic_alloc_frame(ngx_connection_t *c) +{ @@ -6803,7 +6837,7 @@ new file mode 100644 +{ + off_t n; + ngx_buf_t *b; -+ ngx_chain_t *out, *cl, **ll; ++ ngx_chain_t *out, **ll; + + out = *chain; + @@ -6822,7 +6856,11 @@ new file mode 100644 + n = b->last - b->pos; + + if (n > limit) { -+ goto split; ++ if (ngx_quic_split_chain(c, *ll, limit) != NGX_OK) { ++ return NGX_CHAIN_ERROR; ++ } ++ ++ n = limit; + } + + limit -= n; @@ -6832,29 +6870,6 @@ new file mode 100644 + *ll = NULL; + + return out; -+ -+split: -+ -+ cl = ngx_alloc_chain_link(c->pool); -+ if (cl == NULL) { -+ return NGX_CHAIN_ERROR; -+ } -+ -+ cl->buf = ngx_quic_clone_buf(c, b); -+ if (cl->buf == NULL) { -+ return NGX_CHAIN_ERROR; -+ } -+ -+ cl->buf->pos += limit; -+ b->last = cl->buf->pos; -+ b->last_buf = 0; -+ -+ ll = &(*ll)->next; -+ cl->next = *ll; -+ *ll = NULL; -+ *chain = cl; -+ -+ return out; +} + + @@ -6913,12 +6928,16 @@ new file mode 100644 + +ngx_chain_t * +ngx_quic_write_chain(ngx_connection_t *c, ngx_chain_t **chain, ngx_chain_t *in, -+ off_t limit, off_t offset) ++ off_t limit, off_t offset, size_t *size) +{ + off_t n; + u_char *p; + ngx_buf_t *b; -+ ngx_chain_t *cl, *sl; ++ ngx_chain_t *cl; ++ ++ if (size) { ++ *size = 0; ++ } + + while (in && limit) { + cl = *chain; @@ -6945,20 +6964,10 @@ new file mode 100644 + } + + if (b->sync && offset > 0) { -+ /* split hole at offset */ -+ -+ b->sync = 0; -+ -+ sl = ngx_quic_read_chain(c, &cl, offset); -+ if (cl == NGX_CHAIN_ERROR) { ++ if (ngx_quic_split_chain(c, cl, offset) != NGX_OK) { + return NGX_CHAIN_ERROR; + } + -+ sl->buf->sync = 1; -+ cl->buf->sync = 1; -+ -+ *chain = sl; -+ sl->next = cl; + continue; + } + @@ -6984,6 +6993,10 @@ new file mode 100644 + in->buf->pos += n; + offset += n; + limit -= n; ++ ++ if (size) { ++ *size += n; ++ } + } + + if (b->sync && p == b->last) { @@ -6992,19 +7005,11 @@ new file mode 100644 + } + + if (b->sync && p != b->pos) { -+ /* split hole at p - b->pos */ -+ -+ b->sync = 0; -+ -+ sl = ngx_quic_read_chain(c, &cl, p - b->pos); -+ if (sl == NGX_CHAIN_ERROR) { ++ if (ngx_quic_split_chain(c, cl, p - b->pos) != NGX_OK) { + return NGX_CHAIN_ERROR; + } + -+ cl->buf->sync = 1; -+ -+ *chain = sl; -+ sl->next = cl; ++ b->sync = 0; + } + } + @@ -7277,7 +7282,7 @@ new file mode 100644 +ngx_chain_t *ngx_quic_read_chain(ngx_connection_t *c, ngx_chain_t **chain, + off_t limit); +ngx_chain_t *ngx_quic_write_chain(ngx_connection_t *c, ngx_chain_t **chain, -+ ngx_chain_t *in, off_t limit, off_t offset); ++ ngx_chain_t *in, off_t limit, off_t offset, size_t *size); + +#if (NGX_DEBUG) +void ngx_quic_log_frame(ngx_log_t *log, ngx_quic_frame_t *f, ngx_uint_t tx); @@ -11311,7 +11316,7 @@ new file mode 100644 + + if (f->offset > ctx->crypto_received) { + if (ngx_quic_write_chain(c, &ctx->crypto, frame->data, f->length, -+ f->offset - ctx->crypto_received) ++ f->offset - ctx->crypto_received, NULL) + == NGX_CHAIN_ERROR) + { + return NGX_ERROR; @@ -11581,7 +11586,7 @@ diff --git a/src/event/quic/ngx_event_quic_streams.c b/src/event/quic/ngx_event_ new file mode 100644 --- /dev/null +++ b/src/event/quic/ngx_event_quic_streams.c -@@ -0,0 +1,1608 @@ +@@ -0,0 +1,1599 @@ + +/* + * Copyright (C) Nginx, Inc. @@ -12408,9 +12413,10 @@ new file mode 100644 +static ngx_chain_t * +ngx_quic_stream_send_chain(ngx_connection_t *c, ngx_chain_t *in, off_t limit) +{ -+ off_t n, flow; ++ off_t flow; ++ size_t n; + ngx_event_t *wev; -+ ngx_chain_t *out, *cl; ++ ngx_chain_t *out; + ngx_connection_t *pc; + ngx_quic_frame_t *frame; + ngx_quic_stream_t *qs; @@ -12435,17 +12441,7 @@ new file mode 100644 + limit = flow; + } + -+ n = 0; -+ -+ for (cl = in; cl; cl = cl->next) { -+ n += cl->buf->last - cl->buf->pos; -+ if (n >= limit) { -+ n = limit; -+ break; -+ } -+ } -+ -+ in = ngx_quic_write_chain(pc, &qs->out, in, limit, 0); ++ in = ngx_quic_write_chain(pc, &qs->out, in, limit, 0, &n); + if (in == NGX_CHAIN_ERROR) { + return NGX_CHAIN_ERROR; + } @@ -12481,7 +12477,7 @@ new file mode 100644 + } + + ngx_log_debug1(NGX_LOG_DEBUG_EVENT, c->log, 0, -+ "quic send_chain sent:%O", n); ++ "quic send_chain sent:%uz", n); + + return in; +} @@ -12683,7 +12679,7 @@ new file mode 100644 + } + + if (ngx_quic_write_chain(c, &qs->in, frame->data, f->length, -+ f->offset - qs->recv_offset) ++ f->offset - qs->recv_offset, NULL) + == NGX_CHAIN_ERROR) + { + return NGX_ERROR;