comparison src/http/ngx_http_upstream_round_robin.c @ 400:6ebbca3d5ed7 NGINX_0_7_12

nginx 0.7.12 *) Feature: the "server_name" directive supports empty name "". *) Feature: the "gzip_disable" directive supports special "msie6" mask. *) Bugfix: if the "max_fails=0" parameter was used in upstream with several servers, then a worker process exited on a SIGFPE signal. Thanks to Maxim Dounin. *) Bugfix: a request body was dropped while redirection via an "error_page" directive. *) Bugfix: a full response was returned for request method HEAD while redirection via an "error_page" directive. *) Bugfix: the $r->header_in() method did not return value of the "Host", "User-Agent", and "Connection" request header lines; the bug had appeared in 0.7.0.
author Igor Sysoev <http://sysoev.ru>
date Tue, 26 Aug 2008 00:00:00 +0400
parents 984bb0b1399b
children 49a0eb7ce20c
comparison
equal deleted inserted replaced
399:59e324e4d6d3 400:6ebbca3d5ed7
279 peers->number = ur->naddrs; 279 peers->number = ur->naddrs;
280 peers->name = &ur->host; 280 peers->name = &ur->host;
281 281
282 for (i = 0; i < ur->naddrs; i++) { 282 for (i = 0; i < ur->naddrs; i++) {
283 283
284 len = INET_ADDRSTRLEN - 1 + 1 + sizeof(":65536") - 1; 284 len = NGX_INET_ADDRSTRLEN + sizeof(":65536") - 1;
285 285
286 p = ngx_pnalloc(r->pool, len); 286 p = ngx_pnalloc(r->pool, len);
287 if (p == NULL) { 287 if (p == NULL) {
288 return NGX_ERROR; 288 return NGX_ERROR;
289 } 289 }
290 290
291 len = ngx_inet_ntop(AF_INET, &ur->addrs[i], p, INET_ADDRSTRLEN); 291 len = ngx_inet_ntop(AF_INET, &ur->addrs[i], p, NGX_INET_ADDRSTRLEN);
292 len = ngx_sprintf(&p[len], ":%d", ur->port) - p; 292 len = ngx_sprintf(&p[len], ":%d", ur->port) - p;
293 293
294 sin = ngx_pcalloc(r->pool, sizeof(struct sockaddr_in)); 294 sin = ngx_pcalloc(r->pool, sizeof(struct sockaddr_in));
295 if (sin == NULL) { 295 if (sin == NULL) {
296 return NGX_ERROR; 296 return NGX_ERROR;
643 /* ngx_lock_mutex(rrp->peers->mutex); */ 643 /* ngx_lock_mutex(rrp->peers->mutex); */
644 644
645 peer->fails++; 645 peer->fails++;
646 peer->accessed = now; 646 peer->accessed = now;
647 647
648 peer->current_weight -= peer->weight / peer->max_fails; 648 if (peer->max_fails) {
649 peer->current_weight -= peer->weight / peer->max_fails;
650 }
649 651
650 ngx_log_debug2(NGX_LOG_DEBUG_HTTP, pc->log, 0, 652 ngx_log_debug2(NGX_LOG_DEBUG_HTTP, pc->log, 0,
651 "free rr peer failed: %ui %i", 653 "free rr peer failed: %ui %i",
652 rrp->current, peer->current_weight); 654 rrp->current, peer->current_weight);
653 655