Mercurial > hg > nginx
comparison src/http/modules/proxy/ngx_http_proxy_upstream.c @ 314:d71c87d11b16
nginx-0.0.3-2004-04-14-09:57:36 import
author | Igor Sysoev <igor@sysoev.ru> |
---|---|
date | Wed, 14 Apr 2004 05:57:36 +0000 |
parents | 98f1a8028067 |
children | 39b6f2df45c0 |
comparison
equal
deleted
inserted
replaced
313:98f1a8028067 | 314:d71c87d11b16 |
---|---|
115 ngx_http_proxy_upstream_conf_t *uc; | 115 ngx_http_proxy_upstream_conf_t *uc; |
116 | 116 |
117 r = p->request; | 117 r = p->request; |
118 uc = p->lcf->upstream; | 118 uc = p->lcf->upstream; |
119 | 119 |
120 len = http_methods[p->upstream->method - 1].len | 120 if (p->upstream->method) { |
121 + uc->uri.len | 121 len = http_methods[p->upstream->method - 1].len; |
122 + r->uri.len - uc->location->len | 122 |
123 + 1 + r->args.len /* 1 is for "?" */ | 123 } else { |
124 + sizeof(http_version) - 1 | 124 len = r->method_name.len; |
125 + sizeof(connection_close_header) - 1 | 125 } |
126 + 2; /* 2 is for "\r\n" at the header end */ | 126 |
127 len += uc->uri.len | |
128 + r->uri.len - uc->location->len | |
129 + 1 + r->args.len /* 1 is for "?" */ | |
130 + sizeof(http_version) - 1 | |
131 + sizeof(connection_close_header) - 1 | |
132 + 2; /* 2 is for "\r\n" at the header end */ | |
127 | 133 |
128 | 134 |
129 if (p->lcf->preserve_host && r->headers_in.host) { | 135 if (p->lcf->preserve_host && r->headers_in.host) { |
130 len += sizeof(host_header) - 1 | 136 len += sizeof(host_header) - 1 |
131 + r->headers_in.host_name_len | 137 + r->headers_in.host_name_len |
177 ngx_alloc_link_and_set_hunk(chain, h, r->pool, NULL); | 183 ngx_alloc_link_and_set_hunk(chain, h, r->pool, NULL); |
178 | 184 |
179 | 185 |
180 /* the request line */ | 186 /* the request line */ |
181 | 187 |
182 h->last = ngx_cpymem(h->last, http_methods[p->upstream->method - 1].data, | 188 if (p->upstream->method) { |
183 http_methods[p->upstream->method - 1].len); | 189 h->last = ngx_cpymem(h->last, |
190 http_methods[p->upstream->method - 1].data, | |
191 http_methods[p->upstream->method - 1].len); | |
192 } else { | |
193 h->last = ngx_cpymem(h->last, r->method_name.data, r->method_name.len); | |
194 } | |
184 | 195 |
185 h->last = ngx_cpymem(h->last, uc->uri.data, uc->uri.len); | 196 h->last = ngx_cpymem(h->last, uc->uri.data, uc->uri.len); |
186 | 197 |
187 h->last = ngx_cpymem(h->last, | 198 h->last = ngx_cpymem(h->last, |
188 r->uri.data + uc->location->len, | 199 r->uri.data + uc->location->len, |