Latest update - 7400
This commit is contained in:
@@ -33,3 +33,6 @@
|
|||||||
[submodule "lib/ngx_http_geoip2_module"]
|
[submodule "lib/ngx_http_geoip2_module"]
|
||||||
path = lib/ngx_http_geoip2_module
|
path = lib/ngx_http_geoip2_module
|
||||||
url = https://github.com/leev/ngx_http_geoip2_module.git
|
url = https://github.com/leev/ngx_http_geoip2_module.git
|
||||||
|
[submodule "lib/nginx-module-vts"]
|
||||||
|
path = lib/nginx-module-vts
|
||||||
|
url = https://github.com/vozlt/nginx-module-vts
|
||||||
@@ -95,6 +95,7 @@ if [ "$NAXSI" = 1 ]; then BUILD_MODULES="${BUILD_MODULES} --add-module=./lib/nax
|
|||||||
if [ "$DAV_EXT" = 1 ]; then BUILD_MODULES="${BUILD_MODULES} --add-module=./lib/nginx-dav-ext-module"; fi
|
if [ "$DAV_EXT" = 1 ]; then BUILD_MODULES="${BUILD_MODULES} --add-module=./lib/nginx-dav-ext-module"; fi
|
||||||
if [ "$FANCYINDEX" = 1 ]; then BUILD_MODULES="${BUILD_MODULES} --add-module=./lib/ngx-fancyindex"; fi
|
if [ "$FANCYINDEX" = 1 ]; then BUILD_MODULES="${BUILD_MODULES} --add-module=./lib/ngx-fancyindex"; fi
|
||||||
if [ "$GEOIP2" = 1 ]; then BUILD_MODULES="${BUILD_MODULES} --add-module=./lib/ngx_http_geoip2_module"; fi
|
if [ "$GEOIP2" = 1 ]; then BUILD_MODULES="${BUILD_MODULES} --add-module=./lib/ngx_http_geoip2_module"; fi
|
||||||
|
if [ "$VTS" = 1 ]; then BUILD_MODULES="${BUILD_MODULES} --add-module=./lib/nginx-module-vts"; fi
|
||||||
|
|
||||||
auto/configure \
|
auto/configure \
|
||||||
--with-cc-opt="-DTCP_FASTOPEN=23 ${BUILD_BIT}${BUILD_LTO} -g -O3 -march=native -fstack-protector-strong -fuse-ld=gold -fuse-linker-plugin --param=ssp-buffer-size=4 -Wformat -Werror=format-security -Wno-strict-aliasing -Wp,-D_FORTIFY_SOURCE=2 -gsplit-dwarf -DNGX_HTTP_HEADERS" \
|
--with-cc-opt="-DTCP_FASTOPEN=23 ${BUILD_BIT}${BUILD_LTO} -g -O3 -march=native -fstack-protector-strong -fuse-ld=gold -fuse-linker-plugin --param=ssp-buffer-size=4 -Wformat -Werror=format-security -Wno-strict-aliasing -Wp,-D_FORTIFY_SOURCE=2 -gsplit-dwarf -DNGX_HTTP_HEADERS" \
|
||||||
|
|||||||
@@ -47,6 +47,9 @@ FANCYINDEX=1
|
|||||||
### GEOIP2
|
### GEOIP2
|
||||||
GEOIP2=1
|
GEOIP2=1
|
||||||
|
|
||||||
|
### nginx-module-vts
|
||||||
|
VTS=1
|
||||||
|
|
||||||
##########################
|
##########################
|
||||||
### nginx install path ###
|
### nginx install path ###
|
||||||
##########################
|
##########################
|
||||||
|
|||||||
Submodule
+1
Submodule lib/nginx-module-vts added at 46d85558e3
@@ -44,7 +44,7 @@ typedef struct {
|
|||||||
ngx_shm_zone_t *shm_zone;
|
ngx_shm_zone_t *shm_zone;
|
||||||
/* integer value, 1 corresponds to 0.001 r/s */
|
/* integer value, 1 corresponds to 0.001 r/s */
|
||||||
ngx_uint_t burst;
|
ngx_uint_t burst;
|
||||||
ngx_uint_t nodelay; /* unsigned nodelay:1 */
|
ngx_uint_t delay;
|
||||||
} ngx_http_limit_req_limit_t;
|
} ngx_http_limit_req_limit_t;
|
||||||
|
|
||||||
|
|
||||||
@@ -499,12 +499,12 @@ ngx_http_limit_req_account(ngx_http_limit_req_limit_t *limits, ngx_uint_t n,
|
|||||||
|
|
||||||
excess = *ep;
|
excess = *ep;
|
||||||
|
|
||||||
if (excess == 0 || (*limit)->nodelay) {
|
if ((ngx_uint_t) excess <= (*limit)->delay) {
|
||||||
max_delay = 0;
|
max_delay = 0;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
ctx = (*limit)->shm_zone->data;
|
ctx = (*limit)->shm_zone->data;
|
||||||
max_delay = excess * 1000 / ctx->rate;
|
max_delay = (excess - (*limit)->delay) * 1000 / ctx->rate;
|
||||||
}
|
}
|
||||||
|
|
||||||
while (n--) {
|
while (n--) {
|
||||||
@@ -544,11 +544,11 @@ ngx_http_limit_req_account(ngx_http_limit_req_limit_t *limits, ngx_uint_t n,
|
|||||||
|
|
||||||
ctx->node = NULL;
|
ctx->node = NULL;
|
||||||
|
|
||||||
if (limits[n].nodelay) {
|
if ((ngx_uint_t) excess <= limits[n].delay) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
delay = excess * 1000 / ctx->rate;
|
delay = (excess - limits[n].delay) * 1000 / ctx->rate;
|
||||||
|
|
||||||
if (delay > max_delay) {
|
if (delay > max_delay) {
|
||||||
max_delay = delay;
|
max_delay = delay;
|
||||||
@@ -875,9 +875,9 @@ ngx_http_limit_req(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
|
|||||||
{
|
{
|
||||||
ngx_http_limit_req_conf_t *lrcf = conf;
|
ngx_http_limit_req_conf_t *lrcf = conf;
|
||||||
|
|
||||||
ngx_int_t burst;
|
ngx_int_t burst, delay;
|
||||||
ngx_str_t *value, s;
|
ngx_str_t *value, s;
|
||||||
ngx_uint_t i, nodelay;
|
ngx_uint_t i;
|
||||||
ngx_shm_zone_t *shm_zone;
|
ngx_shm_zone_t *shm_zone;
|
||||||
ngx_http_limit_req_limit_t *limit, *limits;
|
ngx_http_limit_req_limit_t *limit, *limits;
|
||||||
|
|
||||||
@@ -885,7 +885,7 @@ ngx_http_limit_req(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
|
|||||||
|
|
||||||
shm_zone = NULL;
|
shm_zone = NULL;
|
||||||
burst = 0;
|
burst = 0;
|
||||||
nodelay = 0;
|
delay = 0;
|
||||||
|
|
||||||
for (i = 1; i < cf->args->nelts; i++) {
|
for (i = 1; i < cf->args->nelts; i++) {
|
||||||
|
|
||||||
@@ -908,7 +908,19 @@ ngx_http_limit_req(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
|
|||||||
burst = ngx_atoi(value[i].data + 6, value[i].len - 6);
|
burst = ngx_atoi(value[i].data + 6, value[i].len - 6);
|
||||||
if (burst <= 0) {
|
if (burst <= 0) {
|
||||||
ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
|
ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
|
||||||
"invalid burst rate \"%V\"", &value[i]);
|
"invalid burst value \"%V\"", &value[i]);
|
||||||
|
return NGX_CONF_ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ngx_strncmp(value[i].data, "delay=", 6) == 0) {
|
||||||
|
|
||||||
|
delay = ngx_atoi(value[i].data + 6, value[i].len - 6);
|
||||||
|
if (delay <= 0) {
|
||||||
|
ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
|
||||||
|
"invalid delay value \"%V\"", &value[i]);
|
||||||
return NGX_CONF_ERROR;
|
return NGX_CONF_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -916,7 +928,7 @@ ngx_http_limit_req(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (ngx_strcmp(value[i].data, "nodelay") == 0) {
|
if (ngx_strcmp(value[i].data, "nodelay") == 0) {
|
||||||
nodelay = 1;
|
delay = NGX_MAX_INT_T_VALUE / 1000;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -956,7 +968,7 @@ ngx_http_limit_req(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
|
|||||||
|
|
||||||
limit->shm_zone = shm_zone;
|
limit->shm_zone = shm_zone;
|
||||||
limit->burst = burst * 1000;
|
limit->burst = burst * 1000;
|
||||||
limit->nodelay = nodelay;
|
limit->delay = delay * 1000;
|
||||||
|
|
||||||
return NGX_CONF_OK;
|
return NGX_CONF_OK;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -169,7 +169,14 @@ typedef struct {
|
|||||||
|
|
||||||
|
|
||||||
#define ngx_mp4_atom_next(mp4, n) \
|
#define ngx_mp4_atom_next(mp4, n) \
|
||||||
mp4->buffer_pos += (size_t) n; \
|
\
|
||||||
|
if (n > (size_t) (mp4->buffer_end - mp4->buffer_pos)) { \
|
||||||
|
mp4->buffer_pos = mp4->buffer_end; \
|
||||||
|
\
|
||||||
|
} else { \
|
||||||
|
mp4->buffer_pos += (size_t) n; \
|
||||||
|
} \
|
||||||
|
\
|
||||||
mp4->offset += n
|
mp4->offset += n
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1505,8 +1505,8 @@ ngx_http_upstream_connect(ngx_http_request_t *r, ngx_http_upstream_t *u)
|
|||||||
|
|
||||||
r->connection->log->action = "connecting to upstream";
|
r->connection->log->action = "connecting to upstream";
|
||||||
|
|
||||||
if (u->state && u->state->response_time) {
|
if (u->state && u->state->response_time == (ngx_msec_t) -1) {
|
||||||
u->state->response_time = ngx_current_msec - u->state->response_time;
|
u->state->response_time = ngx_current_msec - u->start_time;
|
||||||
}
|
}
|
||||||
|
|
||||||
u->state = ngx_array_push(r->upstream_states);
|
u->state = ngx_array_push(r->upstream_states);
|
||||||
@@ -1518,7 +1518,9 @@ ngx_http_upstream_connect(ngx_http_request_t *r, ngx_http_upstream_t *u)
|
|||||||
|
|
||||||
ngx_memzero(u->state, sizeof(ngx_http_upstream_state_t));
|
ngx_memzero(u->state, sizeof(ngx_http_upstream_state_t));
|
||||||
|
|
||||||
u->state->response_time = ngx_current_msec;
|
u->start_time = ngx_current_msec;
|
||||||
|
|
||||||
|
u->state->response_time = (ngx_msec_t) -1;
|
||||||
u->state->connect_time = (ngx_msec_t) -1;
|
u->state->connect_time = (ngx_msec_t) -1;
|
||||||
u->state->header_time = (ngx_msec_t) -1;
|
u->state->header_time = (ngx_msec_t) -1;
|
||||||
|
|
||||||
@@ -2002,7 +2004,7 @@ ngx_http_upstream_send_request(ngx_http_request_t *r, ngx_http_upstream_t *u,
|
|||||||
"http upstream send request");
|
"http upstream send request");
|
||||||
|
|
||||||
if (u->state->connect_time == (ngx_msec_t) -1) {
|
if (u->state->connect_time == (ngx_msec_t) -1) {
|
||||||
u->state->connect_time = ngx_current_msec - u->state->response_time;
|
u->state->connect_time = ngx_current_msec - u->start_time;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!u->request_sent && ngx_http_upstream_test_connect(c) != NGX_OK) {
|
if (!u->request_sent && ngx_http_upstream_test_connect(c) != NGX_OK) {
|
||||||
@@ -2413,7 +2415,7 @@ ngx_http_upstream_process_header(ngx_http_request_t *r, ngx_http_upstream_t *u)
|
|||||||
|
|
||||||
/* rc == NGX_OK */
|
/* rc == NGX_OK */
|
||||||
|
|
||||||
u->state->header_time = ngx_current_msec - u->state->response_time;
|
u->state->header_time = ngx_current_msec - u->start_time;
|
||||||
|
|
||||||
if (u->headers_in.status_n >= NGX_HTTP_SPECIAL_RESPONSE) {
|
if (u->headers_in.status_n >= NGX_HTTP_SPECIAL_RESPONSE) {
|
||||||
|
|
||||||
@@ -4309,8 +4311,8 @@ ngx_http_upstream_finalize_request(ngx_http_request_t *r,
|
|||||||
u->resolved->ctx = NULL;
|
u->resolved->ctx = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (u->state && u->state->response_time) {
|
if (u->state && u->state->response_time == (ngx_msec_t) -1) {
|
||||||
u->state->response_time = ngx_current_msec - u->state->response_time;
|
u->state->response_time = ngx_current_msec - u->start_time;
|
||||||
|
|
||||||
if (u->pipe && u->pipe->read_length) {
|
if (u->pipe && u->pipe->read_length) {
|
||||||
u->state->bytes_received += u->pipe->read_length
|
u->state->bytes_received += u->pipe->read_length
|
||||||
@@ -5419,18 +5421,18 @@ ngx_http_upstream_response_time_variable(ngx_http_request_t *r,
|
|||||||
state = r->upstream_states->elts;
|
state = r->upstream_states->elts;
|
||||||
|
|
||||||
for ( ;; ) {
|
for ( ;; ) {
|
||||||
if (state[i].status) {
|
|
||||||
|
|
||||||
if (data == 1 && state[i].header_time != (ngx_msec_t) -1) {
|
if (data == 1) {
|
||||||
ms = state[i].header_time;
|
ms = state[i].header_time;
|
||||||
|
|
||||||
} else if (data == 2 && state[i].connect_time != (ngx_msec_t) -1) {
|
} else if (data == 2) {
|
||||||
ms = state[i].connect_time;
|
ms = state[i].connect_time;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
ms = state[i].response_time;
|
ms = state[i].response_time;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (ms != -1) {
|
||||||
ms = ngx_max(ms, 0);
|
ms = ngx_max(ms, 0);
|
||||||
p = ngx_sprintf(p, "%T.%03M", (time_t) ms / 1000, ms % 1000);
|
p = ngx_sprintf(p, "%T.%03M", (time_t) ms / 1000, ms % 1000);
|
||||||
|
|
||||||
|
|||||||
@@ -365,7 +365,7 @@ struct ngx_http_upstream_s {
|
|||||||
ngx_int_t (*rewrite_cookie)(ngx_http_request_t *r,
|
ngx_int_t (*rewrite_cookie)(ngx_http_request_t *r,
|
||||||
ngx_table_elt_t *h);
|
ngx_table_elt_t *h);
|
||||||
|
|
||||||
ngx_msec_t timeout;
|
ngx_msec_t start_time;
|
||||||
|
|
||||||
ngx_http_upstream_state_t *state;
|
ngx_http_upstream_state_t *state;
|
||||||
|
|
||||||
|
|||||||
@@ -690,7 +690,7 @@ ngx_stream_proxy_connect(ngx_stream_session_t *s)
|
|||||||
u->proxy_protocol = pscf->proxy_protocol;
|
u->proxy_protocol = pscf->proxy_protocol;
|
||||||
|
|
||||||
if (u->state) {
|
if (u->state) {
|
||||||
u->state->response_time = ngx_current_msec - u->state->response_time;
|
u->state->response_time = ngx_current_msec - u->start_time;
|
||||||
}
|
}
|
||||||
|
|
||||||
u->state = ngx_array_push(s->upstream_states);
|
u->state = ngx_array_push(s->upstream_states);
|
||||||
@@ -701,9 +701,11 @@ ngx_stream_proxy_connect(ngx_stream_session_t *s)
|
|||||||
|
|
||||||
ngx_memzero(u->state, sizeof(ngx_stream_upstream_state_t));
|
ngx_memzero(u->state, sizeof(ngx_stream_upstream_state_t));
|
||||||
|
|
||||||
|
u->start_time = ngx_current_msec;
|
||||||
|
|
||||||
u->state->connect_time = (ngx_msec_t) -1;
|
u->state->connect_time = (ngx_msec_t) -1;
|
||||||
u->state->first_byte_time = (ngx_msec_t) -1;
|
u->state->first_byte_time = (ngx_msec_t) -1;
|
||||||
u->state->response_time = ngx_current_msec;
|
u->state->response_time = (ngx_msec_t) -1;
|
||||||
|
|
||||||
rc = ngx_event_connect_peer(&u->peer);
|
rc = ngx_event_connect_peer(&u->peer);
|
||||||
|
|
||||||
@@ -817,7 +819,7 @@ ngx_stream_proxy_init_upstream(ngx_stream_session_t *s)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
u->state->connect_time = ngx_current_msec - u->state->response_time;
|
u->state->connect_time = ngx_current_msec - u->start_time;
|
||||||
|
|
||||||
if (u->peer.notify) {
|
if (u->peer.notify) {
|
||||||
u->peer.notify(&u->peer, u->peer.data,
|
u->peer.notify(&u->peer, u->peer.data,
|
||||||
@@ -1622,7 +1624,7 @@ ngx_stream_proxy_process(ngx_stream_session_t *s, ngx_uint_t from_upstream,
|
|||||||
if (from_upstream) {
|
if (from_upstream) {
|
||||||
if (u->state->first_byte_time == (ngx_msec_t) -1) {
|
if (u->state->first_byte_time == (ngx_msec_t) -1) {
|
||||||
u->state->first_byte_time = ngx_current_msec
|
u->state->first_byte_time = ngx_current_msec
|
||||||
- u->state->response_time;
|
- u->start_time;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1857,7 +1859,9 @@ ngx_stream_proxy_finalize(ngx_stream_session_t *s, ngx_uint_t rc)
|
|||||||
pc = u->peer.connection;
|
pc = u->peer.connection;
|
||||||
|
|
||||||
if (u->state) {
|
if (u->state) {
|
||||||
u->state->response_time = ngx_current_msec - u->state->response_time;
|
if (u->state->response_time == (ngx_msec_t) -1) {
|
||||||
|
u->state->response_time = ngx_current_msec - u->start_time;
|
||||||
|
}
|
||||||
|
|
||||||
if (pc) {
|
if (pc) {
|
||||||
u->state->bytes_received = u->received;
|
u->state->bytes_received = u->received;
|
||||||
|
|||||||
@@ -267,24 +267,22 @@ ngx_stream_upstream_response_time_variable(ngx_stream_session_t *s,
|
|||||||
for ( ;; ) {
|
for ( ;; ) {
|
||||||
|
|
||||||
if (data == 1) {
|
if (data == 1) {
|
||||||
if (state[i].first_byte_time == (ngx_msec_t) -1) {
|
|
||||||
*p++ = '-';
|
|
||||||
goto next;
|
|
||||||
}
|
|
||||||
|
|
||||||
ms = state[i].first_byte_time;
|
ms = state[i].first_byte_time;
|
||||||
|
|
||||||
} else if (data == 2 && state[i].connect_time != (ngx_msec_t) -1) {
|
} else if (data == 2) {
|
||||||
ms = state[i].connect_time;
|
ms = state[i].connect_time;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
ms = state[i].response_time;
|
ms = state[i].response_time;
|
||||||
}
|
}
|
||||||
|
|
||||||
ms = ngx_max(ms, 0);
|
if (ms != -1) {
|
||||||
p = ngx_sprintf(p, "%T.%03M", (time_t) ms / 1000, ms % 1000);
|
ms = ngx_max(ms, 0);
|
||||||
|
p = ngx_sprintf(p, "%T.%03M", (time_t) ms / 1000, ms % 1000);
|
||||||
|
|
||||||
next:
|
} else {
|
||||||
|
*p++ = '-';
|
||||||
|
}
|
||||||
|
|
||||||
if (++i == s->upstream_states->nelts) {
|
if (++i == s->upstream_states->nelts) {
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -130,6 +130,7 @@ typedef struct {
|
|||||||
time_t start_sec;
|
time_t start_sec;
|
||||||
ngx_uint_t requests;
|
ngx_uint_t requests;
|
||||||
ngx_uint_t responses;
|
ngx_uint_t responses;
|
||||||
|
ngx_msec_t start_time;
|
||||||
|
|
||||||
ngx_str_t ssl_name;
|
ngx_str_t ssl_name;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user