Proxy: better error message about unexpected data.

Requested by Igor Sysoev.
Fixed variable syntax checking in "set", "geo", "limit_conn_zone",
and "perl_set" directives.
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.
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.
Fixed handling of ngx_write_fd() and ngx_read_fd() errors.

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.
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;
    }
Simplified URL parsing code.

Except for the "listen" directive, "*" specified as a hostname is
no longer treated specially.
Fixed URL parsing code.

The URL parsing code is not expected to initialize port from default port
when in "no_resolve" mode.  This got broken in r4671 for the case of IPv6
literals.
Implemented IPv6 support for URLs specified using domain names.

This includes "debug_connection", upstreams, "proxy_pass", etc.
(ticket #92)

To preserve compatibility, "listen" specified with a domain name
selects the first IPv4 address, if available.  If not available,
the first IPv6 address will be used (ticket #186).
Added checks that disallow adding a variable with an empty name.
Added variable name syntax checks to "geo" and "map" directives.
Avoid sending "100 Continue" on 413 Request Entity Too Large.

Patch by Igor Sysoev.
Slightly optimized code that handles special headers in "add_header".
Let "add_header" affect 201 responses (ticket #125).
Fixed return type of internal function that allocates radix tree nodes.
Brought the link to ngx_http_perl_module documentation up to date.
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.
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.
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.