summaryrefslogtreecommitdiff
path: root/src/http/modules/perl/nginx.xs
diff options
context:
space:
mode:
authornginx <nginx@nginx.org>2013-07-17 13:20:40 +0000
committerJon Kolb <jon@b0g.us>2013-07-17 13:20:40 +0000
commite11452c2e0b93111df75a5bd3fa61c237048ae35 (patch)
treedb53fbcb0d28137f495882a4841d5aae8df0ccf0 /src/http/modules/perl/nginx.xs
parente9bd13a142dcc2333c60638409a3e6893b35cdb2 (diff)
downloadnginx-e11452c2e0b93111df75a5bd3fa61c237048ae35.tar.gz
Changes with nginx 1.4.2 17 Jul 2013v1.4.2
*) Bugfix: the $r->header_in() embedded perl method did not return value of the "Cookie" and "X-Forwarded-For" request header lines; the bug had appeared in 1.3.14. *) Bugfix: nginx could not be built with the ngx_mail_ssl_module, but without ngx_http_ssl_module; the bug had appeared in 1.3.14. *) Bugfix: in the "proxy_set_body" directive. Thanks to Lanshun Zhou. *) Bugfix: the "fail_timeout" parameter of the "server" directive in the "upstream" context might not work if "max_fails" parameter was used; the bug had appeared in 1.3.0. *) Bugfix: a segmentation fault might occur in a worker process if the "ssl_stapling" directive was used. Thanks to Piotr Sikora. *) Bugfix: nginx/Windows might stop accepting connections if several worker processes were used.
Diffstat (limited to 'src/http/modules/perl/nginx.xs')
-rw-r--r--src/http/modules/perl/nginx.xs38
1 files changed, 28 insertions, 10 deletions
diff --git a/src/http/modules/perl/nginx.xs b/src/http/modules/perl/nginx.xs
index bbfef079c..77fb65373 100644
--- a/src/http/modules/perl/nginx.xs
+++ b/src/http/modules/perl/nginx.xs
@@ -222,10 +222,11 @@ header_in(r, key)
dXSTARG;
ngx_http_request_t *r;
SV *key;
- u_char *p, *lowcase_key, *cookie;
+ u_char *p, *lowcase_key, *value, sep;
STRLEN len;
ssize_t size;
ngx_uint_t i, n, hash;
+ ngx_array_t *a;
ngx_list_part_t *part;
ngx_table_elt_t *h, **ph;
ngx_http_header_t *hh;
@@ -255,6 +256,19 @@ header_in(r, key)
hh = ngx_hash_find(&cmcf->headers_in_hash, hash, lowcase_key, len);
if (hh) {
+
+ if (hh->offset == offsetof(ngx_http_headers_in_t, cookies)) {
+ sep = ';';
+ goto multi;
+ }
+
+ #if (NGX_HTTP_X_FORWARDED_FOR)
+ if (hh->offset == offsetof(ngx_http_headers_in_t, x_forwarded_for)) {
+ sep = ',';
+ goto multi;
+ }
+ #endif
+
if (hh->offset) {
ph = (ngx_table_elt_t **) ((char *) &r->headers_in + hh->offset);
@@ -268,15 +282,19 @@ header_in(r, key)
XSRETURN_UNDEF;
}
- /* Cookie */
+ multi:
+
+ /* Cookie, X-Forwarded-For */
- n = r->headers_in.cookies.nelts;
+ a = (ngx_array_t *) ((char *) &r->headers_in + hh->offset);
+
+ n = a->nelts;
if (n == 0) {
XSRETURN_UNDEF;
}
- ph = r->headers_in.cookies.elts;
+ ph = a->elts;
if (n == 1) {
ngx_http_perl_set_targ((*ph)->value.data, (*ph)->value.len);
@@ -290,12 +308,12 @@ header_in(r, key)
size += ph[i]->value.len + sizeof("; ") - 1;
}
- cookie = ngx_pnalloc(r->pool, size);
- if (cookie == NULL) {
+ value = ngx_pnalloc(r->pool, size);
+ if (value == NULL) {
XSRETURN_UNDEF;
}
- p = cookie;
+ p = value;
for (i = 0; /* void */ ; i++) {
p = ngx_copy(p, ph[i]->value.data, ph[i]->value.len);
@@ -304,10 +322,10 @@ header_in(r, key)
break;
}
- *p++ = ';'; *p++ = ' ';
+ *p++ = sep; *p++ = ' ';
}
- ngx_http_perl_set_targ(cookie, size);
+ ngx_http_perl_set_targ(value, size);
goto done;
}
@@ -419,7 +437,7 @@ request_body(r)
p = ngx_pnalloc(r->pool, len);
if (p == NULL) {
- return XSRETURN_UNDEF;
+ XSRETURN_UNDEF;
}
data = p;