[nginx] svn commit: r4740 - trunk/src/http

defan at nginx.com defan at nginx.com
Fri Jul 6 04:27:06 UTC 2012


Author: defan
Date: 2012-07-06 04:27:06 +0000 (Fri, 06 Jul 2012)
New Revision: 4740
URL: http://trac.nginx.org/nginx/changeset/4740/nginx

Log:
Corrected $request_length calculation for pipelined requests.


Modified:
   trunk/src/http/ngx_http_request.c

Modified: trunk/src/http/ngx_http_request.c
===================================================================
--- trunk/src/http/ngx_http_request.c	2012-07-03 13:06:40 UTC (rev 4739)
+++ trunk/src/http/ngx_http_request.c	2012-07-06 04:27:06 UTC (rev 4740)
@@ -747,6 +747,7 @@
 
             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 @@
 
         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_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 @@
 
         /* 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 @@
          * 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_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);



More information about the nginx-devel mailing list