Mercurial > hg > nginx-ranges
diff src/http/ngx_http_upstream.c @ 86:962c43960644 NGINX_0_1_43
nginx 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 bug appeared in 0.1.29.
author | Igor Sysoev <http://sysoev.ru> |
---|---|
date | Tue, 30 Aug 2005 00:00:00 +0400 |
parents | 6ae11d59d10e |
children | 71c46860eb55 |
line wrap: on
line diff
--- 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_ 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_ 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_ && !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(n 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_req 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); + + line.len = len; + line.data = p; + + return ngx_snprintf(buf, len, "%V", &line); } - p = ngx_palloc(r->pool, r->uri.len - u->conf->location->len + escape); - if (p == NULL) { - return buf; + } else { + line.len = r->uri.len - u->conf->location->len; + if (line.len > len) { + line.len = len; } - ngx_escape_uri(p, r->uri.data + u->conf->location->len, - r->uri.len - u->conf->location->len, NGX_ESCAPE_URI); - - 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;