Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nginx/nginx.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorIgor Sysoev <igor@sysoev.ru>2003-10-27 19:16:17 +0300
committerIgor Sysoev <igor@sysoev.ru>2003-10-27 19:16:17 +0300
commit425a42ce3dfe0a24c5c6eb44285447b40e685291 (patch)
tree7eaa9a2587617b14b88d4dc6b7ee1979b2b8f733 /src
parent10fc9ef77503ec4db5f5006557aeffc1939043ca (diff)
nginx-0.0.1-2003-10-27-19:16:17 import
Diffstat (limited to 'src')
-rw-r--r--src/event/modules/ngx_kqueue_module.c2
-rw-r--r--src/event/ngx_event_connect.c12
-rw-r--r--src/http/modules/proxy/ngx_http_proxy_handler.c1
-rw-r--r--src/http/ngx_http_request.c2
-rw-r--r--src/http/ngx_http_special_response.c6
5 files changed, 19 insertions, 4 deletions
diff --git a/src/event/modules/ngx_kqueue_module.c b/src/event/modules/ngx_kqueue_module.c
index 14eb27038..2c743fcfb 100644
--- a/src/event/modules/ngx_kqueue_module.c
+++ b/src/event/modules/ngx_kqueue_module.c
@@ -201,7 +201,7 @@ static int ngx_kqueue_add_event(ngx_event_t *ev, int event, u_int flags)
{
c = ev->data;
ngx_log_error(NGX_LOG_ALERT, ev->log, 0,
- "previous event were not passed in kernel", c->fd);
+ "previous event on #%d were not passed in kernel", c->fd);
return NGX_ERROR;
}
diff --git a/src/event/ngx_event_connect.c b/src/event/ngx_event_connect.c
index c76ade1c8..32609f18d 100644
--- a/src/event/ngx_event_connect.c
+++ b/src/event/ngx_event_connect.c
@@ -38,8 +38,6 @@ int ngx_event_connect_peer(ngx_peer_connection_t *pc)
pc->cached = 0;
pc->connection = NULL;
- peer = &pc->peers->peers[0];
-
if (pc->peers->number > 1) {
/* there are several peers */
@@ -85,6 +83,8 @@ int ngx_event_connect_peer(ngx_peer_connection_t *pc)
}
}
+ peer = &pc->peers->peers[pc->cur_peer];
+
/* ngx_unlock_mutex(pc->peers->mutex); */
#if 0
@@ -182,6 +182,8 @@ int ngx_event_connect_peer(ngx_peer_connection_t *pc)
addr.sin_addr.s_addr = peer->addr;
addr.sin_port = peer->port;
+ngx_log_debug(pc->log, "CONNECT: %s" _ peer->addr_port_text.data);
+
rc = connect(s, (struct sockaddr *) &addr, sizeof(struct sockaddr_in));
if (rc == -1) {
@@ -232,6 +234,12 @@ int ngx_event_connect_peer(ngx_peer_connection_t *pc)
void ngx_event_connect_peer_failed(ngx_peer_connection_t *pc)
{
+ pc->cur_peer++;
+
+ if (pc->cur_peer >= pc->peers->number) {
+ pc->cur_peer = 0;
+ }
+
pc->tries--;
return;
diff --git a/src/http/modules/proxy/ngx_http_proxy_handler.c b/src/http/modules/proxy/ngx_http_proxy_handler.c
index ae6d5d148..0bb3cce40 100644
--- a/src/http/modules/proxy/ngx_http_proxy_handler.c
+++ b/src/http/modules/proxy/ngx_http_proxy_handler.c
@@ -457,6 +457,7 @@ static void ngx_http_proxy_send_request(ngx_http_proxy_ctx_t *p)
return;
}
+ ngx_event_connect_peer_failed(&p->upstream);
ngx_http_proxy_close_connection(c);
}
diff --git a/src/http/ngx_http_request.c b/src/http/ngx_http_request.c
index 9b8ac2786..e3a495234 100644
--- a/src/http/ngx_http_request.c
+++ b/src/http/ngx_http_request.c
@@ -629,7 +629,7 @@ static void ngx_http_process_request_headers(ngx_event_t *rev)
return;
}
- if (r->header_timeout_set) {
+ if (rev->timer_set) {
ngx_del_timer(rev);
}
diff --git a/src/http/ngx_http_special_response.c b/src/http/ngx_http_special_response.c
index ce6183e8b..035d4878f 100644
--- a/src/http/ngx_http_special_response.c
+++ b/src/http/ngx_http_special_response.c
@@ -157,6 +157,12 @@ int ngx_http_special_response_handler(ngx_http_request_t *r, int error)
ngx_chain_t *out, **ll, *cl;
ngx_http_core_loc_conf_t *clcf;
+ rc = ngx_http_discard_body(r);
+
+ if (rc != NGX_OK) {
+ return rc;
+ }
+
r->headers_out.status = error;
if (error < NGX_HTTP_BAD_REQUEST) {