Mercurial > hg > nginx-vendor-0-5
comparison src/http/ngx_http_upstream.c @ 262:e0b1d0a6c629 NGINX_0_5_1
nginx 0.5.1
*) Bugfix: the "post_action" directive might not run after a
unsuccessful completion of a request.
*) Workaround: for Eudora for Mac; bug appeared in 0.4.11.
Thanks to Bron Gondwana.
*) Bugfix: if the "upstream" name was used in the "fastcgi_pass", then
the message "no port in upstream" was issued; bug appeared in 0.5.0.
*) Bugfix: if the "proxy_pass" and "fastcgi_pass" directives used the
same servers but different ports, then these directives uses the
first described port; bug appeared in 0.5.0.
*) Bugfix: if the "proxy_pass" and "fastcgi_pass" directives used the
unix domain sockets, then these directives used first described
socket; bug appeared in 0.5.0.
*) Bugfix: ngx_http_auth_basic_module ignored the user if it was in the
last line in the password file and there was no the carriage return,
the line feed, or the ":" symbol after the password.
*) Bugfix: the $upstream_response_time variable might be equal to
"0.000", although response time was more than 1 millisecond.
author | Igor Sysoev <http://sysoev.ru> |
---|---|
date | Mon, 11 Dec 2006 00:00:00 +0300 |
parents | 0effe91f6083 |
children | 4de4f8bc5d07 |
comparison
equal
deleted
inserted
replaced
261:e6ae240d5952 | 262:e0b1d0a6c629 |
---|---|
491 static void | 491 static void |
492 ngx_http_upstream_connect(ngx_http_request_t *r, ngx_http_upstream_t *u) | 492 ngx_http_upstream_connect(ngx_http_request_t *r, ngx_http_upstream_t *u) |
493 { | 493 { |
494 ngx_int_t rc; | 494 ngx_int_t rc; |
495 ngx_time_t *tp; | 495 ngx_time_t *tp; |
496 ngx_msec_int_t ms; | |
497 ngx_connection_t *c; | 496 ngx_connection_t *c; |
498 | 497 |
499 r->connection->log->action = "connecting to upstream"; | 498 r->connection->log->action = "connecting to upstream"; |
500 | 499 |
501 r->connection->single_connection = 0; | 500 r->connection->single_connection = 0; |
502 | 501 |
503 if (u->state && u->state->response_time) { | 502 if (u->state && u->state->response_sec) { |
504 tp = ngx_timeofday(); | 503 tp = ngx_timeofday(); |
505 ms = tp->sec * 1000 + tp->msec - u->state->response_time; | 504 u->state->response_sec = tp->sec - u->state->response_sec; |
506 u->state->response_time = (ms >= 0) ? ms : 0; | 505 u->state->response_msec = tp->msec - u->state->response_msec; |
507 } | 506 } |
508 | 507 |
509 u->state = ngx_array_push(&u->states); | 508 u->state = ngx_array_push(&u->states); |
510 if (u->state == NULL) { | 509 if (u->state == NULL) { |
511 ngx_http_upstream_finalize_request(r, u, | 510 ngx_http_upstream_finalize_request(r, u, |
514 } | 513 } |
515 | 514 |
516 ngx_memzero(u->state, sizeof(ngx_http_upstream_state_t)); | 515 ngx_memzero(u->state, sizeof(ngx_http_upstream_state_t)); |
517 | 516 |
518 tp = ngx_timeofday(); | 517 tp = ngx_timeofday(); |
519 u->state->response_time = tp->sec * 1000 + tp->msec; | 518 u->state->response_sec = tp->sec; |
519 u->state->response_msec = tp->msec; | |
520 | 520 |
521 rc = ngx_event_connect_peer(&u->peer); | 521 rc = ngx_event_connect_peer(&u->peer); |
522 | 522 |
523 ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, | 523 ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, |
524 "http upstream connect: %i", rc); | 524 "http upstream connect: %i", rc); |
2041 | 2041 |
2042 static void | 2042 static void |
2043 ngx_http_upstream_finalize_request(ngx_http_request_t *r, | 2043 ngx_http_upstream_finalize_request(ngx_http_request_t *r, |
2044 ngx_http_upstream_t *u, ngx_int_t rc) | 2044 ngx_http_upstream_t *u, ngx_int_t rc) |
2045 { | 2045 { |
2046 ngx_time_t *tp; | 2046 ngx_time_t *tp; |
2047 ngx_msec_int_t ms; | |
2048 | 2047 |
2049 ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, | 2048 ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, |
2050 "finalize http upstream request: %i", rc); | 2049 "finalize http upstream request: %i", rc); |
2051 | 2050 |
2052 *u->cleanup = NULL; | 2051 *u->cleanup = NULL; |
2053 | 2052 |
2054 if (u->state->response_time) { | 2053 if (u->state->response_sec) { |
2055 tp = ngx_timeofday(); | 2054 tp = ngx_timeofday(); |
2056 ms = tp->sec * 1000 + tp->msec - u->state->response_time; | 2055 u->state->response_sec = tp->sec - u->state->response_sec; |
2057 u->state->response_time = (ms >= 0) ? ms : 0; | 2056 u->state->response_msec = tp->msec - u->state->response_msec; |
2058 } | 2057 } |
2059 | 2058 |
2060 u->finalize_request(r, rc); | 2059 u->finalize_request(r, rc); |
2061 | 2060 |
2062 u->peer.free(&u->peer, u->peer.data, 0); | 2061 u->peer.free(&u->peer, u->peer.data, 0); |
2529 ngx_http_variable_value_t *v, uintptr_t data) | 2528 ngx_http_variable_value_t *v, uintptr_t data) |
2530 { | 2529 { |
2531 u_char *p; | 2530 u_char *p; |
2532 size_t len; | 2531 size_t len; |
2533 ngx_uint_t i; | 2532 ngx_uint_t i; |
2533 ngx_msec_int_t ms; | |
2534 ngx_http_upstream_t *u; | 2534 ngx_http_upstream_t *u; |
2535 ngx_http_upstream_state_t *state; | 2535 ngx_http_upstream_state_t *state; |
2536 | 2536 |
2537 v->valid = 1; | 2537 v->valid = 1; |
2538 v->no_cachable = 0; | 2538 v->no_cachable = 0; |
2560 for ( ;; ) { | 2560 for ( ;; ) { |
2561 if (state[i].status == 0) { | 2561 if (state[i].status == 0) { |
2562 *p++ = '-'; | 2562 *p++ = '-'; |
2563 | 2563 |
2564 } else { | 2564 } else { |
2565 p = ngx_sprintf(p, "%d.%03d", | 2565 ms = state[i].response_sec * 1000 + state[i].response_msec; |
2566 state[i].response_time / 1000, | 2566 ms = (ms >= 0) ? ms : 0; |
2567 state[i].response_time % 1000); | 2567 p = ngx_sprintf(p, "%d.%03d", ms / 1000, ms % 1000); |
2568 } | 2568 } |
2569 | 2569 |
2570 if (++i == u->states.nelts) { | 2570 if (++i == u->states.nelts) { |
2571 break; | 2571 break; |
2572 } | 2572 } |
2841 umcf = ngx_http_conf_get_module_main_conf(cf, ngx_http_upstream_module); | 2841 umcf = ngx_http_conf_get_module_main_conf(cf, ngx_http_upstream_module); |
2842 | 2842 |
2843 uscfp = umcf->upstreams.elts; | 2843 uscfp = umcf->upstreams.elts; |
2844 | 2844 |
2845 for (i = 0; i < umcf->upstreams.nelts; i++) { | 2845 for (i = 0; i < umcf->upstreams.nelts; i++) { |
2846 if (uscfp[i]->host.len != u->host.len | 2846 if (uscfp[i]->port != u->portn |
2847 || uscfp[i]->host.len != u->host.len | |
2847 || ngx_strncasecmp(uscfp[i]->host.data, u->host.data, u->host.len) | 2848 || ngx_strncasecmp(uscfp[i]->host.data, u->host.data, u->host.len) |
2848 != 0) | 2849 != 0) |
2849 { | 2850 { |
2850 continue; | 2851 continue; |
2851 } | 2852 } |