diff src/http/ngx_http_upstream.c @ 3271:fcd98af88df3

proxy_bind, fastcgi_bind, and memcached_bind
author Igor Sysoev <igor@sysoev.ru>
date Mon, 02 Nov 2009 15:24:02 +0000
parents 48bfb7dc981b
children 98f49b2bcae8
line wrap: on
line diff
--- a/src/http/ngx_http_upstream.c
+++ b/src/http/ngx_http_upstream.c
@@ -479,6 +479,8 @@ ngx_http_upstream_init_request(ngx_http_
         return;
     }
 
+    u->peer.local = u->conf->local;
+
     clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module);
 
     u->output.alignment = clcf->directio_alignment;
@@ -4196,6 +4198,31 @@ ngx_http_upstream_add(ngx_conf_t *cf, ng
 }
 
 
+char *
+ngx_http_upsteam_bind_set_slot(ngx_conf_t *cf, ngx_command_t *cmd,
+    void *conf)
+{
+    char  *p = conf;
+
+    ngx_str_t    *value;
+    ngx_addr_t  **paddr;
+
+    paddr = (ngx_addr_t **) (p + cmd->offset);
+
+    value = cf->args->elts;
+
+    *paddr = ngx_parse_addr(cf->pool, &value[1]);
+    if (*paddr) {
+        return NGX_CONF_OK;
+    }
+
+    ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
+                       "invalid address \"%V\"", &value[1]);
+
+    return NGX_CONF_ERROR;
+}
+
+
 ngx_int_t
 ngx_http_upstream_hide_headers_hash(ngx_conf_t *cf,
     ngx_http_upstream_conf_t *conf, ngx_http_upstream_conf_t *prev,