Commit Graph

325 Commits

Author SHA1 Message Date
Maxim Dounin
c42c70f478 Workaround for cpu hog on errors with cached connections.
Just doing another connect isn't safe as peer.get() may expect peer.tries
to be strictly positive (this is the case e.g. with round robin with multiple
upstream servers).  Increment peer.tries to at least avoid cpu hog in
round robin balancer (with the patch alert will be seen instead).

This is not enough to fully address the problem though, hence TODO.  We
should be able to inform balancer that the error wasn't considered fatal
and it may make sense to retry the same peer.
2011-09-15 18:12:58 +00:00
Maxim Dounin
d7c2673d3f API change: ngx_chain_update_chains() now requires pool.
The ngx_chain_update_chains() needs pool to free chain links used for buffers
with non-matching tags.  Providing one helps to reduce memory consumption
for long-lived requests.
2011-09-15 16:03:17 +00:00
Igor Sysoev
c2f852c260 update r3945 with more descriptive error message 2011-07-29 15:33:03 +00:00
Igor Sysoev
a3741fb24d finalizing with rc == 0 in unbuffered proxy mode caused nginx to wait
for another send_timeout before actually closing client's connection
if client timed out while still talking to upstream server

patch by Maxim Dounin
2011-07-22 13:30:16 +00:00
Igor Sysoev
6c3c3bbe42 fix segfault if cache key is larger than upstream buffer size
patch by Lanshun Zhou
2011-07-19 11:24:16 +00:00
Igor Sysoev
87ee007022 revert r3935 and fix "stalled cache updating" alert
by freeing cache at upstream finalize phase
patch by Maxim Dounin
2011-06-28 13:26:08 +00:00
Igor Sysoev
1788ec0c48 fix "stalled cache updating" alert,
when non-cachable HEAD response did not not free an expired cache node
2011-06-01 08:02:34 +00:00
Igor Sysoev
0d6283918f fix a broken cached response if bypass/no_cache directive values are different,
the bug has been introduced in r3700
2011-05-13 10:05:38 +00:00
Igor Sysoev
64efecc2b5 allow to use $upstream_... variables in SSI 2011-04-21 10:07:07 +00:00
Igor Sysoev
fde7d51392 fix case when a host in fastcgi_pass, scgi_pass, and uwsgi_pass
is given by expression and refers to a defined upstream
2011-04-04 10:43:21 +00:00
Igor Sysoev
9135a0e022 move debug logging inside ngx_http_file_cache_free() 2010-07-28 15:56:56 +00:00
Igor Sysoev
406a68003c several changes in cache cleanup handling:
*) now ngx_http_file_cache_cleanup() uses ngx_http_file_cache_free()
*) ngx_http_file_cache_free() interface has been changed to accept r->cache
   ngx_http_file_cache_cleanup() must use r->cache, but not r, because
   there can be several r->cache's during request processing, r->cache may
   be NULL at request finalising, etc.
