comparison src/http/ngx_http_upstream_round_robin.c @ 906:a0310ac2814f

rewritten upstream
author Igor Sysoev <igor@sysoev.ru>
date Tue, 12 Dec 2006 16:46:16 +0000
parents f247db60fc85
children 327aef5c6ac4
comparison
equal deleted inserted replaced
905:be52cfdb3e31 906:a0310ac2814f
59 } 59 }
60 60
61 61
62 /* an upstream implicitly defined by proxy_pass, etc. */ 62 /* an upstream implicitly defined by proxy_pass, etc. */
63 63
64 if (us->port == 0 && us->default_port == 0) {
65 ngx_log_error(NGX_LOG_EMERG, cf->log, 0,
66 "no port in upstream \"%V\" in %s:%ui",
67 &us->host, us->file_name.data, us->line);
68 return NGX_ERROR;
69 }
70
64 ngx_memzero(&u, sizeof(ngx_url_t)); 71 ngx_memzero(&u, sizeof(ngx_url_t));
65 72
66 u.host = us->host; 73 u.host = us->host;
67 u.portn = us->port; 74 u.port = us->port ? us->port : us->default_port;
68 75
69 if (ngx_inet_resolve_host(cf, &u) != NGX_OK) { 76 if (ngx_inet_resolve_host(cf, &u) != NGX_OK) {
70 if (u.err) { 77 if (u.err) {
71 ngx_log_error(NGX_LOG_EMERG, cf->log, 0, 78 ngx_log_error(NGX_LOG_EMERG, cf->log, 0,
72 "%s in upstream \"%V\" in %s:%ui", 79 "%s in upstream \"%V\" in %s:%ui",
73 u.err, &us->host, us->file_name.data, us->line); 80 u.err, &us->host, us->file_name.data, us->line);
74 } 81 }
75 82
76 return NGX_ERROR;
77 }
78
79 if (us->port == 0) {
80 ngx_log_error(NGX_LOG_EMERG, cf->log, 0,
81 "no port in upstream \"%V\" in %s:%ui",
82 &us->host, us->file_name.data, us->line);
83 return NGX_ERROR; 83 return NGX_ERROR;
84 } 84 }
85 85
86 n = u.naddrs; 86 n = u.naddrs;
87 87