comparison src/http/modules/ngx_http_fastcgi_module.c @ 5604:22d485944c20

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.
author Maxim Dounin <mdounin@mdounin.ru>
date Mon, 17 Mar 2014 15:34:36 +0400
parents d15822784cf9
children c95d7882dfc9
comparison
equal deleted inserted replaced
5603:b2b5b1b74129 5604:22d485944c20
1206 1206
1207 f->state = ngx_http_fastcgi_st_version; 1207 f->state = ngx_http_fastcgi_st_version;
1208 f->fastcgi_stdout = 0; 1208 f->fastcgi_stdout = 0;
1209 f->large_stderr = 0; 1209 f->large_stderr = 0;
1210 1210
1211 if (f->split_parts) {
1212 f->split_parts->nelts = 0;
1213 }
1214
1211 r->state = 0; 1215 r->state = 0;
1212 1216
1213 return NGX_OK; 1217 return NGX_OK;
1214 } 1218 }
1215 1219
1486 1490
1487 f->split_parts->nelts = 0; 1491 f->split_parts->nelts = 0;
1488 1492
1489 rc = ngx_http_parse_header_line(r, &buf, 1); 1493 rc = ngx_http_parse_header_line(r, &buf, 1);
1490 1494
1495 if (rc != NGX_OK) {
1496 ngx_log_error(NGX_LOG_ALERT, r->connection->log, 0,
1497 "invalid header after joining "
1498 "FastCGI records");
1499 return NGX_ERROR;
1500 }
1501
1491 h->key.len = r->header_name_end - r->header_name_start; 1502 h->key.len = r->header_name_end - r->header_name_start;
1492 h->key.data = r->header_name_start; 1503 h->key.data = r->header_name_start;
1493 h->key.data[h->key.len] = '\0'; 1504 h->key.data[h->key.len] = '\0';
1494 1505
1495 h->value.len = r->header_end - r->header_start; 1506 h->value.len = r->header_end - r->header_start;