diff src/http/modules/proxy/ngx_http_proxy_handler.c @ 6:80ba094c6b3e NGINX_0_1_3

nginx 0.1.3 *) Feature: the ngx_http_autoindex_module and the autoindex directive. *) Feature: the proxy_set_x_url directive. *) Bugfix: proxy module may get caught in an endless loop when sendfile is not used.
author Igor Sysoev <http://sysoev.ru>
date Mon, 25 Oct 2004 00:00:00 +0400
parents 4b2dafa26fe2
children 46833bd150cb
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
@@ -98,6 +98,13 @@ static ngx_command_t  ngx_http_proxy_com
       offsetof(ngx_http_proxy_loc_conf_t, preserve_host),
       NULL },
 
+    { ngx_string("proxy_set_x_url"),
+      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, set_x_url),
+      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,
@@ -894,6 +901,7 @@ static void *ngx_http_proxy_create_loc_c
     conf->send_lowat = NGX_CONF_UNSET_SIZE;
 
     conf->preserve_host = NGX_CONF_UNSET;
+    conf->set_x_url = NGX_CONF_UNSET;
     conf->set_x_real_ip = NGX_CONF_UNSET;
     conf->add_x_forwarded_for = NGX_CONF_UNSET;
 
@@ -938,6 +946,7 @@ static char *ngx_http_proxy_merge_loc_co
     ngx_conf_merge_size_value(conf->send_lowat, prev->send_lowat, 0);
 
     ngx_conf_merge_value(conf->preserve_host, prev->preserve_host, 0);
+    ngx_conf_merge_value(conf->set_x_url, prev->set_x_url, 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);
@@ -1147,6 +1156,10 @@ static char *ngx_http_proxy_set_pass(ngx
 
         lcf->peers->number = i;
 
+        /* STUB */
+        lcf->peers->max_fails = 1;
+        lcf->peers->fail_timeout = 60;
+
         for (i = 0; h->h_addr_list[i] != NULL; i++) {
             lcf->peers->peers[i].host.data = host;
             lcf->peers->peers[i].host.len = lcf->upstream->host.len;