comparison src/http/ngx_http_core_module.c @ 152:396dbbc06dd7 NGINX_0_3_23

nginx 0.3.23 *) Feature: the "optimize_host_names" directive. *) Bugfix: in using of the variables in the "path" and "alias" directives. *) Bugfix: the ngx_http_perl_module was incorrectly built on Linux and Solaris.
author Igor Sysoev <http://sysoev.ru>
date Tue, 24 Jan 2006 00:00:00 +0300
parents 36af50a5582d
children bb61aa162c6b
comparison
equal deleted inserted replaced
151:843df9f3304d 152:396dbbc06dd7
133 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_CONF_TAKE1, 133 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_CONF_TAKE1,
134 ngx_conf_set_enum_slot, 134 ngx_conf_set_enum_slot,
135 NGX_HTTP_SRV_CONF_OFFSET, 135 NGX_HTTP_SRV_CONF_OFFSET,
136 offsetof(ngx_http_core_srv_conf_t, restrict_host_names), 136 offsetof(ngx_http_core_srv_conf_t, restrict_host_names),
137 &ngx_http_restrict_host_names }, 137 &ngx_http_restrict_host_names },
138
139 { ngx_string("optimize_host_names"),
140 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_CONF_FLAG,
141 ngx_conf_set_flag_slot,
142 NGX_HTTP_SRV_CONF_OFFSET,
143 offsetof(ngx_http_core_srv_conf_t, optimize_host_names),
144 NULL },
138 145
139 { ngx_string("ignore_invalid_headers"), 146 { ngx_string("ignore_invalid_headers"),
140 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_CONF_FLAG, 147 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_CONF_FLAG,
141 ngx_conf_set_flag_slot, 148 ngx_conf_set_flag_slot,
142 NGX_HTTP_SRV_CONF_OFFSET, 149 NGX_HTTP_SRV_CONF_OFFSET,
993 1000
994 clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module); 1001 clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module);
995 1002
996 alias = clcf->alias ? clcf->name.len : 0; 1003 alias = clcf->alias ? clcf->name.len : 0;
997 1004
1005 if (alias && !r->valid_location) {
1006 ngx_log_error(NGX_LOG_ALERT, r->connection->log, 0,
1007 "\"alias\" could not be used in location \"%V\" "
1008 "where URI was rewritten", &clcf->name);
1009 return NULL;
1010 }
1011
998 if (clcf->root_lengths == NULL) { 1012 if (clcf->root_lengths == NULL) {
999 1013
1000 r->root_length = clcf->root.len; 1014 r->root_length = clcf->root.len;
1001 1015
1002 path->len = clcf->root.len + r->uri.len - alias + 1 + reserved; 1016 path->len = clcf->root.len + r->uri.len - alias + 1 + reserved;
1824 cscf->connection_pool_size = NGX_CONF_UNSET_SIZE; 1838 cscf->connection_pool_size = NGX_CONF_UNSET_SIZE;
1825 cscf->request_pool_size = NGX_CONF_UNSET_SIZE; 1839 cscf->request_pool_size = NGX_CONF_UNSET_SIZE;
1826 cscf->client_header_timeout = NGX_CONF_UNSET_MSEC; 1840 cscf->client_header_timeout = NGX_CONF_UNSET_MSEC;
1827 cscf->client_header_buffer_size = NGX_CONF_UNSET_SIZE; 1841 cscf->client_header_buffer_size = NGX_CONF_UNSET_SIZE;
1828 cscf->restrict_host_names = NGX_CONF_UNSET_UINT; 1842 cscf->restrict_host_names = NGX_CONF_UNSET_UINT;
1843 cscf->optimize_host_names = NGX_CONF_UNSET;
1829 cscf->ignore_invalid_headers = NGX_CONF_UNSET; 1844 cscf->ignore_invalid_headers = NGX_CONF_UNSET;
1830 1845
1831 return cscf; 1846 return cscf;
1832 } 1847 }
1833 1848
1905 return NGX_CONF_ERROR; 1920 return NGX_CONF_ERROR;
1906 } 1921 }
1907 1922
1908 ngx_conf_merge_unsigned_value(conf->restrict_host_names, 1923 ngx_conf_merge_unsigned_value(conf->restrict_host_names,
1909 prev->restrict_host_names, 0); 1924 prev->restrict_host_names, 0);
1925
1926 ngx_conf_merge_value(conf->optimize_host_names,
1927 prev->optimize_host_names, 1);
1910 1928
1911 ngx_conf_merge_value(conf->ignore_invalid_headers, 1929 ngx_conf_merge_value(conf->ignore_invalid_headers,
1912 prev->ignore_invalid_headers, 1); 1930 prev->ignore_invalid_headers, 1);
1913 1931
1914 return NGX_CONF_OK; 1932 return NGX_CONF_OK;
1988 2006
1989 ngx_uint_t i; 2007 ngx_uint_t i;
1990 ngx_hash_key_t *type; 2008 ngx_hash_key_t *type;
1991 ngx_hash_init_t types_hash; 2009 ngx_hash_init_t types_hash;
1992 2010
1993 ngx_conf_merge_str_value(conf->root, prev->root, "html"); 2011 if (conf->root.data == NULL) {
1994 2012
1995 if (ngx_conf_full_name(cf->cycle, &conf->root) == NGX_ERROR) { 2013 conf->root = prev->root;
1996 return NGX_CONF_ERROR; 2014 conf->root_lengths = prev->root_lengths;
2015 conf->root_values = prev->root_values;
2016
2017 if (prev->root.data == NULL) {
2018 conf->root.len = sizeof("html") - 1;
2019 conf->root.data = (u_char *) "html";
2020
2021 if (ngx_conf_full_name(cf->cycle, &conf->root) == NGX_ERROR) {
2022 return NGX_CONF_ERROR;
2023 }
2024 }
1997 } 2025 }
1998 2026
1999 if (conf->post_action.data == NULL) { 2027 if (conf->post_action.data == NULL) {
2000 conf->post_action = prev->post_action; 2028 conf->post_action = prev->post_action;
2001 } 2029 }
2415 2443
2416 if (!alias && lcf->root.data[lcf->root.len - 1] == '/') { 2444 if (!alias && lcf->root.data[lcf->root.len - 1] == '/') {
2417 lcf->root.len--; 2445 lcf->root.len--;
2418 } 2446 }
2419 2447
2420 n = ngx_http_script_variables_count(&value[1]); 2448 if (ngx_conf_full_name(cf->cycle, &lcf->root) == NGX_ERROR) {
2449 return NGX_CONF_ERROR;
2450 }
2451
2452 n = ngx_http_script_variables_count(&lcf->root);
2421 2453
2422 if (n == 0) { 2454 if (n == 0) {
2423 return NGX_CONF_OK; 2455 return NGX_CONF_OK;
2424 } 2456 }
2425 2457
2426 ngx_memzero(&sc, sizeof(ngx_http_script_compile_t)); 2458 ngx_memzero(&sc, sizeof(ngx_http_script_compile_t));
2427 2459
2428 sc.cf = cf; 2460 sc.cf = cf;
2429 sc.source = &value[1]; 2461 sc.source = &lcf->root;
2430 sc.lengths = &lcf->root_lengths; 2462 sc.lengths = &lcf->root_lengths;
2431 sc.values = &lcf->root_values; 2463 sc.values = &lcf->root_values;
2432 sc.variables = n; 2464 sc.variables = n;
2433 sc.complete_lengths = 1; 2465 sc.complete_lengths = 1;
2434 sc.complete_values = 1; 2466 sc.complete_values = 1;