Merge of r4643:

Removed historical and now redundant syntax pre-checks in ngx_parse_url().


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

Fixed potential null pointer dereference in ngx_resolver_create().
While here, improved error message.


git-svn-id: svn://svn.nginx.org/nginx/branches/stable-1.2@4716 73f98a42-aea0-e011-b76d-00259023448c
Merge of r4646: jemalloc 3.0.0 compatibility.

Fixed compilation with -DNGX_DEBUG_MALLOC on FreeBSD 10.

After jemalloc 3.0.0 import there is no _malloc_options symbol, it has
been replaced with the malloc_conf one with a different syntax.


git-svn-id: svn://svn.nginx.org/nginx/branches/stable-1.2@4717 73f98a42-aea0-e011-b76d-00259023448c
Merge of r4647: xslt reuse.

Fixed the reuse of parsed DTDs and XSLTs.

Patch by Kuramoto Eiji.


git-svn-id: svn://svn.nginx.org/nginx/branches/stable-1.2@4718 73f98a42-aea0-e011-b76d-00259023448c
Merge of r4648, r4649, r4650: memory leak with $geoip_org.

Patch by Denis F. Latypoff (slightly modified).


git-svn-id: svn://svn.nginx.org/nginx/branches/stable-1.2@4719 73f98a42-aea0-e011-b76d-00259023448c
Merge of r4651: proxy_cookie_* fix.

Fixed returned value handling from the cookie rewrite handler.

If the "proxy_cookie_domain" or "proxy_cookie_path" directive is used and there
are no matches in Set-Cookie header then ngx_http_proxy_rewrite_cookie() returns
NGX_DECLINED to indicate that the header was not rewritten. Returning this value
further from the upstream headers copy handler resulted in 500 error response.

See here for report:
http://mailman.nginx.org/pipermail/nginx/2012-May/033858.html


git-svn-id: svn://svn.nginx.org/nginx/branches/stable-1.2@4720 73f98a42-aea0-e011-b76d-00259023448c
Merge of r4652: ssl without buffer should not set c->buffered.

Removed mistaken setting of NGX_SSL_BUFFERED flag in ngx_ssl_send_chain()
if SSL buffer is not used.


git-svn-id: svn://svn.nginx.org/nginx/branches/stable-1.2@4721 73f98a42-aea0-e011-b76d-00259023448c
Merge of r4653: ngx_inet.c code reduction.

Code reduction (no functional changes).


git-svn-id: svn://svn.nginx.org/nginx/branches/stable-1.2@4722 73f98a42-aea0-e011-b76d-00259023448c
Merge of r4671: support for IPv6 literals in proxy_pass and so on.


git-svn-id: svn://svn.nginx.org/nginx/branches/stable-1.2@4723 73f98a42-aea0-e011-b76d-00259023448c
Merge of r4654, r4672, r4684, r4685, r4692: resolver changes.

*) Resolver: fixed format specification.
   Patch by Yichun Zhang (agentzh).

*) Support for IPv6 literals and an optional port in resolver.

*) Fixed crash in ngx_resolver_cleanup_tree().

   If sending a DNS request fails with an error (e.g., when mistakenly
   trying to send it to a local IP broadcast), such a request is not
   deleted if there are clients waiting on it.  However, it was still
   erroneously removed from the queue.  Later ngx_resolver_cleanup_tree()
   attempted to remove it from the queue again that resulted in a NULL
   pointer dereference.

*) When "resolver" is configured with a domain name, only the first
   resolved address was used.  Now all addresses will be used.

*) Fixed segfault with poll and resolver used.

   Poll event method needs ngx_cycle->files to work, and use of
   ngx_exit_cycle without files set caused null pointer dereference in  
   resolver's cleanup on udp socket close.


git-svn-id: svn://svn.nginx.org/nginx/branches/stable-1.2@4724 73f98a42-aea0-e011-b76d-00259023448c
Merge of r4655, r4656, r4657, r4695, r4696: upstream changes.