*) test if updating request does not complete correctly
2010-07-28 15:49:34 +00:00
Igor Sysoev
6af21b7cda fix r3707: cache node should be freed be a response is not cached 2010-07-27 15:26:33 +00:00
Igor Sysoev
3cf3100977 fix typo 2010-07-27 13:04:13 +00:00
Igor Sysoev
f297d0dd27 an intercepted error code was not cached 2010-07-19 15:31:46 +00:00
Igor Sysoev
cc963cd7e2 style fix 2010-07-19 15:29:16 +00:00
Igor Sysoev
f7d659aa52 proxy_cache_pass, fastcgi_cache_bypass, uwsgi_cache_bypass, scgi_cache_bypass 2010-07-19 09:36:04 +00:00
Igor Sysoev
6a47b43234 rename ngx_http_file_cache_create() to ngx_http_file_cache_new() 2010-07-16 10:01:49 +00:00
Igor Sysoev
9aa3d7f667 ngx_http_file_cache_create() 2010-07-15 14:01:02 +00:00
Igor Sysoev
f3870c66df use ngx_http_test_predicates(), ngx_http_set_predicate_slot()
delete ngx_http_cache(), ngx_http_no_cache_set_slot()
2010-07-14 11:15:45 +00:00
Igor Sysoev
0bd1809f05 treat Set-Cookie as a header that forbids caching 2010-07-02 09:49:27 +00:00
Igor Sysoev
7e14b50c28 use shared ngx_http_upstream_ignore_headers_masks[] 2010-07-02 09:25:38 +00:00
Igor Sysoev
de0b1d6f12 remove r->zero_in_uri 2010-05-24 12:35:10 +00:00
Igor Sysoev
9b2763a245 proxy_no_cache and fastcgi_no_cache 2010-05-24 11:01:05 +00:00
Igor Sysoev
402b2f07c2 do not cache response if it has "no-store" or "private"
in "Cache-Control" header
2010-05-14 12:04:58 +00:00
Igor Sysoev
05b1a8f1e3 ngx_str_set() and ngx_str_null() 2010-05-14 09:56:37 +00:00
Igor Sysoev
328df7a5cc use ngx_min() and ngx_max() 2010-05-14 09:55:33 +00:00
Igor Sysoev
5739072cfe fix segfault: ngx_http_upstream_cleanup() cleans r->cleanup,
the bug had been introduced in r3419
2010-05-14 09:22:58 +00:00
Igor Sysoev
4e20f24b5b delete u->cleanup mark, this fixes large values in $upstream_response_time,
the bug had been introduced in r3007
2010-01-29 16:45:14 +00:00
Igor Sysoev
e146ebd813 allow to handle 301/302 in error_page 2009-12-23 15:31:16 +00:00
Igor Sysoev
bd375b9566 fix typo 2009-12-23 14:22:17 +00:00
Igor Sysoev
601ab90cd4 fix handling cached HTTP/0.9 response 2009-11-29 20:48:01 +00:00
Igor Sysoev
8b816d88a9 change ngx_parse_addr() interface 2009-11-02 16:11:06 +00:00
Igor Sysoev
72e928755b proxy_bind, fastcgi_bind, and memcached_bind 2009-11-02 15:24:02 +00:00
Igor Sysoev
671236993a test comma separator in "Cache-Control" 2009-10-08 14:22:00 +00:00
Igor Sysoev
136dd8d1e6 use real file cache length, this fixes cache size counting for responses
without "Content-Length" header and 304 responses.
2009-10-07 12:55:58 +00:00
Igor Sysoev
65166cfa2f fix request counter in resolver handling, the bug was introduced in r3050 2009-09-28 12:31:47 +00:00
Igor Sysoev
a552ab476e check unsafe Destination 2009-09-25 09:30:06 +00:00
Igor Sysoev
12a7d493d4 fix request counter for X-Accel-Redirect, the bug was introduced in r3050 2009-09-13 13:45:32 +00:00
Igor Sysoev
3e751480b2 increase request counter before an upstream cleanup because the cleanup
decreases the counter via ngx_http_finalize_request(r, NGX_DONE),
the bug was introduced in r3050
2009-09-08 11:37:50 +00:00
Igor Sysoev
8013a83067 clean cache updating state if a response has uncacheable code or
cache prohibitive headers
2009-09-04 09:57:38 +00:00
Igor Sysoev
8b8e995eb8 do not create cache key in AIO invocation 2009-08-28 11:23:50 +00:00
Igor Sysoev
a39d4e1aee fix sending a cached file using AIO 2009-08-28 11:22:27 +00:00
Igor Sysoev
6fb506a215 directio_alignment 2009-08-28 08:15:55 +00:00
Igor Sysoev
a962506498 FreeBSD and Linux AIO support 2009-08-28 08:12:35 +00:00
Igor Sysoev
5297d456d8 axe r->connection->destroyed testing 2009-08-26 16:14:57 +00:00
Igor Sysoev
5374610ace process upstream ETag header 2009-08-23 16:10:39 +00:00
Igor Sysoev
9db33c9234 fix copy destination name length, introduced in r3025 2009-08-20 13:37:26 +00:00
Igor Sysoev
b7a09c5523 allow cross device temporary files atomic copying:
*) ngx_copy_file()
*) delete ngx_ext_rename_file_t.log_rename_error and .rename_error fields
2009-08-12 12:05:33 +00:00
Igor Sysoev
22fc3e656e fix segfault introduced in r3007 2009-08-07 13:16:42 +00:00
Igor Sysoev
15b7420aa6 ngx_http_upstream_create() to cleanup the previous upstream after
internal redirect
2009-07-27 13:25:29 +00:00
Igor Sysoev
ce1ba38b93 fix handling "Last-Modified" and "Accept-Ranges" for upstream responses 2009-07-27 13:14:45 +00:00
Igor Sysoev
7335dfa4b6 allow to proxy_pass_header/fastcgi_pass_header "X-Accel-Redirect",
"X-Accel-Limit-Rate", "X-Accel-Buffering", and "X-Accel-Charset"
2009-07-27 12:06:12 +00:00
Igor Sysoev
2e9542b910 fix ngx_http_send_special() for subrequests handled by perl 2009-07-09 13:32:51 +00:00
Igor Sysoev
704462ac85 fix building --without-http-cache, broken in r2953 2009-06-22 09:10:50 +00:00
Igor Sysoev
ad0d2fced4 fix segfault if there is error_page 401, proxy_intercept_errors is on
and backend does not return "WWW-Authenticate" header
2009-06-18 14:28:50 +00:00
Igor Sysoev
bd9eda9986 $upstream_cache_status 2009-06-18 13:34:47 +00:00
Igor Sysoev
0775182312 fix building --without-http-cache, broken in r2930 2009-06-15 14:25:08 +00:00
Igor Sysoev
83c93ba109 inherit proxy_set_header, proxy_hide_header, and fastcgi_hide_header
only if cache settings are similar
2009-06-08 12:33:11 +00:00
Igor Sysoev
55192e7470 proxy_cache_use_stale/fastcgi_cache_use_stale updating 2009-06-06 18:49:47 +00:00
Igor Sysoev
fa524e9063 delete useless r->cache->uses 2009-06-06 17:48:54 +00:00
Igor Sysoev
260c4321d7 return NULL instead of NGX_CONF_ERROR on a create conf failure 2009-06-02 16:09:44 +00:00
Igor Sysoev
60190068ab reset content_type hash value, this fixes a bug when XSLT responses
could not be processed by SSI, charset, and gzip filters
2009-05-25 09:06:29 +00:00
Igor Sysoev
5ed3691b6e proxy_cache_methods and fastcgi_cache_methods 2009-05-19 13:27:27 +00:00
Igor Sysoev
980491302b use already given variable 2009-05-19 12:55:26 +00:00
Igor Sysoev
731e6a9b11 style fix 2009-05-14 16:24:39 +00:00
Igor Sysoev
dbebf0bdbc fix building --without-http-cache
the bug had been appeared in r2806
2009-05-08 20:14:35 +00:00
Igor Sysoev
c340a2841b delete level event of appropriate type, this should fix select()'s EBADF,
WSAENOTSOCK, and "select ready != events" alerts
2009-05-06 08:40:44 +00:00
Igor Sysoev
25870d8ea2 reinit proxy/fastcgi header parser before ngx_http_upstream_cache_send() 2009-05-05 17:18:33 +00:00
Igor Sysoev
b4097d6093 proxy/fastcgi_cache_use_stale http_50x did not work 2009-05-05 15:17:00 +00:00
Igor Sysoev
b01c9cc10e proxy_ignore_headers and fastcgi_ignore_headers 2009-04-30 16:15:07 +00:00
Igor Sysoev
df585ef949 get a full response if the response is cacheable or storable even
a client has closed connection prematurely
2009-04-27 11:20:55 +00:00
Igor Sysoev
9bd1010164 fix building --without-http-cache, introduced in r2664 and later 2009-04-15 12:25:51 +00:00
Igor Sysoev
c796dd263a shutdown client connection for cacheable header only responses 2009-04-15 11:19:27 +00:00
Igor Sysoev
e41e724726 support 304 for cacheable responses 2009-04-15 11:17:38 +00:00
Igor Sysoev
ea8536b821 support HEAD in proxy cache 2009-04-15 09:53:22 +00:00
Igor Sysoev
a655f363e2 style fix 2009-04-10 14:49:51 +00:00
Igor Sysoev
909b36ab1f do not call ngx_http_file_cache_free() if a response is not cacheable 2009-04-10 14:48:41 +00:00
Igor Sysoev
49ed98d1eb add debug logging 2009-04-10 14:47:18 +00:00
Igor Sysoev
21a3c66a87 support Cache-Control no-cache and max-age in cache 2009-04-04 17:35:40 +00:00
Igor Sysoev
054c505050 update r2664 2009-04-04 17:22:26 +00:00
Igor Sysoev
c8298bf3ee support Expires in cache 2009-04-03 15:48:19 +00:00
Igor Sysoev
db8f150044 fix r2664: ..._cache_valid did not work for stale responses 2009-04-03 15:47:45 +00:00
Igor Sysoev
c1713aadf5 zero field 2009-04-03 15:44:41 +00:00
Igor Sysoev
0eea247b1d support X-Accel-Expires in cache 2009-04-03 14:33:34 +00:00
Igor Sysoev
56f86505db cache GET requests only 2009-04-03 12:06:04 +00:00
Igor Sysoev
52859f2f13 a prelimiary proxy cache support 2009-03-23 13:14:51 +00:00
Igor Sysoev
1f4220ee86 small optimization: " == NGX_ERROR" > " != NGX_OK" 2009-02-24 10:42:23 +00:00
Igor Sysoev
7a86f07057 fix fastcgi_store 2009-01-21 20:54:40 +00:00
Igor Sysoev
6019a7621b proxy/fastcgi_store did not delete incomplete files 2009-01-16 13:57:00 +00:00
Igor Sysoev
f7204173f9 in miss case memcached module returned END instead of default 404 page body
the bug has been introduced in r2269
2009-01-15 13:10:45 +00:00
Igor Sysoev
302cedceb0 variable support for unix sockets in fastcgi_pass and proxy_pass 2008-12-23 19:35:12 +00:00
Igor Sysoev
cf6c582b9a fix segfault 2008-12-17 16:07:58 +00:00
Igor Sysoev
371766c0a5 $upstream_response_length 2008-12-11 15:30:52 +00:00
Igor Sysoev
524f54f56d use ngx_ext_rename_file() for single file MOVE 2008-12-10 14:53:45 +00:00
Igor Sysoev
b9409a8e25 use already available r and u instead of ev 2008-12-09 17:25:03 +00:00
Igor Sysoev
3e15a9712a fix r2378, run posted requests after upstream event handling 2008-12-08 18:28:06 +00:00
Igor Sysoev
851cd73f1d *) refactor subrequest handling, now they run as separate posted requests
*) now $upstream_addr, $upstream_status, $upstream_response_time can be used
   with log_subrequest
