Commit graph

3621 commits

Author SHA1 Message Date
Maxim Dounin
214dfd3e22 Merge of r4282, r4302:
Added image/webp and video/webm MIME types.  Added svgz extension for
compressed SVG.
2011-12-14 15:16:05 +00:00
Maxim Dounin
7377d07c39 Merge of r4275, r4276, r4278, r4279:
Fixes for proxy_set_header, fastcgi/scgi/uwsgi_param inheritance:

*) Fixed proxy_set_header inheritance with proxy_cache (ticket #45).

   Headers cleared with cache enabled (If-Modified-Since etc.) might be
   cleared in unrelated servers/locations without proxy_cache enabled
   if proxy_cache was used in some server/location.

   Example config which triggered the problem:

       proxy_set_header X-Test "test";
       server { location /1 { proxy_cache name; proxy_pass ... } }
       server { location /2 { proxy_pass ... } }

   Another one:

       server {
           proxy_cache name;
           location /1 { proxy_pass ... }
           location /2 { proxy_cache off; proxy_pass ... }
       }

   In both cases If-Modified-Since header wasn't sent to backend in
   location /2.

   Fix is to not modify conf->headers_source, but instead merge user-supplied
   headers from conf->headers_source and default headers (either cache or not)
   into separate headers_merged array.

*) Fixed proxy_set_header inheritance with proxy_set_body.

*) Separate functions to merge fastcgi/scgi/uwsgi params.
   No functional changes.

*) Fixed fastcgi/scgi/uwsgi_param inheritance.  The following problems were
   fixed:

   1. Directive fastcgi_cache affected headers sent to backends in unrelated
      servers / locations (see ticket #45).

   2. If-Unmodified-Since, If-Match and If-Range headers were sent to
      backends if fastcgi_cache was used.

   3. Cache-related headers were sent to backends if there were no
      fastcgi_param directives and fastcgi_cache was used at server level.
2011-12-14 15:13:25 +00:00
Maxim Dounin
aa96ac67fc Merge of r4270, r4274:
Minor cleanup:

*) Changed error message to be more appropriate in the imaginary
   "open_file_cache max=0" case.

*) Fixed NGX_CONF_TAKE1/NGX_CONF_FLAG misuse.
2011-12-14 14:31:55 +00:00
Maxim Dounin
b527aea8d1 Merge of r4267, r4301:
Fix of the "keepalive_disable" directive.
2011-12-14 13:40:25 +00:00
Maxim Dounin
5bb71a40b9 Merge of r4266, r4308, r4309:
Image filter changes:

*) The "image_filter_sharpen" directive.

*) Cosmetics.

*) Fixed "rotate" to always work when combined with "resize/crop".
2011-12-14 13:37:53 +00:00
Maxim Dounin
0c9e5e185e Merge of r4231, r4300, r4303, r4304:
Configure/build changes and fixes:

*) Revamped "configure --help" text.

*) FreeBSD 10-current has recently gotten POSIX_FADV_* macros.
   A fix for the broken build applied.

*) AIX 7 defines sys_nerr in errno.h, therefore <errno.h> included
   in the sys_nerr test.

   When sys_nerr and _sys_nerr are missed on a particular platform
   and our euristic for a maximum errno detection applied always
   print the maximum errno number we reached instead of printing void.

   This makes possible to build nginx on AIX 7.1.

*) Made it possible to build/install from the SVN checkout.
2011-12-14 13:34:16 +00:00
Maxim Dounin
6692bd213c Merge of r4227, r4228:
Fixed range checking for the "somaxconn" sysctl.  Fixed port range checking.
2011-12-14 13:06:45 +00:00
Maxim Dounin
ed89c54f99 Merge of r4223:
FreeBSD's MALLOC_OPTIONS must be set before any malloc() call.
The bug has been introduced in r3799.
2011-12-13 19:01:10 +00:00
Maxim Dounin
b993b9ded7 Merge of r4221, r4222:
Fixed unix ngx_write_chain_to_file() to return total bytes written.

