diff src/http/ngx_http_variables.c @ 3929:fa4612bfb9fa

change ngx_http_map_find(): use case sensitive regexes
author Igor Sysoev <igor@sysoev.ru>
date Mon, 30 May 2011 12:36:17 +0000
parents 83cd1910329c
children 4d9f985fd217 dfb04ceb266f
line wrap: on
line diff
--- a/src/http/ngx_http_variables.c
+++ b/src/http/ngx_http_variables.c
@@ -1661,14 +1661,30 @@ ngx_http_variable_pid(ngx_http_request_t
 
 
 void *
-ngx_http_map_find(ngx_http_request_t *r, ngx_http_map_t *map, ngx_uint_t key,
-    u_char *text, size_t len, ngx_str_t *match)
+ngx_http_map_find(ngx_http_request_t *r, ngx_http_map_t *map, ngx_str_t *match)
 {
-    void  *p;
-
-    p = ngx_hash_find_combined(&map->hash, key, text, len);
-    if (p) {
-        return p;
+    void        *value;
+    u_char      *low;
+    size_t       len;
+    ngx_uint_t   key;
+
+    len = match->len;
+
+    if (len) {
+        low = ngx_pnalloc(r->pool, len);
+        if (low == NULL) {
+            return NULL;
+        }
+
+    } else {
+        low = NULL;
+    }
+
+    key = ngx_hash_strlow(low, match->data, len);
+
+    value = ngx_hash_find_combined(&map->hash, key, low, len);
+    if (value) {
+        return value;
     }
 
 #if (NGX_PCRE)