]> git.kaiwu.me - nginx.git/log
nginx.git
11 years agoUpstream: fix $upstream_cache_last_modified variable.
Piotr Sikora [Wed, 1 Oct 2014 22:48:53 +0000 (15:48 -0700)]
Upstream: fix $upstream_cache_last_modified variable.

Due to the u->headers_in.last_modified_time not being correctly initialized,
this variable was evaluated to "Thu, 01 Jan 1970 00:00:00 GMT" for responses
cached without the "Last-Modified" header which resulted in subsequent proxy
requests being sent with "If-Modified-Since: Thu, 01 Jan 1970 00:00:00 GMT"
header.

Signed-off-by: Piotr Sikora <piotr@cloudflare.com>
11 years agoFixed counting of sent bytes in the send chain functions on EINTR.
Valentin Bartenev [Wed, 27 Aug 2014 16:51:01 +0000 (20:51 +0400)]
Fixed counting of sent bytes in the send chain functions on EINTR.

Previously, a value of the "send" variable wasn't properly adjusted
in a rare case when syscall was interrupted by a signal.  As a result,
these functions could send less data than the limit allows.

11 years agoVersion bump.
Valentin Bartenev [Thu, 2 Oct 2014 18:36:27 +0000 (22:36 +0400)]
Version bump.

11 years agorelease-1.7.6 tag
Maxim Dounin [Tue, 30 Sep 2014 13:20:33 +0000 (17:20 +0400)]
release-1.7.6 tag

11 years agonginx-1.7.6-RELEASE release-1.7.6
Maxim Dounin [Tue, 30 Sep 2014 13:20:32 +0000 (17:20 +0400)]
nginx-1.7.6-RELEASE

11 years agoUpstream keepalive: reset c->sent on cached connections.
Maxim Dounin [Mon, 29 Sep 2014 18:27:45 +0000 (22:27 +0400)]
Upstream keepalive: reset c->sent on cached connections.

The c->sent is reset to 0 on each request by server-side http code,
so do the same on client side.  This allows to count number of bytes
sent in a particular request.

11 years agoLimit req: reduced number of parameters in the lookup function.
Valentin Bartenev [Wed, 24 Sep 2014 17:55:19 +0000 (21:55 +0400)]
Limit req: reduced number of parameters in the lookup function.

No functional changes.

11 years agoLimit req: use complex value in limit_req_zone.
Valentin Bartenev [Wed, 24 Sep 2014 17:55:19 +0000 (21:55 +0400)]
Limit req: use complex value in limit_req_zone.

One intentional side effect of this change is that key is allowed only
in the first position.  Previously, it was possible to specify the key
variable at any position, but that was never documented, and is contrary
with nginx configuration practice for positional parameters.

11 years agoLimit conn: aligned field names in structures.
Valentin Bartenev [Wed, 24 Sep 2014 17:55:19 +0000 (21:55 +0400)]
Limit conn: aligned field names in structures.

No functional changes.

