Mercurial > hg > nginx-vendor-0-6
comparison src/http/ngx_http_variables.c @ 216:fa32d59d9a15 NGINX_0_3_55
nginx 0.3.55
*) Feature: the "stub" parameter in the "include" SSI command.
*) Feature: the "block" SSI command.
*) Feature: the unicode2nginx script was added to contrib.
*) Bugfix: if a "root" was specified by variable only, then the root
was relative to a server prefix.
*) Bugfix: if the request contained "//" or "/./" and escaped symbols
after them, then the proxied request was sent unescaped.
*) Bugfix: the $r->headers_in("Cookie") of the ngx_http_perl_module now
returns all "Cookie" header lines.
*) Bugfix: a segmentation fault occurred if
"client_body_in_file_only on" was used and nginx switched to a next
upstream.
*) Bugfix: on some condition while reconfiguration character codes
inside the "charset_map" may be treated invalid; bug appeared in
0.3.50.
author | Igor Sysoev <http://sysoev.ru> |
---|---|
date | Fri, 28 Jul 2006 00:00:00 +0400 |
parents | 3866d57d9cfd |
children | 559bc7ec214e |
comparison
equal
deleted
inserted
replaced
215:84a7f4bc1133 | 216:fa32d59d9a15 |
---|---|
521 | 521 |
522 static ngx_int_t | 522 static ngx_int_t |
523 ngx_http_variable_headers(ngx_http_request_t *r, ngx_http_variable_value_t *v, | 523 ngx_http_variable_headers(ngx_http_request_t *r, ngx_http_variable_value_t *v, |
524 uintptr_t data) | 524 uintptr_t data) |
525 { | 525 { |
526 size_t len; | 526 ssize_t len; |
527 u_char *p; | 527 u_char *p; |
528 ngx_uint_t i; | 528 ngx_uint_t i, n; |
529 ngx_array_t *a; | 529 ngx_array_t *a; |
530 ngx_table_elt_t **h; | 530 ngx_table_elt_t **h; |
531 | 531 |
532 a = (ngx_array_t *) ((char *) r + data); | 532 a = (ngx_array_t *) ((char *) r + data); |
533 | 533 |
534 if (a->nelts == 0) { | 534 n = a->nelts; |
535 | |
536 if (n == 0) { | |
535 v->not_found = 1; | 537 v->not_found = 1; |
536 return NGX_OK; | 538 return NGX_OK; |
537 } | 539 } |
538 | 540 |
539 v->valid = 1; | 541 v->valid = 1; |
540 v->no_cachable = 0; | 542 v->no_cachable = 0; |
541 v->not_found = 0; | 543 v->not_found = 0; |
542 | 544 |
543 h = a->elts; | 545 h = a->elts; |
544 | 546 |
545 if (a->nelts == 1) { | 547 if (n == 1) { |
546 v->len = (*h)->value.len; | 548 v->len = (*h)->value.len; |
547 v->data = (*h)->value.data; | 549 v->data = (*h)->value.data; |
548 | 550 |
549 return NGX_OK; | 551 return NGX_OK; |
550 } | 552 } |
551 | 553 |
552 len = (size_t) - (ssize_t) (sizeof("; ") - 1); | 554 len = - (ssize_t) (sizeof("; ") - 1); |
553 | 555 |
554 for (i = 0; i < a->nelts; i++) { | 556 for (i = 0; i < n; i++) { |
555 len += h[i]->value.len + sizeof("; ") - 1; | 557 len += h[i]->value.len + sizeof("; ") - 1; |
556 } | 558 } |
557 | 559 |
558 p = ngx_palloc(r->pool, len); | 560 p = ngx_palloc(r->pool, len); |
559 if (p == NULL) { | 561 if (p == NULL) { |
564 v->data = p; | 566 v->data = p; |
565 | 567 |
566 for (i = 0; /* void */ ; i++) { | 568 for (i = 0; /* void */ ; i++) { |
567 p = ngx_copy(p, h[i]->value.data, h[i]->value.len); | 569 p = ngx_copy(p, h[i]->value.data, h[i]->value.len); |
568 | 570 |
569 if (i == a->nelts - 1) { | 571 if (i == n - 1) { |
570 break; | 572 break; |
571 } | 573 } |
572 | 574 |
573 *p++ = ';'; *p++ = ' '; | 575 *p++ = ';'; *p++ = ' '; |
574 } | 576 } |