Corrected $request_length calculation for pipelined requests.

This commit is contained in:
Andrey Belov 2012-07-06 04:27:06 +00:00
parent bbfc96c703
commit 3d87bcf9ae

View File

@ -747,6 +747,7 @@ ngx_http_process_request_line(ngx_event_t *rev)
r->request_line.len = r->request_end - r->request_start;
r->request_line.data = r->request_start;
r->request_length = r->header_in->pos - r->request_start;
if (r->args_start) {
@ -1056,6 +1057,8 @@ ngx_http_process_request_headers(ngx_event_t *rev)
if (rc == NGX_OK) {
r->request_length += r->header_in->pos - r->header_name_start;
if (r->invalid_header && cscf->ignore_invalid_headers) {
/* there was error while a header line parsing */
@ -1119,7 +1122,7 @@ ngx_http_process_request_headers(ngx_event_t *rev)
ngx_log_debug0(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
"http header done");
r->request_length += r->header_in->pos - r->header_in->start;
r->request_length += r->header_in->pos - r->header_name_start;
r->http_state = NGX_HTTP_PROCESS_REQUEST_STATE;
@ -1226,8 +1229,6 @@ ngx_http_alloc_large_header_buffer(ngx_http_request_t *r,
/* the client fills up the buffer with "\r\n" */
r->request_length += r->header_in->end - r->header_in->start;
r->header_in->pos = r->header_in->start;
r->header_in->last = r->header_in->start;
@ -1287,8 +1288,6 @@ ngx_http_alloc_large_header_buffer(ngx_http_request_t *r,
* to relocate the parser header pointers
*/
r->request_length += r->header_in->end - r->header_in->start;
r->header_in = b;
return NGX_OK;
@ -1297,8 +1296,6 @@ ngx_http_alloc_large_header_buffer(ngx_http_request_t *r,
ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
"http large header copy: %d", r->header_in->pos - old);
r->request_length += old - r->header_in->start;
new = b->start;
ngx_memcpy(new, old, r->header_in->pos - old);