]> git.kaiwu.me - nginx.git/log
nginx.git
12 years agoAdjusted default value of types_hash_bucket_size (ticket #352).
Maxim Dounin [Mon, 31 Mar 2014 18:47:42 +0000 (22:47 +0400)]
Adjusted default value of types_hash_bucket_size (ticket #352).

The ngx_cacheline_size may be too low on some platforms, resulting
in unexpected hash build problems (as no collisions are tolerated due
to low bucket_size, and max_size isn't big enough to build a hash without
collisions).  These problems aren't fatal anymore but nevertheless
need to be addressed.

12 years agoCore: fixed hash to actually try max_size.
Maxim Dounin [Mon, 31 Mar 2014 17:40:35 +0000 (21:40 +0400)]
Core: fixed hash to actually try max_size.

Previously, maximum size of a hash table built was (max_size - 1).

12 years agoCore: hash now ignores bucket_size if it hits max_size limit.
Maxim Dounin [Mon, 31 Mar 2014 17:40:31 +0000 (21:40 +0400)]
Core: hash now ignores bucket_size if it hits max_size limit.

12 years agoCore: slab log_nomem flag.
Maxim Dounin [Mon, 31 Mar 2014 17:38:30 +0000 (21:38 +0400)]
Core: slab log_nomem flag.

The flag allows to suppress "ngx_slab_alloc() failed: no memory" messages
from a slab allocator, e.g., if an LRU expiration is used by a consumer
and allocation failures aren't fatal.

The flag is now used in the SSL session cache code, and in the limit_req
module.

12 years agoWin32: fixed cpu hog by cache manager on exit (ticket #514).
Maxim Dounin [Mon, 31 Mar 2014 17:38:28 +0000 (21:38 +0400)]
Win32: fixed cpu hog by cache manager on exit (ticket #514).

The "ngx_quit" may be reset by the worker thread before it's seen
by a ngx_cache_manager_thread(), resulting in an infinite loop.  Make
sure to test ngx_exiting as well.

12 years agoMail: fixed ngx_mail_send() (ticket #519).
Maxim Dounin [Mon, 31 Mar 2014 17:38:27 +0000 (21:38 +0400)]
Mail: fixed ngx_mail_send() (ticket #519).

12 years agoAdded #ifndef around NGX_HAVE_CASELESS_FILESYSTEM define.
Maxim Dounin [Mon, 31 Mar 2014 17:38:25 +0000 (21:38 +0400)]
Added #ifndef around NGX_HAVE_CASELESS_FILESYSTEM define.

This brings Cygwin compilation in line with other case-insensitive
systems (notably win32 and OS X) where one can force case sensitivity
using -DNGX_HAVE_CASELESS_FILESYSTEM=0.

12 years agoMp4: improved logging after adding "end" support.
Roman Arutyunyan [Mon, 31 Mar 2014 16:05:53 +0000 (20:05 +0400)]
Mp4: improved logging after adding "end" support.

Despite introducing start and end crop operations existing log
messages still mostly refer only to start.  Logging is improved
to match both cases.

New debug logging is added to track entry count in atoms after
cropping.

Two format type mismatches are fixed as well.

12 years agoMp4: fixed seeking to a track end.
Roman Arutyunyan [Mon, 31 Mar 2014 15:52:17 +0000 (19:52 +0400)]
Mp4: fixed seeking to a track end.

When "start" value is equal to a track duration the request
fails with "time is out mp4 stts" like it did before track
duration check was added.  Now such tracks are considered
short and skipped.

12 years agoSPDY: detect premature closing of stream.
Valentin Bartenev [Fri, 28 Mar 2014 16:22:57 +0000 (20:22 +0400)]
SPDY: detect premature closing of stream.

The SPDY/3.1 specification requires that the server must respond with
a 400 "Bad request" error if the sum of the data frame payload lengths
does not equal the size of the Content-Length header.

This also fixes "zero size buf in output" alert, that might be triggered
if client sends a greater than zero Content-Length header and closes
stream using the FIN flag with an empty request body.

12 years agoSPDY: fixed the DATA frame length handling in case of some errors.
Valentin Bartenev [Fri, 28 Mar 2014 16:05:07 +0000 (20:05 +0400)]
SPDY: fixed the DATA frame length handling in case of some errors.

There are a few cases in ngx_http_spdy_state_read_data() related to error
handling when ngx_http_spdy_state_skip() might be called with an inconsistent
state between *pos and sc->length, that leads to violation of frame layout
parsing and resuted in corruption of spdy connection.

Based on a patch by Xiaochen Wang.

12 years agoSPDY: better detect if headers block has wrong entries count.
Valentin Bartenev [Wed, 26 Mar 2014 14:01:11 +0000 (18:01 +0400)]
SPDY: better detect if headers block has wrong entries count.

Previously, only one case was checked: if there's more data to parse
in a r->header_in buffer, but the buffer can be filled to the end by
the last parsed entry, so we also need to check that there's no more
data to inflate.

12 years agoSPDY: detect premature end of frame while start parsing headers.
Valentin Bartenev [Wed, 26 Mar 2014 13:43:39 +0000 (17:43 +0400)]
SPDY: detect premature end of frame while start parsing headers.

12 years agoApply underscores_in_headers also to the first character.
Piotr Sikora [Mon, 24 Mar 2014 23:35:44 +0000 (16:35 -0700)]
Apply underscores_in_headers also to the first character.

Signed-off-by: Piotr Sikora <piotr@cloudflare.com>
12 years agoIncreased default value of variables_hash_max_size.
Andrei Belov [Tue, 25 Mar 2014 14:49:28 +0000 (18:49 +0400)]
Increased default value of variables_hash_max_size.

12 years agoMp4: skipped empty stss atom table in output.
Sergey Kandaurov [Mon, 24 Mar 2014 13:55:10 +0000 (17:55 +0400)]
Mp4: skipped empty stss atom table in output.

The atom may have no data entries after cropping.

This fixes "zero size buf in output" alerts.

12 years agoRange filter: single_range flag in request.
Maxim Dounin [Fri, 21 Mar 2014 15:33:21 +0000 (19:33 +0400)]
Range filter: single_range flag in request.

If set, it means that response body is going to be in more than one buffer,
hence only range requests with a single range should be honored.

The flag is now used by mp4 and cacheable upstream responses, thus allowing
range requests of mp4 files with start/end, as well as range processing
on a first request to a not-yet-cached files with proxy_cache.

Notably this makes it possible to play mp4 files (with proxy_cache, or with
mp4 module) on iOS devices, as byte-range support is required by Apple.

12 years agoMp4: added "end" argument support.
Roman Arutyunyan [Thu, 20 Mar 2014 12:05:19 +0000 (16:05 +0400)]
Mp4: added "end" argument support.

12 years agoMp4: moved atom cropping code out of update functions.
Roman Arutyunyan [Thu, 20 Mar 2014 12:05:18 +0000 (16:05 +0400)]
Mp4: moved atom cropping code out of update functions.

It can now be reused for implementing mp4 end.

12 years agoSPDY: improved ngx_http_spdy_state_save() again.
Maxim Dounin [Wed, 19 Mar 2014 15:30:09 +0000 (19:30 +0400)]
SPDY: improved ngx_http_spdy_state_save() again.

12 years agoMacros used for initialization in ngx_http_core_init_main_conf().
Maxim Dounin [Wed, 19 Mar 2014 08:57:40 +0000 (12:57 +0400)]
Macros used for initialization in ngx_http_core_init_main_conf().

12 years agoSPDY: improved ngx_http_spdy_state_save() check.
Maxim Dounin [Wed, 19 Mar 2014 08:57:39 +0000 (12:57 +0400)]
SPDY: improved ngx_http_spdy_state_save() check.

12 years agoSPDY: macro used for recv_buffer_size initialization.
Maxim Dounin [Wed, 19 Mar 2014 08:57:32 +0000 (12:57 +0400)]
SPDY: macro used for recv_buffer_size initialization.

12 years agoVersion bump.
Maxim Dounin [Tue, 18 Mar 2014 18:05:05 +0000 (22:05 +0400)]
Version bump.

12 years agorelease-1.5.12 tag
Maxim Dounin [Tue, 18 Mar 2014 13:08:35 +0000 (17:08 +0400)]
release-1.5.12 tag

12 years agonginx-1.5.12-RELEASE release-1.5.12
Maxim Dounin [Tue, 18 Mar 2014 13:08:35 +0000 (17:08 +0400)]
nginx-1.5.12-RELEASE

12 years agoSPDY: always check size of data to be saved into state buffer.
Maxim Dounin [Tue, 18 Mar 2014 13:00:19 +0000 (17:00 +0400)]
SPDY: always check size of data to be saved into state buffer.

12 years agoAdded server-side support for PROXY protocol v1 (ticket #355).
Roman Arutyunyan [Mon, 17 Mar 2014 13:41:24 +0000 (17:41 +0400)]
Added server-side support for PROXY protocol v1 (ticket #355).

Client address specified in the PROXY protocol header is now
saved in the $proxy_protocol_addr variable and can be used in
the realip module.

This is currently not implemented for mail.

12 years agoFastCGI: f->split_parts reset on request start.
Maxim Dounin [Mon, 17 Mar 2014 11:34:36 +0000 (15:34 +0400)]
FastCGI: f->split_parts reset on request start.

Additionally, make sure to check for errors from ngx_http_parse_header_line()
call after joining saved parts.  There shouldn't be any errors, though
check may help to catch bugs like missing f->split_parts reset.

Reported by Lucas Molas.

12 years agoCore: fixed wrong indices in listening sockets compare loops.
Maxim Dounin [Fri, 7 Mar 2014 11:17:38 +0000 (15:17 +0400)]
Core: fixed wrong indices in listening sockets compare loops.

Proper use is "ls[i]" and "nls[n]".  Previous code used it wrong in
several places, likely due to cut-n-paste errors.

12 years agoMIME: added application/xspf+xml MIME type (ticket #479).
Filipe da Silva [Thu, 6 Mar 2014 09:51:08 +0000 (10:51 +0100)]
MIME: added application/xspf+xml MIME type (ticket #479).

12 years agoAdded connection serial number in logging of left open sockets.
Sergey Kandaurov [Thu, 6 Mar 2014 19:15:10 +0000 (23:15 +0400)]
Added connection serial number in logging of left open sockets.

12 years agoFixed format specifier in logging of "c->number".
Sergey Kandaurov [Thu, 6 Mar 2014 14:25:59 +0000 (18:25 +0400)]
Fixed format specifier in logging of "c->number".

12 years agoMIME: added video/mp2t and application/vnd.apple.mpegurl types.
Roman Arutyunyan [Tue, 4 Mar 2014 19:40:35 +0000 (23:40 +0400)]
MIME: added video/mp2t and application/vnd.apple.mpegurl types.

Both types are used by HLS.  The values are taken from RFC 3555
and HLS specification respectively.

12 years agoVersion bump.
Roman Arutyunyan [Tue, 4 Mar 2014 19:38:31 +0000 (23:38 +0400)]
Version bump.

12 years agorelease-1.5.11 tag
Maxim Dounin [Tue, 4 Mar 2014 11:39:23 +0000 (15:39 +0400)]
release-1.5.11 tag

12 years agonginx-1.5.11-RELEASE release-1.5.11
Maxim Dounin [Tue, 4 Mar 2014 11:39:23 +0000 (15:39 +0400)]
nginx-1.5.11-RELEASE

12 years agoSPDY: fixed potential integer overflow while parsing headers.
Valentin Bartenev [Mon, 3 Mar 2014 15:24:55 +0000 (19:24 +0400)]
SPDY: fixed potential integer overflow while parsing headers.

Previously r->header_size was used to store length for a part of
value that represents an individual already parsed HTTP header,
while r->header_end pointed to the end of the whole value.

Instead of storing length of a following name or value as pointer
to a potential end address (r->header_name_end and r->header_end)
that might be overflowed, now r->lowercase_index counter is used
to store remaining length of a following unparsed field.

It also fixes incorrect $body_bytes_sent value if a request is
closed while parsing of the request header.  Since r->header_size
is intended for counting header size, thus abusing it for header
parsing purpose was certainly a bad idea.

12 years agoSPDY: constant number of preallocated structures for headers.
Valentin Bartenev [Mon, 3 Mar 2014 15:24:54 +0000 (19:24 +0400)]
SPDY: constant number of preallocated structures for headers.

12 years agoRequest body: avoid potential overflow.
Maxim Dounin [Mon, 3 Mar 2014 13:39:53 +0000 (17:39 +0400)]
Request body: avoid potential overflow.

12 years agoGzip static: fixed NGX_CONF_FLAG misuse.
Valentin Bartenev [Mon, 3 Mar 2014 13:17:25 +0000 (17:17 +0400)]
Gzip static: fixed NGX_CONF_FLAG misuse.

12 years agoDocs: xslt regenerated.
Maxim Dounin [Fri, 28 Feb 2014 16:17:01 +0000 (20:17 +0400)]
Docs: xslt regenerated.

12 years agoDocs: switched from java XSLScript to xslscript.pl.
Maxim Dounin [Fri, 28 Feb 2014 16:17:00 +0000 (20:17 +0400)]
Docs: switched from java XSLScript to xslscript.pl.

Latter is available from http://hg.nginx.org/xslscript.

12 years agoDisabled redirects to named locations if URI is not set.
Maxim Dounin [Thu, 27 Feb 2014 16:36:35 +0000 (20:36 +0400)]
Disabled redirects to named locations if URI is not set.

If something like "error_page 400 @name" is used in a configuration,
a request could be passed to a named location without URI set, and this
in turn might result in segmentation faults or other bad effects
as most of the code assumes URI is set.

With this change nginx will catch such configuration problems in
ngx_http_named_location() and will stop request processing if URI
is not set, returning 500.

12 years agoCore: allocate enough memory to hold IPv6 text address plus port.
Ruslan Ermilov [Sat, 22 Feb 2014 08:08:31 +0000 (12:08 +0400)]
Core: allocate enough memory to hold IPv6 text address plus port.

12 years agoResolver: properly handle connect() failures.
Ruslan Ermilov [Thu, 20 Feb 2014 13:27:09 +0000 (17:27 +0400)]
Resolver: properly handle connect() failures.

If initial attempt to connect() the UDP socket failed, e.g.
due to network unreachable, no further attempts were made.

12 years agoUpstream: fixed error message wording.
Konstantin Pavlov [Thu, 20 Feb 2014 09:48:40 +0000 (13:48 +0400)]
Upstream: fixed error message wording.

12 years agoAccess: supplemented the obfuscated code with a comment.
Ruslan Ermilov [Wed, 19 Feb 2014 17:45:27 +0000 (21:45 +0400)]
Access: supplemented the obfuscated code with a comment.

12 years agoUpstream: ngx_post_event() instead of upgraded call (ticket #503).
Maxim Dounin [Tue, 18 Feb 2014 13:30:40 +0000 (17:30 +0400)]
Upstream: ngx_post_event() instead of upgraded call (ticket #503).

If a request is finalized in the first call to the
ngx_http_upstream_process_upgraded() function, e.g., because upstream
server closed the connection for some reason, in the second call
the u->peer.connection pointer will be null, resulting in segmentation
fault.

Fix is to avoid second direct call, and post event instead.  This ensures
that ngx_http_upstream_process_upgraded() won't be called again if
a request is finalized.

12 years agoMp4: remove useless leading stsc entry in result mp4.
Roman Arutyunyan [Fri, 14 Feb 2014 11:14:48 +0000 (15:14 +0400)]
Mp4: remove useless leading stsc entry in result mp4.

The fix removes useless stsc entry in result mp4.
If start_sample == n then current stsc entry should be skipped
and the result stsc should start with the next entry.
The reason for that is start_sample starts from 0, not 1.

12 years agoWin32: MSVC 2013 compatibility.
Maxim Dounin [Thu, 13 Feb 2014 12:54:00 +0000 (16:54 +0400)]
Win32: MSVC 2013 compatibility.

Warnings about GetVersionEx() deprecation silenced.  Precompiled object
linked in.

12 years agoSPDY: fixed reversed priority order in window waiting queue.
Valentin Bartenev [Wed, 12 Feb 2014 17:02:29 +0000 (21:02 +0400)]
SPDY: fixed reversed priority order in window waiting queue.

12 years agoUpstream: fix $upstream_status variable.
Piotr Sikora [Wed, 12 Feb 2014 05:54:42 +0000 (21:54 -0800)]
Upstream: fix $upstream_status variable.

Previously, upstream's status code was overwritten with
cached response's status code when STALE or REVALIDATED
response was sent to the client.

Signed-off-by: Piotr Sikora <piotr@cloudflare.com>
12 years agoSPDY: fixed parsing of http version.
Xiaochen Wang [Tue, 11 Feb 2014 12:54:16 +0000 (20:54 +0800)]
SPDY: fixed parsing of http version.

There is an error while parsing multi-digit minor version numbers (e.g.
"HTTP/1.10").

12 years agoSSL: the $ssl_session_reused variable.
Maxim Dounin [Tue, 11 Feb 2014 15:20:25 +0000 (19:20 +0400)]
SSL: the $ssl_session_reused variable.

12 years agoRange filter: fixed duplicate charset.
Ruslan Ermilov [Tue, 4 Feb 2014 13:13:35 +0000 (17:13 +0400)]
Range filter: fixed duplicate charset.

If a proxied response had charset in Content-Type, the
charset was duplicated in a response to client request
with byte ranges.

12 years agoUse ngx_socket_errno where appropriate.
Piotr Sikora [Mon, 3 Feb 2014 22:17:17 +0000 (14:17 -0800)]
Use ngx_socket_errno where appropriate.

Signed-off-by: Piotr Sikora <piotr@cloudflare.com>
12 years agoVersion bump.
Maxim Dounin [Wed, 5 Feb 2014 14:51:30 +0000 (18:51 +0400)]
Version bump.

12 years agorelease-1.5.10 tag
Maxim Dounin [Tue, 4 Feb 2014 12:26:46 +0000 (16:26 +0400)]
release-1.5.10 tag

12 years agonginx-1.5.10-RELEASE release-1.5.10
Maxim Dounin [Tue, 4 Feb 2014 12:26:46 +0000 (16:26 +0400)]
nginx-1.5.10-RELEASE

12 years agoSPDY: fixed parsing of the priority field.
Shigeki Ohtsu [Tue, 4 Feb 2014 05:06:23 +0000 (14:06 +0900)]
SPDY: fixed parsing of the priority field.

The size of the priority field is increased by one bit in spdy/3,
and now it's a 3-bit field followed by 5 bits of unused space.
But a shift of these bits hasn't been adjusted in 39d7eef2e332
accordingly.

12 years agoUpdated PCRE used for win32 builds.
Maxim Dounin [Tue, 4 Feb 2014 03:45:33 +0000 (07:45 +0400)]
Updated PCRE used for win32 builds.

12 years agoCore: added ngx_encode_base64url().
Maxim Dounin [Tue, 4 Feb 2014 00:59:21 +0000 (04:59 +0400)]
Core: added ngx_encode_base64url().

12 years agoCore: handle getsockopt(TCP_FASTOPEN) failures.
Piotr Sikora [Thu, 30 Jan 2014 22:58:21 +0000 (14:58 -0800)]
Core: handle getsockopt(TCP_FASTOPEN) failures.

Linux returns EOPNOTSUPP for non-TCP sockets and ENOPROTOOPT for TCP
sockets, because getsockopt(TCP_FASTOPEN) is not implemented so far.

While there, lower the log level from ALERT to NOTICE to match other
getsockopt() failures.

Signed-off-by: Piotr Sikora <piotr@cloudflare.com>
12 years agoSPDY: protocol implementation switched to spdy/3.1.
Valentin Bartenev [Fri, 31 Jan 2014 15:17:26 +0000 (19:17 +0400)]
SPDY: protocol implementation switched to spdy/3.1.

12 years agoFixed false compiler warning.
Vladimir Homutov [Fri, 31 Jan 2014 10:18:52 +0000 (14:18 +0400)]
Fixed false compiler warning.

Newer gcc versions (4.7+) report possible use of uninitialized variable if
nginx is being compiled with -O3.

12 years agoFixed a compile warning introduced by 01e2a5bcdd8f.
Ruslan Ermilov [Thu, 30 Jan 2014 15:13:12 +0000 (19:13 +0400)]
Fixed a compile warning introduced by 01e2a5bcdd8f.

On systems with OpenSSL that has NPN support but lacks
ALPN support, some compilers emitted a warning about
possibly uninitialized "data" variable.

12 years agoProxy: fixed upstream search by proxy_pass with variables.
Ruslan Ermilov [Thu, 30 Jan 2014 14:57:11 +0000 (18:57 +0400)]
Proxy: fixed upstream search by proxy_pass with variables.

If "proxy_pass" is specified with variables, the resulting
hostname is looked up in the list of upstreams defined in
configuration.  The search was case-sensitive, as opposed
to the case of "proxy_pass" specified without variables.

12 years agoSSL: support ALPN (IETF's successor to NPN).
Piotr Sikora [Tue, 28 Jan 2014 23:33:49 +0000 (15:33 -0800)]
SSL: support ALPN (IETF's successor to NPN).

Signed-off-by: Piotr Sikora <piotr@cloudflare.com>
12 years agoMp4: fix seeks to standalone last chunk.
Roman Arutyunyan [Wed, 29 Jan 2014 09:44:15 +0000 (13:44 +0400)]
Mp4: fix seeks to standalone last chunk.

If seek position is within the last track chunk
and that chunk is standalone (stsc entry describes only
this chunk) such seek generates stsc seek error. The
problem is that chunk numbers start with 1, not with 0.

12 years agoMp4: skip tracks shorter than seek position (ticket #414).
Roman Arutyunyan [Wed, 29 Jan 2014 09:33:45 +0000 (13:33 +0400)]
Mp4: skip tracks shorter than seek position (ticket #414).

Mp4 module does not check movie and track durations when reading
file.  Instead it generates errors when track metadata is shorter
than seek position.  Now such tracks are skipped and movie duration
check is performed at file read stage.

12 years agoMp4: fix seeks after the last key frame.
Roman Arutyunyan [Wed, 29 Jan 2014 09:30:36 +0000 (13:30 +0400)]
Mp4: fix seeks after the last key frame.

Mp4 module does not allow seeks after the last key frame.  Since
stss atom only contains key frames it's usually shorter than
other track atoms.  That leads to stss seek error when seek
position is close to the end of file.  The fix outputs empty
stss frame instead of generating error.

12 years agoFixed TCP_DEFER_ACCEPT handling (ticket #353).
Maxim Dounin [Tue, 28 Jan 2014 11:40:46 +0000 (15:40 +0400)]
Fixed TCP_DEFER_ACCEPT handling (ticket #353).

Backed out 05a56ebb084a, as it turns out that kernel can return connections
without any delay if syncookies are used.  This basically means we can't
assume anything about connections returned with deferred accept set.

To solve original problem the 05a56ebb084a tried to solve, i.e. to don't
wait longer than needed if a connection was accepted after deferred accept
timeout, this patch changes a timeout set with setsockopt(TCP_DEFER_ACCEPT)
to 1 second, unconditionally.  This is believed to be enough for speed
improvements, and doesn't imply major changes to timeouts used.

Note that before 2.6.32 connections were dropped after a timeout.  Though
it is believed that 1s is still appropriate for kernels before 2.6.32,
as previously tcp_synack_retries controlled the actual timeout and 1s results
in more than 1 minute actual timeout by default.

12 years agoSSI: fixed $date_local and $date_gmt without SSI (ticket #230).
Maxim Dounin [Tue, 28 Jan 2014 11:40:45 +0000 (15:40 +0400)]
SSI: fixed $date_local and $date_gmt without SSI (ticket #230).

If there is no SSI context in a given request at a given time,
the $date_local and $date_gmt variables used "%s" format, instead
of "%A, %d-%b-%Y %H:%M:%S %Z" documented as the default and used
if there is SSI module context and timefmt wasn't modified using
the "config" SSI command.

While use of these variables outside of the SSI evaluation isn't strictly
valid, previous behaviour is certainly inconsistent, hence the fix.

12 years agoConfigure: enabled -Werror for clang.
Ruslan Ermilov [Mon, 27 Jan 2014 20:31:31 +0000 (00:31 +0400)]
Configure: enabled -Werror for clang.

Modern clang versions seem to no longer produce warnings for
system headers on Linux (at least clang 3.3 works), hence the
change.  For older versions --with-cc-opt="-Wno-error" can be
used as a workaround.

12 years agoTypo fixed.
Tatsuhiko Kubo [Thu, 23 Jan 2014 13:09:59 +0000 (22:09 +0900)]
Typo fixed.

12 years agoSSL: fixed $ssl_session_id possible segfault after 97e3769637a7.
Maxim Dounin [Thu, 23 Jan 2014 14:32:26 +0000 (18:32 +0400)]
SSL: fixed $ssl_session_id possible segfault after 97e3769637a7.

Even during execution of a request it is possible that there will be
no session available, notably in case of renegotiation.  As a result
logging of $ssl_session_id in some cases caused NULL pointer dereference
after revision 97e3769637a7 (1.5.9).  The check added returns an empty
string if there is no session available.

12 years agoVersion bump.
Maxim Dounin [Thu, 23 Jan 2014 14:32:25 +0000 (18:32 +0400)]
Version bump.

12 years agorelease-1.5.9 tag
Maxim Dounin [Wed, 22 Jan 2014 13:42:59 +0000 (17:42 +0400)]
release-1.5.9 tag

12 years agonginx-1.5.9-RELEASE release-1.5.9
Maxim Dounin [Wed, 22 Jan 2014 13:42:59 +0000 (17:42 +0400)]
nginx-1.5.9-RELEASE

12 years agoUpdated OpenSSL used for win32 builds.
Maxim Dounin [Wed, 22 Jan 2014 12:10:13 +0000 (16:10 +0400)]
Updated OpenSSL used for win32 builds.

12 years agoUpstream: reading from a client after connection upgrade.
Maxim Dounin [Wed, 22 Jan 2014 12:05:07 +0000 (16:05 +0400)]
Upstream: reading from a client after connection upgrade.

Read event on a client connection might have been disabled during
previous processing, and we at least need to handle events.  Calling
ngx_http_upstream_process_upgraded() is a simpliest way to do it.

Notably this change is needed for select, poll and /dev/poll event
methods.

Previous version of this patch was posted here:
http://mailman.nginx.org/pipermail/nginx/2014-January/041839.html

12 years agoSSL: fixed $ssl_session_id variable.
Maxim Dounin [Wed, 22 Jan 2014 12:05:06 +0000 (16:05 +0400)]
SSL: fixed $ssl_session_id variable.

Previously, it used to contain full session serialized instead of just
a session id, making it almost impossible to use the variable in a safe
way.

Thanks to Ivan Ristić.

12 years agoSPDY: use ngx_queue_t to queue streams for post processing.
Valentin Bartenev [Mon, 20 Jan 2014 16:56:49 +0000 (20:56 +0400)]
SPDY: use ngx_queue_t to queue streams for post processing.

It simplifies the code and allows easy reuse the same queue pointer to store
streams in various queues with different requirements.  Future implementation
of SPDY/3.1 will take advantage of this quality.

12 years agoSPDY: store the length of frame instead of its whole size.
Valentin Bartenev [Wed, 22 Jan 2014 00:58:19 +0000 (04:58 +0400)]
SPDY: store the length of frame instead of its whole size.

The "length" value better corresponds with the specification and reduces
confusion about whether frame's header is included in "size" or not.

Also this change simplifies some parts of code, since in more cases the
length of frame is more useful than its actual size, especially considering
that the size of frame header is constant.

12 years agoSPDY: use frame->next pointer to chain free frames.
Valentin Bartenev [Wed, 22 Jan 2014 00:58:19 +0000 (04:58 +0400)]
SPDY: use frame->next pointer to chain free frames.

There is no need in separate "free" pointer and like it is for ngx_chain_t
the "next" pointer can be used.  But after this change successfully handled
frame should not be accessed, so the frame handling cycle was improved to
store pointer to the next frame before processing.

Also worth noting that initializing "free" pointer to NULL in the original
code was surplus.

12 years agoSPDY: proper handling of all RST_STREAM statuses.
Valentin Bartenev [Wed, 22 Jan 2014 00:58:19 +0000 (04:58 +0400)]
SPDY: proper handling of all RST_STREAM statuses.

Previously, only stream CANCEL and INTERNAL_ERROR were handled right.

12 years agoSPDY: removed state to check first SETTINGS frame.
Valentin Bartenev [Wed, 22 Jan 2014 00:58:19 +0000 (04:58 +0400)]
SPDY: removed state to check first SETTINGS frame.

That code was based on misunderstanding of spdy specification about
configuration applicability in the SETTINGS frames.  The original
interpretation was that configuration is assigned for the whole
SPDY connection, while it is only for the endpoint.

Moreover, the strange thing is that specification forbids multiple
entries in the SETTINGS frame with the same ID even if flags are
different.  As a result, Chrome sends two SETTINGS frames: one with
its own configuration, and another one with configuration stored
for a server (when the FLAG_SETTINGS_PERSIST_VALUE flags were used
by the server).

To simplify implementation we refuse to use the persistent settings
feature and thereby avoid all the complexity related with its proper
support.

12 years agoSPDY: better name for frame entries counter.
Valentin Bartenev [Wed, 22 Jan 2014 00:58:19 +0000 (04:58 +0400)]
SPDY: better name for frame entries counter.

The "headers" is not a good term, since it is used not only to count
name/value pairs in the HEADERS block but to count SETTINGS entries too.

Moreover, one name/value pair in HEADERS can contain multiple http headers
with the same name.

No functional changes.

12 years agoSPDY: fixed possible segfault.
Valentin Bartenev [Wed, 22 Jan 2014 00:58:19 +0000 (04:58 +0400)]
SPDY: fixed possible segfault.

While processing a DATA frame, the link to related stream is stored in spdy
connection object as part of connection state.  But this stream can be closed
between receiving parts of the frame.

12 years agoTypo fixed.
Maxim Dounin [Tue, 21 Jan 2014 13:39:49 +0000 (17:39 +0400)]
Typo fixed.

12 years agoMail: fixed passing of IPv6 client address in XCLIENT.
Ruslan Ermilov [Fri, 17 Jan 2014 18:06:04 +0000 (22:06 +0400)]
Mail: fixed passing of IPv6 client address in XCLIENT.

12 years agoCore: improved ngx_reset_pool() (ticket #490).
Maxim Dounin [Fri, 17 Jan 2014 02:24:53 +0000 (06:24 +0400)]
Core: improved ngx_reset_pool() (ticket #490).

Previously pool->current wasn't moved back to pool, resulting in blocks
not used for further allocations if pool->current was already moved at the
time of ngx_reset_pool().  Additionally, to preserve logic of moving
pool->current, the p->d.failed counters are now properly cleared.  While
here, pool->chain is also cleared.

This change is essentially a nop with current code, but generally improves
things.

12 years agoSPDY: send output queue after processing of read event.
Valentin Bartenev [Wed, 15 Jan 2014 13:16:38 +0000 (17:16 +0400)]
SPDY: send output queue after processing of read event.

During the processing of input some control frames can be added to the queue.
And if there were no writing streams at the moment, these control frames might
be left unsent for a long time (or even forever).

This long delay is especially critical for PING replies since a client can
consider connection as broken and then resend exactly the same request over
a new connection, which is not safe in case of non-idempotent HTTP methods.

12 years agoSPDY: the SETTINGS frame should be allocated from sc->pool.
Valentin Bartenev [Wed, 15 Jan 2014 13:16:38 +0000 (17:16 +0400)]
SPDY: the SETTINGS frame should be allocated from sc->pool.

There is no reason to allocate it from connection pool that more like just
a bug especially since ngx_http_spdy_settings_frame_handler() already uses
sc->pool to free a chain.

12 years agoSPDY: fixed possible uninitialized memory access.
Valentin Bartenev [Wed, 15 Jan 2014 13:16:38 +0000 (17:16 +0400)]
SPDY: fixed possible uninitialized memory access.

The frame->stream pointer should always be initialized for control frames since
the check against it can be performed in ngx_http_spdy_filter_cleanup().

12 years agoSPDY: fixed off_t/size_t type conversions on 32 bits platforms.
Valentin Bartenev [Wed, 15 Jan 2014 09:23:31 +0000 (13:23 +0400)]
SPDY: fixed off_t/size_t type conversions on 32 bits platforms.

Parameters of ngx_http_spdy_filter_get_shadow() are changed from size_t to off_t
since the last call of the function may get size and offset from the rest of a
file buffer.  This fixes possible data loss rightfully complained by MSVC on 32
bits systems where off_t is 8 bytes long while size_t is only 4 bytes.

The other two type casts are needed just to suppress warnings about possible
data loss also complained by MSVC but false positive in these cases.

12 years agoSPDY: fixed build, broken by b7ee1bae0ffa.
Valentin Bartenev [Tue, 14 Jan 2014 21:44:52 +0000 (01:44 +0400)]
SPDY: fixed build, broken by b7ee1bae0ffa.

False positive warning about the "cl" variable may be uninitialized in
the ngx_http_spdy_filter_get_data_frame() call was suppressed.

It is always initialized either in the "while" cycle or in the following
"if" condition since frame_size cannot be zero.

12 years agoSPDY: added the "spdy_chunk_size" directive.
Valentin Bartenev [Tue, 14 Jan 2014 12:24:45 +0000 (16:24 +0400)]
SPDY: added the "spdy_chunk_size" directive.

12 years agoSPDY: implemented buffers chain splitting.
Valentin Bartenev [Tue, 14 Jan 2014 12:24:45 +0000 (16:24 +0400)]
SPDY: implemented buffers chain splitting.

It fixes "chain too big in spdy filter" alerts, and adds full support for rate
limiting of SPDY streams.