Mercurial > hg > nginx-quic
comparison src/http/modules/ngx_http_proxy_module.c @ 5907:195561ef367f
Upstream: moved header initializations to separate functions.
No functional changes.
author | Roman Arutyunyan <arut@nginx.com> |
---|---|
date | Wed, 19 Nov 2014 17:33:21 +0300 |
parents | 2f7e557eab5b |
children | f8e80f8c7fc7 |
comparison
equal
deleted
inserted
replaced
5906:548f704c1907 | 5907:195561ef367f |
---|---|
144 | 144 |
145 static ngx_int_t ngx_http_proxy_add_variables(ngx_conf_t *cf); | 145 static ngx_int_t ngx_http_proxy_add_variables(ngx_conf_t *cf); |
146 static void *ngx_http_proxy_create_loc_conf(ngx_conf_t *cf); | 146 static void *ngx_http_proxy_create_loc_conf(ngx_conf_t *cf); |
147 static char *ngx_http_proxy_merge_loc_conf(ngx_conf_t *cf, | 147 static char *ngx_http_proxy_merge_loc_conf(ngx_conf_t *cf, |
148 void *parent, void *child); | 148 void *parent, void *child); |
149 static ngx_int_t ngx_http_proxy_merge_headers(ngx_conf_t *cf, | 149 static ngx_int_t ngx_http_proxy_init_headers(ngx_conf_t *cf, |
150 ngx_http_proxy_loc_conf_t *conf, ngx_http_proxy_loc_conf_t *prev); | 150 ngx_http_proxy_loc_conf_t *conf); |
151 | 151 |
152 static char *ngx_http_proxy_pass(ngx_conf_t *cf, ngx_command_t *cmd, | 152 static char *ngx_http_proxy_pass(ngx_conf_t *cf, ngx_command_t *cmd, |
153 void *conf); | 153 void *conf); |
154 static char *ngx_http_proxy_redirect(ngx_conf_t *cf, ngx_command_t *cmd, | 154 static char *ngx_http_proxy_redirect(ngx_conf_t *cf, ngx_command_t *cmd, |
155 void *conf); | 155 void *conf); |
3013 if (ngx_http_script_compile(&sc) != NGX_OK) { | 3013 if (ngx_http_script_compile(&sc) != NGX_OK) { |
3014 return NGX_CONF_ERROR; | 3014 return NGX_CONF_ERROR; |
3015 } | 3015 } |
3016 } | 3016 } |
3017 | 3017 |
3018 if (ngx_http_proxy_merge_headers(cf, conf, prev) != NGX_OK) { | 3018 if (conf->headers_source == NULL) { |
3019 conf->flushes = prev->flushes; | |
3020 conf->headers_set_len = prev->headers_set_len; | |
3021 conf->headers_set = prev->headers_set; | |
3022 conf->headers_set_hash = prev->headers_set_hash; | |
3023 conf->headers_source = prev->headers_source; | |
3024 } | |
3025 | |
3026 #if (NGX_HTTP_CACHE) | |
3027 if ((conf->upstream.cache == NULL) != (prev->upstream.cache == NULL)) { | |
3028 conf->headers_set_hash.buckets = NULL; | |
3029 } | |
3030 #endif | |
3031 | |
3032 if (ngx_http_proxy_init_headers(cf, conf) != NGX_OK) { | |
3019 return NGX_CONF_ERROR; | 3033 return NGX_CONF_ERROR; |
3020 } | 3034 } |
3021 | 3035 |
3022 return NGX_CONF_OK; | 3036 return NGX_CONF_OK; |
3023 } | 3037 } |
3024 | 3038 |
3025 | 3039 |
3026 static ngx_int_t | 3040 static ngx_int_t |
3027 ngx_http_proxy_merge_headers(ngx_conf_t *cf, ngx_http_proxy_loc_conf_t *conf, | 3041 ngx_http_proxy_init_headers(ngx_conf_t *cf, ngx_http_proxy_loc_conf_t *conf) |
3028 ngx_http_proxy_loc_conf_t *prev) | |
3029 { | 3042 { |
3030 u_char *p; | 3043 u_char *p; |
3031 size_t size; | 3044 size_t size; |
3032 uintptr_t *code; | 3045 uintptr_t *code; |
3033 ngx_uint_t i; | 3046 ngx_uint_t i; |
3036 ngx_hash_key_t *hk; | 3049 ngx_hash_key_t *hk; |
3037 ngx_hash_init_t hash; | 3050 ngx_hash_init_t hash; |
3038 ngx_http_script_compile_t sc; | 3051 ngx_http_script_compile_t sc; |
3039 ngx_http_script_copy_code_t *copy; | 3052 ngx_http_script_copy_code_t *copy; |
3040 | 3053 |
3041 if (conf->headers_source == NULL) { | 3054 if (conf->headers_set_hash.buckets) { |
3042 conf->flushes = prev->flushes; | |
3043 conf->headers_set_len = prev->headers_set_len; | |
3044 conf->headers_set = prev->headers_set; | |
3045 conf->headers_set_hash = prev->headers_set_hash; | |
3046 conf->headers_source = prev->headers_source; | |
3047 } | |
3048 | |
3049 if (conf->headers_set_hash.buckets | |
3050 #if (NGX_HTTP_CACHE) | |
3051 && ((conf->upstream.cache == NULL) == (prev->upstream.cache == NULL)) | |
3052 #endif | |
3053 ) | |
3054 { | |
3055 return NGX_OK; | 3055 return NGX_OK; |
3056 } | 3056 } |
3057 | |
3058 | 3057 |
3059 if (ngx_array_init(&headers_names, cf->temp_pool, 4, sizeof(ngx_hash_key_t)) | 3058 if (ngx_array_init(&headers_names, cf->temp_pool, 4, sizeof(ngx_hash_key_t)) |
3060 != NGX_OK) | 3059 != NGX_OK) |
3061 { | 3060 { |
3062 return NGX_ERROR; | 3061 return NGX_ERROR; |