]> git.kaiwu.me - nginx.git/commitdiff
now the "memcached_pass" directive uses ngx_parse_url()
authorIgor Sysoev <igor@sysoev.ru>
Tue, 24 Oct 2006 13:50:35 +0000 (13:50 +0000)
committerIgor Sysoev <igor@sysoev.ru>
Tue, 24 Oct 2006 13:50:35 +0000 (13:50 +0000)
src/http/modules/ngx_http_memcached_module.c

index bb5ab5d0a01944f8f47ee13b727d57ad96aba2e3..eb91e9b651b7f9560d36bd8665ef184a9d19884b 100644 (file)
@@ -590,7 +590,7 @@ ngx_http_memcached_pass(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
     ngx_http_memcached_loc_conf_t *lcf = conf;
 
     ngx_str_t                 *value;
-    ngx_inet_upstream_t        inet_upstream;
+    ngx_url_t                  u;
     ngx_http_core_loc_conf_t  *clcf;
 
     if (lcf->upstream.schema.len) {
@@ -599,16 +599,19 @@ ngx_http_memcached_pass(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
 
     value = cf->args->elts;
 
-    ngx_memzero(&inet_upstream, sizeof(ngx_inet_upstream_t));
+    ngx_memzero(&u, sizeof(ngx_url_t));
 
-    inet_upstream.name = value[1];
-    inet_upstream.url = value[1];
-
-    lcf->peers = ngx_inet_upstream_parse(cf, &inet_upstream);
-    if (lcf->peers == NULL) {
-        return NGX_CONF_ERROR;
+    u.url = value[1];
+    u.uri_part = 1;
+    
+    if (ngx_parse_url(cf, &u) != NGX_OK) {
+        if (u.err) {
+            ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
+                               "%s in \"%V\"", u.err, &u.url);
+        }
     }
 
+    lcf->peers = u.peers;
     lcf->upstream.schema.len = sizeof("memcached://") - 1;
     lcf->upstream.schema.data = (u_char *) "memcached://";