]> git.kaiwu.me - nginx.git/log
nginx.git
13 years agoCreate request object only after the first byte was received.
Valentin Bartenev [Thu, 7 Mar 2013 17:21:50 +0000 (17:21 +0000)]
Create request object only after the first byte was received.

Previously, we always created an object and logged 400 (Bad Request)
in access log if a client closed connection without sending any data.
Such a connection was counted as "reading".

Since it's common for modern browsers to behave like this, it's no
longer considered an error if a client closes connection without
sending any data, and such a connection will be counted as "waiting".

Now, we do not log 400 (Bad Request) and keep memory footprint as
small as possible.

13 years agoVersion bump.
Valentin Bartenev [Thu, 7 Mar 2013 17:07:04 +0000 (17:07 +0000)]
Version bump.

13 years agorelease-1.3.14 tag
Maxim Dounin [Tue, 5 Mar 2013 14:36:20 +0000 (14:36 +0000)]
release-1.3.14 tag

13 years agonginx-1.3.14-RELEASE release-1.3.14
Maxim Dounin [Tue, 5 Mar 2013 14:35:58 +0000 (14:35 +0000)]
nginx-1.3.14-RELEASE

13 years agoMp4: fixed handling of too small mdat atoms (ticket #266).
Maxim Dounin [Mon, 4 Mar 2013 15:39:03 +0000 (15:39 +0000)]
Mp4: fixed handling of too small mdat atoms (ticket #266).

Patch by Gernot Vormayr (with minor changes).

13 years agoAllocate request object from its own pool.
Valentin Bartenev [Fri, 1 Mar 2013 14:55:42 +0000 (14:55 +0000)]
Allocate request object from its own pool.

Previously, it was allocated from a connection pool and
was selectively freed for an idle keepalive connection.

The goal is to put coupled things in one chunk of memory,
and to simplify handling of request objects.

13 years agoSNI: added restriction on requesting host other than negotiated.
Valentin Bartenev [Wed, 27 Feb 2013 17:41:34 +0000 (17:41 +0000)]
SNI: added restriction on requesting host other than negotiated.

According to RFC 6066, client is not supposed to request a different server
name at the application layer.  Server implementations that rely upon these
names being equal must validate that a client did not send a different name
in HTTP request.  Current versions of Apache HTTP server always return 400
"Bad Request" in such cases.

There exist implementations however (e.g., SPDY) that rely on being able to
request different host names in one connection.  Given this, we only reject
requests with differing host names if verification of client certificates
is enabled in a corresponding server configuration.

An example of configuration that might not work as expected:

  server {
      listen 433 ssl default;
      return 404;
  }

  server {
      listen 433 ssl;
      server_name example.org;

      ssl_client_certificate org.cert;
      ssl_verify_client on;
  }

  server {
      listen 433 ssl;
      server_name example.com;

      ssl_client_certificate com.cert;
      ssl_verify_client on;
  }

Previously, a client was able to request example.com by presenting
a certificate for example.org, and vice versa.

13 years agoSNI: reset to default server if requested host was not found.
Valentin Bartenev [Wed, 27 Feb 2013 17:38:54 +0000 (17:38 +0000)]
SNI: reset to default server if requested host was not found.

Not only this is consistent with a case without SNI, but this also
prevents abusing configurations that assume that the $host variable
is limited to one of the configured names for a server.

An example of potentially unsafe configuration:

  server {
      listen 443 ssl default_server;
      ...
  }

  server {
      listen 443;
      server_name example.com;

      location / {
          proxy_pass http://$host;
      }
  }

Note: it is possible to negotiate "example.com" by SNI, and to request
arbitrary host name that does not exist in the configuration above.

13 years agoSNI: avoid surplus lookup of virtual server if SNI was used.
Valentin Bartenev [Wed, 27 Feb 2013 17:33:59 +0000 (17:33 +0000)]
SNI: avoid surplus lookup of virtual server if SNI was used.

13 years agoApply server configuration as soon as host is known.
Valentin Bartenev [Wed, 27 Feb 2013 17:27:15 +0000 (17:27 +0000)]
Apply server configuration as soon as host is known.

Previously, this was done only after the whole request header
was parsed, and if an error occurred earlier then the request
was processed in the default server (or server chosen by SNI),
while r->headers_in.server might be set to the value from the
Host: header or host from request line.

r->headers_in.server is in turn used for $host variable and
in HTTP redirects if "server_name_in_redirect" is disabled.
Without the change, configurations that rely on this during
error handling are potentially unsafe if SNI is used.

This change also allows to use server specific settings of
"underscores_in_headers", "ignore_invalid_headers", and
"large_client_header_buffers" directives for HTTP requests
and HTTPS requests without SNI.

13 years agoSSL: do not treat SSL handshake as request.
Valentin Bartenev [Wed, 27 Feb 2013 17:21:21 +0000 (17:21 +0000)]
SSL: do not treat SSL handshake as request.

The request object will not be created until SSL handshake is complete.
This simplifies adding another connection handler that does not need
request object right after handshake (e.g., SPDY).

There are also a few more intentional effects:

 - the "client_header_buffer_size" directive will be taken from the
   server configuration that was negotiated by SNI;

 - SSL handshake errors and timeouts are not logged into access log
   as bad requests;

 - ngx_ssl_create_connection() is not called until the first byte of
   ClientHello message was received.  This also decreases memory
   consumption if plain HTTP request is sent to SSL socket.

13 years agoStatus: do not count connection as reading right after accept().
Valentin Bartenev [Wed, 27 Feb 2013 17:16:51 +0000 (17:16 +0000)]
Status: do not count connection as reading right after accept().

Before we receive the first bytes, the connection is counted
as waiting.

This change simplifies further code changes.

13 years agoSNI: reuse selected configuration for all requests in a connection.
Valentin Bartenev [Wed, 27 Feb 2013 17:12:48 +0000 (17:12 +0000)]
SNI: reuse selected configuration for all requests in a connection.

Previously, only the first request in a connection was assigned the
configuration selected by SNI.  All subsequent requests initially
used the default server's configuration, ignoring SNI, which was
wrong.

Now all subsequent requests in a connection will initially use the
configuration selected by SNI.  This is done by storing a pointer
to configuration in http connection object.  It points to default
server's configuration initially, but changed upon receipt of SNI.

(The request's configuration can be further refined when parsing
the request line and Host: header.)

This change was not made specific to SNI as it also allows slightly
faster access to configuration without the request object.

13 years agoSNI: ignore captures in server_name regexes when matching by SNI.
Valentin Bartenev [Wed, 27 Feb 2013 17:06:52 +0000 (17:06 +0000)]
SNI: ignore captures in server_name regexes when matching by SNI.

This change helps to decouple ngx_http_ssl_servername() from the request
object.

Note: now we close connection in case of error during server name lookup
for request.  Previously, we did so only for HTTP/0.9 requests.

13 years agoChanged interface of ngx_http_validate_host().
Valentin Bartenev [Wed, 27 Feb 2013 17:03:14 +0000 (17:03 +0000)]
Changed interface of ngx_http_validate_host().

13 years agoIntroduced the ngx_http_set_connection_log() macro.
Valentin Bartenev [Wed, 27 Feb 2013 16:56:47 +0000 (16:56 +0000)]
Introduced the ngx_http_set_connection_log() macro.

No functional changes.

13 years agoThe default server lookup is now done only once per connection.
Valentin Bartenev [Wed, 27 Feb 2013 16:53:01 +0000 (16:53 +0000)]
The default server lookup is now done only once per connection.

Previously, it was done for every request in a connection.

13 years agoCorrectly handle multiple X-Forwarded-For headers (ticket #106).
Ruslan Ermilov [Wed, 27 Feb 2013 13:29:50 +0000 (13:29 +0000)]
Correctly handle multiple X-Forwarded-For headers (ticket #106).

13 years agoFixed separator in $sent_http_cache_control.
Ruslan Ermilov [Wed, 27 Feb 2013 13:22:20 +0000 (13:22 +0000)]
Fixed separator in $sent_http_cache_control.

In case multiple "Cache-Control" headers are sent to a client,
multiple values in $sent_http_cache_control were incorrectly
split by a semicolon.  Now they are split by a comma.

13 years agoFixed potential segfault in ngx_http_keepalive_handler().
Valentin Bartenev [Sat, 23 Feb 2013 13:23:48 +0000 (13:23 +0000)]
Fixed potential segfault in ngx_http_keepalive_handler().

In case of error in the read event handling we close a connection
by calling ngx_http_close_connection(), that also destroys connection
pool. Thereafter, an attempt to free a buffer (added in r4892) that
was allocated from the pool could cause SIGSEGV and is meaningless
as well (the buffer already freed with the pool).

13 years agoSSL: retry "sess_id" and "id" allocations.
Maxim Dounin [Sat, 23 Feb 2013 11:54:25 +0000 (11:54 +0000)]
SSL: retry "sess_id" and "id" allocations.

In case of fully populated SSL session cache with no memory left for
new allocations, ngx_ssl_new_session() will try to expire the oldest
non-expired session and retry, but only in case when slab allocation
fails for "cached_sess", not when slab allocation fails for either
"sess_id" or "id", which can happen for number of reasons and results
in new session not being cached.

Patch fixes this by adding retry logic to "sess_id" & "id" allocations.

Patch by Piotr Sikora.

13 years agoTrailing whitespace fix.
Maxim Dounin [Sat, 23 Feb 2013 11:50:42 +0000 (11:50 +0000)]
Trailing whitespace fix.

13 years agoIntroduced variables in ngx_http_stub_status module.
Andrey Belov [Thu, 21 Feb 2013 23:31:57 +0000 (23:31 +0000)]
Introduced variables in ngx_http_stub_status module.

Three new variables were added: $connections_active, $connections_reading
and $connections_writing.

13 years agoConnection upgrade support in uwsgi and scgi modules.
Maxim Dounin [Wed, 20 Feb 2013 16:41:05 +0000 (16:41 +0000)]
Connection upgrade support in uwsgi and scgi modules.

Prodded by Roberto De Ioris.

13 years agoRemoved zero termination of shm zone names.
Valentin Bartenev [Tue, 19 Feb 2013 17:48:45 +0000 (17:48 +0000)]
Removed zero termination of shm zone names.

It was added in r2717 and no longer needed since r2721,
where the termination was added to ngx_shm_alloc() and
ngx_init_zone_pool().  So then it only corrupts error
messages about ivalid zones.

13 years agoVersion bump.
Valentin Bartenev [Tue, 19 Feb 2013 17:45:12 +0000 (17:45 +0000)]
Version bump.

13 years agorelease-1.3.13 tag
Maxim Dounin [Tue, 19 Feb 2013 15:15:11 +0000 (15:15 +0000)]
release-1.3.13 tag

13 years agonginx-1.3.13-RELEASE release-1.3.13
Maxim Dounin [Tue, 19 Feb 2013 15:14:48 +0000 (15:14 +0000)]
nginx-1.3.13-RELEASE

13 years agoProxy: fixed do_write handling in previous commit.
Maxim Dounin [Mon, 18 Feb 2013 15:08:46 +0000 (15:08 +0000)]
Proxy: fixed do_write handling in previous commit.

As rightfully complained by MSVC, do_write variable was used uninitialized.
Correct fix is to set it's initial value based on event happened.

13 years agoProxy: support for connection upgrade (101 Switching Protocols).
Maxim Dounin [Mon, 18 Feb 2013 13:50:52 +0000 (13:50 +0000)]
Proxy: support for connection upgrade (101 Switching Protocols).

This allows to proxy WebSockets by using configuration like this:

    location /chat/ {
        proxy_pass http://backend;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "upgrade";
    }

Connection upgrade is allowed as long as it was requested by a client
via the Upgrade request header.

13 years agoConfigure: changed default compiler from "gcc" to "cc".
Gleb Smirnoff [Mon, 18 Feb 2013 11:35:28 +0000 (11:35 +0000)]
Configure: changed default compiler from "gcc" to "cc".

This allows to automatically pick the preferred system compiler on
systems with multiple compilers.

Reviewed by: mdounin, ru

13 years agoConfigure: rebuild perl module nginx.so if headers are changed.
Maxim Dounin [Fri, 15 Feb 2013 16:50:22 +0000 (16:50 +0000)]
Configure: rebuild perl module nginx.so if headers are changed.

Note: the "-p" argument of cp(1) dropped intentionally, to force nginx.so
rebuild.  It is considered too boring to properly list all dependencies
in Makefile.PL.

13 years agoFixed false memset warning on Linux with -O3 (ticket #275).
Maxim Dounin [Wed, 13 Feb 2013 14:39:46 +0000 (14:39 +0000)]
Fixed false memset warning on Linux with -O3 (ticket #275).

Prodded by John Leach.

13 years agoUpdated OpenSSL used for win32 builds.
Maxim Dounin [Mon, 11 Feb 2013 23:37:20 +0000 (23:37 +0000)]
Updated OpenSSL used for win32 builds.

13 years agoAdded support for {SHA} passwords (ticket #50).
Maxim Dounin [Thu, 7 Feb 2013 12:09:56 +0000 (12:09 +0000)]
Added support for {SHA} passwords (ticket #50).

Note: use of {SHA} passwords is discouraged as {SHA} password scheme is
vulnerable to attacks using rainbow tables.  Use of {SSHA}, $apr1$ or
crypt() algorithms as supported by OS is recommended instead.

The {SHA} password scheme support is added to avoid the need of changing
the scheme recorded in password files from {SHA} to {SSHA} because such
a change hides security problem with {SHA} passwords.

Patch by Louis Opter, with minor changes.

13 years agoVersion bump.
Maxim Dounin [Thu, 7 Feb 2013 12:09:09 +0000 (12:09 +0000)]
Version bump.

13 years agorelease-1.3.12 tag
Maxim Dounin [Tue, 5 Feb 2013 14:07:01 +0000 (14:07 +0000)]
release-1.3.12 tag

13 years agonginx-1.3.12-RELEASE release-1.3.12
Maxim Dounin [Tue, 5 Feb 2013 14:06:41 +0000 (14:06 +0000)]
nginx-1.3.12-RELEASE

13 years agoUpdated OpenSSL used for win32 builds.
Maxim Dounin [Tue, 5 Feb 2013 13:41:48 +0000 (13:41 +0000)]
Updated OpenSSL used for win32 builds.

13 years agoGeoIP: removed pseudo-support of "proxy" and "netspeed" databases.
Ruslan Ermilov [Mon, 4 Feb 2013 16:44:22 +0000 (16:44 +0000)]
GeoIP: removed pseudo-support of "proxy" and "netspeed" databases.

13 years agoFastCGI: proper handling of split fastcgi end request.
Maxim Dounin [Fri, 1 Feb 2013 14:41:50 +0000 (14:41 +0000)]
FastCGI: proper handling of split fastcgi end request.

If fastcgi end request record was split between several network packets,
with fastcgi_keep_conn it was possible that connection was saved in incorrect
state (e.g. with padding bytes not yet read).

13 years agoFastCGI: unconditional state transitions.
Maxim Dounin [Fri, 1 Feb 2013 14:41:07 +0000 (14:41 +0000)]
FastCGI: unconditional state transitions.

Checks for f->padding before state transitions make code hard to follow,
remove them and make sure we always do another loop iteration after
f->state is set to ngx_http_fastcgi_st_padding.

13 years agoFastCGI: fixed wrong connection close with fastcgi_keep_conn.
Maxim Dounin [Fri, 1 Feb 2013 14:40:19 +0000 (14:40 +0000)]
FastCGI: fixed wrong connection close with fastcgi_keep_conn.

With fastcgi_keep_conn it was possible that connection was closed after
FCGI_STDERR record with zero padding and without any further data read yet.
This happended as f->state was set to ngx_http_fastcgi_st_padding and then
"break" happened, resulting in p->length being set to f->padding, i.e. 0
(which in turn resulted in connection close).

Fix is to make sure we continue the loop after f->state is set.

13 years agoRequest body: fixed client_body_in_file_only.
Maxim Dounin [Fri, 1 Feb 2013 14:38:18 +0000 (14:38 +0000)]
Request body: fixed client_body_in_file_only.

After introduction of chunked request body reading support in 1.3.9 (r4931),
the rb->bufs wasn't set if request body was fully preread while calling the
ngx_http_read_client_request_body() function.

Reported by Yichun Zhang (agentzh).

13 years agoSSL: fixed ngx_ssl_handshake() with level-triggered event methods.
Maxim Dounin [Fri, 1 Feb 2013 14:37:43 +0000 (14:37 +0000)]
SSL: fixed ngx_ssl_handshake() with level-triggered event methods.

Missing calls to ngx_handle_write_event() and ngx_handle_read_event()
resulted in a CPU hog during SSL handshake if an level-triggered event
method (e.g. select) was used.

13 years agoSSL: take into account data in the buffer while limiting output.
Valentin Bartenev [Mon, 28 Jan 2013 15:41:12 +0000 (15:41 +0000)]
SSL: take into account data in the buffer while limiting output.

In some rare cases this can result in a more smooth sending rate.

13 years agoSSL: avoid calling SSL_write() with zero data size.
Valentin Bartenev [Mon, 28 Jan 2013 15:40:25 +0000 (15:40 +0000)]
SSL: avoid calling SSL_write() with zero data size.

According to documentation, calling SSL_write() with num=0 bytes to be sent
results in undefined behavior.

We don't currently call ngx_ssl_send_chain() with empty chain and buffer.
This check handles the case of a chain with total data size that is
a multiple of NGX_SSL_BUFSIZE, and with the special buffer at the end.

In practice such cases resulted in premature connection close and critical
error "SSL_write() failed (SSL:)" in the error log.

13 years agoSSL: calculation of buffer size moved closer to its usage.
Valentin Bartenev [Mon, 28 Jan 2013 15:38:36 +0000 (15:38 +0000)]
SSL: calculation of buffer size moved closer to its usage.

No functional changes.

13 years agoSSL: preservation of flush flag for buffered data.
Valentin Bartenev [Mon, 28 Jan 2013 15:37:11 +0000 (15:37 +0000)]
SSL: preservation of flush flag for buffered data.

Previously, if SSL buffer was not sent we lost information that the data
must be flushed.

13 years agoSSL: resetting of flush flag after the data was written.
Valentin Bartenev [Mon, 28 Jan 2013 15:35:12 +0000 (15:35 +0000)]
SSL: resetting of flush flag after the data was written.

There is no need to flush next chunk of data if it does not contain a buffer
with the flush or last_buf flags set.

13 years agoSSL: removed conditions that always hold true.
Valentin Bartenev [Mon, 28 Jan 2013 15:34:09 +0000 (15:34 +0000)]
SSL: removed conditions that always hold true.

13 years agoSecure_link: fixed configuration inheritance.
Ruslan Ermilov [Mon, 28 Jan 2013 14:42:07 +0000 (14:42 +0000)]
Secure_link: fixed configuration inheritance.

The "secure_link_secret" directive was always inherited from the outer
configuration level even when "secure_link" and "secure_link_md5" were
specified on the inner level.

13 years agoEvents: fixed null pointer dereference with resolver and poll.
Ruslan Ermilov [Fri, 25 Jan 2013 09:59:28 +0000 (09:59 +0000)]
Events: fixed null pointer dereference with resolver and poll.

A POLLERR signalled by poll() without POLLIN/POLLOUT, as seen on
Linux, would generate both read and write events, but there's no
write event handler for resolver events.  A fix is to only call
event handler of an active event.

13 years agoGeoIP: IPv6 support.
Ruslan Ermilov [Thu, 24 Jan 2013 16:15:51 +0000 (16:15 +0000)]
GeoIP: IPv6 support.

When using IPv6 databases, IPv4 addresses are looked up as IPv4-mapped
IPv6 addresses.

Mostly based on a patch by Gregor Kališnik (ticket #250).

13 years agoConfigure: fixed GeoIP library detection.
Ruslan Ermilov [Thu, 24 Jan 2013 16:15:07 +0000 (16:15 +0000)]
Configure: fixed GeoIP library detection.

13 years agoConfigure: fixed style of include directories.
Ruslan Ermilov [Thu, 24 Jan 2013 16:14:12 +0000 (16:14 +0000)]
Configure: fixed style of include directories.

13 years agoProxy: fixed proxy_method to always add space.
Maxim Dounin [Tue, 22 Jan 2013 12:36:00 +0000 (12:36 +0000)]
Proxy: fixed proxy_method to always add space.

Before the patch if proxy_method was specified at http{} level the code
to add trailing space wasn't executed, resulting in incorrect requests
to upstream.

13 years agoRemoved redundant variable assignment.
Sergey Budnevitch [Mon, 21 Jan 2013 15:05:54 +0000 (15:05 +0000)]
Removed redundant variable assignment.

13 years agoVariables $pipe, $request_length, $time_iso8601, and $time_local.
Ruslan Ermilov [Mon, 21 Jan 2013 13:15:29 +0000 (13:15 +0000)]
Variables $pipe, $request_length, $time_iso8601, and $time_local.

Log module counterparts are preserved for efficiency.

Based on patch by Kiril Kalchev.

13 years agoVersion bump.
Ruslan Ermilov [Thu, 17 Jan 2013 09:55:36 +0000 (09:55 +0000)]
Version bump.

13 years agoFixed and improved the "*_bind" directives of proxying modules.
Ruslan Ermilov [Wed, 16 Jan 2013 09:42:57 +0000 (09:42 +0000)]
Fixed and improved the "*_bind" directives of proxying modules.

The "proxy_bind", "fastcgi_bind", "uwsgi_bind", "scgi_bind" and
"memcached_bind" directives are now inherited; inherited value
can be reset by the "off" parameter.  Duplicate directives are
now detected.  Parameter value can now contain variables.

13 years agorelease-1.3.11 tag
Maxim Dounin [Thu, 10 Jan 2013 13:17:29 +0000 (13:17 +0000)]
release-1.3.11 tag

13 years agonginx-1.3.11-RELEASE release-1.3.11
Maxim Dounin [Thu, 10 Jan 2013 13:17:04 +0000 (13:17 +0000)]
nginx-1.3.11-RELEASE

13 years agoFixed "proxy_pass" with IP address and no port (ticket #276).
Ruslan Ermilov [Thu, 10 Jan 2013 12:58:55 +0000 (12:58 +0000)]
Fixed "proxy_pass" with IP address and no port (ticket #276).

Upstreams created by "proxy_pass" with IP address and no port were
broken in 1.3.10, by not initializing port in u->sockaddr.

API change: ngx_parse_url() was modified to always initialize port
(in u->sockaddr and in u->port), even for the u->no_resolve case;
ngx_http_upstream() and ngx_http_upstream_add() were adopted.

13 years agoUpdated PCRE used for win32 builds.
Maxim Dounin [Thu, 10 Jan 2013 11:38:14 +0000 (11:38 +0000)]
Updated PCRE used for win32 builds.

13 years agoSSL: speedup loading of configs with many ssl servers.
Maxim Dounin [Wed, 9 Jan 2013 14:11:48 +0000 (14:11 +0000)]
SSL: speedup loading of configs with many ssl servers.

The patch saves one EC_KEY_generate_key() call per server{} block by
informing OpenSSL about SSL_OP_SINGLE_ECDH_USE we are going to use before
the SSL_CTX_set_tmp_ecdh() call.

For a configuration file with 10k simple server{} blocks with SSL enabled
this change reduces startup time from 18s to 5s on a slow test box here.

13 years agoEvents: added check for duplicate "events" directive.
Valentin Bartenev [Tue, 8 Jan 2013 14:03:37 +0000 (14:03 +0000)]
Events: added check for duplicate "events" directive.

13 years agoThe data pointer in ngx_open_file_t objects must be initialized.
Valentin Bartenev [Tue, 8 Jan 2013 14:01:57 +0000 (14:01 +0000)]
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).

13 years agoYear 2013.
Ruslan Ermilov [Mon, 31 Dec 2012 22:08:19 +0000 (22:08 +0000)]
Year 2013.

13 years agoGeo: improved code readability.
Ruslan Ermilov [Thu, 27 Dec 2012 21:35:47 +0000 (21:35 +0000)]
Geo: improved code readability.

13 years agoUpstream keepalive: detect duplicate "keepalive" directive.
Ruslan Ermilov [Wed, 26 Dec 2012 14:46:06 +0000 (14:46 +0000)]
Upstream keepalive: detect duplicate "keepalive" directive.

A failure to detect duplicate "keepalive" directive resulted in
stack exhaustion.

13 years agoVersion bump.
Ruslan Ermilov [Wed, 26 Dec 2012 09:29:37 +0000 (09:29 +0000)]
Version bump.

13 years agoGeo: made "default" affect both IPv4 and IPv6 when using prefixes.
Ruslan Ermilov [Wed, 26 Dec 2012 05:03:51 +0000 (05:03 +0000)]
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.

13 years agorelease-1.3.10 tag
Maxim Dounin [Tue, 25 Dec 2012 14:24:12 +0000 (14:24 +0000)]
release-1.3.10 tag

13 years agonginx-1.3.10-RELEASE release-1.3.10
Maxim Dounin [Tue, 25 Dec 2012 14:23:45 +0000 (14:23 +0000)]
nginx-1.3.10-RELEASE

13 years agoGeo: properly initialize ngx_cidr_t when dealing with "default".
Ruslan Ermilov [Tue, 25 Dec 2012 10:00:39 +0000 (10:00 +0000)]
Geo: properly initialize ngx_cidr_t when dealing with "default".

13 years agoGeo: IPv6 support.
Ruslan Ermilov [Tue, 25 Dec 2012 08:21:56 +0000 (08:21 +0000)]
Geo: IPv6 support.

The "ranges" mode is still limited to IPv4 only.

13 years agoUpstream: fixed state resetting when switching to backup servers.
Valentin Bartenev [Tue, 25 Dec 2012 08:02:21 +0000 (08:02 +0000)]
Upstream: fixed state resetting when switching to backup servers.

Based on patch by Thomas Chen (ticket #257).

13 years agoFixed HEAD requests handling when proxying is used (closes #261).
Valentin Bartenev [Mon, 24 Dec 2012 17:32:53 +0000 (17:32 +0000)]
Fixed HEAD requests handling when proxying is used (closes #261).

13 years agoTrailing whitespace fix.
Ruslan Ermilov [Mon, 24 Dec 2012 16:40:55 +0000 (16:40 +0000)]
Trailing whitespace fix.

13 years agoAccess log: the "gzip" parameter of the "access_log" directive.
Valentin Bartenev [Sun, 23 Dec 2012 19:09:33 +0000 (19:09 +0000)]
Access log: the "gzip" parameter of the "access_log" directive.

Note: this requires zlib version 1.2.0.4 or above to work.

13 years agoConfigure: added the NGX_ZLIB define.
Valentin Bartenev [Sun, 23 Dec 2012 16:04:14 +0000 (16:04 +0000)]
Configure: added the NGX_ZLIB define.

This was introduced for conditional compilation of the code that requires
the zlib library.

13 years agoAccess log: the "flush" parameter of the "access_log" directive.
Valentin Bartenev [Sun, 23 Dec 2012 15:51:47 +0000 (15:51 +0000)]
Access log: the "flush" parameter of the "access_log" directive.

13 years agoReopening log files code moved to a separate function.
Valentin Bartenev [Sun, 23 Dec 2012 15:36:52 +0000 (15:36 +0000)]
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..

13 years agoAccess log: fixed redundant buffer reallocation.
Valentin Bartenev [Sun, 23 Dec 2012 15:27:55 +0000 (15:27 +0000)]
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.

13 years agoProperly initialize "struct in6_addr" with zeroes.
Ruslan Ermilov [Sat, 22 Dec 2012 20:03:38 +0000 (20:03 +0000)]
Properly initialize "struct in6_addr" with zeroes.

13 years agoCore: crypt_r() error handling fixed.
Maxim Dounin [Fri, 21 Dec 2012 16:13:03 +0000 (16:13 +0000)]
Core: 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.

13 years agoImage filter: fixed image_filter rotate inheritance.
Maxim Dounin [Fri, 21 Dec 2012 15:07:45 +0000 (15:07 +0000)]
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.

13 years agoGeo: ensure that default entry is always present.
Ruslan Ermilov [Fri, 21 Dec 2012 08:46:52 +0000 (08:46 +0000)]
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.

13 years agoThere's no need to normalize address returned by ngx_ptocidr().
Ruslan Ermilov [Fri, 21 Dec 2012 08:44:39 +0000 (08:44 +0000)]
There's no need to normalize address returned by ngx_ptocidr().

13 years agoImage filter: configuration inheritance fixes.
Maxim Dounin [Thu, 20 Dec 2012 19:04:28 +0000 (19:04 +0000)]
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.

13 years agoBrought the link to ngx_http_perl_module documentation up to date.
Ruslan Ermilov [Thu, 20 Dec 2012 15:34:37 +0000 (15:34 +0000)]
Brought the link to ngx_http_perl_module documentation up to date.

13 years agoFixed return type of internal function that allocates radix tree nodes.
Ruslan Ermilov [Thu, 20 Dec 2012 11:16:03 +0000 (11:16 +0000)]
Fixed return type of internal function that allocates radix tree nodes.

13 years agoLet "add_header" affect 201 responses (ticket #125).
Ruslan Ermilov [Wed, 19 Dec 2012 10:33:56 +0000 (10:33 +0000)]
Let "add_header" affect 201 responses (ticket #125).

13 years agoSlightly optimized code that handles special headers in "add_header".
Ruslan Ermilov [Wed, 19 Dec 2012 10:30:45 +0000 (10:30 +0000)]
Slightly optimized code that handles special headers in "add_header".

13 years agoAvoid sending "100 Continue" on 413 Request Entity Too Large.
Maxim Dounin [Tue, 18 Dec 2012 18:39:39 +0000 (18:39 +0000)]
Avoid sending "100 Continue" on 413 Request Entity Too Large.

Patch by Igor Sysoev.

13 years agoAdded checks that disallow adding a variable with an empty name.
Ruslan Ermilov [Mon, 17 Dec 2012 19:03:33 +0000 (19:03 +0000)]
Added checks that disallow adding a variable with an empty name.
Added variable name syntax checks to "geo" and "map" directives.

13 years agoImplemented IPv6 support for URLs specified using domain names.
Ruslan Ermilov [Mon, 17 Dec 2012 12:08:53 +0000 (12:08 +0000)]
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).

13 years agoFixed URL parsing code.
Ruslan Ermilov [Mon, 17 Dec 2012 09:44:46 +0000 (09:44 +0000)]
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.

13 years agoSimplified URL parsing code.
Ruslan Ermilov [Mon, 17 Dec 2012 09:31:53 +0000 (09:31 +0000)]
Simplified URL parsing code.

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