Latest update - 9249

This commit is contained in:
2024-05-29 15:39:59 +09:00
parent 9c07b15206
commit b18c2e4d34
13 changed files with 64 additions and 33 deletions
+1 -1
View File
@@ -19,7 +19,7 @@ else
#include <atomic_ops.h>" #include <atomic_ops.h>"
ngx_feature_path= ngx_feature_path=
ngx_feature_libs="-latomic_ops" ngx_feature_libs="-latomic_ops"
ngx_feature_test="long n = 0; ngx_feature_test="AO_t n = 0;
if (!AO_compare_and_swap(&n, 0, 1)) if (!AO_compare_and_swap(&n, 0, 1))
return 1; return 1;
if (AO_fetch_and_add(&n, 1) != 1) if (AO_fetch_and_add(&n, 1) != 1)
+8 -2
View File
@@ -117,7 +117,10 @@ ngx_output_chain(ngx_output_chain_ctx_t *ctx, ngx_chain_t *in)
ngx_debug_point(); ngx_debug_point();
ctx->in = ctx->in->next; cl = ctx->in;
ctx->in = cl->next;
ngx_free_chain(ctx->pool, cl);
continue; continue;
} }
@@ -203,7 +206,10 @@ ngx_output_chain(ngx_output_chain_ctx_t *ctx, ngx_chain_t *in)
/* delete the completed buf from the ctx->in chain */ /* delete the completed buf from the ctx->in chain */
if (ngx_buf_size(ctx->in->buf) == 0) { if (ngx_buf_size(ctx->in->buf) == 0) {
ctx->in = ctx->in->next; cl = ctx->in;
ctx->in = cl->next;
ngx_free_chain(ctx->pool, cl);
} }
cl = ngx_alloc_chain_link(ctx->pool); cl = ngx_alloc_chain_link(ctx->pool);
+4 -4
View File
@@ -375,7 +375,7 @@ static ngx_command_t ngx_http_fastcgi_commands[] = {
{ ngx_string("fastcgi_limit_rate"), { ngx_string("fastcgi_limit_rate"),
NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1, NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1,
ngx_conf_set_size_slot, ngx_http_set_complex_value_size_slot,
NGX_HTTP_LOC_CONF_OFFSET, NGX_HTTP_LOC_CONF_OFFSET,
offsetof(ngx_http_fastcgi_loc_conf_t, upstream.limit_rate), offsetof(ngx_http_fastcgi_loc_conf_t, upstream.limit_rate),
NULL }, NULL },
@@ -2898,7 +2898,7 @@ ngx_http_fastcgi_create_loc_conf(ngx_conf_t *cf)
conf->upstream.send_lowat = NGX_CONF_UNSET_SIZE; conf->upstream.send_lowat = NGX_CONF_UNSET_SIZE;
conf->upstream.buffer_size = NGX_CONF_UNSET_SIZE; conf->upstream.buffer_size = NGX_CONF_UNSET_SIZE;
conf->upstream.limit_rate = NGX_CONF_UNSET_SIZE; conf->upstream.limit_rate = NGX_CONF_UNSET_PTR;
conf->upstream.busy_buffers_size_conf = NGX_CONF_UNSET_SIZE; conf->upstream.busy_buffers_size_conf = NGX_CONF_UNSET_SIZE;
conf->upstream.max_temp_file_size_conf = NGX_CONF_UNSET_SIZE; conf->upstream.max_temp_file_size_conf = NGX_CONF_UNSET_SIZE;
@@ -3015,8 +3015,8 @@ ngx_http_fastcgi_merge_loc_conf(ngx_conf_t *cf, void *parent, void *child)
prev->upstream.buffer_size, prev->upstream.buffer_size,
(size_t) ngx_pagesize); (size_t) ngx_pagesize);
ngx_conf_merge_size_value(conf->upstream.limit_rate, ngx_conf_merge_ptr_value(conf->upstream.limit_rate,
prev->upstream.limit_rate, 0); prev->upstream.limit_rate, NULL);
ngx_conf_merge_bufs_value(conf->upstream.bufs, prev->upstream.bufs, ngx_conf_merge_bufs_value(conf->upstream.bufs, prev->upstream.bufs,
+4 -1
View File
@@ -1231,7 +1231,7 @@ ngx_http_grpc_body_output_filter(void *data, ngx_chain_t *in)
ngx_buf_t *b; ngx_buf_t *b;
ngx_int_t rc; ngx_int_t rc;
ngx_uint_t next, last; ngx_uint_t next, last;
ngx_chain_t *cl, *out, **ll; ngx_chain_t *cl, *out, *ln, **ll;
ngx_http_upstream_t *u; ngx_http_upstream_t *u;
ngx_http_grpc_ctx_t *ctx; ngx_http_grpc_ctx_t *ctx;
ngx_http_grpc_frame_t *f; ngx_http_grpc_frame_t *f;
@@ -1459,7 +1459,10 @@ ngx_http_grpc_body_output_filter(void *data, ngx_chain_t *in)
last = 1; last = 1;
} }
ln = in;
in = in->next; in = in->next;
ngx_free_chain(r->pool, ln);
} }
ctx->in = in; ctx->in = in;
@@ -333,6 +333,8 @@ static ngx_int_t
ngx_http_gunzip_filter_add_data(ngx_http_request_t *r, ngx_http_gunzip_filter_add_data(ngx_http_request_t *r,
ngx_http_gunzip_ctx_t *ctx) ngx_http_gunzip_ctx_t *ctx)
{ {
ngx_chain_t *cl;
if (ctx->zstream.avail_in || ctx->flush != Z_NO_FLUSH || ctx->redo) { if (ctx->zstream.avail_in || ctx->flush != Z_NO_FLUSH || ctx->redo) {
return NGX_OK; return NGX_OK;
} }
@@ -344,8 +346,11 @@ ngx_http_gunzip_filter_add_data(ngx_http_request_t *r,
return NGX_DECLINED; return NGX_DECLINED;
} }
ctx->in_buf = ctx->in->buf; cl = ctx->in;
ctx->in = ctx->in->next; ctx->in_buf = cl->buf;
ctx->in = cl->next;
ngx_free_chain(r->pool, cl);
ctx->zstream.next_in = ctx->in_buf->pos; ctx->zstream.next_in = ctx->in_buf->pos;
ctx->zstream.avail_in = ctx->in_buf->last - ctx->in_buf->pos; ctx->zstream.avail_in = ctx->in_buf->last - ctx->in_buf->pos;
@@ -374,6 +379,7 @@ static ngx_int_t
ngx_http_gunzip_filter_get_buf(ngx_http_request_t *r, ngx_http_gunzip_filter_get_buf(ngx_http_request_t *r,
ngx_http_gunzip_ctx_t *ctx) ngx_http_gunzip_ctx_t *ctx)
{ {
ngx_chain_t *cl;
ngx_http_gunzip_conf_t *conf; ngx_http_gunzip_conf_t *conf;
if (ctx->zstream.avail_out) { if (ctx->zstream.avail_out) {
@@ -383,8 +389,12 @@ ngx_http_gunzip_filter_get_buf(ngx_http_request_t *r,
conf = ngx_http_get_module_loc_conf(r, ngx_http_gunzip_filter_module); conf = ngx_http_get_module_loc_conf(r, ngx_http_gunzip_filter_module);
if (ctx->free) { if (ctx->free) {
ctx->out_buf = ctx->free->buf;
ctx->free = ctx->free->next; cl = ctx->free;
ctx->out_buf = cl->buf;
ctx->free = cl->next;
ngx_free_chain(r->pool, cl);
ctx->out_buf->flush = 0; ctx->out_buf->flush = 0;
@@ -985,10 +985,14 @@ static void
ngx_http_gzip_filter_free_copy_buf(ngx_http_request_t *r, ngx_http_gzip_filter_free_copy_buf(ngx_http_request_t *r,
ngx_http_gzip_ctx_t *ctx) ngx_http_gzip_ctx_t *ctx)
{ {
ngx_chain_t *cl; ngx_chain_t *cl, *ln;
for (cl = ctx->copied; cl; cl = cl->next) { for (cl = ctx->copied; cl; /* void */) {
ngx_pfree(r->pool, cl->buf->start); ln = cl;
cl = cl->next;
ngx_pfree(r->pool, ln->buf->start);
ngx_free_chain(r->pool, ln);
} }
ctx->copied = NULL; ctx->copied = NULL;
+4 -4
View File
@@ -494,7 +494,7 @@ static ngx_command_t ngx_http_proxy_commands[] = {
{ ngx_string("proxy_limit_rate"), { ngx_string("proxy_limit_rate"),
NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1, NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1,
ngx_conf_set_size_slot, ngx_http_set_complex_value_size_slot,
NGX_HTTP_LOC_CONF_OFFSET, NGX_HTTP_LOC_CONF_OFFSET,
offsetof(ngx_http_proxy_loc_conf_t, upstream.limit_rate), offsetof(ngx_http_proxy_loc_conf_t, upstream.limit_rate),
NULL }, NULL },
@@ -3371,7 +3371,7 @@ ngx_http_proxy_create_loc_conf(ngx_conf_t *cf)
conf->upstream.send_lowat = NGX_CONF_UNSET_SIZE; conf->upstream.send_lowat = NGX_CONF_UNSET_SIZE;
conf->upstream.buffer_size = NGX_CONF_UNSET_SIZE; conf->upstream.buffer_size = NGX_CONF_UNSET_SIZE;
conf->upstream.limit_rate = NGX_CONF_UNSET_SIZE; conf->upstream.limit_rate = NGX_CONF_UNSET_PTR;
conf->upstream.busy_buffers_size_conf = NGX_CONF_UNSET_SIZE; conf->upstream.busy_buffers_size_conf = NGX_CONF_UNSET_SIZE;
conf->upstream.max_temp_file_size_conf = NGX_CONF_UNSET_SIZE; conf->upstream.max_temp_file_size_conf = NGX_CONF_UNSET_SIZE;
@@ -3515,8 +3515,8 @@ ngx_http_proxy_merge_loc_conf(ngx_conf_t *cf, void *parent, void *child)
prev->upstream.buffer_size, prev->upstream.buffer_size,
(size_t) ngx_pagesize); (size_t) ngx_pagesize);
ngx_conf_merge_size_value(conf->upstream.limit_rate, ngx_conf_merge_ptr_value(conf->upstream.limit_rate,
prev->upstream.limit_rate, 0); prev->upstream.limit_rate, NULL);
ngx_conf_merge_bufs_value(conf->upstream.bufs, prev->upstream.bufs, ngx_conf_merge_bufs_value(conf->upstream.bufs, prev->upstream.bufs,
8, ngx_pagesize); 8, ngx_pagesize);
+4 -4
View File
@@ -223,7 +223,7 @@ static ngx_command_t ngx_http_scgi_commands[] = {
{ ngx_string("scgi_limit_rate"), { ngx_string("scgi_limit_rate"),
NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1, NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1,
ngx_conf_set_size_slot, ngx_http_set_complex_value_size_slot,
NGX_HTTP_LOC_CONF_OFFSET, NGX_HTTP_LOC_CONF_OFFSET,
offsetof(ngx_http_scgi_loc_conf_t, upstream.limit_rate), offsetof(ngx_http_scgi_loc_conf_t, upstream.limit_rate),
NULL }, NULL },
@@ -1301,7 +1301,7 @@ ngx_http_scgi_create_loc_conf(ngx_conf_t *cf)
conf->upstream.send_lowat = NGX_CONF_UNSET_SIZE; conf->upstream.send_lowat = NGX_CONF_UNSET_SIZE;
conf->upstream.buffer_size = NGX_CONF_UNSET_SIZE; conf->upstream.buffer_size = NGX_CONF_UNSET_SIZE;
conf->upstream.limit_rate = NGX_CONF_UNSET_SIZE; conf->upstream.limit_rate = NGX_CONF_UNSET_PTR;
conf->upstream.busy_buffers_size_conf = NGX_CONF_UNSET_SIZE; conf->upstream.busy_buffers_size_conf = NGX_CONF_UNSET_SIZE;
conf->upstream.max_temp_file_size_conf = NGX_CONF_UNSET_SIZE; conf->upstream.max_temp_file_size_conf = NGX_CONF_UNSET_SIZE;
@@ -1413,8 +1413,8 @@ ngx_http_scgi_merge_loc_conf(ngx_conf_t *cf, void *parent, void *child)
prev->upstream.buffer_size, prev->upstream.buffer_size,
(size_t) ngx_pagesize); (size_t) ngx_pagesize);
ngx_conf_merge_size_value(conf->upstream.limit_rate, ngx_conf_merge_ptr_value(conf->upstream.limit_rate,
prev->upstream.limit_rate, 0); prev->upstream.limit_rate, NULL);
ngx_conf_merge_bufs_value(conf->upstream.bufs, prev->upstream.bufs, ngx_conf_merge_bufs_value(conf->upstream.bufs, prev->upstream.bufs,
@@ -482,9 +482,13 @@ ngx_http_ssi_body_filter(ngx_http_request_t *r, ngx_chain_t *in)
while (ctx->in || ctx->buf) { while (ctx->in || ctx->buf) {
if (ctx->buf == NULL) { if (ctx->buf == NULL) {
ctx->buf = ctx->in->buf;
ctx->in = ctx->in->next; cl = ctx->in;
ctx->buf = cl->buf;
ctx->in = cl->next;
ctx->pos = ctx->buf->pos; ctx->pos = ctx->buf->pos;
ngx_free_chain(r->pool, cl);
} }
if (ctx->state == ssi_start_state) { if (ctx->state == ssi_start_state) {
@@ -335,9 +335,13 @@ ngx_http_sub_body_filter(ngx_http_request_t *r, ngx_chain_t *in)
while (ctx->in || ctx->buf) { while (ctx->in || ctx->buf) {
if (ctx->buf == NULL) { if (ctx->buf == NULL) {
ctx->buf = ctx->in->buf;
ctx->in = ctx->in->next; cl = ctx->in;
ctx->buf = cl->buf;
ctx->in = cl->next;
ctx->pos = ctx->buf->pos; ctx->pos = ctx->buf->pos;
ngx_free_chain(r->pool, cl);
} }
if (ctx->buf->flush || ctx->buf->recycled) { if (ctx->buf->flush || ctx->buf->recycled) {
+4 -4
View File
@@ -289,7 +289,7 @@ static ngx_command_t ngx_http_uwsgi_commands[] = {
{ ngx_string("uwsgi_limit_rate"), { ngx_string("uwsgi_limit_rate"),
NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1, NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1,
ngx_conf_set_size_slot, ngx_http_set_complex_value_size_slot,
NGX_HTTP_LOC_CONF_OFFSET, NGX_HTTP_LOC_CONF_OFFSET,
offsetof(ngx_http_uwsgi_loc_conf_t, upstream.limit_rate), offsetof(ngx_http_uwsgi_loc_conf_t, upstream.limit_rate),
NULL }, NULL },
@@ -1532,7 +1532,7 @@ ngx_http_uwsgi_create_loc_conf(ngx_conf_t *cf)
conf->upstream.send_lowat = NGX_CONF_UNSET_SIZE; conf->upstream.send_lowat = NGX_CONF_UNSET_SIZE;
conf->upstream.buffer_size = NGX_CONF_UNSET_SIZE; conf->upstream.buffer_size = NGX_CONF_UNSET_SIZE;
conf->upstream.limit_rate = NGX_CONF_UNSET_SIZE; conf->upstream.limit_rate = NGX_CONF_UNSET_PTR;
conf->upstream.busy_buffers_size_conf = NGX_CONF_UNSET_SIZE; conf->upstream.busy_buffers_size_conf = NGX_CONF_UNSET_SIZE;
conf->upstream.max_temp_file_size_conf = NGX_CONF_UNSET_SIZE; conf->upstream.max_temp_file_size_conf = NGX_CONF_UNSET_SIZE;
@@ -1656,8 +1656,8 @@ ngx_http_uwsgi_merge_loc_conf(ngx_conf_t *cf, void *parent, void *child)
prev->upstream.buffer_size, prev->upstream.buffer_size,
(size_t) ngx_pagesize); (size_t) ngx_pagesize);
ngx_conf_merge_size_value(conf->upstream.limit_rate, ngx_conf_merge_ptr_value(conf->upstream.limit_rate,
prev->upstream.limit_rate, 0); prev->upstream.limit_rate, NULL);
ngx_conf_merge_bufs_value(conf->upstream.bufs, prev->upstream.bufs, ngx_conf_merge_bufs_value(conf->upstream.bufs, prev->upstream.bufs,
+1 -1
View File
@@ -3236,7 +3236,7 @@ ngx_http_upstream_send_response(ngx_http_request_t *r, ngx_http_upstream_t *u)
p->downstream = c; p->downstream = c;
p->pool = r->pool; p->pool = r->pool;
p->log = c->log; p->log = c->log;
p->limit_rate = u->conf->limit_rate; p->limit_rate = ngx_http_complex_value_size(r, u->conf->limit_rate, 0);
p->start_sec = ngx_time(); p->start_sec = ngx_time();
p->cacheable = u->cacheable || u->store; p->cacheable = u->cacheable || u->store;
+1 -1
View File
@@ -156,7 +156,7 @@ typedef struct {
size_t send_lowat; size_t send_lowat;
size_t buffer_size; size_t buffer_size;
size_t limit_rate; ngx_http_complex_value_t *limit_rate;
size_t busy_buffers_size; size_t busy_buffers_size;
size_t max_temp_file_size; size_t max_temp_file_size;