comparison src/http/ngx_http_core_module.c @ 294:27d9d1f26b38 NGINX_0_5_17

nginx 0.5.17 *) Change: now nginx always returns the 405 status for the TRACE method. *) Feature: now nginx supports the "include" directive inside the "types" block. *) Bugfix: the $document_root variable usage in the "root" and "alias" directives is disabled: this caused recursive stack overflow. *) Bugfix: in the HTTPS protocol in the "proxy_pass" directive. *) Bugfix: in some cases non-cachable variables (such as $uri variable) returned old cached value.
author Igor Sysoev <http://sysoev.ru>
date Mon, 02 Apr 2007 00:00:00 +0400
parents 5bef04fc3fd5
children 30862655219e
comparison
equal deleted inserted replaced
293:30378812e3af 294:27d9d1f26b38
872 r->loc_conf = clcf->limit_except_loc_conf; 872 r->loc_conf = clcf->limit_except_loc_conf;
873 clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module); 873 clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module);
874 } 874 }
875 875
876 if (r == r->main) { 876 if (r == r->main) {
877 r->connection->log->file = clcf->err_log->file; 877 r->connection->log->file = clcf->err_log->file;
878
878 if (!(r->connection->log->log_level & NGX_LOG_DEBUG_CONNECTION)) { 879 if (!(r->connection->log->log_level & NGX_LOG_DEBUG_CONNECTION)) {
879 r->connection->log->log_level = clcf->err_log->log_level; 880 r->connection->log->log_level = clcf->err_log->log_level;
880 } 881 }
881 } 882 }
882 883
1895 static char * 1896 static char *
1896 ngx_http_core_type(ngx_conf_t *cf, ngx_command_t *dummy, void *conf) 1897 ngx_http_core_type(ngx_conf_t *cf, ngx_command_t *dummy, void *conf)
1897 { 1898 {
1898 ngx_http_core_loc_conf_t *lcf = conf; 1899 ngx_http_core_loc_conf_t *lcf = conf;
1899 1900
1900 ngx_str_t *value, *content_type, *old; 1901 ngx_str_t *value, *content_type, *old, file;
1901 ngx_uint_t i, n; 1902 ngx_uint_t i, n;
1902 ngx_hash_key_t *type; 1903 ngx_hash_key_t *type;
1904
1905 value = cf->args->elts;
1906
1907 if (ngx_strcmp(value[0].data, "include") == 0) {
1908 file = value[1];
1909
1910 if (ngx_conf_full_name(cf->cycle, &file) == NGX_ERROR){
1911 return NGX_CONF_ERROR;
1912 }
1913
1914 ngx_log_debug1(NGX_LOG_DEBUG_CORE, cf->log, 0, "include %s", file.data);
1915
1916 return ngx_conf_parse(cf, &file);
1917 }
1903 1918
1904 content_type = ngx_palloc(cf->pool, sizeof(ngx_str_t)); 1919 content_type = ngx_palloc(cf->pool, sizeof(ngx_str_t));
1905 if (content_type == NULL) { 1920 if (content_type == NULL) {
1906 return NGX_CONF_ERROR; 1921 return NGX_CONF_ERROR;
1907 } 1922 }
1908 1923
1909 value = cf->args->elts;
1910 *content_type = value[0]; 1924 *content_type = value[0];
1911 1925
1912 for (i = 1; i < cf->args->nelts; i++) { 1926 for (i = 1; i < cf->args->nelts; i++) {
1913 1927
1914 for (n = 0; n < value[i].len; n++) { 1928 for (n = 0; n < value[i].len; n++) {
2598 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, 2612 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
2599 "server name \"%V\" is invalid", &value[i]); 2613 "server name \"%V\" is invalid", &value[i]);
2600 return NGX_CONF_ERROR; 2614 return NGX_CONF_ERROR;
2601 } 2615 }
2602 2616
2617 if (ngx_strchr(value[i].data, '/')) {
2618 ngx_conf_log_error(NGX_LOG_WARN, cf, 0,
2619 "server name \"%V\" has strange symbols",
2620 &value[i]);
2621 }
2622
2603 sn = ngx_array_push(&cscf->server_names); 2623 sn = ngx_array_push(&cscf->server_names);
2604 if (sn == NULL) { 2624 if (sn == NULL) {
2605 return NGX_CONF_ERROR; 2625 return NGX_CONF_ERROR;
2606 } 2626 }
2607 2627
2642 2662
2643 return NGX_CONF_ERROR; 2663 return NGX_CONF_ERROR;
2644 } 2664 }
2645 2665
2646 value = cf->args->elts; 2666 value = cf->args->elts;
2667
2668 if (ngx_strstr(value[1].data, "$document_root")
2669 || ngx_strstr(value[1].data, "${document_root}"))
2670 {
2671 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
2672 "the $document_root variable may not be used "
2673 "in the \"%V\" directive",
2674 &cmd->name);
2675
2676 return NGX_CONF_ERROR;
2677 }
2647 2678
2648 lcf->alias = alias; 2679 lcf->alias = alias;
2649 lcf->root = value[1]; 2680 lcf->root = value[1];
2650 2681
2651 if (!alias && lcf->root.data[lcf->root.len - 1] == '/') { 2682 if (!alias && lcf->root.data[lcf->root.len - 1] == '/') {