summaryrefslogtreecommitdiff
path: root/src/http
diff options
context:
space:
mode:
authorIgor Sysoev <igor@sysoev.ru>2006-12-11 10:01:16 +0000
committerJonathan Kolb <jon@b0g.us>2006-12-11 10:01:16 +0000
commite1cf9c10bedcb5f1d570d0243e029473831f3031 (patch)
treeb43868f835ffdafd1c6fa26c712caae5aedb20b3 /src/http
parenta1d2290452d6c8de84d143c0d811e84f5765ecb9 (diff)
downloadnginx-e1cf9c10bedcb5f1d570d0243e029473831f3031.tar.gz
Changes with nginx 0.5.1 11 Dec 2006v0.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.
Diffstat (limited to 'src/http')
-rw-r--r--src/http/modules/ngx_http_auth_basic_module.c14
-rw-r--r--src/http/modules/ngx_http_fastcgi_module.c1
-rw-r--r--src/http/modules/ngx_http_memcached_module.c1
-rw-r--r--src/http/modules/ngx_http_proxy_module.c1
-rw-r--r--src/http/modules/perl/nginx.pm2
-rw-r--r--src/http/ngx_http_request.c2
-rw-r--r--src/http/ngx_http_upstream.c29
-rw-r--r--src/http/ngx_http_upstream.h3
-rw-r--r--src/http/ngx_http_upstream_round_robin.c9
9 files changed, 45 insertions, 17 deletions
diff --git a/src/http/modules/ngx_http_auth_basic_module.c b/src/http/modules/ngx_http_auth_basic_module.c
index 5a4f9d823..d021ef83e 100644
--- a/src/http/modules/ngx_http_auth_basic_module.c
+++ b/src/http/modules/ngx_http_auth_basic_module.c
@@ -154,6 +154,8 @@ ngx_http_auth_basic_handler(ngx_http_request_t *r)
offset = 0;
for ( ;; ) {
+ i = left;
+
n = ngx_read_file(&file, buf + left, NGX_HTTP_AUTH_BUF_SIZE - left,
offset);
@@ -228,6 +230,18 @@ ngx_http_auth_basic_handler(ngx_http_request_t *r)
ngx_http_auth_basic_close(&file);
+ if (state == sw_passwd) {
+ pwd.len = i - passwd;
+ pwd.data = ngx_palloc(r->pool, pwd.len + 1);
+ if (pwd.data == NULL) {
+ return NGX_HTTP_INTERNAL_SERVER_ERROR;
+ }
+
+ ngx_cpystrn(pwd.data, &buf[passwd], pwd.len + 1);
+
+ return ngx_http_auth_basic_crypt_handler(r, NULL, &pwd, &alcf->realm);
+ }
+
return ngx_http_auth_basic_set_realm(r, &alcf->realm);
}
diff --git a/src/http/modules/ngx_http_fastcgi_module.c b/src/http/modules/ngx_http_fastcgi_module.c
index ab214770e..fdefb835c 100644
--- a/src/http/modules/ngx_http_fastcgi_module.c
+++ b/src/http/modules/ngx_http_fastcgi_module.c
@@ -2010,6 +2010,7 @@ ngx_http_fastcgi_pass(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
ngx_memzero(&u, sizeof(ngx_url_t));
u.url = value[1];
+ u.upstream = 1;
u.no_resolve = 1;
lcf->upstream.upstream = ngx_http_upstream_add(cf, &u, 0);
diff --git a/src/http/modules/ngx_http_memcached_module.c b/src/http/modules/ngx_http_memcached_module.c
index bd8b83716..5265c38cf 100644
--- a/src/http/modules/ngx_http_memcached_module.c
+++ b/src/http/modules/ngx_http_memcached_module.c
@@ -583,6 +583,7 @@ ngx_http_memcached_pass(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
ngx_memzero(&u, sizeof(ngx_url_t));
u.url = value[1];
+ u.upstream = 1;
u.no_resolve = 1;
/* u.uri_part = 1; may be used as namespace */
diff --git a/src/http/modules/ngx_http_proxy_module.c b/src/http/modules/ngx_http_proxy_module.c
index 2095f6a32..dbca2ab54 100644
--- a/src/http/modules/ngx_http_proxy_module.c
+++ b/src/http/modules/ngx_http_proxy_module.c
@@ -2159,6 +2159,7 @@ ngx_http_proxy_pass(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
u.url.len = url->len - add;
u.url.data = url->data + add;
u.default_portn = port;
+ u.upstream = 1;
u.no_resolve = 1;
u.uri_part = 1;
diff --git a/src/http/modules/perl/nginx.pm b/src/http/modules/perl/nginx.pm
index 867a4474b..c74ffd7bd 100644
--- a/src/http/modules/perl/nginx.pm
+++ b/src/http/modules/perl/nginx.pm
@@ -17,7 +17,7 @@ our @EXPORT = qw(
HTTP_SERVER_ERROR
);
-our $VERSION = '0.5.0';
+our $VERSION = '0.5.1';
require XSLoader;
XSLoader::load('nginx', $VERSION);
diff --git a/src/http/ngx_http_request.c b/src/http/ngx_http_request.c
index 8a86f2e5b..2c1ac9566 100644
--- a/src/http/ngx_http_request.c
+++ b/src/http/ngx_http_request.c
@@ -2247,6 +2247,8 @@ ngx_http_post_action(ngx_http_request_t *r)
r->header_only = 1;
r->post_action = 1;
+ r->read_event_handler = ngx_http_block_read;
+
ngx_http_internal_redirect(r, &clcf->post_action, NULL);
return NGX_OK;
diff --git a/src/http/ngx_http_upstream.c b/src/http/ngx_http_upstream.c
index da1c9adeb..a358ce248 100644
--- a/src/http/ngx_http_upstream.c
+++ b/src/http/ngx_http_upstream.c
@@ -493,17 +493,16 @@ ngx_http_upstream_connect(ngx_http_request_t *r, ngx_http_upstream_t *u)
{
ngx_int_t rc;
ngx_time_t *tp;
- ngx_msec_int_t ms;
ngx_connection_t *c;
r->connection->log->action = "connecting to upstream";
r->connection->single_connection = 0;
- if (u->state && u->state->response_time) {
+ if (u->state && u->state->response_sec) {
tp = ngx_timeofday();
- ms = tp->sec * 1000 + tp->msec - u->state->response_time;
- u->state->response_time = (ms >= 0) ? ms : 0;
+ u->state->response_sec = tp->sec - u->state->response_sec;
+ u->state->response_msec = tp->msec - u->state->response_msec;
}
u->state = ngx_array_push(&u->states);
@@ -516,7 +515,8 @@ ngx_http_upstream_connect(ngx_http_request_t *r, ngx_http_upstream_t *u)
ngx_memzero(u->state, sizeof(ngx_http_upstream_state_t));
tp = ngx_timeofday();
- u->state->response_time = tp->sec * 1000 + tp->msec;
+ u->state->response_sec = tp->sec;
+ u->state->response_msec = tp->msec;
rc = ngx_event_connect_peer(&u->peer);
@@ -2043,18 +2043,17 @@ static void
ngx_http_upstream_finalize_request(ngx_http_request_t *r,
ngx_http_upstream_t *u, ngx_int_t rc)
{
- ngx_time_t *tp;
- ngx_msec_int_t ms;
+ ngx_time_t *tp;
ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
"finalize http upstream request: %i", rc);
*u->cleanup = NULL;
- if (u->state->response_time) {
+ if (u->state->response_sec) {
tp = ngx_timeofday();
- ms = tp->sec * 1000 + tp->msec - u->state->response_time;
- u->state->response_time = (ms >= 0) ? ms : 0;
+ u->state->response_sec = tp->sec - u->state->response_sec;
+ u->state->response_msec = tp->msec - u->state->response_msec;
}
u->finalize_request(r, rc);
@@ -2531,6 +2530,7 @@ ngx_http_upstream_response_time_variable(ngx_http_request_t *r,
u_char *p;
size_t len;
ngx_uint_t i;
+ ngx_msec_int_t ms;
ngx_http_upstream_t *u;
ngx_http_upstream_state_t *state;
@@ -2562,9 +2562,9 @@ ngx_http_upstream_response_time_variable(ngx_http_request_t *r,
*p++ = '-';
} else {
- p = ngx_sprintf(p, "%d.%03d",
- state[i].response_time / 1000,
- state[i].response_time % 1000);
+ ms = state[i].response_sec * 1000 + state[i].response_msec;
+ ms = (ms >= 0) ? ms : 0;
+ p = ngx_sprintf(p, "%d.%03d", ms / 1000, ms % 1000);
}
if (++i == u->states.nelts) {
@@ -2843,7 +2843,8 @@ ngx_http_upstream_add(ngx_conf_t *cf, ngx_url_t *u, ngx_uint_t flags)
uscfp = umcf->upstreams.elts;
for (i = 0; i < umcf->upstreams.nelts; i++) {
- if (uscfp[i]->host.len != u->host.len
+ if (uscfp[i]->port != u->portn
+ || uscfp[i]->host.len != u->host.len
|| ngx_strncasecmp(uscfp[i]->host.data, u->host.data, u->host.len)
!= 0)
{
diff --git a/src/http/ngx_http_upstream.h b/src/http/ngx_http_upstream.h
index 80c4d82b2..185964e2c 100644
--- a/src/http/ngx_http_upstream.h
+++ b/src/http/ngx_http_upstream.h
@@ -35,7 +35,8 @@ typedef struct {
ngx_uint_t bl_state;
ngx_uint_t status;
- ngx_msec_t response_time;
+ time_t response_sec;
+ ngx_uint_t response_msec;
ngx_str_t *peer;
} ngx_http_upstream_state_t;
diff --git a/src/http/ngx_http_upstream_round_robin.c b/src/http/ngx_http_upstream_round_robin.c
index c7ec7ab56..82173e4b0 100644
--- a/src/http/ngx_http_upstream_round_robin.c
+++ b/src/http/ngx_http_upstream_round_robin.c
@@ -69,13 +69,20 @@ ngx_http_upstream_init_round_robin(ngx_conf_t *cf,
if (ngx_inet_resolve_host(cf, &u) != NGX_OK) {
if (u.err) {
ngx_log_error(NGX_LOG_EMERG, cf->log, 0,
- "%s in upstream host \"%V\" is not found in %s:%ui",
+ "%s in upstream \"%V\" in %s:%ui",
u.err, &us->host, us->file_name.data, us->line);
}
return NGX_ERROR;
}
+ if (us->port == 0) {
+ ngx_log_error(NGX_LOG_EMERG, cf->log, 0,
+ "no port in upstream \"%V\" in %s:%ui",
+ &us->host, us->file_name.data, us->line);
+ return NGX_ERROR;
+ }
+
n = u.naddrs;
peers = ngx_pcalloc(cf->pool, sizeof(ngx_http_upstream_rr_peers_t)