]> git.kaiwu.me - nginx.git/log
nginx.git
12 years agoMail: fixed segfault with ssl/starttls at mail{} level and no cert.
Maxim Dounin [Mon, 30 Sep 2013 18:10:13 +0000 (22:10 +0400)]
Mail: fixed segfault with ssl/starttls at mail{} level and no cert.

A configuration like "mail { starttls on; server {}}" triggered NULL
pointer dereference in ngx_mail_ssl_merge_conf() as conf->file was not set.

12 years agoMail: fixed overrun of allocated memory (ticket #411).
Maxim Dounin [Mon, 30 Sep 2013 18:10:08 +0000 (22:10 +0400)]
Mail: fixed overrun of allocated memory (ticket #411).

Reported by Markus Linnala.

12 years agoMail: handle smtp multiline replies.
Maxim Dounin [Mon, 30 Sep 2013 18:10:03 +0000 (22:10 +0400)]
Mail: handle smtp multiline replies.

See here for details:

http://nginx.org/pipermail/nginx/2010-August/021713.html
http://nginx.org/pipermail/nginx/2010-August/021784.html
http://nginx.org/pipermail/nginx/2010-August/021785.html

12 years agoMail: smtp pipelining support.
Maxim Dounin [Mon, 30 Sep 2013 18:09:57 +0000 (22:09 +0400)]
Mail: smtp pipelining support.

Basically, this does the following two changes (and corresponding
modifications of related code):

1. Does not reset session buffer unless it's reached it's end, and always
wait for LF to terminate command (even if we detected invalid command).

2. Record command name to make it available for handlers (since now we
can't assume that command starts from s->buffer->start).

12 years agoMail: mail dependencies are now honored while building addons.
Maxim Dounin [Mon, 30 Sep 2013 18:09:54 +0000 (22:09 +0400)]
Mail: mail dependencies are now honored while building addons.

12 years agoMail: added session close on smtp_greeting_delay violation.
Maxim Dounin [Mon, 30 Sep 2013 18:09:50 +0000 (22:09 +0400)]
Mail: added session close on smtp_greeting_delay violation.

A server MUST send greeting before other replies, while before this
change in case of smtp_greeting_delay violation the 220 greeting was
sent after several 503 replies to commands received before greeting,
resulting in protocol synchronization loss.  Moreover, further commands
were accepted after the greeting.

While closing a connection isn't strictly RFC compliant (RFC 5321
requires servers to wait for a QUIT before closing a connection), it's
probably good enough for practial uses.

12 years agoSSL: adjust buffer used by OpenSSL during handshake (ticket #413).
Maxim Dounin [Fri, 27 Sep 2013 15:39:33 +0000 (19:39 +0400)]
SSL: adjust buffer used by OpenSSL during handshake (ticket #413).

12 years agoFastCGI: non-buffered mode support.
Maxim Dounin [Fri, 27 Sep 2013 12:50:40 +0000 (16:50 +0400)]
FastCGI: non-buffered mode support.

12 years agoUpstream: subrequest_in_memory support for SCGI and uwsgi enabled.
Maxim Dounin [Fri, 27 Sep 2013 12:50:34 +0000 (16:50 +0400)]
Upstream: subrequest_in_memory support for SCGI and uwsgi enabled.

This was missed in 9d59a8eda373 when non-buffered support was added to SCGI
and uwsgi.

12 years agoUpstream: subrequest_in_memory fix.
Maxim Dounin [Fri, 27 Sep 2013 12:50:26 +0000 (16:50 +0400)]
Upstream: subrequest_in_memory fix.

With previous code only part of u->buffer might be emptied in case
of special responses, resulting in partial responses seen by SSI set
in case of simple protocols, or spurious errors like "upstream sent
invalid chunked response" in case of complex ones.

12 years agoUpstream: proxy_no_cache, fastcgi_no_cache warnings removed.
Maxim Dounin [Fri, 27 Sep 2013 12:50:13 +0000 (16:50 +0400)]
Upstream: proxy_no_cache, fastcgi_no_cache warnings removed.

12 years agoProxy: added the "proxy_ssl_ciphers" directive.
Piotr Sikora [Mon, 23 Sep 2013 22:58:28 +0000 (15:58 -0700)]
Proxy: added the "proxy_ssl_ciphers" directive.

Signed-off-by: Piotr Sikora <piotr@cloudflare.com>
12 years agoAdded ngx_filename_cmp() with "/" sorted to the left.
Maxim Dounin [Mon, 23 Sep 2013 15:37:13 +0000 (19:37 +0400)]
Added ngx_filename_cmp() with "/" sorted to the left.

This patch fixes incorrect handling of auto redirect in configurations
like:

    location /0  { }
    location /a- { }
    location /a/ { proxy_pass ... }

With previously used sorting, this resulted in the following locations
tree (as "-" is less than "/"):

        "/a-"
    "/0"    "/a/"

and a request to "/a" didn't match "/a/" with auto_redirect, as it
didn't traverse relevant tree node during lookup (it tested "/a-",
then "/0", and then falled back to null location).

To preserve locale use for non-ASCII characters on case-insensetive
systems, libc's tolower() used.

12 years agoCaseless location tree construction (ticket #90).
Maxim Dounin [Mon, 23 Sep 2013 15:37:06 +0000 (19:37 +0400)]
Caseless location tree construction (ticket #90).

Location tree was always constructed using case-sensitive comparison, even
on case-insensitive systems.  This resulted in incorrect operation if
uppercase letters were used in location directives.  Notably, the
following config:

    location /a { ... }
    location /B { ... }

failed to properly map requests to "/B" into "location /B".

12 years agoSSL: stop loading configs with invalid "ssl_ciphers" values.
Piotr Sikora [Mon, 23 Sep 2013 05:36:11 +0000 (22:36 -0700)]
SSL: stop loading configs with invalid "ssl_ciphers" values.

While there, remove unnecessary check in ngx_mail_ssl_module.

Signed-off-by: Piotr Sikora <piotr@cloudflare.com>
12 years agoCore: fix misallocation at ngx_crypt_apr1 (ticket #412).
Markus Linnala [Fri, 20 Sep 2013 14:57:21 +0000 (17:57 +0300)]
Core: fix misallocation at ngx_crypt_apr1 (ticket #412).

Found by using auth_basic.t from mdounin nginx-tests under valgrind.

==10470== Invalid write of size 1
==10470==    at 0x43603D: ngx_crypt_to64 (ngx_crypt.c:168)
==10470==    by 0x43648E: ngx_crypt (ngx_crypt.c:153)
==10470==    by 0x489D8B: ngx_http_auth_basic_crypt_handler (ngx_http_auth_basic_module.c:297)
==10470==    by 0x48A24A: ngx_http_auth_basic_handler (ngx_http_auth_basic_module.c:240)
==10470==    by 0x44EAB9: ngx_http_core_access_phase (ngx_http_core_module.c:1121)
==10470==    by 0x44A822: ngx_http_core_run_phases (ngx_http_core_module.c:895)
==10470==    by 0x44A932: ngx_http_handler (ngx_http_core_module.c:878)
==10470==    by 0x455EEF: ngx_http_process_request (ngx_http_request.c:1852)
==10470==    by 0x456527: ngx_http_process_request_headers (ngx_http_request.c:1283)
==10470==    by 0x456A91: ngx_http_process_request_line (ngx_http_request.c:964)
==10470==    by 0x457097: ngx_http_wait_request_handler (ngx_http_request.c:486)
==10470==    by 0x4411EE: ngx_epoll_process_events (ngx_epoll_module.c:691)
==10470==  Address 0x5866fab is 0 bytes after a block of size 27 alloc'd
==10470==    at 0x4A074CD: malloc (vg_replace_malloc.c:236)
==10470==    by 0x43B251: ngx_alloc (ngx_alloc.c:22)
==10470==    by 0x421B0D: ngx_malloc (ngx_palloc.c:119)
==10470==    by 0x421B65: ngx_pnalloc (ngx_palloc.c:147)
==10470==    by 0x436368: ngx_crypt (ngx_crypt.c:140)
==10470==    by 0x489D8B: ngx_http_auth_basic_crypt_handler (ngx_http_auth_basic_module.c:297)
==10470==    by 0x48A24A: ngx_http_auth_basic_handler (ngx_http_auth_basic_module.c:240)
==10470==    by 0x44EAB9: ngx_http_core_access_phase (ngx_http_core_module.c:1121)
==10470==    by 0x44A822: ngx_http_core_run_phases (ngx_http_core_module.c:895)
==10470==    by 0x44A932: ngx_http_handler (ngx_http_core_module.c:878)
==10470==    by 0x455EEF: ngx_http_process_request (ngx_http_request.c:1852)
==10470==    by 0x456527: ngx_http_process_request_headers (ngx_http_request.c:1283)
==10470==

12 years agoProxy: added the "proxy_ssl_protocols" directive.
Andrei Belov [Thu, 19 Sep 2013 14:30:33 +0000 (18:30 +0400)]
Proxy: added the "proxy_ssl_protocols" directive.

12 years agoSSL: fixed possible memory and file descriptor leak on HUP signal.
Piotr Sikora [Wed, 18 Sep 2013 23:51:30 +0000 (16:51 -0700)]
SSL: fixed possible memory and file descriptor leak on HUP signal.

The problem appeared in 386a06a22c40 (1.3.7).

Signed-off-by: Piotr Sikora <piotr@cloudflare.com>
12 years agoMIME: added application/json MIME type.
Piotr Sikora [Wed, 18 Sep 2013 19:59:47 +0000 (12:59 -0700)]
MIME: added application/json MIME type.

Signed-off-by: Piotr Sikora <piotr@cloudflare.com>
12 years agoFixed response line formatting with empty reason phrase.
Sergey Kandaurov [Wed, 18 Sep 2013 14:53:26 +0000 (18:53 +0400)]
Fixed response line formatting with empty reason phrase.

As per RFC 2616 sec 6.1 the response status code is always followed by SP.

12 years agoVersion bump.
Sergey Kandaurov [Wed, 18 Sep 2013 14:53:24 +0000 (18:53 +0400)]
Version bump.

12 years agorelease-1.5.5 tag
Maxim Dounin [Tue, 17 Sep 2013 13:31:00 +0000 (17:31 +0400)]
release-1.5.5 tag

12 years agonginx-1.5.5-RELEASE release-1.5.5
Maxim Dounin [Tue, 17 Sep 2013 13:31:00 +0000 (17:31 +0400)]
nginx-1.5.5-RELEASE

12 years agoSSL: guard use of SSL_OP_MSIE_SSLV2_RSA_PADDING.
Piotr Sikora [Mon, 16 Sep 2013 21:24:38 +0000 (14:24 -0700)]
SSL: guard use of SSL_OP_MSIE_SSLV2_RSA_PADDING.

This option had no effect since 0.9.7h / 0.9.8b and it was removed
in recent OpenSSL.

Signed-off-by: Piotr Sikora <piotr@cloudflare.com>
12 years agoImproved check for duplicate path names in ngx_add_path().
Valentin Bartenev [Mon, 16 Sep 2013 14:49:23 +0000 (18:49 +0400)]
Improved check for duplicate path names in ngx_add_path().

The same path names with different "data" context should not be allowed.

In particular it rejects configurations like this:

    proxy_cache_path /var/cache/ keys_zone=one:10m max_size=1g inactive=5m;
    proxy_cache_path /var/cache/ keys_zone=two:20m max_size=4m inactive=30s;

12 years agoRemoved surplus initializations from ngx_conf_set_path_slot().
Valentin Bartenev [Mon, 16 Sep 2013 14:49:22 +0000 (18:49 +0400)]
Removed surplus initializations from ngx_conf_set_path_slot().

An instance of ngx_path_t is already zeroed by ngx_pcalloc().

12 years agoUse ngx_pcalloc() in ngx_conf_merge_path_value().
Valentin Bartenev [Mon, 16 Sep 2013 14:49:10 +0000 (18:49 +0400)]
Use ngx_pcalloc() in ngx_conf_merge_path_value().

It initializes the "data" pointer of ngx_path_t that will be checked after
subsequent changes.

12 years agoUse EPOLLRDHUP in ngx_http_test_reading() (ticket #320).
Valentin Bartenev [Mon, 16 Sep 2013 14:33:39 +0000 (18:33 +0400)]
Use EPOLLRDHUP in ngx_http_test_reading() (ticket #320).

This allows to detect client connection close with pending data when
the ngx_http_test_reading() request event handler is set.

12 years agoUpstream: use EPOLLRDHUP to check broken connections (ticket #320).
Valentin Bartenev [Mon, 16 Sep 2013 14:33:39 +0000 (18:33 +0400)]
Upstream: use EPOLLRDHUP to check broken connections (ticket #320).

This allows to detect client connection close with pending data on Linux
while processing upstream.

12 years agoEvents: support for EPOLLRDHUP (ticket #320).
Valentin Bartenev [Fri, 12 Jul 2013 10:51:07 +0000 (14:51 +0400)]
Events: support for EPOLLRDHUP (ticket #320).

Since Linux 2.6.17, epoll is able to report about peer half-closed connection
using special EPOLLRDHUP flag on a read event.

12 years agoEvents: removed unused flags from the ngx_event_s structure.
Valentin Bartenev [Thu, 5 Sep 2013 12:53:02 +0000 (16:53 +0400)]
Events: removed unused flags from the ngx_event_s structure.

They are not used since 708f8bb772ec (pre 0.0.1).

12 years agoFixed handling of the ready flag with kqueue.
Valentin Bartenev [Thu, 5 Sep 2013 12:53:02 +0000 (16:53 +0400)]
Fixed handling of the ready flag with kqueue.

There is nothing to do more when recv() has returned 0,
so we should drop the flag.

12 years agoReturn reason phrase for 414.
Valentin Bartenev [Tue, 3 Sep 2013 17:07:19 +0000 (21:07 +0400)]
Return reason phrase for 414.

After 62be77b0608f nginx can return this code.

12 years agoUpstream: fixed $upstream_response_time format specifiers.
Maxim Dounin [Wed, 4 Sep 2013 17:30:09 +0000 (21:30 +0400)]
Upstream: fixed $upstream_response_time format specifiers.

12 years agoConfigure: TCP_KEEPIDLE test name simplified.
Maxim Dounin [Wed, 4 Sep 2013 17:17:05 +0000 (21:17 +0400)]
Configure: TCP_KEEPIDLE test name simplified.

12 years agoConfigure: fixed building with Sun C if CFLAGS set (ticket #65).
Maxim Dounin [Wed, 4 Sep 2013 17:17:03 +0000 (21:17 +0400)]
Configure: fixed building with Sun C if CFLAGS set (ticket #65).

12 years agoSSL: clear error queue after SSL_CTX_load_verify_locations().
Maxim Dounin [Wed, 4 Sep 2013 17:17:02 +0000 (21:17 +0400)]
SSL: clear error queue after SSL_CTX_load_verify_locations().

The SSL_CTX_load_verify_locations() may leave errors in the error queue
while returning success (e.g. if there are duplicate certificates in the file
specified), resulting in "ignoring stale global SSL error" alerts later
at runtime.

12 years agoFixed incorrect response line on "return 203".
Maxim Dounin [Wed, 4 Sep 2013 17:17:01 +0000 (21:17 +0400)]
Fixed incorrect response line on "return 203".

Reported by Weibin Yao,
http://mailman.nginx.org/pipermail/nginx-devel/2013-April/003607.html.

12 years agoRequest cleanup code unified, no functional changes.
Maxim Dounin [Wed, 4 Sep 2013 17:17:00 +0000 (21:17 +0400)]
Request cleanup code unified, no functional changes.

Additionally, detaching a cleanup chain from a request is a bit more resilent
to various bugs if any.

12 years agoHandling of ngx_int_t != intptr_t case.
Maxim Dounin [Wed, 4 Sep 2013 17:16:59 +0000 (21:16 +0400)]
Handling of ngx_int_t != intptr_t case.

Casts between pointers and integers produce warnings on size mismatch.  To
silence them, cast to (u)intptr_t should be used.  Prevoiusly, casts to
ngx_(u)int_t were used in some cases, and several ngx_int_t expressions had
no casts.

As of now it's mostly style as ngx_int_t is defined as intptr_t.

12 years agoWin32: $request_time fixed.
Maxim Dounin [Wed, 4 Sep 2013 16:48:30 +0000 (20:48 +0400)]
Win32: $request_time fixed.

On win32, time_t is 64 bits wide by default, and passing an ngx_msec_int_t
argument for %T format specifier doesn't work.  This doesn't manifest itself
on other platforms as time_t and ngx_msec_int_t are usually of the same size.

12 years agoWin32: MinGW GCC compatibility.
Maxim Dounin [Wed, 4 Sep 2013 16:48:28 +0000 (20:48 +0400)]
Win32: MinGW GCC compatibility.

Several warnings silenced, notably (ngx_socket_t) -1 is now checked
on socket operations instead of -1, as ngx_socket_t is unsigned on win32
and gcc complains on comparison.

With this patch, it's now possible to compile nginx using mingw gcc,
with options we normally compile on win32.

12 years agoWin32: Borland C compatibility fixes.
Maxim Dounin [Wed, 4 Sep 2013 16:48:23 +0000 (20:48 +0400)]
Win32: Borland C compatibility fixes.

Several false positive warnings silenced, notably W8012 "Comparing
signed and unsigned" (due to u_short values promoted to int), and
W8072 "Suspicious pointer arithmetic" (due to large type values added
to pointers).

With this patch, it's now again possible to compile nginx using bcc32,
with options we normally compile on win32 minus ipv6 and ssl.

12 years agoWin32: Open Watcom C compatibility fixes.
Maxim Dounin [Wed, 4 Sep 2013 16:48:22 +0000 (20:48 +0400)]
Win32: Open Watcom C compatibility fixes.

Precompiled headers are disabled as they lead to internal compiler errors
with long configure lines.  Couple of false positive warnings silenced.
Various win32 typedefs are adjusted to work with Open Watcom C 1.9 headers.

With this patch, it's now again possible to compile nginx using owc386,
with options we normally compile on win32 minus ipv6 and ssl.

12 years agoDisable symlinks: removed recursive call of ngx_file_o_path_info().
Valentin Bartenev [Mon, 2 Sep 2013 16:06:03 +0000 (20:06 +0400)]
Disable symlinks: removed recursive call of ngx_file_o_path_info().

It is surplus.

12 years agoDisable symlinks: use O_PATH to open path components.
Valentin Bartenev [Mon, 2 Sep 2013 04:07:59 +0000 (08:07 +0400)]
Disable symlinks: use O_PATH to open path components.

It was introduced in Linux 2.6.39, glibc 2.14 and allows to obtain
file descriptors without actually opening files.  Thus made it possible
to traverse path with openat() syscalls without the need to have read
permissions for path components.  It is effectively emulates O_SEARCH
which is missing on Linux.

O_PATH is used in combination with O_RDONLY.  The last one is ignored
if O_PATH is used, but it allows nginx to not fail when it was built on
modern system (i.e. glibc 2.14+) and run with a kernel older than 2.6.39.
Then O_PATH is unknown to the kernel and ignored, while O_RDONLY is used.

Sadly, fstat() is not working with O_PATH descriptors till Linux 3.6.
As a workaround we fallback to fstatat() with the AT_EMPTY_PATH flag
that was introduced at the same time as O_PATH.

12 years agoAdded the NGX_EBADF define.
Valentin Bartenev [Mon, 2 Sep 2013 04:07:44 +0000 (08:07 +0400)]
Added the NGX_EBADF define.

12 years agoAssume the HTTP/1.0 version by default.
Valentin Bartenev [Sun, 1 Sep 2013 23:45:14 +0000 (03:45 +0400)]
Assume the HTTP/1.0 version by default.

It is believed to be better than fallback to HTTP/0.9, because most of
the clients at present time support HTTP/1.0.  It allows nginx to return
error response code for them in cases when it fail to parse request line,
and therefore fail to detect client protocol version.

Even if the client does not support HTTP/1.0, this assumption should not
cause any harm, since from the HTTP/0.9 point of view it still a valid
response.

12 years agoUpstream: setting u->header_sent before ngx_http_upstream_upgrade().
Maxim Dounin [Fri, 30 Aug 2013 17:44:16 +0000 (21:44 +0400)]
Upstream: setting u->header_sent before ngx_http_upstream_upgrade().

Without u->header_sent set a special response might be generated following
an upgraded connection.  The problem appeared in 1ccdda1f37f3 (1.5.3).
Catched by "header already sent" alerts in 1.5.4 after upstream timeouts.

12 years agoReferer: fixed hostname buffer overflow check.
Valentin Bartenev [Thu, 29 Aug 2013 18:35:54 +0000 (22:35 +0400)]
Referer: fixed hostname buffer overflow check.

Because of premature check the effective buffer size was 255 symbols
while the buffer is able to handle 256.

12 years agoReferer: "server_names" parsing deferred to merge phase.
Sergey Kandaurov [Thu, 29 Aug 2013 18:35:27 +0000 (22:35 +0400)]
Referer: "server_names" parsing deferred to merge phase.

This allows to approach "server_name" values specified below the
"valid_referers" directive when used within the "server_names" parameter, e.g.:

    server_name  example.org;
    valid_referers server_names;
    server_name  example.com;

As a bonus, this fixes bogus error with "server_names" specified several times.

12 years agoReferer: fixed server_name regex matching.
Sergey Kandaurov [Thu, 29 Aug 2013 18:35:26 +0000 (22:35 +0400)]
Referer: fixed server_name regex matching.

The server_name regexes are normally compiled for case-sensitive matching.
This violates case-insensitive obligations in the referer module.  To fix
this, the host string is converted to lower case before matching.

Previously server_name regex was executed against the whole referer string
after dropping the scheme part.  This could led to an improper matching, e.g.:

    server_name ~^localhost$;
    valid_referers server_names;

    Referer: http://localhost/index.html

It was changed to look only at the hostname part.

The server_name regexes are separated into another array to not clash with
regular regexes.

12 years agoReferer: fixed error type usage inconsistency for ngx_http_add*().
Sergey Kandaurov [Thu, 29 Aug 2013 18:35:26 +0000 (22:35 +0400)]
Referer: fixed error type usage inconsistency for ngx_http_add*().

12 years agoImage filter: large image handling.
Lanshun Zhou [Tue, 27 Aug 2013 16:19:07 +0000 (00:19 +0800)]
Image filter: large image handling.

If Content-Length header is not set, and the image size is larger than the
buffer size, client will hang until a timeout occurs.

Now NGX_HTTP_UNSUPPORTED_MEDIA_TYPE is returned immediately.

diff -r d1403de41631 -r 4fae04f332b4
src/http/modules/ngx_http_image_filter_module.c

12 years agoTypo fixed.
Maxim Dounin [Tue, 27 Aug 2013 22:34:30 +0000 (02:34 +0400)]
Typo fixed.

12 years agoVersion bump.
Maxim Dounin [Tue, 27 Aug 2013 22:34:21 +0000 (02:34 +0400)]
Version bump.

12 years agorelease-1.5.4 tag
Maxim Dounin [Tue, 27 Aug 2013 13:37:15 +0000 (17:37 +0400)]
release-1.5.4 tag

12 years agonginx-1.5.4-RELEASE release-1.5.4
Maxim Dounin [Tue, 27 Aug 2013 13:37:15 +0000 (17:37 +0400)]
nginx-1.5.4-RELEASE

12 years agoUpdated PCRE used for win32 builds.
Maxim Dounin [Fri, 23 Aug 2013 18:54:08 +0000 (22:54 +0400)]
Updated PCRE used for win32 builds.

As of PCRE 8.33, config.h.generic no longer contains boolean macros.  Two
of them (SUPPORT_PCRE8 and HAVE_MEMMOVE) were added to appropriate makefiles.
This allows PCRE 8.33 to compile and don't change anything for previous
versions.

12 years agoConfigure: pcre.lib dependencies fix.
Maxim Dounin [Fri, 23 Aug 2013 18:53:54 +0000 (22:53 +0400)]
Configure: pcre.lib dependencies fix.

Previously, an attempt to build pcre.lib on win32 before anything else
failed due to no pcre.h.

12 years agoCache: lock timeouts are now logged at info level.
Maxim Dounin [Fri, 23 Aug 2013 18:18:54 +0000 (22:18 +0400)]
Cache: lock timeouts are now logged at info level.

12 years agoUpstream: posted requests handling after ssl handshake errors.
Maxim Dounin [Fri, 23 Aug 2013 18:18:46 +0000 (22:18 +0400)]
Upstream: posted requests handling after ssl handshake errors.

Missing call to ngx_http_run_posted_request() resulted in a main request hang
if subrequest's ssl handshake with an upstream server failed for some reason.

Reported by Aviram Cohen.

12 years agoFixed try_files with empty argument (ticket #390).
Maxim Dounin [Fri, 23 Aug 2013 18:18:39 +0000 (22:18 +0400)]
Fixed try_files with empty argument (ticket #390).

12 years agoMIME: eot MIME type updated to follow IANA (ticket #306).
Sergey Kandaurov [Fri, 23 Aug 2013 12:24:24 +0000 (16:24 +0400)]
MIME: eot MIME type updated to follow IANA (ticket #306).

12 years agoMIME: added the most common OOXML MIME types (ticket #243).
Sergey Kandaurov [Fri, 23 Aug 2013 12:24:24 +0000 (16:24 +0400)]
MIME: added the most common OOXML MIME types (ticket #243).

12 years agoMIME: added application/font-woff MIME type (ticket #292).
Sergey Kandaurov [Fri, 23 Aug 2013 12:24:23 +0000 (16:24 +0400)]
MIME: added application/font-woff MIME type (ticket #292).

12 years agoAdded auth request to win32 builds.
Maxim Dounin [Wed, 21 Aug 2013 16:46:10 +0000 (20:46 +0400)]
Added auth request to win32 builds.

12 years agoAdded safety belt for the case of sending header twice.
Sergey Kandaurov [Tue, 30 Jul 2013 11:04:46 +0000 (15:04 +0400)]
Added safety belt for the case of sending header twice.

The aforementioned situation is abnormal per se and as such it now forces
request termination with appropriate error message.

12 years agoAutoindex: improved ngx_de_info() error handling.
Sergey Kandaurov [Tue, 30 Jul 2013 07:43:21 +0000 (11:43 +0400)]
Autoindex: improved ngx_de_info() error handling.

This allows to build a directory listing whenever a loop exists in symbolic
link resolution of the path argument.

12 years agoAutoindex: return NGX_ERROR on error if headers were sent.
Sergey Kandaurov [Tue, 30 Jul 2013 07:43:21 +0000 (11:43 +0400)]
Autoindex: return NGX_ERROR on error if headers were sent.

This prevents ngx_http_finalize_request() from issuing
ngx_http_special_response_handler() on a freed context.

12 years agoStyle improved after 12dd27b74117.
Maxim Dounin [Tue, 20 Aug 2013 17:33:43 +0000 (21:33 +0400)]
Style improved after 12dd27b74117.

12 years agoBacked out f1a91825730a and 7094bd12c1ff.
Maxim Dounin [Tue, 20 Aug 2013 17:11:19 +0000 (21:11 +0400)]
Backed out f1a91825730a and 7094bd12c1ff.

While ngx_get_full_name() might have a bit more descriptive arguments,
the ngx_conf_full_name() is generally easier to use when parsing
configuration and limits exposure of cycle->prefix / cycle->conf_prefix
details.

12 years agoAuth request module import.
Maxim Dounin [Wed, 21 Aug 2013 15:19:47 +0000 (19:19 +0400)]
Auth request module import.

12 years agoMinor ngx_http_parse_request_line() optimization.
Maxim Dounin [Wed, 21 Aug 2013 08:51:31 +0000 (12:51 +0400)]
Minor ngx_http_parse_request_line() optimization.

Noted by Nils Kuhnhenn.

12 years agoFormat specifier fixes in error logging.
Sergey Kandaurov [Tue, 20 Aug 2013 16:47:16 +0000 (20:47 +0400)]
Format specifier fixes in error logging.

12 years agoWhitespace fix.
Maxim Dounin [Sat, 17 Aug 2013 12:54:55 +0000 (16:54 +0400)]
Whitespace fix.

12 years agoSPDY: alert about activated fake events instead of deleting them.
Valentin Bartenev [Thu, 15 Aug 2013 15:16:12 +0000 (19:16 +0400)]
SPDY: alert about activated fake events instead of deleting them.

They refer to the same socket descriptor as our real connection, and
deleting them will stop processing of the connection.

Events of fake connections must not be activated, and if it happened there
is nothing we can do.  The whole processing should be terminated as soon as
possible, but it is not obvious how to do this safely.

12 years agoSPDY: do not reject headers with empty value (ticket #396).
Valentin Bartenev [Thu, 15 Aug 2013 15:16:09 +0000 (19:16 +0400)]
SPDY: do not reject headers with empty value (ticket #396).

A quote from SPDY draft 2 specification: "The length of each name and
value must be greater than zero.  A receiver of a zero-length name or
value must send a RST_STREAM with code PROTOCOL error."

But it appears that Chrome browser allows sending requests over SPDY/2
connection using JavaScript that contain headers with empty values.

For better compatibility across SPDY clients and to be compliant with
HTTP, such headers are no longer rejected.

Also, it is worth noting that in SPDY draft 3 the statement has been
changed so that it permits empty values for headers.

12 years agoSPDY: fixed corruption of headers with names longer than 255.
Valentin Bartenev [Thu, 15 Aug 2013 15:14:58 +0000 (19:14 +0400)]
SPDY: fixed corruption of headers with names longer than 255.

It is a bad idea to put zero byte in position where the length of
the next header name can be stored before it was parsed.

12 years agoUnbreak building on Linux without sendfile64() support.
Valentin Bartenev [Thu, 15 Aug 2013 15:14:33 +0000 (19:14 +0400)]
Unbreak building on Linux without sendfile64() support.

It was broken in 8e446a2daf48 when the NGX_SENDFILE_LIMIT constant was added
to ngx_linux_sendfile_chain.c having the same name as already defined one in
ngx_linux_config.h.

The newer is needed to overcome a bug in old Linux kernels by limiting the
number of bytes to send per sendfile() syscall.  The older is used with
sendfile() on ancient kernels that works with 32-bit offsets only.

One of these renamed to NGX_SENDFILE_MAXSIZE.

12 years agoReferer module: fixed regex matching against HTTPS referers.
Sergey Kandaurov [Tue, 13 Aug 2013 13:47:04 +0000 (17:47 +0400)]
Referer module: fixed regex matching against HTTPS referers.

When matching a compiled regex against value in the "Referer" header field,
the length was calculated incorrectly for strings that start from "https://".
This might cause matching to fail for regexes with end-of-line anchors.

Patch by Liangbin Li.

12 years agoDon't lose pointer to first nonempty buf in ngx_*_sendfile_chain().
Gleb Smirnoff [Thu, 8 Aug 2013 11:06:39 +0000 (15:06 +0400)]
Don't lose pointer to first nonempty buf in ngx_*_sendfile_chain().

In ngx_*_sendfile_chain() when calculating pointer to a first
non-zero sized buf, use "in" as iterator.  This fixes processing
of zero sized buf(s) after EINTR.  Otherwise function can return
zero sized buf to caller, and later ngx_http_write_filter()
logs warning.

12 years agoFixed misleading example SSL config.
Sergey Budnevitch [Wed, 7 Aug 2013 16:01:43 +0000 (20:01 +0400)]
Fixed misleading example SSL config.

a) ssl as listen parameter is preferable.
b) ssl_protocols defaults are better because they do not forbid TLS versions
   1.1 and 1.2.
c) ssl_session_timeout has sense only with SSL cache.

12 years agoAPI change: removed the ngx_conf_full_name() function.
Valentin Bartenev [Tue, 6 Aug 2013 15:58:40 +0000 (19:58 +0400)]
API change: removed the ngx_conf_full_name() function.

The ngx_get_full_name() should be used instead.

12 years agoReplaced ngx_conf_full_name() with ngx_get_full_name().
Valentin Bartenev [Tue, 6 Aug 2013 15:58:40 +0000 (19:58 +0400)]
Replaced ngx_conf_full_name() with ngx_get_full_name().

The ngx_get_full_name() function takes more readable arguments list.

12 years agoFixed memory leaks in the root and auth_basic_user_file directives.
Valentin Bartenev [Tue, 6 Aug 2013 15:58:40 +0000 (19:58 +0400)]
Fixed memory leaks in the root and auth_basic_user_file directives.

If a relative path is set by variables, then the ngx_conf_full_name()
function was called while processing requests, which causes allocations
from the cycle pool.

A new function that takes pool as an argument was introduced.

12 years agoImage filter: use "application/json" MIME type for JSON output.
Valentin Bartenev [Mon, 5 Aug 2013 10:30:03 +0000 (14:30 +0400)]
Image filter: use "application/json" MIME type for JSON output.

As it is defined by RFC 4627, and allows for various browser tools like
JSONView to display JSON well-formatted.

12 years agoCore: guard use of AI_ADDRCONFIG.
Ruslan Ermilov [Mon, 5 Aug 2013 09:44:56 +0000 (13:44 +0400)]
Core: guard use of AI_ADDRCONFIG.

Some systems (notably NetBSD and OpenBSD) lack AI_ADDRCONFIG support.

Reported by Piotr Sikora.

12 years agoFixed build with signed socklen_t and unix sockets.
Maxim Dounin [Mon, 5 Aug 2013 07:40:33 +0000 (11:40 +0400)]
Fixed build with signed socklen_t and unix sockets.

This seems to be the case at least under Cygwin, where build was broken
by 05ba5bce31e0 (1.5.3).

Reported by Kevin Worthington,
http://mailman.nginx.org/pipermail/nginx/2013-August/040028.html.

12 years agoCore: only resolve address families configured on the local system.
Ruslan Ermilov [Mon, 5 Aug 2013 06:55:59 +0000 (10:55 +0400)]
Core: only resolve address families configured on the local system.

This is done by passing AI_ADDRCONFIG to getaddrinfo().

On Linux, setting net.ipv6.conf.all.disable_ipv6 to 1 will now be
respected.

On FreeBSD, AI_ADDRCONFIG filtering is currently implemented by
attempting to create a datagram socket for the corresponding family,
which succeeds even if the system doesn't in fact have any addresses
of that family configured.  That is, if the system with IPv6 support
in the kernel doesn't have IPv6 addresses configured, AI_ADDRCONFIG
will filter out IPv6 only inside a jail without IPv6 addresses or
with IPv6 disabled.

12 years agoMIME: use "application/javascript" for .js files.
Valentin Bartenev [Wed, 31 Jul 2013 19:40:46 +0000 (23:40 +0400)]
MIME: use "application/javascript" for .js files.

Though there are several MIME types commonly used for JavaScript nowadays,
the most common being "text/javascript", "application/javascript", and
currently used by nginx "application/x-javascript", RFC 4329 prefers
"application/javascript".

The "charset_types" directive's default value was adjusted accordingly.

12 years agoVersion bump.
Sergey Kandaurov [Wed, 31 Jul 2013 14:35:57 +0000 (18:35 +0400)]
Version bump.

12 years agoConfigure: fixed autotest cleanup commands.
Sergey Kandaurov [Wed, 31 Jul 2013 14:16:40 +0000 (18:16 +0400)]
Configure: fixed autotest cleanup commands.

Previously, if configured with --with-cc="clang -g", the autotest.dSYM
directories were left unremoved.

12 years agorelease-1.5.3 tag
Maxim Dounin [Tue, 30 Jul 2013 13:27:55 +0000 (17:27 +0400)]
release-1.5.3 tag

12 years agonginx-1.5.3-RELEASE release-1.5.3
Maxim Dounin [Tue, 30 Jul 2013 13:27:55 +0000 (17:27 +0400)]
nginx-1.5.3-RELEASE

12 years agoPerl: fixed syntax usage for C preprocessor directives.
Sergey Kandaurov [Mon, 29 Jul 2013 13:30:01 +0000 (17:30 +0400)]
Perl: fixed syntax usage for C preprocessor directives.

As per perlxs, C preprocessor directives should be at the first
non-whitespace of a line to avoid interpreting them as comments.

#if and #endif are moved so that there are no blank lines before them
to retain them as part of the function body.

12 years agoUpstream: reliably detect connection failures with SSL peers.
Ruslan Ermilov [Mon, 29 Jul 2013 09:23:16 +0000 (13:23 +0400)]
Upstream: reliably detect connection failures with SSL peers.

12 years agoUpstream: no last buffer on errors.
Maxim Dounin [Thu, 25 Jul 2013 11:00:41 +0000 (15:00 +0400)]
Upstream: no last buffer on errors.

Previously, after sending a header we always sent a last buffer and
finalized a request with code 0, even in case of errors.  In some cases
this resulted in a loss of ability to detect the response wasn't complete
(e.g. if Content-Length was removed from a response by gzip filter).

This change tries to propogate to a client information that a response
isn't complete in such cases.  In particular, with this change we no longer
pretend a returned response is complete if we wasn't able to create
a temporary file.

If an error code suggests the error wasn't fatal, we flush buffered data
and disable keepalive, then finalize request normally.  This allows to to
propogate information about a problem to a client, while still sending all
the data we've got from an upstream.

12 years agoUpstream: request finalization rework.
Maxim Dounin [Thu, 25 Jul 2013 11:00:29 +0000 (15:00 +0400)]
Upstream: request finalization rework.

No semantic changes expected, though some checks are done differently.
In particular, the r->cached flag is no longer explicitly checked.  Instead,
we relay on u->header_sent not being set if a response is sent from
a cache.

12 years agoUpstream: NGX_HTTP_CLIENT_CLOSED_REQUEST no longer reset to 0.
Maxim Dounin [Thu, 25 Jul 2013 11:00:25 +0000 (15:00 +0400)]
Upstream: NGX_HTTP_CLIENT_CLOSED_REQUEST no longer reset to 0.

The NGX_HTTP_CLIENT_CLOSED_REQUEST code is allowed to happen after we
started sending a response (much like NGX_HTTP_REQUEST_TIME_OUT), so there
is no need to reset response code to 0 in this case.