Previously result of last iteration's writev() was returned.  This was
unnoticed as return value was only used if chain contained only one or
two buffers.
2011-12-13 18:59:18 +00:00
Maxim Dounin
3a8f4c1141 Merge of r4217, r4218:
Fixed "expires @00h".  Fixed "expires @time" with unknown last modified
time (ticket #32).
2011-12-13 18:46:07 +00:00
Maxim Dounin
80824feaff Merge of r4153:
Better handling of late upstream creation.

Configuration with duplicate upstream blocks defined after first use, i.e.
like

    server {
        ...
        location / {
            proxy_pass http://backend;
        }
    }

    upstream backend { ... }
    upstream backend { ... }

now correctly results in "duplicate upstream" error.

Additionally, upstream blocks defined after first use now handle various
server directive parameters ("weight", "max_fails", etc.).  Previously
configuration like

    server {
        ...
        location / {
            proxy_pass http://backend;
        }
    }

    upstream backend {
        server 127.0.0.1 max_fails=5;
    }

incorrectly resulted in "invalid parameter "max_fails=5"" error.
2011-12-13 18:34:34 +00:00
Maxim Dounin
5d45af698c Merge of r4144:
Upstream: clearing of u->peer.connection on close.

This fixes crashes observed with some 3rd party balancer modules.  Standard
balancer modules (round-robin and ip hash) explicitly set pc->connection
(aka u->peer.connection) to NULL and aren't affected.
2011-12-13 18:30:15 +00:00
Maxim Dounin
86e4445d8a Merge of r4001, r4002, r4008:
Manpage changes:

*) Support link.

*) Commented out reference to non-existing nginx.conf(5).

*) Rebuild manpage only if needed.
2011-12-13 18:07:52 +00:00
Maxim Dounin
33a77285e5 Merge of r4000, r4014, r4265, r4321, r4342, r4343:
Infrastructure changes:

*) Don't ignore xmllint errors.

*) Added missing dependencies for the CHANGES{,ru} targets.
   Pass string params to xsltproc.

*) Ancient incomplete ngx_http_status_module removal.

*) Compute the repository root from the checkout.

*) Fixed RELEASE target to correctly call "release" one.
2011-12-13 17:58:18 +00:00
Maxim Dounin
a0a8663eae Version bump. 2011-12-13 16:59:41 +00:00
Igor Sysoev
a407664a1b release-1.0.10 tag 2011-11-15 08:24:10 +00:00
Igor Sysoev
b4082d0c75 nginx-1.0.10-RELEASE 2011-11-15 08:24:03 +00:00
Igor Sysoev
6883ab13b4 Merge of r4283:
Fix of "Content-Length" header of MP4 response if start argument was used.

Patch by Piotr Sikora.
2011-11-14 16:14:11 +00:00
Igor Sysoev
9e4f24d33f Merge of r4280:
Reverted incorrect change in internal md5 (part of r3928).
2011-11-14 16:13:15 +00:00
Igor Sysoev
13f1b5adee Merge of r4268:
Fixed compression pointer processing in DNS response greater than 255 bytes.

Thanks to Ben Hawkes.
2011-11-14 16:12:25 +00:00
Igor Sysoev
7067707c4e Version bump. 2011-11-14 15:53:35 +00:00
Igor Sysoev
922b417f45 release-1.0.9 tag 2011-11-01 14:51:26 +00:00
Igor Sysoev
ac8c0e5273 nginx-1.0.9-RELEASE 2011-11-01 14:51:19 +00:00
Igor Sysoev
e28778ad86 Surplus CHANGES line removal. 2011-11-01 14:39:36 +00:00
Igor Sysoev
96833ed5f5 Merging r4236:
Fixed documentation pointer.
2011-11-01 14:21:22 +00:00
Igor Sysoev
a49c69306d Merging r4210:
Fixed utf8 decode (ticket #25).

Patch by Alexey Kuts.
2011-11-01 14:20:43 +00:00
Igor Sysoev
d3769b1966 Merging r4209:
Skipping location rewrite phase for server null location.
2011-11-01 14:19:13 +00:00
Igor Sysoev
9b3014e024 Merging r4198:
Additional headers for proxy/fastcgi/uwsgi/scgi_ignore_headers.

Now the following headers may be ignored as well: X-Accel-Limit-Rate,
X-Accel-Buffering, X-Accel-Charset.
2011-11-01 14:18:10 +00:00
Igor Sysoev
d66f8ae634 Merging r4189, r4197:
Perl related fixes:

*) Handling of Content-Encoding set from perl.

   This fixes double gzipping in case of gzip filter being enabled while perl
   returns already gzipped response.

