comparison src/http/modules/proxy/ngx_http_proxy_upstream.c @ 36:a39d1b793287 NGINX_0_1_18

nginx 0.1.18 *) Workaround: the default values of the devpoll_events and the devpoll_changes directives changed from 512 to 32 to be compatible with Solaris 10. *) Bugfix: the proxy_set_x_var and fastcgi_set_var directives were not inherited. *) Bugfix: in the redirect rewrite directive the arguments were concatenated with URI by the "&" rather than the "?". *) Bugfix: the lines without trailing ";" in the file being included by the ngx_http_geo_module were silently ignored. *) Feature: the ngx_http_stub_status_module. *) Bugfix: the unknown log format in the access_log directive caused the segmentation fault. *) Feature: the new "document_root" parameter of the fastcgi_params directive. *) Feature: the fastcgi_redirect_errors directive. *) Feature: the new "break" modifier of the "rewrite" directive allows to stop the rewrite/location cycle and sets the current configuration to the request.
author Igor Sysoev <http://sysoev.ru>
date Wed, 09 Feb 2005 00:00:00 +0300
parents aab2ea7c0458
children 9f3205d496a0
comparison
equal deleted inserted replaced
35:ef53675fe4a6 36:a39d1b793287
98 ngx_http_proxy_upstream_conf_t *uc; 98 ngx_http_proxy_upstream_conf_t *uc;
99 99
100 r = p->request; 100 r = p->request;
101 uc = p->lcf->upstream; 101 uc = p->lcf->upstream;
102 102
103 #if (NGX_SUPPRESS_WARN)
104 var = NULL;
105 index = NULL;
106 #endif
107
103 if (p->upstream->method) { 108 if (p->upstream->method) {
104 len = http_methods[p->upstream->method - 1].len; 109 len = http_methods[p->upstream->method - 1].len;
105 110
106 } else { 111 } else {
107 len = r->method_name.len; 112 len = r->method_name.len;
167 + sizeof(CRLF) - 1; 172 + sizeof(CRLF) - 1;
168 } 173 }
169 } 174 }
170 175
171 176
172 cmcf = ngx_http_get_module_main_conf(r, ngx_http_core_module); 177 if (p->lcf->x_vars) {
173 178 cmcf = ngx_http_get_module_main_conf(r, ngx_http_core_module);
174 var = cmcf->variables.elts; 179
175 index = p->lcf->x_vars.elts; 180 var = cmcf->variables.elts;
176 181 index = p->lcf->x_vars->elts;
177 for (i = 0; i < p->lcf->x_vars.nelts; i++) { 182
178 183 for (i = 0; i < p->lcf->x_vars->nelts; i++) {
179 if (!(value = ngx_http_get_variable(r, index[i]))) { 184
180 continue; 185 if (!(value = ngx_http_get_variable(r, index[i]))) {
181 } 186 continue;
182 187 }
183 if (value->text.len) { 188
184 len += sizeof("X-") - 1 + var[index[i]].name.len + sizeof(": ") - 1 189 if (value->text.len) {
185 + value->text.len + sizeof(CRLF) - 1; 190 len += sizeof("X-") - 1 + var[index[i]].name.len
191 + sizeof(": ") - 1 + value->text.len + sizeof(CRLF) - 1;
192 }
186 } 193 }
187 } 194 }
188 195
189 196
190 part = &r->headers_in.headers.part; 197 part = &r->headers_in.headers.part;
354 r->connection->addr_text.len); 361 r->connection->addr_text.len);
355 *b->last++ = CR; *b->last++ = LF; 362 *b->last++ = CR; *b->last++ = LF;
356 } 363 }
357 364
358 365
359 for (i = 0; i < p->lcf->x_vars.nelts; i++) { 366 if (p->lcf->x_vars) {
360 367 for (i = 0; i < p->lcf->x_vars->nelts; i++) {
361 if (!(value = ngx_http_get_variable(r, index[i]))) { 368
362 continue; 369 if (!(value = ngx_http_get_variable(r, index[i]))) {
363 } 370 continue;
364 371 }
365 if (value->text.len == 0) { 372
366 continue; 373 if (value->text.len == 0) {
367 } 374 continue;
368 375 }
369 *b->last++ = 'X'; *b->last++ = '-'; 376
370 377 *b->last++ = 'X'; *b->last++ = '-';
371 b->last = ngx_cpymem(b->last, var[index[i]].name.data, 378
372 var[index[i]].name.len); 379 b->last = ngx_cpymem(b->last, var[index[i]].name.data,
373 380 var[index[i]].name.len);
374 *b->last++ = ':'; *b->last++ = ' '; 381
375 382 *b->last++ = ':'; *b->last++ = ' ';
376 b->last = ngx_cpymem(b->last, value->text.data, value->text.len); 383
377 384 b->last = ngx_cpymem(b->last, value->text.data, value->text.len);
378 *b->last++ = CR; *b->last++ = LF; 385
386 *b->last++ = CR; *b->last++ = LF;
387 }
379 } 388 }
380 389
381 390
382 part = &r->headers_in.headers.part; 391 part = &r->headers_in.headers.part;
383 header = part->elts; 392 header = part->elts;