Mercurial > hg > nginx-vendor-0-7
comparison 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 |
comparison
equal
deleted
inserted
replaced
85:ed21d13ec23c | 86:962c43960644 |
---|---|
239 } | 239 } |
240 } | 240 } |
241 | 241 |
242 u = r->upstream; | 242 u = r->upstream; |
243 | 243 |
244 u->request_bufs = r->request_body->bufs; | 244 if (r->request_body) { |
245 u->request_bufs = r->request_body->bufs; | |
246 } | |
245 | 247 |
246 if (u->conf->method == NGX_CONF_UNSET_UINT) { | 248 if (u->conf->method == NGX_CONF_UNSET_UINT) { |
247 u->method = r->method; | 249 u->method = r->method; |
248 | 250 |
249 } else { | 251 } else { |
250 u->method = u->conf->method; | 252 u->method = u->conf->method; |
251 } | 253 } |
252 | 254 |
253 if (u->create_request(r) == NGX_ERROR) { | 255 if (u->create_request(r) != NGX_OK) { |
254 ngx_http_finalize_request(r, NGX_HTTP_INTERNAL_SERVER_ERROR); | 256 ngx_http_finalize_request(r, NGX_HTTP_INTERNAL_SERVER_ERROR); |
255 return; | 257 return; |
256 } | 258 } |
257 | 259 |
258 u->peer.log = r->connection->log; | 260 u->peer.log = r->connection->log; |
613 | 615 |
614 if ((ngx_event_flags & NGX_USE_KQUEUE_EVENT) | 616 if ((ngx_event_flags & NGX_USE_KQUEUE_EVENT) |
615 && !u->request_sent | 617 && !u->request_sent |
616 && c->write->pending_eof) | 618 && c->write->pending_eof) |
617 { | 619 { |
618 ngx_log_error(NGX_LOG_ERR, c->log, c->write->kq_errno, | 620 (void) ngx_connection_error(c, c->write->kq_errno, |
619 "connect() failed"); | 621 "kevent() reported that connect() failed"); |
620 | |
621 ngx_http_upstream_next(r, u, NGX_HTTP_UPSTREAM_FT_ERROR); | 622 ngx_http_upstream_next(r, u, NGX_HTTP_UPSTREAM_FT_ERROR); |
622 return; | 623 return; |
623 } | 624 } |
624 | 625 |
625 #endif | 626 #endif |
711 "http upstream send request handler"); | 712 "http upstream send request handler"); |
712 | 713 |
713 if (wev->timedout) { | 714 if (wev->timedout) { |
714 c->log->action = "sending request to upstream"; | 715 c->log->action = "sending request to upstream"; |
715 ngx_http_upstream_next(r, u, NGX_HTTP_UPSTREAM_FT_TIMEOUT); | 716 ngx_http_upstream_next(r, u, NGX_HTTP_UPSTREAM_FT_TIMEOUT); |
716 return; | |
717 } | |
718 | |
719 if (r->connection->write->eof && (!u->cachable || !u->request_sent)) { | |
720 ngx_http_upstream_finalize_request(r, u, | |
721 NGX_HTTP_INTERNAL_SERVER_ERROR); | |
722 return; | 717 return; |
723 } | 718 } |
724 | 719 |
725 ngx_http_upstream_send_request(r, u); | 720 ngx_http_upstream_send_request(r, u); |
726 } | 721 } |
1786 | 1781 |
1787 static u_char * | 1782 static u_char * |
1788 ngx_http_upstream_log_error(ngx_http_request_t *r, u_char *buf, size_t len) | 1783 ngx_http_upstream_log_error(ngx_http_request_t *r, u_char *buf, size_t len) |
1789 { | 1784 { |
1790 u_char *p; | 1785 u_char *p; |
1786 ngx_str_t line; | |
1791 uintptr_t escape; | 1787 uintptr_t escape; |
1792 ngx_http_upstream_t *u; | 1788 ngx_http_upstream_t *u; |
1793 ngx_peer_connection_t *peer; | 1789 ngx_peer_connection_t *peer; |
1794 | 1790 |
1795 u = r->upstream; | 1791 u = r->upstream; |
1822 r->uri.len - u->conf->location->len, NGX_ESCAPE_URI); | 1818 r->uri.len - u->conf->location->len, NGX_ESCAPE_URI); |
1823 | 1819 |
1824 buf += r->uri.len - u->conf->location->len + escape; | 1820 buf += r->uri.len - u->conf->location->len + escape; |
1825 len -= r->uri.len - u->conf->location->len + escape; | 1821 len -= r->uri.len - u->conf->location->len + escape; |
1826 | 1822 |
1827 if (r->args.len) { | 1823 } else { |
1828 p = ngx_snprintf(buf, len, "?%V", &r->args); | 1824 p = ngx_palloc(r->pool, |
1829 len -= p - buf; | 1825 r->uri.len - u->conf->location->len + escape); |
1830 buf = p; | 1826 if (p == NULL) { |
1827 return buf; | |
1831 } | 1828 } |
1832 | 1829 |
1833 return ngx_http_log_error_info(r, buf, len); | 1830 ngx_escape_uri(p, r->uri.data + u->conf->location->len, |
1834 } | 1831 r->uri.len - u->conf->location->len, NGX_ESCAPE_URI); |
1835 | 1832 |
1836 p = ngx_palloc(r->pool, r->uri.len - u->conf->location->len + escape); | 1833 line.len = len; |
1837 if (p == NULL) { | 1834 line.data = p; |
1838 return buf; | 1835 |
1839 } | 1836 return ngx_snprintf(buf, len, "%V", &line); |
1840 | 1837 } |
1841 ngx_escape_uri(p, r->uri.data + u->conf->location->len, | |
1842 r->uri.len - u->conf->location->len, NGX_ESCAPE_URI); | |
1843 | |
1844 p = ngx_cpymem(buf, p, r->uri.len - u->conf->location->len + escape); | |
1845 | 1838 |
1846 } else { | 1839 } else { |
1847 p = ngx_cpymem(buf, r->uri.data + u->conf->location->len, | 1840 line.len = r->uri.len - u->conf->location->len; |
1848 r->uri.len - u->conf->location->len); | 1841 if (line.len > len) { |
1849 } | 1842 line.len = len; |
1850 | 1843 } |
1851 len -= p - buf; | 1844 |
1852 buf = p; | 1845 line.data = r->uri.data + u->conf->location->len; |
1846 p = ngx_snprintf(buf, len, "%V", &line); | |
1847 | |
1848 len -= p - buf; | |
1849 buf = p; | |
1850 } | |
1853 | 1851 |
1854 if (r->args.len) { | 1852 if (r->args.len) { |
1855 p = ngx_snprintf(buf, len, "?%V", &r->args); | 1853 p = ngx_snprintf(buf, len, "?%V", &r->args); |
1856 len -= p - buf; | 1854 len -= p - buf; |
1857 buf = p; | 1855 buf = p; |