*) Fixed macro name.
2011-11-01 14:15:42 +00:00
Igor Sysoev
a1db86a30b Merging r4195, r4196:
AIO related fixes:

*) Fix for connection drops with AIO.

   Connections serving content with AIO to fast clients were dropped with
   "client timed out" messages after send_timeout from response start.

*) Fix for socket leak with "aio sendfile" and "limit_rate".

   Second aio post happened when timer set by limit_rate expired while we have
   aio request in flight, resulting in "second aio post" alert and socket leak.

   The patch adds actual protection from aio calls with r->aio already set to
   aio sendfile code in ngx_http_copy_filter().  This should fix other cases
   as well, e.g. when sending buffered to disk upstream replies while still
   talking to upstream.

   The ngx_http_writer() is also fixed to handle the above case (though it's
   mostly optimization now).
2011-11-01 14:13:25 +00:00
Igor Sysoev
844ce56e34 Merging r4193, r4194:
Autoindex fixes:

*) Autoindex: escape '?' in file names.

   For files with '?' in their names autoindex generated links with '?' not
   escaped.  This resulted in effectively truncated links as '?' indicates
   query string start.

   This is an updated version of the patch originally posted at [1].  It
   introduces generic NGX_ESCAPE_URI_COMPONENT which escapes everything but
   unreserved characters as per RFC 3986.  This approach also renders unneeded
   special colon processing (as colon is percent-encoded now), it's dropped
   accordingly.

   [1] http://nginx.org/pipermail/nginx-devel/2010-February/000112.html

*) Autoindex: escape html in file names.
2011-11-01 14:09:15 +00:00
Igor Sysoev
5fdf27caec Merging r4158:
Added uwsgi_buffering and scgi_buffering directives.

Patch by Peter Smit.
2011-11-01 14:04:23 +00:00
Igor Sysoev
8f25bfda21 Merging r4190, r4232:
MP4 related fixes:

*) Fixing mp4 module seeking on 32-bit platforms.

*) Adding m4a and m4v MIME types (ticket #42).
2011-11-01 14:02:07 +00:00
Igor Sysoev
74d7c5319c Merging r4179, r4182, r4212:
Adding RELEASE procedure in GNUmakefile.
2011-11-01 14:00:04 +00:00
Igor Sysoev
07eb7bec1f Merging r4155, r4219, r4220, r4230:
Windows related fixes:

*) Fixed segmentation fault with empty config on Windows.
   See here for report:
   http://mailman.nginx.org/pipermail/nginx-ru/2011-September/043288.html

*) Recent SDKs allow to build IPV6 only for Windows XP or above.

*) Fixing conflict with SDK off_t definition.

*) Fix of building by Microsoft Visual C++ 10 compiler.
2011-11-01 13:56:26 +00:00
Igor Sysoev
4332c96e38 Merging r4151, r4152, r4177:
HTTP cache related fixes:

*) Cache: fix for sending of empty responses.

   Revert wrong fix for empty responses introduced in 0.8.31 and apply new
   one, rewritten to match things done by static module as close as possible.

*) Cache: fix for sending of stale responses.

   For normal cached responses ngx_http_cache_send() sends last buffer and then
   request finalized via ngx_http_finalize_request() call, i.e. everything is
   ok.

   But for stale responses (i.e. when upstream died, but we have something in
   cache) the same ngx_http_cache_send() sends last buffer, but then in
   ngx_http_upstream_finalize_request() another last buffer is send.  This
   causes duplicate final chunk to appear if chunked encoding is used (and
   resulting problems with keepalive connections and so on).

   Fix this by not sending in ngx_http_upstream_finalize_request()
   another last buffer if we know response was from cache.

