Mercurial > hg > nginx
comparison src/http/ngx_http_upstream.c @ 6899:d2b2ff157da5
Variables: generic prefix variables.
author | Dmitry Volyntsev <xeioex@nginx.com> |
---|---|
date | Tue, 31 Jan 2017 21:19:58 +0300 |
parents | a5d1b1383dea |
children | 9a9e13686869 |
comparison
equal
deleted
inserted
replaced
6885:25203fc377fb | 6899:d2b2ff157da5 |
---|---|
160 ngx_http_variable_value_t *v, uintptr_t data); | 160 ngx_http_variable_value_t *v, uintptr_t data); |
161 static ngx_int_t ngx_http_upstream_response_time_variable(ngx_http_request_t *r, | 161 static ngx_int_t ngx_http_upstream_response_time_variable(ngx_http_request_t *r, |
162 ngx_http_variable_value_t *v, uintptr_t data); | 162 ngx_http_variable_value_t *v, uintptr_t data); |
163 static ngx_int_t ngx_http_upstream_response_length_variable( | 163 static ngx_int_t ngx_http_upstream_response_length_variable( |
164 ngx_http_request_t *r, ngx_http_variable_value_t *v, uintptr_t data); | 164 ngx_http_request_t *r, ngx_http_variable_value_t *v, uintptr_t data); |
165 static ngx_int_t ngx_http_upstream_header_variable(ngx_http_request_t *r, | |
166 ngx_http_variable_value_t *v, uintptr_t data); | |
167 static ngx_int_t ngx_http_upstream_cookie_variable(ngx_http_request_t *r, | |
168 ngx_http_variable_value_t *v, uintptr_t data); | |
165 | 169 |
166 static char *ngx_http_upstream(ngx_conf_t *cf, ngx_command_t *cmd, void *dummy); | 170 static char *ngx_http_upstream(ngx_conf_t *cf, ngx_command_t *cmd, void *dummy); |
167 static char *ngx_http_upstream_server(ngx_conf_t *cf, ngx_command_t *cmd, | 171 static char *ngx_http_upstream_server(ngx_conf_t *cf, ngx_command_t *cmd, |
168 void *conf); | 172 void *conf); |
169 | 173 |
411 ngx_http_upstream_cache_etag, 0, | 415 ngx_http_upstream_cache_etag, 0, |
412 NGX_HTTP_VAR_NOCACHEABLE|NGX_HTTP_VAR_NOHASH, 0 }, | 416 NGX_HTTP_VAR_NOCACHEABLE|NGX_HTTP_VAR_NOHASH, 0 }, |
413 | 417 |
414 #endif | 418 #endif |
415 | 419 |
420 { ngx_string("upstream_http_"), NULL, ngx_http_upstream_header_variable, | |
421 0, NGX_HTTP_VAR_NOCACHEABLE|NGX_HTTP_VAR_PREFIX, 0 }, | |
422 | |
423 { ngx_string("upstream_cookie_"), NULL, ngx_http_upstream_cookie_variable, | |
424 0, NGX_HTTP_VAR_NOCACHEABLE|NGX_HTTP_VAR_PREFIX, 0 }, | |
425 | |
416 { ngx_null_string, NULL, NULL, 0, 0, 0 } | 426 { ngx_null_string, NULL, NULL, 0, 0, 0 } |
417 }; | 427 }; |
418 | 428 |
419 | 429 |
420 static ngx_http_upstream_next_t ngx_http_upstream_next_errors[] = { | 430 static ngx_http_upstream_next_t ngx_http_upstream_next_errors[] = { |
5389 | 5399 |
5390 return NGX_OK; | 5400 return NGX_OK; |
5391 } | 5401 } |
5392 | 5402 |
5393 | 5403 |
5394 ngx_int_t | 5404 static ngx_int_t |
5395 ngx_http_upstream_header_variable(ngx_http_request_t *r, | 5405 ngx_http_upstream_header_variable(ngx_http_request_t *r, |
5396 ngx_http_variable_value_t *v, uintptr_t data) | 5406 ngx_http_variable_value_t *v, uintptr_t data) |
5397 { | 5407 { |
5398 if (r->upstream == NULL) { | 5408 if (r->upstream == NULL) { |
5399 v->not_found = 1; | 5409 v->not_found = 1; |
5404 &r->upstream->headers_in.headers.part, | 5414 &r->upstream->headers_in.headers.part, |
5405 sizeof("upstream_http_") - 1); | 5415 sizeof("upstream_http_") - 1); |
5406 } | 5416 } |
5407 | 5417 |
5408 | 5418 |
5409 ngx_int_t | 5419 static ngx_int_t |
5410 ngx_http_upstream_cookie_variable(ngx_http_request_t *r, | 5420 ngx_http_upstream_cookie_variable(ngx_http_request_t *r, |
5411 ngx_http_variable_value_t *v, uintptr_t data) | 5421 ngx_http_variable_value_t *v, uintptr_t data) |
5412 { | 5422 { |
5413 ngx_str_t *name = (ngx_str_t *) data; | 5423 ngx_str_t *name = (ngx_str_t *) data; |
5414 | 5424 |