diff 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
line wrap: on
line diff
--- a/src/http/modules/proxy/ngx_http_proxy_upstream.c
+++ b/src/http/modules/proxy/ngx_http_proxy_upstream.c
@@ -117,13 +117,19 @@ static ngx_chain_t *ngx_http_proxy_creat
     r = p->request;
     uc = p->lcf->upstream;
 
-    len = http_methods[p->upstream->method - 1].len
-          + uc->uri.len
-          + r->uri.len - uc->location->len
-          + 1 + r->args.len                                  /* 1 is for "?" */
-          + sizeof(http_version) - 1
-          + sizeof(connection_close_header) - 1
-          + 2;                          /* 2 is for "\r\n" at the header end */
+    if (p->upstream->method) {
+        len = http_methods[p->upstream->method - 1].len;
+
+    } else {
+        len = r->method_name.len;
+    }
+
+    len += uc->uri.len
+           + r->uri.len - uc->location->len
+           + 1 + r->args.len                                 /* 1 is for "?" */
+           + sizeof(http_version) - 1
+           + sizeof(connection_close_header) - 1
+           + 2;                         /* 2 is for "\r\n" at the header end */
 
 
     if (p->lcf->preserve_host && r->headers_in.host) {
@@ -179,8 +185,13 @@ static ngx_chain_t *ngx_http_proxy_creat
 
     /* the request line */
 
-    h->last = ngx_cpymem(h->last, http_methods[p->upstream->method - 1].data,
-                         http_methods[p->upstream->method - 1].len);
+    if (p->upstream->method) {
+        h->last = ngx_cpymem(h->last,
+                             http_methods[p->upstream->method - 1].data,
+                             http_methods[p->upstream->method - 1].len);
+    } else {
+        h->last = ngx_cpymem(h->last, r->method_name.data, r->method_name.len);
+    }
 
     h->last = ngx_cpymem(h->last, uc->uri.data, uc->uri.len);