Version bump.


git-svn-id: svn://svn.nginx.org/nginx/branches/stable-1.2@5036 73f98a42-aea0-e011-b76d-00259023448c
Merge of r4944: removed GLOB_NOSORT glob option.

This will result in alphabetical sorting of included files if
the "include" directive with wildcards is used.

Note that the behaviour is now different from that on Windows, where
alphabetical sorting is not guaranteed for FindFirsFile()/FindNextFile()
(used to be alphabetical on NTFS, but not on FAT).

Approved by Igor Sysoev, prodded by many.


git-svn-id: svn://svn.nginx.org/nginx/branches/stable-1.2@5037 73f98a42-aea0-e011-b76d-00259023448c
Merge of r4945, r4984: ngx_inet.[ch] minor fixes.

*) Fixed the NGX_SOCKADDR_STRLEN macro definition.
   The ngx_sock_ntop() function, when told to print both address and port,
   prints IPv6 address in square brackets, followed by colon and port.

*) Properly initialize "struct in6_addr" with zeroes.


git-svn-id: svn://svn.nginx.org/nginx/branches/stable-1.2@5038 73f98a42-aea0-e011-b76d-00259023448c
Merge of r4946, r4978: perl.

*) Fixed build with embedded perl in certain setups (ticket #48).

*) Brought the link to ngx_http_perl_module documentation up to date.


git-svn-id: svn://svn.nginx.org/nginx/branches/stable-1.2@5039 73f98a42-aea0-e011-b76d-00259023448c
Merge of r4947: xslt: prevented infinite loop.

If XSLT transformation failed and error 500 was handled in the same
location, an infinite loop occured that exhausted the stack.


git-svn-id: svn://svn.nginx.org/nginx/branches/stable-1.2@5040 73f98a42-aea0-e011-b76d-00259023448c
Merge of r4948, r4949, r4964, r4973, r5011: variables.

*) Allow the complex value to be defined as an empty string.
   This makes conversion from strings to complex values possible
   without the loss of functionality.

*) The "auth_basic" directive gained support of variables.
        
*) Fixed variable syntax checking in "set", "geo", "limit_conn_zone",
   and "perl_set" directives.
            
*) Added checks that disallow adding a variable with an empty name.
   Added variable name syntax checks to "geo" and "map" directives.

*) Variables $pipe, $request_length, $time_iso8601, and $time_local.
   Log module counterparts are preserved for efficiency.
   Based on patch by Kiril Kalchev.


git-svn-id: svn://svn.nginx.org/nginx/branches/stable-1.2@5041 73f98a42-aea0-e011-b76d-00259023448c
Merge of r4961: configure: better check for PCRE JIT.

On Mac OS X system toolchain by default prefers include files
from /usr/local/include, but libraries from /usr/lib.  This might result in
various problems, in particular the one outlined below.

If the PCRE library is installed into /usr/local/, this results in pcre.h
being used from /usr/local/include (with PCRE_CONFIG_JIT defined), but
libpcre from /usr/lib (as shipped with the OS, without pcre_free_study()
symbol).  As a result build fails as we use pcre_free_study() function
if we try to compile with PCRE JIT support.

Obvious workaround to the root cause is to ask compiler to prefer
library from /usr/local/lib via ./configure --with-ld-opt="-L/usr/local/lib".
On the other hand, in any case it would be good to check if the function
we are going to use is available, hence the change.

See thread here for details:
http://mailman.nginx.org/pipermail/nginx-devel/2012-December/003074.html

Prodded by Piotr Sikora.


git-svn-id: svn://svn.nginx.org/nginx/branches/stable-1.2@5042 73f98a42-aea0-e011-b76d-00259023448c
Merge of r4962: limit_rate fix.

Limit rate: fixed integer overflow in limit calculation (ticket #256).

Patch by Alexey Antropov.


git-svn-id: svn://svn.nginx.org/nginx/branches/stable-1.2@5043 73f98a42-aea0-e011-b76d-00259023448c
Merge of r4963: proxy: better error message about unexpected data.

Requested by Igor Sysoev.


git-svn-id: svn://svn.nginx.org/nginx/branches/stable-1.2@5044 73f98a42-aea0-e011-b76d-00259023448c
Merge of r4965: upstream: fixed SIGSEGV with the "if" directive.

Configuration like

    location / {
        set $true 1;

        if ($true) {
            proxy_pass http://backend;
        }

        if ($true) {
            # nothing
        }
    }

resulted in segmentation fault due to NULL pointer dereference as the
upstream configuration wasn't initialized in an implicit location created
by the last if(), but the r->content_handler was set due to first if().

Instead of committing a suicide by dereferencing a NULL pointer, return
500 (Internal Server Error) in such cases, i.e. if uscf is NULL.  Better
fix would be to avoid such cases by fixing the "if" directive handling,
but it's out of scope of this patch.

Prodded by Piotr Sikora.


git-svn-id: svn://svn.nginx.org/nginx/branches/stable-1.2@5045 73f98a42-aea0-e011-b76d-00259023448c
Merge of r4966: gzip: fixed zlib memLevel adjusting.

An incorrect memLevel (lower than 1) might be passed to deflateInit2() if the
"gzip_hash" directive is set to a value less than the value of "gzip_window"
directive. This resulted in "deflateInit2() failed: -2" alert and an empty
reply.


git-svn-id: svn://svn.nginx.org/nginx/branches/stable-1.2@5046 73f98a42-aea0-e011-b76d-00259023448c
Merge of r4967: ngx_write_fd() and ngx_read_fd() errors handling.

The ngx_write_fd() and ngx_read_fd() functions return -1 in case of error,
so the incorrect comparison with NGX_FILE_ERROR (which is 0 on windows
platforms) might result in inaccurate error message in the error log.

Also the ngx_errno global variable is being set only if the returned value
is -1.


git-svn-id: svn://svn.nginx.org/nginx/branches/stable-1.2@5047 73f98a42-aea0-e011-b76d-00259023448c
Merge of r4968, r4969, r4977, r4980, r4981, r4990: geo fixes.

*) Geo: improved ngx_http_geo_block() code readability.

