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