2008-12-08 14:23:20 +00:00
Igor Sysoev
15fbaa6612 read and process upstream header in cycle,
this fixes the case when local FastCGI server sends many warnings in stderr
2008-12-01 14:08:00 +00:00
Igor Sysoev
a485909174 memcached response was stored in variable with END 2008-11-12 21:01:01 +00:00
Igor Sysoev
694c84975d fix r1913 2008-10-30 15:59:10 +00:00
Igor Sysoev
797c6ef394 *) ngx_http_upstream_test_next()
*) add proxy_next_upstream http_502 and http_504
*) fix http_503
2008-09-30 15:39:02 +00:00
Igor Sysoev
d01eea1e18 ngx_http_upstream_intercept_errors() 2008-09-30 14:57:09 +00:00
Igor Sysoev
316542508b strip charset name quotes 2008-09-09 11:58:45 +00:00
Igor Sysoev
916ee8ecea proxy_ssl_session_reuse 2008-08-17 17:47:52 +00:00
Igor Sysoev
f60dde9767 disable original URI usage in proxy_pass after X-Accel-Redirect 2008-08-17 17:44:08 +00:00
Igor Sysoev
ac721d0647 if upstream sent a location header without status use 302 2008-08-04 14:53:16 +00:00
Igor Sysoev
7f6b2ffc60 *) back out r2040
*) refactor ngx_palloc()
*) introduce ngx_pnalloc()
*) additional pool blocks have smaller header
2008-06-17 15:00:30 +00:00
Igor Sysoev
6a2ea3f544 small fix 2008-04-17 14:32:11 +00:00
Igor Sysoev
523e09ee1a fix segfault 2008-04-11 09:15:07 +00:00
Igor Sysoev
f576f0d2bc quick resolving handles u->resolved->ctx by itself 2008-04-09 14:20:17 +00:00
Igor Sysoev
a4ec6869fc fix peer sendfile capability 2008-04-04 12:07:13 +00:00
Igor Sysoev
9ff26ce124 use ngx_ext_rename_file() in proxy/fastcgi_store 2008-03-17 13:07:35 +00:00
Igor Sysoev
cca6000247 ngx_resolve_name() frees ctx on immediate failure 2008-03-05 07:30:44 +00:00
Igor Sysoev
8efe926dc5 fix r1903 2008-03-03 20:04:06 +00:00
Igor Sysoev
7c15b75cc7 fix memory leak in long-lived non buffered connections 2008-03-03 10:42:00 +00:00
Igor Sysoev
d3434dfa63 check port in upstream list 2008-02-21 13:58:45 +00:00
Igor Sysoev
be0a61e618 test response length in proxy/fastcgi_store 2008-02-11 13:14:56 +00:00
Igor Sysoev
0123ee3adf optimization 2007-12-26 13:24:57 +00:00
Igor Sysoev
6d4b5a1f86 $upstream_addr did not contain last address, the bug was introduced in r1659 2007-12-11 16:26:56 +00:00
Igor Sysoev
3fc85af2fc style fix: remove trailing spaces 2007-12-10 12:30:09 +00:00
Igor Sysoev
f2932dcbe5 optimize r->upstream usage 2007-12-10 12:29:43 +00:00
Igor Sysoev
cb54061885 *) now ngx_conf_set_str_array_slot() tests NGX_CONF_UNSET_PTR
this fixes fastcgi_catch_stderr segfault introduced in r1453
*) ngx_http_upstream_hide_headers_hash()
*) proxy/fastcgi pass_header/hide_header use
   ngx_http_upstream_hide_headers_hash()