*) Geo: fixed the "ranges" without ranges case.  The following
   configuration returned an empty value for $geo:

       geo $geo {
           ranges;
           default default;
       }

*) Fixed return type of internal function that allocates radix tree nodes.

*) There's no need to normalize address returned by ngx_ptocidr().

*) Geo: ensure that default entry is always present.  If 0.0.0.0/32 entry
   was present and there was no explicit "default", we failed to add an
   empty string as a default value.

*) Trailing whitespace fix.


git-svn-id: svn://svn.nginx.org/nginx/branches/stable-1.2@5048 73f98a42-aea0-e011-b76d-00259023448c
Merge of r4993, r4994, r4997, r5000: geo ipv6 support.

*) Geo: IPv6 support.  The "ranges" mode is still limited to IPv4 only.

*) Geo: properly initialize ngx_cidr_t when dealing with "default".

*) Geo: made "default" affect both IPv4 and IPv6 when using prefixes.
   Previously, "default" was equivalent to specifying 0.0.0.0/0, now
   it's equivalent to specifying both 0.0.0.0/0 and ::/0 (if support
   for IPv6 is enabled) with the same value.

*) Geo: improved code readability.


git-svn-id: svn://svn.nginx.org/nginx/branches/stable-1.2@5049 73f98a42-aea0-e011-b76d-00259023448c
Merge of r4974: avoid sending "100 Continue" on 413. 

Avoid sending "100 Continue" on 413 Request Entity Too Large.

Patch by Igor Sysoev.


git-svn-id: svn://svn.nginx.org/nginx/branches/stable-1.2@5050 73f98a42-aea0-e011-b76d-00259023448c
Merge of r4983: crypt_r() error handling fixed.

The crypt_r() function returns NULL on errors, check it explicitly instead
of assuming errno will remain 0 if there are no errors (per POSIX, the
setting of errno after a successful call to a function is unspecified
unless the description of that function specifies that errno shall not
be modified).

Additionally, dropped unneeded ngx_set_errno(0) and fixed error handling
of memory allocation after normal crypt(), which was inapropriate and
resulted in null pointer dereference on allocation failures.


git-svn-id: svn://svn.nginx.org/nginx/branches/stable-1.2@5051 73f98a42-aea0-e011-b76d-00259023448c
Merge of r4976: let add_header affect 201 responses (ticket #125).


git-svn-id: svn://svn.nginx.org/nginx/branches/stable-1.2@5052 73f98a42-aea0-e011-b76d-00259023448c
Merge of r4979, r4982: image filter configuration inheritance.

*) Image filter: configuration inheritance fixes.

   The image_filter_jpeg_quality, image_filter_sharpen and
   "image_filter rotate" were inherited incorrectly if a directive
   with variables was defined, and then redefined to a literal value,
   i.e. in configurations like

       image_filter_jpeg_quality $arg_q;

       location / {
           image_filter_jpeg_quality 50;
       }

   Patch by Ian Babrou, with minor changes.

*) Image filter: fixed image_filter rotate inheritance.

   Configurations like

       location /i/ {
           image_filter resize 200 200;
           image_filter rotate 180;

           location /i/foo/ {
               image_filter resize 200 200;
           }
      }

   resulted in rotation incorrectly applied in the location /i/foo,
   without any way to clear it.  Fix is to handle conf->angle/conf->acv
   consistently with other filter variables and do not try to inherit
   them if there are transformations defined for current location.


git-svn-id: svn://svn.nginx.org/nginx/branches/stable-1.2@5053 73f98a42-aea0-e011-b76d-00259023448c
Merge of r4985, r4986, r4987, r4988, r4989, r5002: access_log gzip.

*) Access log: fixed redundant buffer reallocation.  Previously a new
   buffer was allocated for every "access_log" directive with the same
   file path and "buffer=" parameters, while only one buffer per file
   is used.

*) Reopening log files code moved to a separate function.  The code
   refactored in a way to call custom handler that can do appropriate
   cleanup work (if any), like flushing buffers, finishing compress
   streams, finalizing connections to log daemon, etc..

*) Access log: the "flush" parameter of the "access_log" directive.

*) Configure: added the NGX_ZLIB define.  This was introduced for
   conditional compilation of the code that requires the zlib library.

*) Access log: the "gzip" parameter of the "access_log" directive.
   Note: this requires zlib version 1.2.0.4 or above to work.

*) The data pointer in ngx_open_file_t objects must be initialized.
   Uninitialized pointer may result in arbitrary segfaults if access_log
   is used without buffer and without variables in file path.
   Patch by Tatsuhiko Kubo (ticket #268).


git-svn-id: svn://svn.nginx.org/nginx/branches/stable-1.2@5054 73f98a42-aea0-e011-b76d-00259023448c
Merge of r4991: fixed proxied HEAD requests with gzip enabled.

Fixed HEAD requests handling when proxying is used (ticket #261).


git-svn-id: svn://svn.nginx.org/nginx/branches/stable-1.2@5055 73f98a42-aea0-e011-b76d-00259023448c