diff src/http/ngx_http_request.c @ 680:597573166f34 NGINX_1_3_3

nginx 1.3.3 *) Feature: entity tags support and the "etag" directive. *) Bugfix: trailing dot in a source value was not ignored if the "map" directive was used with the "hostnames" parameter. *) Bugfix: incorrect location might be used to process a request if a URI was changed via a "rewrite" directive before an internal redirect to a named location.
author Igor Sysoev <http://sysoev.ru>
date Tue, 10 Jul 2012 00:00:00 +0400
parents 981b4c44593b
children 5cb5db9975ba
line wrap: on
line diff
--- a/src/http/ngx_http_request.c
+++ b/src/http/ngx_http_request.c
@@ -93,6 +93,14 @@ ngx_http_header_t  ngx_http_headers_in[]
                  offsetof(ngx_http_headers_in_t, if_unmodified_since),
                  ngx_http_process_unique_header_line },
 
+    { ngx_string("If-Match"),
+                 offsetof(ngx_http_headers_in_t, if_match),
+                 ngx_http_process_unique_header_line },
+
+    { ngx_string("If-None-Match"),
+                 offsetof(ngx_http_headers_in_t, if_none_match),
+                 ngx_http_process_unique_header_line },
+
     { ngx_string("User-Agent"), offsetof(ngx_http_headers_in_t, user_agent),
                  ngx_http_process_user_agent },
 
@@ -747,6 +755,7 @@ ngx_http_process_request_line(ngx_event_
 
             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 +1065,8 @@ ngx_http_process_request_headers(ngx_eve
 
         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 +1130,7 @@ ngx_http_process_request_headers(ngx_eve
             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 +1237,6 @@ ngx_http_alloc_large_header_buffer(ngx_h
 
         /* 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 +1296,6 @@ ngx_http_alloc_large_header_buffer(ngx_h
          * 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 +1304,6 @@ ngx_http_alloc_large_header_buffer(ngx_h
     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);