summaryrefslogtreecommitdiffhomepage
path: root/src/http/v2/ngx_http_v2.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/http/v2/ngx_http_v2.c')
-rw-r--r--src/http/v2/ngx_http_v2.c37
1 files changed, 23 insertions, 14 deletions
diff --git a/src/http/v2/ngx_http_v2.c b/src/http/v2/ngx_http_v2.c
index 1962d6dc1..071fadb59 100644
--- a/src/http/v2/ngx_http_v2.c
+++ b/src/http/v2/ngx_http_v2.c
@@ -637,7 +637,7 @@ ngx_http_v2_handle_connection(ngx_http_v2_connection_t *h2c)
{
ngx_int_t rc;
ngx_connection_t *c;
- ngx_http_v2_srv_conf_t *h2scf;
+ ngx_http_core_loc_conf_t *clcf;
ngx_http_core_srv_conf_t *cscf;
if (h2c->last_out || h2c->processing || h2c->pushing) {
@@ -709,10 +709,10 @@ ngx_http_v2_handle_connection(ngx_http_v2_connection_t *h2c)
ngx_del_timer(c->write);
}
- h2scf = ngx_http_get_module_srv_conf(h2c->http_connection->conf_ctx,
- ngx_http_v2_module);
+ clcf = ngx_http_get_module_loc_conf(h2c->http_connection->conf_ctx,
+ ngx_http_core_module);
- ngx_add_timer(c->read, h2scf->idle_timeout);
+ ngx_add_timer(c->read, clcf->keepalive_timeout);
}
@@ -1200,12 +1200,14 @@ static u_char *
ngx_http_v2_state_headers(ngx_http_v2_connection_t *h2c, u_char *pos,
u_char *end)
{
- size_t size;
- ngx_uint_t padded, priority, depend, dependency, excl, weight;
- ngx_uint_t status;
- ngx_http_v2_node_t *node;
- ngx_http_v2_stream_t *stream;
- ngx_http_v2_srv_conf_t *h2scf;
+ size_t size;
+ ngx_uint_t padded, priority, depend, dependency, excl,
+ weight;
+ ngx_uint_t status;
+ ngx_http_v2_node_t *node;
+ ngx_http_v2_stream_t *stream;
+ ngx_http_v2_srv_conf_t *h2scf;
+ ngx_http_core_loc_conf_t *clcf;
padded = h2c->state.flags & NGX_HTTP_V2_PADDED_FLAG;
priority = h2c->state.flags & NGX_HTTP_V2_PRIORITY_FLAG;
@@ -1364,7 +1366,10 @@ ngx_http_v2_state_headers(ngx_http_v2_connection_t *h2c, u_char *pos,
ngx_http_v2_set_dependency(h2c, node, depend, excl);
}
- if (h2c->connection->requests >= h2scf->max_requests) {
+ clcf = ngx_http_get_module_loc_conf(h2c->http_connection->conf_ctx,
+ ngx_http_core_module);
+
+ if (h2c->connection->requests >= clcf->keepalive_requests) {
h2c->goaway = 1;
if (ngx_http_v2_send_goaway(h2c, NGX_HTTP_V2_NO_ERROR) == NGX_ERROR) {
@@ -4659,6 +4664,7 @@ ngx_http_v2_idle_handler(ngx_event_t *rev)
ngx_connection_t *c;
ngx_http_v2_srv_conf_t *h2scf;
ngx_http_v2_connection_t *h2c;
+ ngx_http_core_loc_conf_t *clcf;
c = rev->data;
h2c = c->data;
@@ -4690,10 +4696,10 @@ ngx_http_v2_idle_handler(ngx_event_t *rev)
#endif
- h2scf = ngx_http_get_module_srv_conf(h2c->http_connection->conf_ctx,
- ngx_http_v2_module);
+ clcf = ngx_http_get_module_loc_conf(h2c->http_connection->conf_ctx,
+ ngx_http_core_module);
- if (h2c->idle++ > 10 * h2scf->max_requests) {
+ if (h2c->idle++ > 10 * clcf->keepalive_requests) {
ngx_log_error(NGX_LOG_INFO, h2c->connection->log, 0,
"http2 flood detected");
ngx_http_v2_finalize_connection(h2c, NGX_HTTP_V2_NO_ERROR);
@@ -4707,6 +4713,9 @@ ngx_http_v2_idle_handler(ngx_event_t *rev)
ngx_del_timer(c->read);
}
+ h2scf = ngx_http_get_module_srv_conf(h2c->http_connection->conf_ctx,
+ ngx_http_v2_module);
+
h2c->pool = ngx_create_pool(h2scf->pool_size, h2c->connection->log);
if (h2c->pool == NULL) {
ngx_http_v2_finalize_connection(h2c, NGX_HTTP_V2_INTERNAL_ERROR);