mirror of
https://github.com/nginx/nginx.git
synced 2024-11-21 16:28:40 +00:00
Upstream: variables support in proxy_limit_rate and friends.
This commit is contained in:
parent
ea8270c614
commit
71ca978a35
@ -375,7 +375,7 @@ static ngx_command_t ngx_http_fastcgi_commands[] = {
|
||||
|
||||
{ ngx_string("fastcgi_limit_rate"),
|
||||
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,
|
||||
offsetof(ngx_http_fastcgi_loc_conf_t, upstream.limit_rate),
|
||||
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.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.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,
|
||||
(size_t) ngx_pagesize);
|
||||
|
||||
ngx_conf_merge_size_value(conf->upstream.limit_rate,
|
||||
prev->upstream.limit_rate, 0);
|
||||
ngx_conf_merge_ptr_value(conf->upstream.limit_rate,
|
||||
prev->upstream.limit_rate, NULL);
|
||||
|
||||
|
||||
ngx_conf_merge_bufs_value(conf->upstream.bufs, prev->upstream.bufs,
|
||||
|
@ -494,7 +494,7 @@ static ngx_command_t ngx_http_proxy_commands[] = {
|
||||
|
||||
{ ngx_string("proxy_limit_rate"),
|
||||
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,
|
||||
offsetof(ngx_http_proxy_loc_conf_t, upstream.limit_rate),
|
||||
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.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.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,
|
||||
(size_t) ngx_pagesize);
|
||||
|
||||
ngx_conf_merge_size_value(conf->upstream.limit_rate,
|
||||
prev->upstream.limit_rate, 0);
|
||||
ngx_conf_merge_ptr_value(conf->upstream.limit_rate,
|
||||
prev->upstream.limit_rate, NULL);
|
||||
|
||||
ngx_conf_merge_bufs_value(conf->upstream.bufs, prev->upstream.bufs,
|
||||
8, ngx_pagesize);
|
||||
|
@ -223,7 +223,7 @@ static ngx_command_t ngx_http_scgi_commands[] = {
|
||||
|
||||
{ ngx_string("scgi_limit_rate"),
|
||||
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,
|
||||
offsetof(ngx_http_scgi_loc_conf_t, upstream.limit_rate),
|
||||
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.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.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,
|
||||
(size_t) ngx_pagesize);
|
||||
|
||||
ngx_conf_merge_size_value(conf->upstream.limit_rate,
|
||||
prev->upstream.limit_rate, 0);
|
||||
ngx_conf_merge_ptr_value(conf->upstream.limit_rate,
|
||||
prev->upstream.limit_rate, NULL);
|
||||
|
||||
|
||||
ngx_conf_merge_bufs_value(conf->upstream.bufs, prev->upstream.bufs,
|
||||
|
@ -289,7 +289,7 @@ static ngx_command_t ngx_http_uwsgi_commands[] = {
|
||||
|
||||
{ ngx_string("uwsgi_limit_rate"),
|
||||
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,
|
||||
offsetof(ngx_http_uwsgi_loc_conf_t, upstream.limit_rate),
|
||||
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.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.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,
|
||||
(size_t) ngx_pagesize);
|
||||
|
||||
ngx_conf_merge_size_value(conf->upstream.limit_rate,
|
||||
prev->upstream.limit_rate, 0);
|
||||
ngx_conf_merge_ptr_value(conf->upstream.limit_rate,
|
||||
prev->upstream.limit_rate, NULL);
|
||||
|
||||
|
||||
ngx_conf_merge_bufs_value(conf->upstream.bufs, prev->upstream.bufs,
|
||||
|
@ -3236,7 +3236,7 @@ ngx_http_upstream_send_response(ngx_http_request_t *r, ngx_http_upstream_t *u)
|
||||
p->downstream = c;
|
||||
p->pool = r->pool;
|
||||
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->cacheable = u->cacheable || u->store;
|
||||
|
@ -156,7 +156,7 @@ typedef struct {
|
||||
|
||||
size_t send_lowat;
|
||||
size_t buffer_size;
|
||||
size_t limit_rate;
|
||||
ngx_http_complex_value_t *limit_rate;
|
||||
|
||||
size_t busy_buffers_size;
|
||||
size_t max_temp_file_size;
|
||||
|
Loading…
Reference in New Issue
Block a user