From c0b58bbcf662843d23d23218399ac884fa0c07ca Mon Sep 17 00:00:00 2001 From: Hakase Date: Mon, 16 Sep 2019 13:39:01 +0900 Subject: [PATCH] Latest update - 7566 --- src/core/ngx_resolver.c | 3 +- src/http/v2/ngx_http_v2.c | 76 +++++++-------------------------------- 2 files changed, 14 insertions(+), 65 deletions(-) diff --git a/src/core/ngx_resolver.c b/src/core/ngx_resolver.c index 593645d..e51712c 100644 --- a/src/core/ngx_resolver.c +++ b/src/core/ngx_resolver.c @@ -972,7 +972,8 @@ ngx_resolve_addr(ngx_resolver_ctx_t *ctx) name = ngx_resolver_dup(r, rn->name, rn->nlen); if (name == NULL) { - goto failed; + ngx_resolver_free(r, ctx); + return NGX_ERROR; } ctx->name.len = rn->nlen; diff --git a/src/http/v2/ngx_http_v2.c b/src/http/v2/ngx_http_v2.c index 58ffb21..9b6f44c 100644 --- a/src/http/v2/ngx_http_v2.c +++ b/src/http/v2/ngx_http_v2.c @@ -1109,20 +1109,19 @@ ngx_http_v2_state_headers(ngx_http_v2_connection_t *h2c, u_char *pos, return ngx_http_v2_connection_error(h2c, NGX_HTTP_V2_PROTOCOL_ERROR); } - h2c->last_sid = h2c->state.sid; - - h2c->state.pool = ngx_create_pool(1024, h2c->connection->log); - if (h2c->state.pool == NULL) { - return ngx_http_v2_connection_error(h2c, NGX_HTTP_V2_INTERNAL_ERROR); - } - if (depend == h2c->state.sid) { ngx_log_error(NGX_LOG_INFO, h2c->connection->log, 0, "client sent HEADERS frame for stream %ui " "with incorrect dependency", h2c->state.sid); - status = NGX_HTTP_V2_PROTOCOL_ERROR; - goto rst_stream; + return ngx_http_v2_connection_error(h2c, NGX_HTTP_V2_PROTOCOL_ERROR); + } + + h2c->last_sid = h2c->state.sid; + + h2c->state.pool = ngx_create_pool(1024, h2c->connection->log); + if (h2c->state.pool == NULL) { + return ngx_http_v2_connection_error(h2c, NGX_HTTP_V2_INTERNAL_ERROR); } h2scf = ngx_http_get_module_srv_conf(h2c->http_connection->conf_ctx, @@ -1851,28 +1850,7 @@ ngx_http_v2_state_priority(ngx_http_v2_connection_t *h2c, u_char *pos, "client sent PRIORITY frame for stream %ui " "with incorrect dependency", h2c->state.sid); - node = ngx_http_v2_get_node_by_id(h2c, h2c->state.sid, 0); - - if (node && node->stream) { - if (ngx_http_v2_terminate_stream(h2c, node->stream, - NGX_HTTP_V2_PROTOCOL_ERROR) - == NGX_ERROR) - { - return ngx_http_v2_connection_error(h2c, - NGX_HTTP_V2_INTERNAL_ERROR); - } - - } else { - if (ngx_http_v2_send_rst_stream(h2c, h2c->state.sid, - NGX_HTTP_V2_PROTOCOL_ERROR) - == NGX_ERROR) - { - return ngx_http_v2_connection_error(h2c, - NGX_HTTP_V2_INTERNAL_ERROR); - } - } - - return ngx_http_v2_state_complete(h2c, pos, end); + return ngx_http_v2_connection_error(h2c, NGX_HTTP_V2_PROTOCOL_ERROR); } node = ngx_http_v2_get_node_by_id(h2c, h2c->state.sid, 1); @@ -2263,41 +2241,11 @@ ngx_http_v2_state_window_update(ngx_http_v2_connection_t *h2c, u_char *pos, h2c->state.sid, window); if (window == 0) { - if (h2c->state.sid == 0) { - ngx_log_error(NGX_LOG_INFO, h2c->connection->log, 0, - "client sent WINDOW_UPDATE frame " - "with incorrect window increment 0"); - - return ngx_http_v2_connection_error(h2c, - NGX_HTTP_V2_PROTOCOL_ERROR); - } - ngx_log_error(NGX_LOG_INFO, h2c->connection->log, 0, - "client sent WINDOW_UPDATE frame for stream %ui " - "with incorrect window increment 0", h2c->state.sid); + "client sent WINDOW_UPDATE frame " + "with incorrect window increment 0"); - node = ngx_http_v2_get_node_by_id(h2c, h2c->state.sid, 0); - - if (node && node->stream) { - if (ngx_http_v2_terminate_stream(h2c, node->stream, - NGX_HTTP_V2_PROTOCOL_ERROR) - == NGX_ERROR) - { - return ngx_http_v2_connection_error(h2c, - NGX_HTTP_V2_INTERNAL_ERROR); - } - - } else { - if (ngx_http_v2_send_rst_stream(h2c, h2c->state.sid, - NGX_HTTP_V2_PROTOCOL_ERROR) - == NGX_ERROR) - { - return ngx_http_v2_connection_error(h2c, - NGX_HTTP_V2_INTERNAL_ERROR); - } - } - - return ngx_http_v2_state_complete(h2c, pos, end); + return ngx_http_v2_connection_error(h2c, NGX_HTTP_V2_PROTOCOL_ERROR); } if (h2c->state.sid) {