*) Fixed cache bypass caching of non-cacheable replies (ticket #21).

   If cache was bypassed with proxy_cache_bypass, cache-controlling headers
   (Cache-Control, Expires) wasn't considered and response was cached even
   if it was actually non-cacheable.

   Patch by John Ferlito.
2011-11-01 13:49:31 +00:00
Igor Sysoev
1682a70d28 Merging r4147, r4148, r4149, r4150, r4207:
Fixes of combination of error_page and return directives:

*) Fix for incorrect 201 replies from dav module.

   Replies with 201 code contain body, and we should clearly indicate it's
   empty if it's empty.  Before 0.8.32 chunked was explicitly disabled for
   201 replies and as a result empty body was indicated by connection close
   (not perfect, but worked).  Since 0.8.32 chunked is enabled, and this
   causes incorrect responses from dav module when HTTP/1.1 is used: with
   "Transfer-Encoding: chunked" but no chunks at all.

   Fix is to actually return empty body in special response handler instead
   of abusing r->header_only flag.

   See here for initial report:
   http://mailman.nginx.org/pipermail/nginx-ru/2010-October/037535.html

*) Fix for double content when return is used in error_page handler.

   Test case:

      location / {
          error_page 405 /nope;
          return 405;
      }

      location /nope {
          return 200;
      }

   This is expected to return 405 with empty body, but in 0.8.42+ will return
   builtin 405 error page as well (though not counted in Content-Length, thus
   breaking protocol).

   Fix is to use status provided by rewrite script execution in case
   it's less than NGX_HTTP_BAD_REQUEST even if r->error_status set.  This
   check is in line with one in ngx_http_script_return_code().

   Note that this patch also changes behaviour for "return 302 ..." and
   "rewrite ... redirect" used as error handler.  E.g.

       location / {
           error_page 405 /redirect;
           return 405;
       }

       location /redirect {
           rewrite ^ http://example.com/;
       }

   will actually return redirect to "http://example.com/" instead of builtin
   405 error page with meaningless Location header.  This looks like correct
   change and it's in line with what happens on e.g. directory redirects
   in error handlers.

*) Fix for "return 202" not discarding body.

   Big POST (not fully preread) to a

       location / {
           return 202;
       }

   resulted in incorrect behaviour due to "return" code path not calling
   ngx_http_discard_request_body().  The same applies to all "return" used
   with 2xx/3xx codes except 201 and 204, and to all "return ... text" uses.

   Fix is to add ngx_http_discard_request_body() call to
   ngx_http_send_response() function where it looks appropriate.
   Discard body call from emtpy gif module removed as it's now redundant.

   Reported by Pyry Hakulinen, see
   http://mailman.nginx.org/pipermail/nginx/2011-August/028503.html

*) Incorrect special case for "return 204" removed.

   The special case in question leads to replies without body in
   configuration like

       location / { error_page 404 /zero; return 404; }
       location /zero { return 204; }

   while replies with empty body are expected per protocol specs.

   Correct one will look like

       if (status == NGX_HTTP_NO_CONTENT) {

           rc = ngx_http_send_header(r);

           if (rc == NGX_ERROR || r->header_only) {
               return rc;
           }

           return ngx_http_send_special(r, NGX_HTTP_LAST);
       }

   though it looks like it's better to drop this special case at all.

*) Clear old Location header (if any) while adding a new one.

   This prevents incorrect behaviour when another redirect is issued within
   error_page 302 handler.
2011-11-01 13:45:33 +00:00
Igor Sysoev
340e48b29f Merging r4132, r4134, r4143, r4183, r4191, r4199:
Various fixes related to error messages:

*) Removed old warning that suggested to use "server_name_in_redirect off"
   (now the default) in place of no longer supported "server_name *".

*) Fixing directive name in error message if types hash size is not enough.

*) Replaced "can not" with "cannot" and "could not" in a bunch of places.
   Fixed nearby grammar errors.

*) Overhauled error messages.
2011-11-01 13:24:50 +00:00
Igor Sysoev
8f86bdbb06 Merging r4034, r4186, r4187, r4229, r4235, r4237:
SSL related fixes:

*) Better handling of various per-server ssl options with SNI.

   SSL_set_SSL_CTX() doesn't touch values cached within ssl connection
   structure, it only changes certificates (at least as of now, OpenSSL
   1.0.0d and earlier).

   As a result settings like ssl_verify_client, ssl_verify_depth,
   ssl_prefer_server_ciphers are only configurable on per-socket basis while
   with SNI it should be possible to specify them different for two servers
   listening on the same socket.

   Workaround is to explicitly re-apply settings we care about from context
   to ssl connection in servername callback.

   Note that SSL_clear_options() is only available in OpenSSL 0.9.8m+.  I.e.
   with older versions it is not possible to clear ssl_prefer_server_ciphers
   option if it's set in default server for a socket.