2007-12-09 18:03:20 +00:00
Igor Sysoev
5a55d7104b return NGX_ERROR instead of NGX_HTTP_INTERNAL_SERVER_ERROR in u->parse_header() 2007-12-09 08:22:35 +00:00
Igor Sysoev
27dd6a62bd use malloc() in ngx_win32_rename_file, set crit level instead of error 2007-12-07 19:57:13 +00:00
Igor Sysoev
6b2fce430b allow to use IP addresses without defined resolver 2007-12-03 10:05:19 +00:00
Igor Sysoev
96dd8af8e6 proxy_pass variables support 2007-11-27 13:34:13 +00:00
Igor Sysoev
32717eb60c r->headers_out.refresh 2007-11-27 11:56:18 +00:00
Igor Sysoev
685fd08753 set r->headers_out.location for non-local redirects 2007-11-27 11:52:37 +00:00
Igor Sysoev
1d04b14c09 64-bit time_t compatibility 2007-11-15 14:26:36 +00:00
Igor Sysoev
2d3f3f6eb6 fix English grammar 2007-10-14 18:56:15 +00:00
Igor Sysoev
7ed63ee75f use pool instead of ngx_conf_t 2007-10-08 08:55:12 +00:00
Igor Sysoev
7973964b3f optimization 2007-10-08 04:59:26 +00:00
Igor Sysoev
f53294103b pass length clearly 2007-10-01 12:57:47 +00:00
Igor Sysoev
0659720dc8 use ngx_strstrn() and ngx_strcasestrn() 2007-09-26 19:26:14 +00:00
Igor Sysoev
4b96baa417 u_char* is enough to keep file name 2007-09-15 17:11:06 +00:00
Igor Sysoev
9e4b7276f9 connection error should be logged with "connecting to upstream" action,
the bug was introduced in r1154
2007-09-09 18:43:16 +00:00
Igor Sysoev
3dea919675 read EOF of header only responses in non-buffered proxying 2007-09-09 18:32:53 +00:00
Igor Sysoev
e101338634 upstream sendfile bit was overridden by r->connection->sendfile 2007-08-14 20:44:09 +00:00
Igor Sysoev
6876bcdad6 backup upstream servers 2007-08-09 13:54:33 +00:00
Igor Sysoev
32b787560a fix case when two directives
proxy_pass   http://backend;
    proxy_pass   https://backend;
