diff src/http/modules/ngx_http_fastcgi_module.c @ 260:0effe91f6083 NGINX_0_5_0

nginx 0.5.0 *) Change: the parameters in the "%name" form in the "log_format" directive are not supported anymore. *) Change: the "proxy_upstream_max_fails", "proxy_upstream_fail_timeout", "fastcgi_upstream_max_fails", "fastcgi_upstream_fail_timeout", "memcached_upstream_max_fails", and "memcached_upstream_fail_timeout" directives are not supported anymore. *) Feature: the "server" directive in the "upstream" context supports the "max_fails", "fail_timeout", and "down" parameters. *) Feature: the "ip_hash" directive inside the "upstream" block. *) Feature: the WAIT status in the "Auth-Status" header line of the IMAP/POP3 proxy authentication server response. *) Bugfix: nginx could not be built on 64-bit platforms; bug appeared in 0.4.14.
author Igor Sysoev <http://sysoev.ru>
date Mon, 04 Dec 2006 00:00:00 +0300
parents acd2ec3541cb
children e0b1d0a6c629
line wrap: on
line diff
--- a/src/http/modules/ngx_http_fastcgi_module.c
+++ b/src/http/modules/ngx_http_fastcgi_module.c
@@ -13,9 +13,6 @@
 typedef struct {
     ngx_http_upstream_conf_t       upstream;
 
-    ngx_http_upstream_srv_conf_t  *upstream_peers;
-    ngx_peers_t                   *peers0;
-
     ngx_str_t                      index;
 
     ngx_array_t                   *flushes;
@@ -121,6 +118,11 @@ static char *ngx_http_fastcgi_pass(ngx_c
 static char *ngx_http_fastcgi_lowat_check(ngx_conf_t *cf, void *post,
     void *data);
 
+static char *ngx_http_fastcgi_upstream_max_fails_unsupported(ngx_conf_t *cf,
+    ngx_command_t *cmd, void *conf);
+static char *ngx_http_fastcgi_upstream_fail_timeout_unsupported(ngx_conf_t *cf,
+    ngx_command_t *cmd, void *conf);
+
 
 static ngx_http_fastcgi_request_start_t  ngx_http_fastcgi_request_start = {
     { 1,                                               /* version */
@@ -310,16 +312,16 @@ static ngx_command_t  ngx_http_fastcgi_c
 
     { ngx_string("fastcgi_upstream_max_fails"),
       NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1,
-      ngx_conf_set_num_slot,
-      NGX_HTTP_LOC_CONF_OFFSET,
-      offsetof(ngx_http_fastcgi_loc_conf_t, upstream.max_fails),
+      ngx_http_fastcgi_upstream_max_fails_unsupported,
+      0,
+      0,
       NULL },
 
     { ngx_string("fastcgi_upstream_fail_timeout"),
       NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1,
-      ngx_conf_set_sec_slot,
-      NGX_HTTP_LOC_CONF_OFFSET,
-      offsetof(ngx_http_fastcgi_loc_conf_t, upstream.fail_timeout),
+      ngx_http_fastcgi_upstream_fail_timeout_unsupported,
+      0,
+      0,
       NULL },
 
     { ngx_string("fastcgi_param"),
@@ -411,8 +413,6 @@ ngx_http_fastcgi_handler(ngx_http_reques
 
     u->peer.log = r->connection->log;
     u->peer.log_error = NGX_ERROR_ERR;
-    u->peer.peers = flcf->upstream_peers->peers;
-    u->peer.tries = flcf->upstream_peers->peers->number;
 #if (NGX_THREADS)
     u->peer.lock = &r->connection->lock;
 #endif
@@ -1547,9 +1547,6 @@ ngx_http_fastcgi_create_loc_conf(ngx_con
     conf->upstream.max_temp_file_size_conf = NGX_CONF_UNSET_SIZE;
     conf->upstream.temp_file_write_size_conf = NGX_CONF_UNSET_SIZE;
 
-    conf->upstream.max_fails = NGX_CONF_UNSET_UINT;
-    conf->upstream.fail_timeout = NGX_CONF_UNSET;
-
     conf->upstream.pass_request_headers = NGX_CONF_UNSET;
     conf->upstream.pass_request_body = NGX_CONF_UNSET;
 
@@ -1573,7 +1570,6 @@ ngx_http_fastcgi_merge_loc_conf(ngx_conf
     uintptr_t                    *code;
     ngx_str_t                    *header;
     ngx_uint_t                    i, j;
-    ngx_peer_t                   *peer;
     ngx_array_t                   hide_headers;
     ngx_keyval_t                 *src;
     ngx_hash_key_t               *hk;
@@ -1707,25 +1703,6 @@ ngx_http_fastcgi_merge_loc_conf(ngx_conf
                                        |NGX_HTTP_UPSTREAM_FT_OFF;
     }
 
-    ngx_conf_merge_uint_value(conf->upstream.max_fails,
-                              prev->upstream.max_fails, 1);
-
-    ngx_conf_merge_sec_value(conf->upstream.fail_timeout,
-                              prev->upstream.fail_timeout, 10);
-
-    if (conf->upstream_peers) {
-        peer = conf->upstream_peers->peers->peer;
-        for (i = 0; i < conf->upstream_peers->peers->number; i++) {
-            ngx_conf_init_uint_value(peer[i].weight, 1);
-            peer[i].current_weight = peer[i].weight;
-            ngx_conf_init_uint_value(peer[i].max_fails,
-                              conf->upstream.max_fails);
-            ngx_conf_init_value(peer[i].fail_timeout,
-                              conf->upstream.fail_timeout);
-        }
-
-    }
-
     ngx_conf_merge_path_value(conf->upstream.temp_path,
                               prev->upstream.temp_path,
                               NGX_HTTP_FASTCGI_TEMP_PATH, 1, 2, 0,
@@ -1844,8 +1821,8 @@ ngx_http_fastcgi_merge_loc_conf(ngx_conf
 
 peers:
 
-    if (conf->upstream_peers == NULL) {
-        conf->upstream_peers = prev->upstream_peers;
+    if (conf->upstream.upstream == NULL) {
+        conf->upstream.upstream = prev->upstream.upstream;
         conf->upstream.schema = prev->upstream.schema;
     }
 
@@ -2033,10 +2010,10 @@ ngx_http_fastcgi_pass(ngx_conf_t *cf, ng
     ngx_memzero(&u, sizeof(ngx_url_t));
 
     u.url = value[1];
-    u.upstream = 1;
-
-    lcf->upstream_peers = ngx_http_upstream_add(cf, &u);
-    if (lcf->upstream_peers == NULL) {
+    u.no_resolve = 1;
+
+    lcf->upstream.upstream = ngx_http_upstream_add(cf, &u, 0);
+    if (lcf->upstream.upstream == NULL) {
         return NGX_CONF_ERROR;
     }
 
@@ -2084,3 +2061,29 @@ ngx_http_fastcgi_lowat_check(ngx_conf_t 
 
     return NGX_CONF_OK;
 }
+
+
+static char *
+ngx_http_fastcgi_upstream_max_fails_unsupported(ngx_conf_t *cf,
+    ngx_command_t *cmd, void *conf)
+{
+    ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
+         "\"fastcgi_upstream_max_fails\" is not supported, "
+         "use the \"max_fails\" parameter of the \"server\" directive ",
+         "inside the \"upstream\" block");
+
+    return NGX_CONF_ERROR;
+}
+
+
+static char *
+ngx_http_fastcgi_upstream_fail_timeout_unsupported(ngx_conf_t *cf,
+    ngx_command_t *cmd, void *conf)
+{
+    ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
+         "\"fastcgi_upstream_fail_timeout\" is not supported, "
+         "use the \"fail_timeout\" parameter of the \"server\" directive ",
+         "inside the \"upstream\" block");
+
+    return NGX_CONF_ERROR;
+}