*) Upstream: least_conn balancer module.

*) Upstream: weights and IPv6 support in ip_hash balancer.

*) Upstream keepalive: "single" parameter deprecated.


git-svn-id: svn://svn.nginx.org/nginx/branches/stable-1.2@4725 73f98a42-aea0-e011-b76d-00259023448c
Merge of r4682, r4694, r4699, r4704, r4705: minor nits.

*) Fixed spelling of "endianness", and called it "byte ordering" in the
   user visible part.

*) Fixed return type of ngx_strerror_init().

*) Fixed a harmless error in spelling of "Connection: close" when computing
   the response header length.

*) Style.

*) Added code to look up Google perftools in /opt/local/, for MacPorts.


git-svn-id: svn://svn.nginx.org/nginx/branches/stable-1.2@4726 73f98a42-aea0-e011-b76d-00259023448c
Merge of r4686, r4687: $status variable.

Contains response status code as a 3-digit integer
(with leading zeroes if necessary), or one of the following values:

    000 - response status code has not yet been assigned
    009 - HTTP/0.9 request is being processed


git-svn-id: svn://svn.nginx.org/nginx/branches/stable-1.2@4727 73f98a42-aea0-e011-b76d-00259023448c
Merge of r4688, r4689, r4706:

*) Mp4: fixed non-keyframe seeks in some cases (ticket #175).

   Number of entries in stsc atom was wrong if we've added an entry to
   split a chunk.

   Additionally, there is no need to add an entry if we are going to split
   last chunk in an entry, it's enough to update the entry we already have.
   Previously new entry was added and old one was left as is, resulting in
   incorrect entry with zero chunks which might confuse some software.

*) Mp4: fixed streaming if moov atom is at buffer edge.


git-svn-id: svn://svn.nginx.org/nginx/branches/stable-1.2@4728 73f98a42-aea0-e011-b76d-00259023448c
Merge of r4690: conflicting wildcard server names fix.

With previous code wildcard names were added to hash even if conflict
was detected.  This resulted in identical names in hash and segfault
later in ngx_hash_wildcard_init().


git-svn-id: svn://svn.nginx.org/nginx/branches/stable-1.2@4729 73f98a42-aea0-e011-b76d-00259023448c
Merge of r4691: changed default alignment to 16.

This fixes alignment problems observerd on ARMs, and likely also needed
for MIPSes.  Unless we know alignment is not required just assume we
need 16, which appears to be safe default for all architectures.

See here for details:
http://mailman.nginx.org/pipermail/nginx/2012-June/034139.html


git-svn-id: svn://svn.nginx.org/nginx/branches/stable-1.2@4730 73f98a42-aea0-e011-b76d-00259023448c
Merge of r4693: fixed "sendmsg() failed" alerts on HP-UX.

HP-UX needs _HPUX_ALT_XOPEN_SOCKET_API to be defined to be able to
use various POSIX versions of networking functions.  Notably sendmsg()
resulted in "sendmsg() failed (9: Bad file number)" alerts without it.

See xopen_networking(7) for more details.


git-svn-id: svn://svn.nginx.org/nginx/branches/stable-1.2@4731 73f98a42-aea0-e011-b76d-00259023448c
Merge of r4697: disabled gzip in OpenSSL prior to 1.0.0.

Disabled gzip compression in OpenSSL prior to 1.0.0 version.
This saves about 522K per connection.


git-svn-id: svn://svn.nginx.org/nginx/branches/stable-1.2@4732 73f98a42-aea0-e011-b76d-00259023448c
Merge of r4698: X-Forwarded-For conditionals.

Fixed compile-time conditionals used to detect if X-Forwarded-For support
is needed.

Note: compatibility shims where added during merge to avoid possible
breakage of 3rd party modules.  At least cache purge module was broken
by the original commit, as it used to rely on NGX_HTTP_PROXY define.


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