在 src\http\ngx_http_core_module.c
static void *
ngx_http_core_create_loc_conf(ngx_conf_t *cf)
{
ngx_http_core_loc_conf_t *clcf;
clcf = ngx_pcalloc(cf->pool, sizeof(ngx_http_core_loc_conf_t));
if (clcf == NULL) {
return NULL;
}
/*
* set by ngx_pcalloc():
*
* clcf->escaped_name = { 0, NULL };
* clcf->root = { 0, NULL };
* clcf->limit_except = 0;
* clcf->post_action = { 0, NULL };
* clcf->types = NULL;
* clcf->default_type = { 0, NULL };
* clcf->error_log = NULL;
* clcf->error_pages = NULL;
* clcf->client_body_path = NULL;
* clcf->regex = NULL;
* clcf->exact_match = 0;
* clcf->auto_redirect = 0;
* clcf->alias = 0;
* clcf->gzip_proxied = 0;
* clcf->keepalive_disable = 0;
*/
clcf->client_max_body_size = NGX_CONF_UNSET;
clcf->client_body_buffer_size = NGX_CONF_UNSET_SIZE;
clcf->client_body_timeout = NGX_CONF_UNSET_MSEC;
clcf->satisfy = NGX_CONF_UNSET_UINT;
clcf->auth_delay = NGX_CONF_UNSET_MSEC;
clcf->if_modified_since = NGX_CONF_UNSET_UINT;
clcf->max_ranges = NGX_CONF_UNSET_UINT;
clcf->client_body_in_file_only = NGX_CONF_UNSET_UINT;
clcf->client_body_in_single_buffer = NGX_CONF_UNSET;
clcf->internal = NGX_CONF_UNSET;
clcf->sendfile = NGX_CONF_UNSET;
clcf->sendfile_max_chunk = NGX_CONF_UNSET_SIZE;
clcf->subrequest_output_buffer_size = NGX_CONF_UNSET_SIZE;
clcf->aio = NGX_CONF_UNSET;
clcf->aio_write = NGX_CONF_UNSET;
#if (NGX_THREADS)
clcf->thread_pool = NGX_CONF_UNSET_PTR;
clcf->thread_pool_value = NGX_CONF_UNSET_PTR;
#endif
clcf->read_ahead = NGX_CONF_UNSET_SIZE;
clcf->directio = NGX_CONF_UNSET;
clcf->directio_alignment = NGX_CONF_UNSET;
clcf->tcp_nopush = NGX_CONF_UNSET;
clcf->tcp_nodelay = NGX_CONF_UNSET;
clcf->send_timeout = NGX_CONF_UNSET_MSEC;
clcf->send_lowat = NGX_CONF_UNSET_SIZE;
clcf->postpone_output = NGX_CONF_UNSET_SIZE;
clcf->limit_rate = NGX_CONF_UNSET_PTR;
clcf->limit_rate_after = NGX_CONF_UNSET_PTR;
clcf->keepalive_time = NGX_CONF_UNSET_MSEC;
clcf->keepalive_timeout = NGX_CONF_UNSET_MSEC;
clcf->keepalive_header = NGX_CONF_UNSET;
clcf->keepalive_requests = NGX_CONF_UNSET_UINT;
clcf->lingering_close = NGX_CONF_UNSET_UINT;
clcf->lingering_time = NGX_CONF_UNSET_MSEC;
clcf->lingering_timeout = NGX_CONF_UNSET_MSEC;
clcf->resolver_timeout = NGX_CONF_UNSET_MSEC;
clcf->reset_timedout_connection = NGX_CONF_UNSET;
clcf->absolute_redirect = NGX_CONF_UNSET;
clcf->server_name_in_redirect = NGX_CONF_UNSET;
clcf->port_in_redirect = NGX_CONF_UNSET;
clcf->msie_padding = NGX_CONF_UNSET;
clcf->msie_refresh = NGX_CONF_UNSET;
clcf->log_not_found = NGX_CONF_UNSET;
clcf->log_subrequest = NGX_CONF_UNSET;
clcf->recursive_error_pages = NGX_CONF_UNSET;
clcf->chunked_transfer_encoding = NGX_CONF_UNSET;
clcf->etag = NGX_CONF_UNSET;
clcf->server_tokens = NGX_CONF_UNSET_UINT;
clcf->types_hash_max_size = NGX_CONF_UNSET_UINT;
clcf->types_hash_bucket_size = NGX_CONF_UNSET_UINT;
clcf->open_file_cache = NGX_CONF_UNSET_PTR;
clcf->open_file_cache_valid = NGX_CONF_UNSET;
clcf->open_file_cache_min_uses = NGX_CONF_UNSET_UINT;
clcf->open_file_cache_errors = NGX_CONF_UNSET;
clcf->open_file_cache_events = NGX_CONF_UNSET;
#if (NGX_HTTP_GZIP)
clcf->gzip_vary = NGX_CONF_UNSET;
clcf->gzip_http_version = NGX_CONF_UNSET_UINT;
#if (NGX_PCRE)
clcf->gzip_disable = NGX_CONF_UNSET_PTR;
#endif
clcf->gzip_disable_msie6 = 3;
#if (NGX_HTTP_DEGRADATION)
clcf->gzip_disable_degradation = 3;
#endif
#endif
#if (NGX_HAVE_OPENAT)
clcf->disable_symlinks = NGX_CONF_UNSET_UINT;
clcf->disable_symlinks_from = NGX_CONF_UNSET_PTR;
#endif
return clcf;
}
用于创建HTTP核心模块的location级配置结构
clcf = ngx_pcalloc(cf->pool, sizeof(ngx_http_core_loc_conf_t));
if (clcf == NULL) {
return NULL;
}
分配内存作为 ngx_http_core_loc_conf_t 结构体 (HTTP核心模块的location级配置结构)
clcf 也是函数的返回值
设置个各个字段的初始值,这个值表示 该字段尚未设置
clcf->gzip_disable_msie6 = 3;
clcf->gzip_disable_degradation = 3;
clcf->gzip_disable_msie6 = 3;
控制是否对 MSIE 6(Internet Explorer 6)浏览器禁用 Gzip 压缩功能
初始值为 3,表示默认情况下对 MSIE 6 禁用 Gzip 压缩
clcf->gzip_disable_degradation = 3;
控制当系统处于降级模式时是否禁用 Gzip 压缩
初始值为 3,表示默认情况下在降级模式时对 MSIE 6 禁用 Gzip 压缩