diff src/http/modules/proxy/ngx_http_proxy_handler.c @ 288:f81d075ad172

nginx-0.0.2-2004-03-14-23:46:25 import
author Igor Sysoev <igor@sysoev.ru>
date Sun, 14 Mar 2004 20:46:25 +0000
parents 35a6a9df2d25
children 87e73f067470
line wrap: on
line diff
--- a/src/http/modules/proxy/ngx_http_proxy_handler.c
+++ b/src/http/modules/proxy/ngx_http_proxy_handler.c
@@ -81,6 +81,13 @@ static ngx_command_t  ngx_http_proxy_com
       offsetof(ngx_http_proxy_loc_conf_t, send_timeout),
       NULL },
 
+    { ngx_string("proxy_preserve_host"),
+      NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_FLAG,
+      ngx_conf_set_flag_slot,
+      NGX_HTTP_LOC_CONF_OFFSET,
+      offsetof(ngx_http_proxy_loc_conf_t, preserve_host),
+      NULL },
+
     { ngx_string("proxy_set_x_real_ip"),
       NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_FLAG,
       ngx_conf_set_flag_slot,
@@ -774,6 +781,7 @@ static void *ngx_http_proxy_create_loc_c
     conf->connect_timeout = NGX_CONF_UNSET;
     conf->send_timeout = NGX_CONF_UNSET;
 
+    conf->preserve_host = NGX_CONF_UNSET;
     conf->set_x_real_ip = NGX_CONF_UNSET;
     conf->add_x_forwarded_for = NGX_CONF_UNSET;
 
@@ -816,6 +824,7 @@ static char *ngx_http_proxy_merge_loc_co
                               prev->connect_timeout, 60000);
     ngx_conf_merge_msec_value(conf->send_timeout, prev->send_timeout, 30000);
 
+    ngx_conf_merge_value(conf->preserve_host, prev->preserve_host, 0);
     ngx_conf_merge_value(conf->set_x_real_ip, prev->set_x_real_ip, 0);
     ngx_conf_merge_value(conf->add_x_forwarded_for,
                          prev->add_x_forwarded_for, 0);
@@ -1057,6 +1066,7 @@ static char *ngx_http_proxy_parse_upstre
             }
 
             if (u->port_text.data == NULL) {
+                u->default_port = 1;
                 u->port = htons(80);
                 u->port_text.len = 2;
                 u->port_text.data = "80";
@@ -1087,6 +1097,7 @@ static char *ngx_http_proxy_parse_upstre
     u->uri.len = 1;
 
     if (u->port_text.data == NULL) {
+        u->default_port = 1;
         u->port = htons(80);
         u->port_text.len = 2;
         u->port_text.data = "80";