diff src/http/ngx_http_core_module.c @ 16:74b1868dd3cd NGINX_0_1_8

nginx 0.1.8 *) Bugfix: in the ngx_http_autoindex_module if the long file names were in the listing. *) Feature: the "^~" modifier in the location directive. *) Feature: the proxy_max_temp_file_size directive.
author Igor Sysoev <http://sysoev.ru>
date Sat, 20 Nov 2004 00:00:00 +0300
parents 7da8ea7c4448
children 6f8b0dc0f8dd
line wrap: on
line diff
--- a/src/http/ngx_http_core_module.c
+++ b/src/http/ngx_http_core_module.c
@@ -13,7 +13,8 @@
 
 #define NGX_HTTP_LOCATION_EXACT           1
 #define NGX_HTTP_LOCATION_AUTO_REDIRECT   2
-#define NGX_HTTP_LOCATION_REGEX           3
+#define NGX_HTTP_LOCATION_NOREGEX         3
+#define NGX_HTTP_LOCATION_REGEX           4
 
 
 static void ngx_http_phase_event_handler(ngx_event_t *rev);
@@ -564,12 +565,13 @@ static ngx_int_t ngx_http_find_location(
                                         ngx_array_t *locations, size_t len)
 {
     ngx_int_t                  n, rc;
-    ngx_uint_t                 i, found;
+    ngx_uint_t                 i, found, noregex;
     ngx_http_core_loc_conf_t  *clcf, **clcfp;
 
     ngx_log_debug0(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, "find location");
 
     found = 0;
+    noregex = 0;
 
     clcfp = locations->elts;
     for (i = 0; i < locations->nelts; i++) {
@@ -619,6 +621,7 @@ static ngx_int_t ngx_http_find_location(
             }
 
             r->loc_conf = clcfp[i]->loc_conf;
+            noregex = clcfp[i]->noregex;
             found = 1;
         }
     }
@@ -637,6 +640,10 @@ static ngx_int_t ngx_http_find_location(
 
 #if (NGX_PCRE)
 
+    if (noregex) {
+        return NGX_HTTP_LOCATION_NOREGEX;
+    }
+
     /* regex matches */
 
     for (/* void */; i < locations->nelts; i++) {
@@ -1069,6 +1076,13 @@ static char *ngx_location_block(ngx_conf
             clcf->name = value[2];
             clcf->exact_match = 1;
 
+        } else if (value[1].len == 2
+                   && value[1].data[0] == '^'
+                   && value[1].data[1] == '~')
+        {
+            clcf->name = value[2];
+            clcf->noregex = 1;
+
         } else if ((value[1].len == 1 && value[1].data[0] == '~')
                    || (value[1].len == 2
                        && value[1].data[0] == '~'