comparison src/http/modules/ngx_http_memcached_module.c @ 807:3095bf59059b

now the "memcached_pass" directive uses ngx_parse_url()
author Igor Sysoev <igor@sysoev.ru>
date Tue, 24 Oct 2006 13:50:35 +0000
parents e924670896ab
children b630109560b7
comparison
equal deleted inserted replaced
806:fc742aa760f3 807:3095bf59059b
588 ngx_http_memcached_pass(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) 588 ngx_http_memcached_pass(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
589 { 589 {
590 ngx_http_memcached_loc_conf_t *lcf = conf; 590 ngx_http_memcached_loc_conf_t *lcf = conf;
591 591
592 ngx_str_t *value; 592 ngx_str_t *value;
593 ngx_inet_upstream_t inet_upstream; 593 ngx_url_t u;
594 ngx_http_core_loc_conf_t *clcf; 594 ngx_http_core_loc_conf_t *clcf;
595 595
596 if (lcf->upstream.schema.len) { 596 if (lcf->upstream.schema.len) {
597 return "is duplicate"; 597 return "is duplicate";
598 } 598 }
599 599
600 value = cf->args->elts; 600 value = cf->args->elts;
601 601
602 ngx_memzero(&inet_upstream, sizeof(ngx_inet_upstream_t)); 602 ngx_memzero(&u, sizeof(ngx_url_t));
603 603
604 inet_upstream.name = value[1]; 604 u.url = value[1];
605 inet_upstream.url = value[1]; 605 u.uri_part = 1;
606 606
607 lcf->peers = ngx_inet_upstream_parse(cf, &inet_upstream); 607 if (ngx_parse_url(cf, &u) != NGX_OK) {
608 if (lcf->peers == NULL) { 608 if (u.err) {
609 return NGX_CONF_ERROR; 609 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
610 } 610 "%s in \"%V\"", u.err, &u.url);
611 611 }
612 }
613
614 lcf->peers = u.peers;
612 lcf->upstream.schema.len = sizeof("memcached://") - 1; 615 lcf->upstream.schema.len = sizeof("memcached://") - 1;
613 lcf->upstream.schema.data = (u_char *) "memcached://"; 616 lcf->upstream.schema.data = (u_char *) "memcached://";
614 617
615 clcf = ngx_http_conf_get_module_loc_conf(cf, ngx_http_core_module); 618 clcf = ngx_http_conf_get_module_loc_conf(cf, ngx_http_core_module);
616 619