summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorValentin Bartenev <vbart@nginx.com>2016-04-14 15:14:15 +0300
committerValentin Bartenev <vbart@nginx.com>2016-04-14 15:14:15 +0300
commit60f0960ab6cb35a6fffc57f32c311c93c28181af (patch)
treec6e181ba3c329e8c3db7f88324ee9facb0e46117
parent4c1b9fef65e9a992933ae0168e62bba279eabfab (diff)
downloadnginx-60f0960ab6cb35a6fffc57f32c311c93c28181af.tar.gz
HTTP/2: deduplicated some code in ngx_http_v2_state_headers().
No functional changes.
-rw-r--r--src/http/v2/ngx_http_v2.c31
1 files changed, 13 insertions, 18 deletions
diff --git a/src/http/v2/ngx_http_v2.c b/src/http/v2/ngx_http_v2.c
index 4bd85b8d3..a2070758f 100644
--- a/src/http/v2/ngx_http_v2.c
+++ b/src/http/v2/ngx_http_v2.c
@@ -948,6 +948,7 @@ ngx_http_v2_state_headers(ngx_http_v2_connection_t *h2c, u_char *pos,
{
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;
@@ -1040,15 +1041,8 @@ ngx_http_v2_state_headers(ngx_http_v2_connection_t *h2c, u_char *pos,
"client sent HEADERS frame for stream %ui "
"with incorrect dependency", h2c->state.sid);
- if (ngx_http_v2_send_rst_stream(h2c, h2c->state.sid,
- NGX_HTTP_V2_PROTOCOL_ERROR)
- != NGX_OK)
- {
- return ngx_http_v2_connection_error(h2c,
- NGX_HTTP_V2_INTERNAL_ERROR);
- }
-
- return ngx_http_v2_state_header_block(h2c, pos, end);
+ status = NGX_HTTP_V2_PROTOCOL_ERROR;
+ goto rst_stream;
}
h2scf = ngx_http_get_module_srv_conf(h2c->http_connection->conf_ctx,
@@ -1060,15 +1054,8 @@ ngx_http_v2_state_headers(ngx_http_v2_connection_t *h2c, u_char *pos,
ngx_log_error(NGX_LOG_INFO, h2c->connection->log, 0,
"concurrent streams exceeded %ui", h2c->processing);
- if (ngx_http_v2_send_rst_stream(h2c, h2c->state.sid,
- NGX_HTTP_V2_REFUSED_STREAM)
- != NGX_OK)
- {
- return ngx_http_v2_connection_error(h2c,
- NGX_HTTP_V2_INTERNAL_ERROR);
- }
-
- return ngx_http_v2_state_header_block(h2c, pos, end);
+ status = NGX_HTTP_V2_REFUSED_STREAM;
+ goto rst_stream;
}
node = ngx_http_v2_get_node_by_id(h2c, h2c->state.sid, 1);
@@ -1105,6 +1092,14 @@ ngx_http_v2_state_headers(ngx_http_v2_connection_t *h2c, u_char *pos,
}
return ngx_http_v2_state_header_block(h2c, pos, end);
+
+rst_stream:
+
+ if (ngx_http_v2_send_rst_stream(h2c, h2c->state.sid, status) != NGX_OK) {
+ return ngx_http_v2_connection_error(h2c, NGX_HTTP_V2_INTERNAL_ERROR);
+ }
+
+ return ngx_http_v2_state_header_block(h2c, pos, end);
}