diff src/http/ngx_http_request.c @ 392:34fb3a573548 NGINX_0_7_8

nginx 0.7.8 *) Feature: the ngx_http_xslt_module. *) Feature: the "$arg_..." variables. *) Feature: Solaris directio support. Thanks to Ivan Debnar. *) Bugfix: now if FastCGI server sends a "Location" header line without status line, then nginx uses 302 status code. Thanks to Maxim Dounin.
author Igor Sysoev <http://sysoev.ru>
date Mon, 04 Aug 2008 00:00:00 +0400
parents 0b6053502c55
children 6ebbca3d5ed7
line wrap: on
line diff
--- a/src/http/ngx_http_request.c
+++ b/src/http/ngx_http_request.c
@@ -647,6 +647,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_end = '\0';
 
 
             if (r->args_start) {
@@ -818,7 +819,6 @@ ngx_http_process_request_headers(ngx_eve
     ssize_t                     n;
     ngx_int_t                   rc, rv;
     ngx_str_t                   header;
-    ngx_uint_t                  i;
     ngx_table_elt_t            *h;
     ngx_connection_t           *c;
     ngx_http_header_t          *hh;
@@ -928,9 +928,7 @@ ngx_http_process_request_headers(ngx_eve
                 ngx_memcpy(h->lowcase_key, r->lowcase_header, h->key.len);
 
             } else {
-                for (i = 0; i < h->key.len; i++) {
-                    h->lowcase_key[i] = ngx_tolower(h->key.data[i]);
-                }
+                ngx_strlow(h->lowcase_key, h->key.data, h->key.len);
             }
 
             hh = ngx_hash_find(&cmcf->headers_in_hash, h->hash,
@@ -1552,8 +1550,8 @@ ngx_http_validate_host(u_char *host, siz
 static ngx_int_t
 ngx_http_find_virtual_server(ngx_http_request_t *r, u_char *host, size_t len)
 {
-    u_char                    *server, ch;
-    ngx_uint_t                 i, hash;
+    u_char                    *server;
+    ngx_uint_t                 hash;
     ngx_http_core_loc_conf_t  *clcf;
     ngx_http_core_srv_conf_t  *cscf;
     u_char                     buf[32];
@@ -1572,16 +1570,7 @@ ngx_http_find_virtual_server(ngx_http_re
         }
     }
 
-    hash = 0;
-
-    for (i = 0; i < len; i++) {
-        ch = host[i];
-
-        ch = ngx_tolower(ch);
-        server[i] = ch;
-
-        hash = ngx_hash(hash, ch);
-    }
+    hash = ngx_hash_strlow(server, host, len);
 
     cscf = ngx_hash_find_combined(&r->virtual_names->names, hash, server, len);