comparison src/http/ngx_http_upstream_round_robin.c @ 6785:d1d0dd69a419

Upstream: added the ngx_http_upstream_resolved_t.name field. This fixes inconsistency in what is stored in the "host" field. Normally it would contain the "host" part of the parsed URL (e.g., proxy_pass with variables), but for the case of an implicit upstream specified with literal address it contained the text representation of the socket address (that is, host including port for IP). Now the "host" field always contains the "host" part of the URL, while the text representation of the socket address is stored in the newly added "name" field. The ngx_http_upstream_create_round_robin_peer() function was modified accordingly in a way to be compatible with the code that does not know about the new "name" field. The "stream" code was similarly modified except for not adding compatibility in ngx_stream_upstream_create_round_robin_peer(). This change is also a prerequisite for the next change.
author Ruslan Ermilov <ru@nginx.com>
date Mon, 31 Oct 2016 18:33:33 +0300
parents fd5c2781460b
children 696df3ac27ac
comparison
equal deleted inserted replaced
6784:1af120241cde 6785:d1d0dd69a419
335 peers->name = &ur->host; 335 peers->name = &ur->host;
336 336
337 if (ur->sockaddr) { 337 if (ur->sockaddr) {
338 peer[0].sockaddr = ur->sockaddr; 338 peer[0].sockaddr = ur->sockaddr;
339 peer[0].socklen = ur->socklen; 339 peer[0].socklen = ur->socklen;
340 peer[0].name = ur->host; 340 peer[0].name = ur->name.data ? ur->name : ur->host;
341 peer[0].weight = 1; 341 peer[0].weight = 1;
342 peer[0].effective_weight = 1; 342 peer[0].effective_weight = 1;
343 peer[0].current_weight = 0; 343 peer[0].current_weight = 0;
344 peer[0].max_conns = 0; 344 peer[0].max_conns = 0;
345 peer[0].max_fails = 1; 345 peer[0].max_fails = 1;