Mercurial > hg > nginx
comparison src/http/modules/ngx_http_proxy_module.c @ 5910:29fa5023bd6f
Proxy: renamed and rearranged fields in proxy configuration.
No functional changes.
author | Roman Arutyunyan <arut@nginx.com> |
---|---|
date | Wed, 19 Nov 2014 17:33:24 +0300 |
parents | 8d0cf26ce071 |
children | 2d3908516101 |
comparison
equal
deleted
inserted
replaced
5909:8d0cf26ce071 | 5910:29fa5023bd6f |
---|---|
49 | 49 |
50 typedef struct { | 50 typedef struct { |
51 ngx_http_upstream_conf_t upstream; | 51 ngx_http_upstream_conf_t upstream; |
52 | 52 |
53 ngx_array_t *body_flushes; | 53 ngx_array_t *body_flushes; |
54 ngx_array_t *body_set_len; | 54 ngx_array_t *body_lengths; |
55 ngx_array_t *body_set; | 55 ngx_array_t *body_values; |
56 ngx_str_t body_source; | |
56 | 57 |
57 ngx_http_proxy_headers_t headers; | 58 ngx_http_proxy_headers_t headers; |
58 #if (NGX_HTTP_CACHE) | 59 #if (NGX_HTTP_CACHE) |
59 ngx_http_proxy_headers_t headers_cache; | 60 ngx_http_proxy_headers_t headers_cache; |
60 #endif | 61 #endif |
64 ngx_array_t *proxy_values; | 65 ngx_array_t *proxy_values; |
65 | 66 |
66 ngx_array_t *redirects; | 67 ngx_array_t *redirects; |
67 ngx_array_t *cookie_domains; | 68 ngx_array_t *cookie_domains; |
68 ngx_array_t *cookie_paths; | 69 ngx_array_t *cookie_paths; |
69 | |
70 ngx_str_t body_source; | |
71 | 70 |
72 ngx_str_t method; | 71 ngx_str_t method; |
73 ngx_str_t location; | 72 ngx_str_t location; |
74 ngx_str_t url; | 73 ngx_str_t url; |
75 | 74 |
1164 ngx_memzero(&le, sizeof(ngx_http_script_engine_t)); | 1163 ngx_memzero(&le, sizeof(ngx_http_script_engine_t)); |
1165 | 1164 |
1166 ngx_http_script_flush_no_cacheable_variables(r, plcf->body_flushes); | 1165 ngx_http_script_flush_no_cacheable_variables(r, plcf->body_flushes); |
1167 ngx_http_script_flush_no_cacheable_variables(r, headers->flushes); | 1166 ngx_http_script_flush_no_cacheable_variables(r, headers->flushes); |
1168 | 1167 |
1169 if (plcf->body_set_len) { | 1168 if (plcf->body_lengths) { |
1170 le.ip = plcf->body_set_len->elts; | 1169 le.ip = plcf->body_lengths->elts; |
1171 le.request = r; | 1170 le.request = r; |
1172 le.flushed = 1; | 1171 le.flushed = 1; |
1173 body_len = 0; | 1172 body_len = 0; |
1174 | 1173 |
1175 while (*(uintptr_t *) le.ip) { | 1174 while (*(uintptr_t *) le.ip) { |
1360 | 1359 |
1361 | 1360 |
1362 /* add "\r\n" at the header end */ | 1361 /* add "\r\n" at the header end */ |
1363 *b->last++ = CR; *b->last++ = LF; | 1362 *b->last++ = CR; *b->last++ = LF; |
1364 | 1363 |
1365 if (plcf->body_set) { | 1364 if (plcf->body_values) { |
1366 e.ip = plcf->body_set->elts; | 1365 e.ip = plcf->body_values->elts; |
1367 e.pos = b->last; | 1366 e.pos = b->last; |
1368 | 1367 |
1369 while (*(uintptr_t *) e.ip) { | 1368 while (*(uintptr_t *) e.ip) { |
1370 code = *(ngx_http_script_code_pt *) e.ip; | 1369 code = *(ngx_http_script_code_pt *) e.ip; |
1371 code((ngx_http_script_engine_t *) &e); | 1370 code((ngx_http_script_engine_t *) &e); |
1376 | 1375 |
1377 ngx_log_debug2(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, | 1376 ngx_log_debug2(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, |
1378 "http proxy header:%N\"%*s\"", | 1377 "http proxy header:%N\"%*s\"", |
1379 (size_t) (b->last - b->pos), b->pos); | 1378 (size_t) (b->last - b->pos), b->pos); |
1380 | 1379 |
1381 if (plcf->body_set == NULL && plcf->upstream.pass_request_body) { | 1380 if (plcf->body_values == NULL && plcf->upstream.pass_request_body) { |
1382 | 1381 |
1383 body = u->request_bufs; | 1382 body = u->request_bufs; |
1384 u->request_bufs = cl; | 1383 u->request_bufs = cl; |
1385 | 1384 |
1386 while (body) { | 1385 while (body) { |
2524 * conf->headers.values = NULL; | 2523 * conf->headers.values = NULL; |
2525 * conf->headers.hash = { NULL, 0 }; | 2524 * conf->headers.hash = { NULL, 0 }; |
2526 * conf->headers_cache.lengths = NULL; | 2525 * conf->headers_cache.lengths = NULL; |
2527 * conf->headers_cache.values = NULL; | 2526 * conf->headers_cache.values = NULL; |
2528 * conf->headers_cache.hash = { NULL, 0 }; | 2527 * conf->headers_cache.hash = { NULL, 0 }; |
2529 * conf->body_set_len = NULL; | 2528 * conf->body_lengths = NULL; |
2530 * conf->body_set = NULL; | 2529 * conf->body_values = NULL; |
2531 * conf->body_source = { 0, NULL }; | 2530 * conf->body_source = { 0, NULL }; |
2532 * conf->redirects = NULL; | 2531 * conf->redirects = NULL; |
2533 * conf->ssl = 0; | 2532 * conf->ssl = 0; |
2534 * conf->ssl_protocols = 0; | 2533 * conf->ssl_protocols = 0; |
2535 * conf->ssl_ciphers = { 0, NULL }; | 2534 * conf->ssl_ciphers = { 0, NULL }; |
3015 } | 3014 } |
3016 | 3015 |
3017 if (conf->body_source.data == NULL) { | 3016 if (conf->body_source.data == NULL) { |
3018 conf->body_flushes = prev->body_flushes; | 3017 conf->body_flushes = prev->body_flushes; |
3019 conf->body_source = prev->body_source; | 3018 conf->body_source = prev->body_source; |
3020 conf->body_set_len = prev->body_set_len; | 3019 conf->body_lengths = prev->body_lengths; |
3021 conf->body_set = prev->body_set; | 3020 conf->body_values = prev->body_values; |
3022 } | 3021 } |
3023 | 3022 |
3024 if (conf->body_source.data && conf->body_set_len == NULL) { | 3023 if (conf->body_source.data && conf->body_lengths == NULL) { |
3025 | 3024 |
3026 ngx_memzero(&sc, sizeof(ngx_http_script_compile_t)); | 3025 ngx_memzero(&sc, sizeof(ngx_http_script_compile_t)); |
3027 | 3026 |
3028 sc.cf = cf; | 3027 sc.cf = cf; |
3029 sc.source = &conf->body_source; | 3028 sc.source = &conf->body_source; |
3030 sc.flushes = &conf->body_flushes; | 3029 sc.flushes = &conf->body_flushes; |
3031 sc.lengths = &conf->body_set_len; | 3030 sc.lengths = &conf->body_lengths; |
3032 sc.values = &conf->body_set; | 3031 sc.values = &conf->body_values; |
3033 sc.complete_lengths = 1; | 3032 sc.complete_lengths = 1; |
3034 sc.complete_values = 1; | 3033 sc.complete_values = 1; |
3035 | 3034 |
3036 if (ngx_http_script_compile(&sc) != NGX_OK) { | 3035 if (ngx_http_script_compile(&sc) != NGX_OK) { |
3037 return NGX_CONF_ERROR; | 3036 return NGX_CONF_ERROR; |