*) Disabling SSL compression. This saves about 300K per SSL connection.
   The SSL_OP_NO_COMPRESSION option is available since OpenSSL 1.0.0.

*) Releasing memory of idle SSL connection. This saves about 34K per SSL
   connection. The SSL_MODE_RELEASE_BUFFERS option is available since
   OpenSSL 1.0.0d.

*) Decrease of log level of some SSL handshake errors.

*) Fixed segfault on configuration testing with ssl (ticket #37).

   The following config caused segmentation fault due to conf->file not
   being properly set if "ssl on" was inherited from the http level:

   http {
       ssl on;
       server {
       }
   }

*) Silently ignoring a stale global SSL error left after disabled renegotiation.
2011-11-01 13:00:30 +00:00
Igor Sysoev
a24ed07583 Merging r4020:
SIGWINCH/NOACCEPT signal is disabled now in non-daemon mode.
Non-daemon mode is currently used by supervisord, daemontools and so on
or during debugging. The NOACCEPT signal is only used for online upgrade
which is not supported when nginx is run under supervisord, etc.,
so this change should not break existant setups.
2011-11-01 11:26:56 +00:00
Igor Sysoev
8b85d78ecd Merging r4017:
Move SO_ACCEPTFILTER and TCP_DEFER_ACCEPT checks into configure.

NetBSD 5.0+ has SO_ACCEPTFILTER support merged from FreeBSD, and having
accept filter check in FreeBSD-specific ngx_freebsd_config.h prevents it
from being used on NetBSD.  Therefore move the check into configure (and
do the same for Linux-specific TCP_DEFER_ACCEPT, just to be in line).
2011-11-01 11:25:15 +00:00
Igor Sysoev
1b6bed1c8e Merging r4013, r4200:
error_log related fixes:

*) Complain on invalid log levels.

   Previously only first log level was required to be correct, while
   error_log directive in fact accepts list of levels (e.g. one may
   specify "error_log ... debug_core debug_http;").  This resulted
   in (avoidable) wierd behaviour on missing semicolon after error_log
   directive, e.g.

       error_log /path/to/log info
       index index.php;

   silently skipped index directive and it's arguments (trying to
   interpret them as log levels without checking to be correct).

*) Fixed configuration summary and manpage contents for the special
   --error-log-path=stderr case.
2011-11-01 11:23:26 +00:00
Igor Sysoev
f59e9d45fb Merging r4009, r4133, r4184, r4201, r4202, r4203, r4204, r4205:
Miscellaneous fixes:

*) Fix of names of the referer hash size directives introduced in r3940.

*) Cosmetics: replaced NGX_CONF_TAKE1 to NGX_CONF_FLAG for "sendfile"
   and "chunked_transfer_encoding" directives, to be in line with all
   directives taking a boolean argument.  Both flags will ensure that
   a directive takes one argument.

*) Improved ngx_parse_time() code readability.

*) Preallocating exact number of default MIME types entries.

*) Stylistic change in checking the boolean expression.

*) Replaced magic constants representing default values of some directives
   with appropriate #define's.

*) Fixed grammar in a comment.

*) Fixed two minor bugs in "types" parsing code.
2011-11-01 11:19:58 +00:00
Igor Sysoev
acde3201b8 Merging r3992, r4192:
access_log related fixes:

*) Removal of error message about %name log_format parameters,
   they have been deleted long ago in 0.5.0-RELEASE.

*) Improved access log escaping to better protect other software.
   Some character sets (notably ISO-8859-1) have C1 control characters in
   upper half, make sure to escape them.
2011-11-01 11:06:31 +00:00
Igor Sysoev
116e15f03a Version bump. 2011-11-01 10:10:50 +00:00
Igor Sysoev
99a5c11b93 release-1.0.8 tag 2011-10-01 06:00:49 +00:00
Igor Sysoev
e3c506efb0 nginx-1.0.8-RELEASE 2011-10-01 06:00:42 +00:00
Igor Sysoev
8c8e599c6e Merging r4089 missed in r4170 merge. 2011-10-01 05:37:30 +00:00
Igor Sysoev
023e0da8dc Version bump. 2011-10-01 05:35:34 +00:00
Igor Sysoev
a810216c01 release-1.0.7 tag 2011-09-30 15:35:30 +00:00