both use one port - 80 or 443, that was defined first.
2007-07-23 12:35:21 +00:00
Igor Sysoev
fbd9b4399f proxy_store and fastcgi_store were changed,
proxy_store_access and fastcgi_store_access were added
2007-07-13 08:30:34 +00:00
Igor Sysoev
58feb53eb4 proxy_store and fastcgi_store 2007-07-12 11:19:05 +00:00
Igor Sysoev
8b0a3d2810 fix segfault when session was freed twice 2007-07-10 21:04:37 +00:00
Igor Sysoev
def1e7439f if subrequest response was buffered in file, then subrequest was finalized
with 0 code, ngx_http_writer() was not set, and response part in file was lost
2007-06-17 09:29:15 +00:00
Igor Sysoev
84cc2cca53 style fix 2007-06-07 14:33:02 +00:00
Igor Sysoev
29f5912635 $upstream_addr 2007-04-23 16:56:17 +00:00
Igor Sysoev
e0f866273f store the upstream states before X-Accel-Redirect to a next upstream 2007-04-18 20:23:19 +00:00
Igor Sysoev
fb958946b5 style fix: remove tabs 2007-04-18 15:21:28 +00:00
Igor Sysoev
2723361e76 $upstream_http_... variables 2007-04-10 07:08:06 +00:00