11 years agoLimit conn: use complex value in limit_conn_zone (ticket #121).
Valentin Bartenev [Wed, 24 Sep 2014 17:55:19 +0000 (21:55 +0400)]
Limit conn: use complex value in limit_conn_zone (ticket #121).

One intentional side effect of this change is that key is allowed only
in the first position.  Previously, it was possible to specify the key
variable at any position, but that was never documented, and is contrary
to nginx configuration practice for positional parameters.

11 years agoLimit conn: removed deprecated "limit_zone" directive.
Valentin Bartenev [Wed, 24 Sep 2014 17:55:19 +0000 (21:55 +0400)]
Limit conn: removed deprecated "limit_zone" directive.

It's deprecated since 260d591cb6a3 (1.1.8).  The "limit_conn_zone" directive
should be used instead.

11 years agoSyslog: improved error handling of unix domain sockets.
Vladimir Homutov [Tue, 26 Aug 2014 10:56:54 +0000 (14:56 +0400)]
Syslog: improved error handling of unix domain sockets.

If a syslog daemon is restarted and the unix socket is used, further logging
might stop to work.  In case of send error, socket is closed, forcing
a reconnection at the next logging attempt.

11 years agoSyslog: enabled logging of send errors.
Vladimir Homutov [Mon, 1 Sep 2014 13:55:07 +0000 (17:55 +0400)]
Syslog: enabled logging of send errors.

The ngx_cycle->log is used when sending the message.  This allows to log syslog
send errors in another log.

Logging to syslog after its cleanup handler has been executed was prohibited.
Previously, this was possible from ngx_destroy_pool(), which resulted in error
messages caused by attempts to write into the closed socket.

The "processing" flag is renamed to "busy" to better match its semantics.

11 years agoAvoided to add duplicate hash key in ngx_http_types_slot().
Gu Feng [Wed, 17 Sep 2014 14:52:02 +0000 (22:52 +0800)]
Avoided to add duplicate hash key in ngx_http_types_slot().

11 years agoRemoved duplicate initialization of the "rev" variable.
Valentin Bartenev [Mon, 22 Sep 2014 15:48:23 +0000 (19:48 +0400)]
Removed duplicate initialization of the "rev" variable.

11 years agoGeneralized definitions of the number of preallocated iovec's.
Valentin Bartenev [Wed, 13 Aug 2014 11:11:45 +0000 (15:11 +0400)]
Generalized definitions of the number of preallocated iovec's.

No functional changes.

11 years agoReduced difference between the send chain functions.
Valentin Bartenev [Wed, 13 Aug 2014 11:11:45 +0000 (15:11 +0400)]
Reduced difference between the send chain functions.

No functional changes.  This follows the change from ad137a80919f.

11 years agoMerged implementations of ngx_readv_chain().
Valentin Bartenev [Wed, 13 Aug 2014 11:11:45 +0000 (15:11 +0400)]
Merged implementations of ngx_readv_chain().

There's no real need in two separate implementations,
with and without kqueue support.

11 years agoRemoved the "complete" variable from various send chain functions.
Valentin Bartenev [Wed, 13 Aug 2014 11:11:45 +0000 (15:11 +0400)]
Removed the "complete" variable from various send chain functions.

It was made redundant by the previous change, since the "sent" variable
is no longer modified.

11 years agoMoved the code for adjusting sent buffers in a separate function.
Valentin Bartenev [Wed, 13 Aug 2014 11:11:45 +0000 (15:11 +0400)]
Moved the code for adjusting sent buffers in a separate function.

11 years agoFixed writev() debug log message in ngx_darwin_sendfile_chain().
Valentin Bartenev [Wed, 13 Aug 2014 11:11:45 +0000 (15:11 +0400)]
Fixed writev() debug log message in ngx_darwin_sendfile_chain().

11 years agoUpstream: fixed file buffers reinit in ngx_http_upstream_reinit().
Roman Arutyunyan [Thu, 18 Sep 2014 12:37:16 +0000 (16:37 +0400)]
Upstream: fixed file buffers reinit in ngx_http_upstream_reinit().

Previously, a file buffer start position was reset to the file start.
Now it's reset to the previous file buffer end.  This fixes
reinitialization of requests having multiple successive parts of a
single file.  Such requests are generated by fastcgi module.

11 years agoFastCGI: fixed start pointers in request buffers.
Roman Arutyunyan [Thu, 18 Sep 2014 12:37:14 +0000 (16:37 +0400)]
FastCGI: fixed start pointers in request buffers.

The start pointers are used in ngx_http_upstream_reinit() to
reinit FastCGI requests.

11 years agoLimit req: don't truncate key value to 255 bytes.
Valentin Bartenev [Tue, 16 Sep 2014 17:12:51 +0000 (21:12 +0400)]
Limit req: don't truncate key value to 255 bytes.

While the module allows to use values up to 65535 bytes as a key,
that actually never worked properly.

11 years agoVersion bump.
Valentin Bartenev [Wed, 17 Sep 2014 08:04:47 +0000 (12:04 +0400)]
Version bump.

11 years agorelease-1.7.5 tag
Maxim Dounin [Tue, 16 Sep 2014 12:19:03 +0000 (16:19 +0400)]
release-1.7.5 tag

11 years agonginx-1.7.5-RELEASE release-1.7.5
Maxim Dounin [Tue, 16 Sep 2014 12:19:03 +0000 (16:19 +0400)]
nginx-1.7.5-RELEASE

11 years agoUpdated OpenSSL used for win32 builds.
Maxim Dounin [Mon, 15 Sep 2014 14:03:49 +0000 (18:03 +0400)]
Updated OpenSSL used for win32 builds.

11 years agoSSL: session id context now includes certificate hash.
Maxim Dounin [Mon, 15 Sep 2014 13:59:47 +0000 (17:59 +0400)]
SSL: session id context now includes certificate hash.

This prevents inappropriate session reuse in unrelated server{}
blocks, while preserving ability to restore sessions on other servers
when using TLS Session Tickets.

Additionally, session context is now set even if there is no session cache
configured.  This is needed as it's also used for TLS Session Tickets.

Thanks to Antoine Delignat-Lavaud and Piotr Sikora.

11 years agoAccess log: fixed the "if=" parameter with buffering (ticket #625).
Valentin Bartenev [Sat, 13 Sep 2014 17:47:13 +0000 (21:47 +0400)]
Access log: fixed the "if=" parameter with buffering (ticket #625).

It might not work if there were more than one "access_log" directives
pointed to the same file and duplicate buffer parameters.

11 years agoUpstream: limited next_upstream time and tries (ticket #544).
Roman Arutyunyan [Fri, 12 Sep 2014 14:50:47 +0000 (18:50 +0400)]
Upstream: limited next_upstream time and tries (ticket #544).

The new directives {proxy,fastcgi,scgi,uwsgi,memcached}_next_upstream_tries
and {proxy,fastcgi,scgi,uwsgi,memcached}_next_upstream_timeout limit
the number of upstreams tried and the maximum time spent for these tries
when searching for a valid upstream.

11 years agoUpstream: included backup peers into peer.tries.
Roman Arutyunyan [Fri, 12 Sep 2014 14:50:46 +0000 (18:50 +0400)]
Upstream: included backup peers into peer.tries.

Since peer.tries is never reset it can now be limited if required.

11 years agoUpstream keepalive: removed "single" parameter remnants.
Maxim Dounin [Thu, 11 Sep 2014 16:09:04 +0000 (20:09 +0400)]
Upstream keepalive: removed "single" parameter remnants.

The "single" parameter is deprecated and ignored since 5b5c07dee156 (1.3.2).

11 years agoAdded warning about unset cache keys.
Maxim Dounin [Thu, 11 Sep 2014 16:08:52 +0000 (20:08 +0400)]
Added warning about unset cache keys.

In fastcgi, scgi and uwsgi modules there are no default cache keys, and
using a cache without a cache key set is likely meaningless.

11 years agoStyle.
Maxim Dounin [Thu, 11 Sep 2014 16:08:45 +0000 (20:08 +0400)]
Style.

11 years agoUpstream: avoided directly terminating the connection.
FengGu [Wed, 13 Aug 2014 06:53:55 +0000 (14:53 +0800)]
Upstream: avoided directly terminating the connection.

When memory allocation failed in ngx_http_upstream_cache(), the connection
would be terminated directly in ngx_http_upstream_init_request().
Return a INTERNAL_SERVER_ERROR response instead.

11 years agoAdded ngx_init_setproctitle() return code check.
Maxim Dounin [Mon, 8 Sep 2014 17:36:09 +0000 (21:36 +0400)]
Added ngx_init_setproctitle() return code check.

The ngx_init_setproctitle() function, as used on systems without
setproctitle(3), may fail due to memory allocation errors, and
therefore its return code needs to be checked.

Reported by Markus Linnala.

11 years agoFixed ETag memory allocation error handling.
Maxim Dounin [Mon, 8 Sep 2014 17:36:03 +0000 (21:36 +0400)]
Fixed ETag memory allocation error handling.

The etag->hash must be set to 0 to avoid an empty ETag header being
returned with the 500 Internal Server Error page after the memory
allocation failure.

Reported by Markus Linnala.

11 years agoCore: ngx_regex_compile() error handling fixes.
Maxim Dounin [Mon, 8 Sep 2014 17:35:53 +0000 (21:35 +0400)]
Core: ngx_regex_compile() error handling fixes.

Now we actually return NGX_ERROR on errors, and provide an error
string for memory allocation errors.

Reported by Markus Linnala.

11 years agoSSL: guard use of all SSL options for bug workarounds.
Piotr Sikora [Wed, 3 Sep 2014 21:49:55 +0000 (14:49 -0700)]
SSL: guard use of all SSL options for bug workarounds.

Some of the OpenSSL forks (read: BoringSSL) started removing unused,
no longer necessary and/or not really working bug workarounds along
with the SSL options and defines for them.

Instead of fixing nginx build after each removal, be proactive
and guard use of all SSL options for bug workarounds.

Signed-off-by: Piotr Sikora <piotr@cloudflare.com>
11 years agoUpstream: suppressed the file cache slab allocator error messages.
Roman Arutyunyan [Fri, 5 Sep 2014 14:14:59 +0000 (18:14 +0400)]
Upstream: suppressed the file cache slab allocator error messages.

The messages "ngx_slab_alloc() failed: no memory in cache keys zone"
from the file cache slab allocator are suppressed since the allocation
is likely to succeed after the forced expiration of cache nodes.
The second allocation failure is reported.

11 years agoEvents: processing of posted events changed from LIFO to FIFO.
Valentin Bartenev [Mon, 1 Sep 2014 14:20:18 +0000 (18:20 +0400)]
Events: processing of posted events changed from LIFO to FIFO.

In theory, this can provide a bit better distribution of latencies.

Also it simplifies the code, since ngx_queue_t is now used instead
of custom implementation.

11 years agoEvents: removed broken thread support from posted events.
Valentin Bartenev [Mon, 1 Sep 2014 14:20:03 +0000 (18:20 +0400)]
Events: removed broken thread support from posted events.

It's mostly dead code.  And the idea of thread support for this task has
been deprecated.

11 years agoMail: initialize the "signature" field of ngx_mail_session_t.
Valentin Bartenev [Mon, 1 Sep 2014 13:50:59 +0000 (17:50 +0400)]
Mail: initialize the "signature" field of ngx_mail_session_t.

Currently it isn't used, but it can be suitable to distinguish
objects stored in c->data.

11 years agoUpstream: improved configuration parser diagnostics.
Ruslan Ermilov [Mon, 1 Sep 2014 08:27:38 +0000 (12:27 +0400)]
Upstream: improved configuration parser diagnostics.

Made it clear when the selected balancing method does not
support certain parameters of the "server" directive.

11 years agoHeaders filter: "add_header" with "always" parameter (ticket #98).
Sergey Kandaurov [Fri, 29 Aug 2014 14:00:10 +0000 (18:00 +0400)]
Headers filter: "add_header" with "always" parameter (ticket #98).

If specified, the header field is set regardless of the status code.

11 years agoVariables: updated list of prefixes in ngx_http_rewrite_set().
Maxim Dounin [Wed, 27 Aug 2014 17:38:08 +0000 (21:38 +0400)]
Variables: updated list of prefixes in ngx_http_rewrite_set().

11 years agoVariables: fixed non-indexed access of prefix vars (ticket #600).
Maxim Dounin [Wed, 27 Aug 2014 17:38:04 +0000 (21:38 +0400)]
Variables: fixed non-indexed access of prefix vars (ticket #600).

Previously, a configuration like

    location / {
        ssi on;
        ssi_types *;
        set $http_foo "bar";
        return 200 '<!--#echo var="http_foo" -->\n';
    }

resulted in NULL pointer dereference in ngx_http_get_variable() as
the variable was explicitly added to the variables hash, but its
get_handler wasn't properly set in the hash.  Fix is to make sure
that get_handler is properly set by ngx_http_variables_init_vars().

11 years agoSPDY: added a comment about handling stream with the timer set.
Valentin Bartenev [Mon, 18 Aug 2014 09:23:45 +0000 (13:23 +0400)]
SPDY: added a comment about handling stream with the timer set.

11 years agoSPDY: avoid setting timeout on stream events in ngx_http_writer().
Valentin Bartenev [Wed, 27 Aug 2014 16:44:11 +0000 (20:44 +0400)]
SPDY: avoid setting timeout on stream events in ngx_http_writer().

The SPDY module doesn't expect timers can be set on stream events for reasons
other than delaying output.  But ngx_http_writer() could add timer on write
event if the delayed flag wasn't set and nginx is waiting for AIO completion.
That could cause delays in sending response over SPDY when file AIO was used.

11 years agoResolver: notify all waiting requests on timeout.
Ruslan Ermilov [Tue, 19 Aug 2014 11:43:26 +0000 (15:43 +0400)]
Resolver: notify all waiting requests on timeout.

If a "resolver_timeout" occurs, only the first waiting request
was notified.  Other requests may hang forever.

11 years agoStub status: corrected the "stub_status" directive.
Ruslan Ermilov [Tue, 26 Aug 2014 13:35:23 +0000 (17:35 +0400)]
Stub status: corrected the "stub_status" directive.

The "stub_status" directive does not require an argument.

11 years agoSub filter: fixed matching for a single character.
Valentin Bartenev [Mon, 25 Aug 2014 12:08:55 +0000 (16:08 +0400)]
Sub filter: fixed matching for a single character.

11 years agoMail: fixed number of arguments allowed in the listen directive.
Valentin Bartenev [Wed, 20 Aug 2014 09:13:27 +0000 (13:13 +0400)]
Mail: fixed number of arguments allowed in the listen directive.

11 years agoMail: fixed a comment.
Valentin Bartenev [Wed, 20 Aug 2014 09:13:27 +0000 (13:13 +0400)]
Mail: fixed a comment.

There's no loc_conf in the mail module.

11 years agoMp4: use trak->smhd_size in ngx_http_mp4_read_smhd_atom().
Roman Arutyunyan [Tue, 19 Aug 2014 10:13:39 +0000 (14:13 +0400)]
Mp4: use trak->smhd_size in ngx_http_mp4_read_smhd_atom().

Reported by Gang Li.

11 years agoImage filter: downgrade strong etags to weak ones as needed.
Sergey Kandaurov [Mon, 18 Aug 2014 08:03:41 +0000 (12:03 +0400)]
Image filter: downgrade strong etags to weak ones as needed.

11 years agoFixed typo.
Sergey Kandaurov [Fri, 15 Aug 2014 10:09:29 +0000 (14:09 +0400)]
Fixed typo.

11 years agoEvents: removed unused variable in ngx_poll_process_events().
Maxim Dounin [Sun, 10 Aug 2014 13:44:46 +0000 (17:44 +0400)]
Events: removed unused variable in ngx_poll_process_events().

11 years agoEvents: format specifier fixes.
Yves Crespin [Thu, 7 Aug 2014 13:04:43 +0000 (15:04 +0200)]
Events: format specifier fixes.

11 years agoEvents: changed nevents type to unsigned in poll module.
Yves Crespin [Thu, 7 Aug 2014 12:56:57 +0000 (14:56 +0200)]
Events: changed nevents type to unsigned in poll module.

11 years agoStyle: use specified macro instead of magic-number.
Tatsuhiko Kubo [Wed, 6 Aug 2014 14:58:44 +0000 (23:58 +0900)]
Style: use specified macro instead of magic-number.

11 years agoPerl: NULL-terminate argument list.
Piotr Sikora [Thu, 19 Jun 2014 11:16:36 +0000 (04:16 -0700)]
Perl: NULL-terminate argument list.

perl_parse() function expects argv/argc-style argument list,
which according to the C standard must be NULL-terminated,
that is: argv[argc] == NULL.

This change fixes a crash (SIGSEGV) that could happen because
of the buffer overrun during perl module initialization.

Signed-off-by: Piotr Sikora <piotr@cloudflare.com>
11 years agoAccess log: allowed logs to syslog with "if=" (ticket #596).
Maxim Dounin [Tue, 5 Aug 2014 20:22:36 +0000 (00:22 +0400)]
Access log: allowed logs to syslog with "if=" (ticket #596).

11 years agoVersion bump.
Maxim Dounin [Tue, 5 Aug 2014 18:50:25 +0000 (22:50 +0400)]
Version bump.

11 years agorelease-1.7.4 tag
Maxim Dounin [Tue, 5 Aug 2014 11:13:05 +0000 (15:13 +0400)]
release-1.7.4 tag

11 years agonginx-1.7.4-RELEASE release-1.7.4
Maxim Dounin [Tue, 5 Aug 2014 11:13:04 +0000 (15:13 +0400)]
nginx-1.7.4-RELEASE

11 years agoMail: discard pipelined commands after SMTP STARTTLS.
Maxim Dounin [Tue, 5 Aug 2014 08:22:07 +0000 (12:22 +0400)]
Mail: discard pipelined commands after SMTP STARTTLS.

The bug had appeared in nginx 1.5.6 (04e43d03e153).

Reported by Chris Boulton.

11 years agoCore: exit on ngx_pnalloc() failure.
Piotr Sikora [Sat, 2 Aug 2014 03:39:22 +0000 (20:39 -0700)]
Core: exit on ngx_pnalloc() failure.

Signed-off-by: Piotr Sikora <piotr@cloudflare.com>
11 years agoStyle: use ngx_free() instead of free().
Tatsuhiko Kubo [Sat, 2 Aug 2014 18:27:39 +0000 (03:27 +0900)]
Style: use ngx_free() instead of free().

11 years agoCore: improved ngx_pstrdup() error handling.
Tatsuhiko Kubo [Fri, 1 Aug 2014 11:04:14 +0000 (20:04 +0900)]
Core: improved ngx_pstrdup() error handling.

11 years agoStatus: indentation and style, no functional changes.
Sergey Kandaurov [Fri, 1 Aug 2014 14:36:35 +0000 (18:36 +0400)]
Status: indentation and style, no functional changes.

11 years agoConfigure: remove outdated and unused patch.zlib.h.
Piotr Sikora [Thu, 31 Jul 2014 10:52:28 +0000 (03:52 -0700)]
Configure: remove outdated and unused patch.zlib.h.

Signed-off-by: Piotr Sikora <piotr@cloudflare.com>
11 years agoDav: ngx_http_map_uri_to_path() errors were not checked.
FengGu [Wed, 30 Jul 2014 06:45:08 +0000 (14:45 +0800)]
Dav: ngx_http_map_uri_to_path() errors were not checked.

Once error occured, it could lead to use uninitialized variables to log,
even more segmentation fault.

11 years agoTypos fixed.
Sergey Kandaurov [Thu, 31 Jul 2014 09:59:37 +0000 (13:59 +0400)]
Typos fixed.

11 years agoSSL: let it build against LibreSSL.
Piotr Sikora [Wed, 30 Jul 2014 11:32:16 +0000 (04:32 -0700)]
SSL: let it build against LibreSSL.

LibreSSL developers decided that LibreSSL is OpenSSL-2.0.0, so tests
for OpenSSL-1.0.2+ are now passing, even though the library doesn't
provide functions that are expected from that version of OpenSSL.

Signed-off-by: Piotr Sikora <piotr@cloudflare.com>
11 years agoSSL: let it build against BoringSSL.
Piotr Sikora [Wed, 30 Jul 2014 11:32:15 +0000 (04:32 -0700)]
SSL: let it build against BoringSSL.

This change adds support for using BoringSSL as a drop-in replacement
for OpenSSL without adding support for any of the BoringSSL-specific
features.

Signed-off-by: Piotr Sikora <piotr@cloudflare.com>
11 years agoSSL: fix build with OPENSSL_NO_ENGINE and/or OPENSSL_NO_OCSP.
Piotr Sikora [Mon, 28 Jul 2014 19:27:57 +0000 (12:27 -0700)]
SSL: fix build with OPENSSL_NO_ENGINE and/or OPENSSL_NO_OCSP.

This is really just a prerequisite for building against BoringSSL,
which doesn't provide either of those features.

Signed-off-by: Piotr Sikora <piotr@cloudflare.com>
11 years agoBigger iovec buffer in ngx_readv_chain().
Maxim Dounin [Mon, 28 Jul 2014 14:30:19 +0000 (18:30 +0400)]
Bigger iovec buffer in ngx_readv_chain().

This helps to reduce likelyhood of memory allocations in ngx_readv_chain(),
which are known to lead to noticeable effects in some cases, see
http://mailman.nginx.org/pipermail/nginx/2014-July/044512.html.

11 years agoSSL: misplaced space in debug message.
Maxim Dounin [Mon, 28 Jul 2014 14:30:18 +0000 (18:30 +0400)]
SSL: misplaced space in debug message.

11 years agoUpstream: SSL handshake timeouts.
Maxim Dounin [Mon, 28 Jul 2014 14:30:14 +0000 (18:30 +0400)]
Upstream: SSL handshake timeouts.

Timeout may not be set on an upstream connection when we call
ngx_ssl_handshake() in ngx_http_upstream_ssl_init_connection(),
so make sure to arm it if it's not set.

Based on a patch by Yichun Zhang.

11 years agoGeoIP: not all variable fields were initialized.
Yichun Zhang [Fri, 25 Jul 2014 21:43:29 +0000 (14:43 -0700)]
GeoIP: not all variable fields were initialized.

The ngx_http_geoip_city_float_variable and
ngx_http_geoip_city_int_variable functions did not always initialize
all variable fields like "not_found", which could lead to empty values
for those corresponding nginx variables randomly.

11 years agoCore: use uppercase hexadecimal digits for percent-encoding.
Piotr Sikora [Fri, 27 Jun 2014 06:39:23 +0000 (23:39 -0700)]
Core: use uppercase hexadecimal digits for percent-encoding.

RFC3986 says that, for consistency, URI producers and normalizers
should use uppercase hexadecimal digits for all percent-encodings.

This is also what modern web browsers and other tools use.

Using lowercase hexadecimal digits makes it harder to interact with
those tools in case when use of the percent-encoded URI is required,
for example when $request_uri is part of the cache key.

Signed-off-by: Piotr Sikora <piotr@cloudflare.com>
11 years agoCore: fixed default log initialization.
Vladimir Homutov [Thu, 24 Jul 2014 12:25:07 +0000 (16:25 +0400)]
Core: fixed default log initialization.

The ngx_log_insert() function may invalidate pointer passed to it,
so make sure to don't use it after the ngx_log_insert() call.

11 years agoUpstream: ngx_http_upstream_store() error handling fixes.
Maxim Dounin [Fri, 18 Jul 2014 16:11:40 +0000 (20:11 +0400)]
Upstream: ngx_http_upstream_store() error handling fixes.

Previously, ngx_http_map_uri_to_path() errors were not checked in
ngx_http_upstream_store().  Moreover, in case of errors temporary
files were not deleted, as u->store was set to 0, preventing cleanup
code in ngx_http_upstream_finalize_request() from removing them.  With
this patch, u->store is set to 0 only if there were no errors.

Reported by Feng Gu.

11 years agoReset of r->uri.len on URI parsing errors.
Maxim Dounin [Fri, 18 Jul 2014 16:02:11 +0000 (20:02 +0400)]
Reset of r->uri.len on URI parsing errors.

This ensures that debug logging and the $uri variable (if used in
400 Bad Request processing) will not try to access uninitialized
memory.

Found by Sergey Bobrov.

11 years agoResolver: fixed resend on malformed responses.
Ruslan Ermilov [Wed, 16 Jul 2014 06:21:28 +0000 (10:21 +0400)]
Resolver: fixed resend on malformed responses.

DNS request resend on malformed responses was broken in 98876ce2a7fd (1.5.8).

Reported by Pramod Korathota.

11 years agoSSL: fix build with recent OpenSSL.
Piotr Sikora [Wed, 9 Jul 2014 19:27:15 +0000 (12:27 -0700)]
SSL: fix build with recent OpenSSL.

X509_check_host() prototype changed recently:
- http://git.openssl.org/gitweb/?p=openssl.git;a=commitdiff;h=ced3d91
- http://git.openssl.org/gitweb/?p=openssl.git;a=commitdiff;h=297c67f

Bump version requirement, so that OpenSSL-1.0.2-beta1 uses fallback code.

Signed-off-by: Piotr Sikora <piotr@cloudflare.com>
11 years agoCore: bugfix for the ngx_slab_max_size case.
Jianjun Zheng [Wed, 18 Jun 2014 08:39:59 +0000 (16:39 +0800)]
Core: bugfix for the ngx_slab_max_size case.

11 years agoStyle: use ngx_str_set().
Tatsuhiko Kubo [Wed, 9 Jul 2014 14:23:59 +0000 (23:23 +0900)]
Style: use ngx_str_set().

11 years agoStyle: use ngx_str_null().
Tatsuhiko Kubo [Wed, 9 Jul 2014 14:22:14 +0000 (23:22 +0900)]
Style: use ngx_str_null().

11 years agoStyle: use ngx_strlen() instead of strlen().
Tatsuhiko Kubo [Wed, 9 Jul 2014 14:20:40 +0000 (23:20 +0900)]
Style: use ngx_strlen() instead of strlen().

11 years agoSPDY: fix support for headers with multiple values.
Piotr Sikora [Tue, 8 Jul 2014 09:17:44 +0000 (02:17 -0700)]
SPDY: fix support for headers with multiple values.

Split SPDY header with multiple, NULL-separated values:

    cookie: foo\0bar

into two separate HTTP headers with the same name:

    cookie: foo
    cookie: bar

Even though the logic for this behavior already existed
in the source code, it doesn't look that it ever worked
and SPDY streams with such headers were simply rejected.

Signed-off-by: Piotr Sikora <piotr@cloudflare.com>
11 years agoStyle: fix typo.
Piotr Sikora [Tue, 8 Jul 2014 10:03:14 +0000 (03:03 -0700)]
Style: fix typo.

Signed-off-by: Piotr Sikora <piotr@cloudflare.com>
11 years agoStyle: use ngx_memcpy() instead of memcpy().
Piotr Sikora [Tue, 8 Jul 2014 10:03:14 +0000 (03:03 -0700)]
Style: use ngx_memcpy() instead of memcpy().

Signed-off-by: Piotr Sikora <piotr@cloudflare.com>
11 years agoStyle: keep return type and function name on different lines.
Piotr Sikora [Tue, 8 Jul 2014 10:03:14 +0000 (03:03 -0700)]
Style: keep return type and function name on different lines.

Signed-off-by: Piotr Sikora <piotr@cloudflare.com>
11 years agoStyle: remove whitespace between function name and parentheses.
Piotr Sikora [Tue, 8 Jul 2014 10:03:14 +0000 (03:03 -0700)]
Style: remove whitespace between function name and parentheses.

Signed-off-by: Piotr Sikora <piotr@cloudflare.com>
11 years agoStyle: add whitespace between control statement and parentheses.
Piotr Sikora [Tue, 8 Jul 2014 10:03:13 +0000 (03:03 -0700)]
Style: add whitespace between control statement and parentheses.

Signed-off-by: Piotr Sikora <piotr@cloudflare.com>
11 years agoSSL: stop accessing SSL_SESSION's fields directly.
Piotr Sikora [Sun, 6 Jul 2014 23:41:14 +0000 (16:41 -0700)]
SSL: stop accessing SSL_SESSION's fields directly.

SSL_SESSION struct is internal part of the OpenSSL library and it's fields
should be accessed via API (when exposed), not directly.

The unfortunate side-effect of this change is that we're losing reference
count that used to be printed at the debug log level, but this seems to be
an acceptable trade-off.

Almost fixes build with -DOPENSSL_NO_SSL_INTERN.

Signed-off-by: Piotr Sikora <piotr@cloudflare.com>
11 years agoSSL: fixed build with OPENSSL_NO_DEPRECATED defined.
Maxim Dounin [Wed, 9 Jul 2014 00:08:13 +0000 (04:08 +0400)]
SSL: fixed build with OPENSSL_NO_DEPRECATED defined.

The RSA_generate_key() is marked as deprecated and causes build to
fail.  On the other hand, replacement function, RSA_generate_key_ex(),
requires much more code.  Since RSA_generate_key() is only needed
for barely usable EXP ciphers, the #ifdef was added instead.

Prodded by Piotr Sikora.