Mercurial > hg > nginx
comparison src/http/modules/ngx_http_proxy_module.c @ 6746:63991ab67b3a
Proxy: do not create conf->headers_source when not needed.
author | Maxim Dounin <mdounin@mdounin.ru> |
---|---|
date | Fri, 14 Oct 2016 19:48:26 +0300 |
parents | 04d8d1f85649 |
children | 20eb4587225b |
comparison
equal
deleted
inserted
replaced
6745:93121485c39b | 6746:63991ab67b3a |
---|---|
3390 != NGX_OK) | 3390 != NGX_OK) |
3391 { | 3391 { |
3392 return NGX_ERROR; | 3392 return NGX_ERROR; |
3393 } | 3393 } |
3394 | 3394 |
3395 if (conf->headers_source == NULL) { | |
3396 conf->headers_source = ngx_array_create(cf->pool, 4, | |
3397 sizeof(ngx_keyval_t)); | |
3398 if (conf->headers_source == NULL) { | |
3399 return NGX_ERROR; | |
3400 } | |
3401 } | |
3402 | |
3403 headers->lengths = ngx_array_create(cf->pool, 64, 1); | 3395 headers->lengths = ngx_array_create(cf->pool, 64, 1); |
3404 if (headers->lengths == NULL) { | 3396 if (headers->lengths == NULL) { |
3405 return NGX_ERROR; | 3397 return NGX_ERROR; |
3406 } | 3398 } |
3407 | 3399 |
3408 headers->values = ngx_array_create(cf->pool, 512, 1); | 3400 headers->values = ngx_array_create(cf->pool, 512, 1); |
3409 if (headers->values == NULL) { | 3401 if (headers->values == NULL) { |
3410 return NGX_ERROR; | 3402 return NGX_ERROR; |
3411 } | 3403 } |
3412 | 3404 |
3413 src = conf->headers_source->elts; | 3405 if (conf->headers_source) { |
3414 for (i = 0; i < conf->headers_source->nelts; i++) { | 3406 |
3415 | 3407 src = conf->headers_source->elts; |
3416 s = ngx_array_push(&headers_merged); | 3408 for (i = 0; i < conf->headers_source->nelts; i++) { |
3417 if (s == NULL) { | 3409 |
3418 return NGX_ERROR; | 3410 s = ngx_array_push(&headers_merged); |
3419 } | 3411 if (s == NULL) { |
3420 | 3412 return NGX_ERROR; |
3421 *s = src[i]; | 3413 } |
3414 | |
3415 *s = src[i]; | |
3416 } | |
3422 } | 3417 } |
3423 | 3418 |
3424 h = default_headers; | 3419 h = default_headers; |
3425 | 3420 |
3426 while (h->key.len) { | 3421 while (h->key.len) { |