Mercurial > hg > nginx-quic
comparison src/http/ngx_http_core_module.c @ 6451:155871d773cc
Backed out server_tokens changes.
Backed out changesets: cf3e75cfa951, 6b72414dfb4f, 602dc42035fe, e5076b96fd01.
author | Maxim Dounin <mdounin@mdounin.ru> |
---|---|
date | Tue, 22 Mar 2016 16:58:38 +0300 |
parents | fc72784b1f52 |
children | 2cd019520210 |
comparison
equal
deleted
inserted
replaced
6450:22c32937a41f | 6451:155871d773cc |
---|---|
56 static char *ngx_http_core_limit_except(ngx_conf_t *cf, ngx_command_t *cmd, | 56 static char *ngx_http_core_limit_except(ngx_conf_t *cf, ngx_command_t *cmd, |
57 void *conf); | 57 void *conf); |
58 static char *ngx_http_core_set_aio(ngx_conf_t *cf, ngx_command_t *cmd, | 58 static char *ngx_http_core_set_aio(ngx_conf_t *cf, ngx_command_t *cmd, |
59 void *conf); | 59 void *conf); |
60 static char *ngx_http_core_directio(ngx_conf_t *cf, ngx_command_t *cmd, | 60 static char *ngx_http_core_directio(ngx_conf_t *cf, ngx_command_t *cmd, |
61 void *conf); | |
62 static char *ngx_http_core_server_tokens(ngx_conf_t *cf, ngx_command_t *cmd, | |
63 void *conf); | 61 void *conf); |
64 static char *ngx_http_core_error_page(ngx_conf_t *cf, ngx_command_t *cmd, | 62 static char *ngx_http_core_error_page(ngx_conf_t *cf, ngx_command_t *cmd, |
65 void *conf); | 63 void *conf); |
66 static char *ngx_http_core_try_files(ngx_conf_t *cf, ngx_command_t *cmd, | 64 static char *ngx_http_core_try_files(ngx_conf_t *cf, ngx_command_t *cmd, |
67 void *conf); | 65 void *conf); |
592 NGX_HTTP_LOC_CONF_OFFSET, | 590 NGX_HTTP_LOC_CONF_OFFSET, |
593 offsetof(ngx_http_core_loc_conf_t, recursive_error_pages), | 591 offsetof(ngx_http_core_loc_conf_t, recursive_error_pages), |
594 NULL }, | 592 NULL }, |
595 | 593 |
596 { ngx_string("server_tokens"), | 594 { ngx_string("server_tokens"), |
597 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1, | 595 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_FLAG, |
598 ngx_http_core_server_tokens, | 596 ngx_conf_set_flag_slot, |
599 NGX_HTTP_LOC_CONF_OFFSET, | 597 NGX_HTTP_LOC_CONF_OFFSET, |
600 0, | 598 offsetof(ngx_http_core_loc_conf_t, server_tokens), |
601 NULL }, | 599 NULL }, |
602 | 600 |
603 { ngx_string("if_modified_since"), | 601 { ngx_string("if_modified_since"), |
604 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1, | 602 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1, |
605 ngx_conf_set_enum_slot, | 603 ngx_conf_set_enum_slot, |
3643 clcf->msie_padding = NGX_CONF_UNSET; | 3641 clcf->msie_padding = NGX_CONF_UNSET; |
3644 clcf->msie_refresh = NGX_CONF_UNSET; | 3642 clcf->msie_refresh = NGX_CONF_UNSET; |
3645 clcf->log_not_found = NGX_CONF_UNSET; | 3643 clcf->log_not_found = NGX_CONF_UNSET; |
3646 clcf->log_subrequest = NGX_CONF_UNSET; | 3644 clcf->log_subrequest = NGX_CONF_UNSET; |
3647 clcf->recursive_error_pages = NGX_CONF_UNSET; | 3645 clcf->recursive_error_pages = NGX_CONF_UNSET; |
3646 clcf->server_tokens = NGX_CONF_UNSET; | |
3648 clcf->chunked_transfer_encoding = NGX_CONF_UNSET; | 3647 clcf->chunked_transfer_encoding = NGX_CONF_UNSET; |
3649 clcf->etag = NGX_CONF_UNSET; | 3648 clcf->etag = NGX_CONF_UNSET; |
3650 clcf->server_tokens = NGX_CONF_UNSET_UINT; | |
3651 clcf->types_hash_max_size = NGX_CONF_UNSET_UINT; | 3649 clcf->types_hash_max_size = NGX_CONF_UNSET_UINT; |
3652 clcf->types_hash_bucket_size = NGX_CONF_UNSET_UINT; | 3650 clcf->types_hash_bucket_size = NGX_CONF_UNSET_UINT; |
3653 | 3651 |
3654 clcf->open_file_cache = NGX_CONF_UNSET_PTR; | 3652 clcf->open_file_cache = NGX_CONF_UNSET_PTR; |
3655 clcf->open_file_cache_valid = NGX_CONF_UNSET; | 3653 clcf->open_file_cache_valid = NGX_CONF_UNSET; |
3909 ngx_conf_merge_value(conf->msie_refresh, prev->msie_refresh, 0); | 3907 ngx_conf_merge_value(conf->msie_refresh, prev->msie_refresh, 0); |
3910 ngx_conf_merge_value(conf->log_not_found, prev->log_not_found, 1); | 3908 ngx_conf_merge_value(conf->log_not_found, prev->log_not_found, 1); |
3911 ngx_conf_merge_value(conf->log_subrequest, prev->log_subrequest, 0); | 3909 ngx_conf_merge_value(conf->log_subrequest, prev->log_subrequest, 0); |
3912 ngx_conf_merge_value(conf->recursive_error_pages, | 3910 ngx_conf_merge_value(conf->recursive_error_pages, |
3913 prev->recursive_error_pages, 0); | 3911 prev->recursive_error_pages, 0); |
3912 ngx_conf_merge_value(conf->server_tokens, prev->server_tokens, 1); | |
3914 ngx_conf_merge_value(conf->chunked_transfer_encoding, | 3913 ngx_conf_merge_value(conf->chunked_transfer_encoding, |
3915 prev->chunked_transfer_encoding, 1); | 3914 prev->chunked_transfer_encoding, 1); |
3916 ngx_conf_merge_value(conf->etag, prev->etag, 1); | 3915 ngx_conf_merge_value(conf->etag, prev->etag, 1); |
3917 | |
3918 if (conf->server_tokens == NGX_CONF_UNSET_UINT) { | |
3919 ngx_conf_merge_uint_value(conf->server_tokens, prev->server_tokens, 1); | |
3920 conf->server_tokens_value = prev->server_tokens_value; | |
3921 } | |
3922 | 3916 |
3923 ngx_conf_merge_ptr_value(conf->open_file_cache, | 3917 ngx_conf_merge_ptr_value(conf->open_file_cache, |
3924 prev->open_file_cache, NULL); | 3918 prev->open_file_cache, NULL); |
3925 | 3919 |
3926 ngx_conf_merge_sec_value(conf->open_file_cache_valid, | 3920 ngx_conf_merge_sec_value(conf->open_file_cache_valid, |
4800 return NGX_CONF_OK; | 4794 return NGX_CONF_OK; |
4801 } | 4795 } |
4802 | 4796 |
4803 | 4797 |
4804 static char * | 4798 static char * |
4805 ngx_http_core_server_tokens(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) | |
4806 { | |
4807 ngx_http_core_loc_conf_t *clcf = conf; | |
4808 | |
4809 ngx_str_t *value; | |
4810 ngx_http_compile_complex_value_t ccv; | |
4811 | |
4812 if (clcf->server_tokens != NGX_CONF_UNSET_UINT) { | |
4813 return "is duplicate"; | |
4814 } | |
4815 | |
4816 value = cf->args->elts; | |
4817 | |
4818 if (ngx_strcmp(value[1].data, "on") == 0) { | |
4819 clcf->server_tokens = 1; | |
4820 return NGX_CONF_OK; | |
4821 } | |
4822 | |
4823 if (ngx_strcmp(value[1].data, "off") == 0) { | |
4824 clcf->server_tokens = 0; | |
4825 return NGX_CONF_OK; | |
4826 } | |
4827 | |
4828 ngx_memzero(&ccv, sizeof(ngx_http_compile_complex_value_t)); | |
4829 | |
4830 ccv.cf = cf; | |
4831 ccv.value = &value[1]; | |
4832 ccv.complex_value = &clcf->server_tokens_value; | |
4833 | |
4834 if (ngx_http_compile_complex_value(&ccv) != NGX_OK) { | |
4835 return NGX_CONF_ERROR; | |
4836 } | |
4837 | |
4838 clcf->server_tokens = 2; | |
4839 | |
4840 return NGX_CONF_OK; | |
4841 } | |
4842 | |
4843 | |
4844 static char * | |
4845 ngx_http_core_error_page(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) | 4799 ngx_http_core_error_page(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) |
4846 { | 4800 { |
4847 ngx_http_core_loc_conf_t *clcf = conf; | 4801 ngx_http_core_loc_conf_t *clcf = conf; |
4848 | 4802 |
4849 u_char *p; | 4803 u_char *p; |