Mercurial > hg > nginx-quic
diff src/http/modules/proxy/ngx_http_proxy_header.c @ 294:5cfd65b8b0a7
nginx-0.0.3-2004-03-23-09:01:52 import
author | Igor Sysoev <igor@sysoev.ru> |
---|---|
date | Tue, 23 Mar 2004 06:01:52 +0000 |
parents | 87e73f067470 |
children | 39b6f2df45c0 |
line wrap: on
line diff
--- a/src/http/modules/proxy/ngx_http_proxy_header.c +++ b/src/http/modules/proxy/ngx_http_proxy_header.c @@ -17,8 +17,8 @@ int ngx_http_proxy_copy_header(ngx_http_ r = p->request; - h = headers_in->headers->elts; - for (i = 0; i < headers_in->headers->nelts; i++) { + h = headers_in->headers.elts; + for (i = 0; i < headers_in->headers.nelts; i++) { if (&h[i] == headers_in->connection) { continue; @@ -98,37 +98,43 @@ static int ngx_http_proxy_rewrite_locati ngx_table_elt_t *loc) { u_char *last; + ngx_table_elt_t *location; ngx_http_request_t *r; ngx_http_proxy_upstream_conf_t *uc; r = p->request; uc = p->lcf->upstream; - r->headers_out.location = ngx_http_add_header(&r->headers_out, - ngx_http_headers_out); - if (r->headers_out.location == NULL) { + location = ngx_http_add_header(&r->headers_out, ngx_http_headers_out); + if (location == NULL) { return NGX_ERROR; } + /* + * we do not set r->headers_out.location to avoid the handling + * the local redirects without a host name by ngx_http_header_filter() + */ + +#if 0 + r->headers_out.location = location; +#endif + if (uc->url.len > loc->value.len || ngx_rstrncmp(loc->value.data, uc->url.data, uc->url.len) != 0) { - *r->headers_out.location = *loc; + *location = *loc; return NGX_OK; } /* TODO: proxy_reverse */ - r->headers_out.location->value.len = uc->location->len - + (loc->value.len - uc->url.len) + 1; - r->headers_out.location->value.data = - ngx_palloc(r->pool, r->headers_out.location->value.len); - - if (r->headers_out.location->value.data == NULL) { + location->value.len = uc->location->len + + (loc->value.len - uc->url.len) + 1; + if (!(location->value.data = ngx_palloc(r->pool, location->value.len))) { return NGX_ERROR; } - last = ngx_cpymem(r->headers_out.location->value.data, + last = ngx_cpymem(location->value.data, uc->location->data, uc->location->len); ngx_cpystrn(last, loc->value.data + uc->url.len,