comparison 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
comparison
equal deleted inserted replaced
15:0503cb60c4e4 16:74b1868dd3cd
11 #include <nginx.h> 11 #include <nginx.h>
12 12
13 13
14 #define NGX_HTTP_LOCATION_EXACT 1 14 #define NGX_HTTP_LOCATION_EXACT 1
15 #define NGX_HTTP_LOCATION_AUTO_REDIRECT 2 15 #define NGX_HTTP_LOCATION_AUTO_REDIRECT 2
16 #define NGX_HTTP_LOCATION_REGEX 3 16 #define NGX_HTTP_LOCATION_NOREGEX 3
17 #define NGX_HTTP_LOCATION_REGEX 4
17 18
18 19
19 static void ngx_http_phase_event_handler(ngx_event_t *rev); 20 static void ngx_http_phase_event_handler(ngx_event_t *rev);
20 static void ngx_http_run_phases(ngx_http_request_t *r); 21 static void ngx_http_run_phases(ngx_http_request_t *r);
21 static ngx_int_t ngx_http_find_location(ngx_http_request_t *r, 22 static ngx_int_t ngx_http_find_location(ngx_http_request_t *r,
562 563
563 static ngx_int_t ngx_http_find_location(ngx_http_request_t *r, 564 static ngx_int_t ngx_http_find_location(ngx_http_request_t *r,
564 ngx_array_t *locations, size_t len) 565 ngx_array_t *locations, size_t len)
565 { 566 {
566 ngx_int_t n, rc; 567 ngx_int_t n, rc;
567 ngx_uint_t i, found; 568 ngx_uint_t i, found, noregex;
568 ngx_http_core_loc_conf_t *clcf, **clcfp; 569 ngx_http_core_loc_conf_t *clcf, **clcfp;
569 570
570 ngx_log_debug0(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, "find location"); 571 ngx_log_debug0(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, "find location");
571 572
572 found = 0; 573 found = 0;
574 noregex = 0;
573 575
574 clcfp = locations->elts; 576 clcfp = locations->elts;
575 for (i = 0; i < locations->nelts; i++) { 577 for (i = 0; i < locations->nelts; i++) {
576 578
577 #if (NGX_PCRE) 579 #if (NGX_PCRE)
617 /* the previous match is longer */ 619 /* the previous match is longer */
618 break; 620 break;
619 } 621 }
620 622
621 r->loc_conf = clcfp[i]->loc_conf; 623 r->loc_conf = clcfp[i]->loc_conf;
624 noregex = clcfp[i]->noregex;
622 found = 1; 625 found = 1;
623 } 626 }
624 } 627 }
625 628
626 if (found) { 629 if (found) {
634 } 637 }
635 } 638 }
636 } 639 }
637 640
638 #if (NGX_PCRE) 641 #if (NGX_PCRE)
642
643 if (noregex) {
644 return NGX_HTTP_LOCATION_NOREGEX;
645 }
639 646
640 /* regex matches */ 647 /* regex matches */
641 648
642 for (/* void */; i < locations->nelts; i++) { 649 for (/* void */; i < locations->nelts; i++) {
643 650
1066 1073
1067 if (cf->args->nelts == 3) { 1074 if (cf->args->nelts == 3) {
1068 if (value[1].len == 1 && value[1].data[0] == '=') { 1075 if (value[1].len == 1 && value[1].data[0] == '=') {
1069 clcf->name = value[2]; 1076 clcf->name = value[2];
1070 clcf->exact_match = 1; 1077 clcf->exact_match = 1;
1078
1079 } else if (value[1].len == 2
1080 && value[1].data[0] == '^'
1081 && value[1].data[1] == '~')
1082 {
1083 clcf->name = value[2];
1084 clcf->noregex = 1;
1071 1085
1072 } else if ((value[1].len == 1 && value[1].data[0] == '~') 1086 } else if ((value[1].len == 1 && value[1].data[0] == '~')
1073 || (value[1].len == 2 1087 || (value[1].len == 2
1074 && value[1].data[0] == '~' 1088 && value[1].data[0] == '~'
1075 && value[1].data[1] == '*')) 1089 && value[1].data[1] == '*'))