summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMaxim Dounin <mdounin@mdounin.ru>2014-03-17 15:34:36 +0400
committerMaxim Dounin <mdounin@mdounin.ru>2014-03-17 15:34:36 +0400
commit8bb322b89ce887eb45aa24e4dc15c53dcb42f97d (patch)
tree6bed9e82d3d20d87eb446bf714e2ddb1516ebeb6
parent7bd9d0c9de995dad17a00f9226de4d9bd96f94e1 (diff)
downloadnginx-8bb322b89ce887eb45aa24e4dc15c53dcb42f97d.tar.gz
FastCGI: f->split_parts reset on request start.
Additionally, make sure to check for errors from ngx_http_parse_header_line() call after joining saved parts. There shouldn't be any errors, though check may help to catch bugs like missing f->split_parts reset. Reported by Lucas Molas.
-rw-r--r--src/http/modules/ngx_http_fastcgi_module.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/http/modules/ngx_http_fastcgi_module.c b/src/http/modules/ngx_http_fastcgi_module.c
index f386926da..e2427b4a8 100644
--- a/src/http/modules/ngx_http_fastcgi_module.c
+++ b/src/http/modules/ngx_http_fastcgi_module.c
@@ -1195,6 +1195,10 @@ ngx_http_fastcgi_reinit_request(ngx_http_request_t *r)
f->fastcgi_stdout = 0;
f->large_stderr = 0;
+ if (f->split_parts) {
+ f->split_parts->nelts = 0;
+ }
+
r->state = 0;
return NGX_OK;
@@ -1475,6 +1479,13 @@ ngx_http_fastcgi_process_header(ngx_http_request_t *r)
rc = ngx_http_parse_header_line(r, &buf, 1);
+ if (rc != NGX_OK) {
+ ngx_log_error(NGX_LOG_ALERT, r->connection->log, 0,
+ "invalid header after joining "
+ "FastCGI records");
+ return NGX_ERROR;
+ }
+
h->key.len = r->header_name_end - r->header_name_start;
h->key.data = r->header_name_start;
h->key.data[h->key.len] = '\0';