Mercurial > hg > nginx-mail
comparison src/http/ngx_http_core_module.c @ 326:9fc4ab6673f9 NGINX_0_6_7
nginx 0.6.7
*) Change: now the paths specified in the "include",
"auth_basic_user_file", "perl_modules", "ssl_certificate",
"ssl_certificate_key", and "ssl_client_certificate" directives are
relative to directory of nginx configuration file nginx.conf, but
not to nginx prefix directory.
*) Change: the --sysconfdir=PATH option in configure was canceled.
*) Change: the special make target "upgrade1" was defined for online
upgrade of 0.1.x versions.
*) Feature: the "server_name" and "valid_referers" directives support
regular expressions.
*) Feature: the "server" directive in the "upstream" context supports
the "backup" parameter.
*) Feature: the ngx_http_perl_module supports the
$r->discard_request_body.
*) Feature: the "add_header Last-Modified ..." directive changes the
"Last-Modified" response header line.
*) Bugfix: if an response different than 200 was returned to an request
with body and connection went to the keep-alive state after the
request, then nginx returned 400 for the next request.
*) Bugfix: a segmentation fault occurred in worker process if invalid
address was set in the "auth_http" directive.
*) Bugfix: now nginx uses default listen backlog value 511 on all
platforms except FreeBSD.
Thanks to Jiang Hong.
*) Bugfix: a worker process may got caught in an endless loop, if an
"server" inside "upstream" block was marked as "down"; bug appeared
in 0.6.6.
*) Bugfix: now Solaris sendfilev() is not used to transfer the client
request body to FastCGI-server via the unix domain socket.
author | Igor Sysoev <http://sysoev.ru> |
---|---|
date | Wed, 15 Aug 2007 00:00:00 +0400 |
parents | f7cd062ee035 |
children | 390b8f8309d6 |
comparison
equal
deleted
inserted
replaced
325:f395c7a4c8a8 | 326:9fc4ab6673f9 |
---|---|
931 static ngx_int_t | 931 static ngx_int_t |
932 ngx_http_core_find_location(ngx_http_request_t *r, | 932 ngx_http_core_find_location(ngx_http_request_t *r, |
933 ngx_array_t *locations, ngx_uint_t regex_start, size_t len) | 933 ngx_array_t *locations, ngx_uint_t regex_start, size_t len) |
934 { | 934 { |
935 ngx_int_t n, rc; | 935 ngx_int_t n, rc; |
936 ngx_uint_t i, found, noregex; | 936 ngx_uint_t i, found; |
937 ngx_http_core_loc_conf_t *clcf, **clcfp; | 937 ngx_http_core_loc_conf_t *clcf, **clcfp; |
938 #if (NGX_PCRE) | |
939 ngx_uint_t noregex; | |
940 #endif | |
938 | 941 |
939 ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, | 942 ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, |
940 "find location for \"%V\"", &r->uri); | 943 "find location for \"%V\"", &r->uri); |
941 | 944 |
942 found = 0; | 945 found = 0; |
946 #if (NGX_PCRE) | |
943 noregex = 0; | 947 noregex = 0; |
948 #endif | |
944 | 949 |
945 clcfp = locations->elts; | 950 clcfp = locations->elts; |
946 for (i = 0; i < locations->nelts; i++) { | 951 for (i = 0; i < locations->nelts; i++) { |
947 | 952 |
948 if (clcfp[i]->noname | 953 if (clcfp[i]->noname |
996 if (len > clcfp[i]->name.len) { | 1001 if (len > clcfp[i]->name.len) { |
997 /* the previous match is longer */ | 1002 /* the previous match is longer */ |
998 break; | 1003 break; |
999 } | 1004 } |
1000 | 1005 |
1006 found = 1; | |
1007 | |
1001 r->loc_conf = clcfp[i]->loc_conf; | 1008 r->loc_conf = clcfp[i]->loc_conf; |
1009 #if (NGX_PCRE) | |
1002 noregex = clcfp[i]->noregex; | 1010 noregex = clcfp[i]->noregex; |
1003 found = 1; | 1011 #endif |
1004 } | 1012 } |
1005 } | 1013 } |
1006 | 1014 |
1007 if (found) { | 1015 if (found) { |
1008 clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module); | 1016 clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module); |
2217 /* STUB: getuid() should be cached */ | 2225 /* STUB: getuid() should be cached */ |
2218 ls->port = (getuid() == 0) ? 80 : 8000; | 2226 ls->port = (getuid() == 0) ? 80 : 8000; |
2219 #endif | 2227 #endif |
2220 ls->family = AF_INET; | 2228 ls->family = AF_INET; |
2221 | 2229 |
2222 ls->conf.backlog = -1; | 2230 ls->conf.backlog = NGX_LISTEN_BACKLOG; |
2223 ls->conf.rcvbuf = -1; | 2231 ls->conf.rcvbuf = -1; |
2224 ls->conf.sndbuf = -1; | 2232 ls->conf.sndbuf = -1; |
2225 } | 2233 } |
2226 | 2234 |
2227 if (conf->server_name.data == NULL) { | 2235 if (conf->server_name.data == NULL) { |
2568 ls->family = AF_INET; | 2576 ls->family = AF_INET; |
2569 ls->addr = u.addr.in_addr; | 2577 ls->addr = u.addr.in_addr; |
2570 ls->port = u.port; | 2578 ls->port = u.port; |
2571 ls->file_name = cf->conf_file->file.name; | 2579 ls->file_name = cf->conf_file->file.name; |
2572 ls->line = cf->conf_file->line; | 2580 ls->line = cf->conf_file->line; |
2573 ls->conf.backlog = -1; | 2581 ls->conf.backlog = NGX_LISTEN_BACKLOG; |
2574 ls->conf.rcvbuf = -1; | 2582 ls->conf.rcvbuf = -1; |
2575 ls->conf.sndbuf = -1; | 2583 ls->conf.sndbuf = -1; |
2576 | 2584 |
2577 n = ngx_inet_ntop(AF_INET, &ls->addr, ls->conf.addr, INET_ADDRSTRLEN + 6); | 2585 n = ngx_inet_ntop(AF_INET, &ls->addr, ls->conf.addr, INET_ADDRSTRLEN + 6); |
2578 ngx_sprintf(&ls->conf.addr[n], ":%ui", ls->port); | 2586 ngx_sprintf(&ls->conf.addr[n], ":%ui", ls->port); |
2690 | 2698 |
2691 u_char ch; | 2699 u_char ch; |
2692 ngx_str_t *value, name; | 2700 ngx_str_t *value, name; |
2693 ngx_uint_t i; | 2701 ngx_uint_t i; |
2694 ngx_http_server_name_t *sn; | 2702 ngx_http_server_name_t *sn; |
2703 #if (NGX_PCRE) | |
2704 ngx_str_t err; | |
2705 u_char errstr[NGX_MAX_CONF_ERRSTR]; | |
2706 #endif | |
2695 | 2707 |
2696 value = cf->args->elts; | 2708 value = cf->args->elts; |
2697 | 2709 |
2698 ch = value[1].data[0]; | 2710 ch = value[1].data[0]; |
2699 | 2711 |
2700 if (cscf->server_name.data == NULL && value[1].len) { | 2712 if (cscf->server_name.data == NULL && value[1].len) { |
2701 if (ngx_strchr(value[1].data, '*')) { | 2713 if (ngx_strchr(value[1].data, '*')) { |
2702 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, | 2714 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, |
2703 "first server name \"%V\" must not be wildcard", | 2715 "first server name \"%V\" must not be wildcard", |
2704 &value[1]); | 2716 &value[1]); |
2717 return NGX_CONF_ERROR; | |
2718 } | |
2719 | |
2720 if (value[1].data[0] == '~') { | |
2721 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, | |
2722 "first server name \"%V\" " | |
2723 "must not be regular expression", &value[1]); | |
2705 return NGX_CONF_ERROR; | 2724 return NGX_CONF_ERROR; |
2706 } | 2725 } |
2707 | 2726 |
2708 name = value[1]; | 2727 name = value[1]; |
2709 | 2728 |
2746 sn = ngx_array_push(&cscf->server_names); | 2765 sn = ngx_array_push(&cscf->server_names); |
2747 if (sn == NULL) { | 2766 if (sn == NULL) { |
2748 return NGX_CONF_ERROR; | 2767 return NGX_CONF_ERROR; |
2749 } | 2768 } |
2750 | 2769 |
2770 #if (NGX_PCRE) | |
2771 sn->regex = NULL; | |
2772 #endif | |
2773 sn->core_srv_conf = cscf; | |
2751 sn->name.len = value[i].len; | 2774 sn->name.len = value[i].len; |
2752 sn->name.data = value[i].data; | 2775 sn->name.data = value[i].data; |
2753 sn->core_srv_conf = cscf; | 2776 |
2777 if (value[i].data[0] != '~') { | |
2778 continue; | |
2779 } | |
2780 | |
2781 #if (NGX_PCRE) | |
2782 err.len = NGX_MAX_CONF_ERRSTR; | |
2783 err.data = errstr; | |
2784 | |
2785 value[i].len--; | |
2786 value[i].data++; | |
2787 | |
2788 sn->regex = ngx_regex_compile(&value[i], NGX_REGEX_CASELESS, cf->pool, | |
2789 &err); | |
2790 | |
2791 if (sn->regex == NULL) { | |
2792 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, "%s", err.data); | |
2793 return NGX_CONF_ERROR; | |
2794 } | |
2795 | |
2796 sn->name.len = value[i].len; | |
2797 sn->name.data = value[i].data; | |
2798 | |
2799 #else | |
2800 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, | |
2801 "the using of the regex \"%V\" " | |
2802 "requires PCRE library", &value[i]); | |
2803 | |
2804 return NGX_CONF_ERROR; | |
2805 #endif | |
2754 } | 2806 } |
2755 | 2807 |
2756 return NGX_CONF_OK; | 2808 return NGX_CONF_OK; |
2757 } | 2809 } |
2758 | 2810 |