aboutsummaryrefslogtreecommitdiff
path: root/src/http/ngx_http_upstream.c
diff options
context:
space:
mode:
authorIgor Sysoev <igor@sysoev.ru>2005-08-30 10:55:07 +0000
committerIgor Sysoev <igor@sysoev.ru>2005-08-30 10:55:07 +0000
commite5035397b01ec12f351a6a984f83091b821978cc (patch)
tree9e65f1b24c595346b666559264878cbb911bfcf7 /src/http/ngx_http_upstream.c
parente3c2cf87e537aba572b08afccabcb64976d43079 (diff)
downloadnginx-e5035397b01ec12f351a6a984f83091b821978cc.tar.gz
nginx-e5035397b01ec12f351a6a984f83091b821978cc.zip
nginx-0.1.43-RELEASE importrelease-0.1.43
*) Feature: the listen(2) backlog in the "listen" directive can be changed using the -HUP signal. *) Feature: the geo2nginx.pl script was added to contrib. *) Change: the FastCGI parameters with the empty values now are passed to a server. *) Bugfix: the segmentation fault occurred or the worker process may got caught in an endless loop if the proxied or FastCGI server sent the "Cache-Control" header line and the "expires" directive was used; in the proxied mode the the bug had appeared in 0.1.29.
Diffstat (limited to 'src/http/ngx_http_upstream.c')
-rw-r--r--src/http/ngx_http_upstream.c56
1 files changed, 27 insertions, 29 deletions
diff --git a/src/http/ngx_http_upstream.c b/src/http/ngx_http_upstream.c
index f59ff179e..c575347db 100644
--- a/src/http/ngx_http_upstream.c
+++ b/src/http/ngx_http_upstream.c
@@ -241,7 +241,9 @@ ngx_http_upstream_init(ngx_http_request_t *r)
u = r->upstream;
- u->request_bufs = r->request_body->bufs;
+ if (r->request_body) {
+ u->request_bufs = r->request_body->bufs;
+ }
if (u->conf->method == NGX_CONF_UNSET_UINT) {
u->method = r->method;
@@ -250,7 +252,7 @@ ngx_http_upstream_init(ngx_http_request_t *r)
u->method = u->conf->method;
}
- if (u->create_request(r) == NGX_ERROR) {
+ if (u->create_request(r) != NGX_OK) {
ngx_http_finalize_request(r, NGX_HTTP_INTERNAL_SERVER_ERROR);
return;
}
@@ -615,9 +617,8 @@ ngx_http_upstream_send_request(ngx_http_request_t *r, ngx_http_upstream_t *u)
&& !u->request_sent
&& c->write->pending_eof)
{
- ngx_log_error(NGX_LOG_ERR, c->log, c->write->kq_errno,
- "connect() failed");
-
+ (void) ngx_connection_error(c, c->write->kq_errno,
+ "kevent() reported that connect() failed");
ngx_http_upstream_next(r, u, NGX_HTTP_UPSTREAM_FT_ERROR);
return;
}
@@ -716,12 +717,6 @@ ngx_http_upstream_send_request_handler(ngx_event_t *wev)
return;
}
- if (r->connection->write->eof && (!u->cachable || !u->request_sent)) {
- ngx_http_upstream_finalize_request(r, u,
- NGX_HTTP_INTERNAL_SERVER_ERROR);
- return;
- }
-
ngx_http_upstream_send_request(r, u);
}
@@ -1788,6 +1783,7 @@ static u_char *
ngx_http_upstream_log_error(ngx_http_request_t *r, u_char *buf, size_t len)
{
u_char *p;
+ ngx_str_t line;
uintptr_t escape;
ngx_http_upstream_t *u;
ngx_peer_connection_t *peer;
@@ -1824,33 +1820,35 @@ ngx_http_upstream_log_error(ngx_http_request_t *r, u_char *buf, size_t len)
buf += r->uri.len - u->conf->location->len + escape;
len -= r->uri.len - u->conf->location->len + escape;
- if (r->args.len) {
- p = ngx_snprintf(buf, len, "?%V", &r->args);
- len -= p - buf;
- buf = p;
+ } else {
+ p = ngx_palloc(r->pool,
+ r->uri.len - u->conf->location->len + escape);
+ if (p == NULL) {
+ return buf;
}
- return ngx_http_log_error_info(r, buf, len);
- }
+ ngx_escape_uri(p, r->uri.data + u->conf->location->len,
+ r->uri.len - u->conf->location->len, NGX_ESCAPE_URI);
- p = ngx_palloc(r->pool, r->uri.len - u->conf->location->len + escape);
- if (p == NULL) {
- return buf;
+ line.len = len;
+ line.data = p;
+
+ return ngx_snprintf(buf, len, "%V", &line);
}
- ngx_escape_uri(p, r->uri.data + u->conf->location->len,
- r->uri.len - u->conf->location->len, NGX_ESCAPE_URI);
+ } else {
+ line.len = r->uri.len - u->conf->location->len;
+ if (line.len > len) {
+ line.len = len;
+ }
- p = ngx_cpymem(buf, p, r->uri.len - u->conf->location->len + escape);
+ line.data = r->uri.data + u->conf->location->len;
+ p = ngx_snprintf(buf, len, "%V", &line);
- } else {
- p = ngx_cpymem(buf, r->uri.data + u->conf->location->len,
- r->uri.len - u->conf->location->len);
+ len -= p - buf;
+ buf = p;
}
- len -= p - buf;
- buf = p;
-
if (r->args.len) {
p = ngx_snprintf(buf, len, "?%V", &r->args);
len -= p - buf;