<feed xmlns='http://www.w3.org/2005/Atom'>
<title>nginx.git/src/http, branch release-1.13.3</title>
<subtitle>nginx</subtitle>
<link rel='alternate' type='text/html' href='https://git.sigsegv.uk/nginx.git/'/>
<entry>
<title>Range filter: avoid negative range start.</title>
<updated>2017-07-11T13:06:26+00:00</updated>
<author>
<name>Maxim Dounin</name>
<email>mdounin@mdounin.ru</email>
</author>
<published>2017-07-11T13:06:26+00:00</published>
<link rel='alternate' type='text/html' href='https://git.sigsegv.uk/nginx.git/commit/?id=d289616b0fb452f7dd4cbb4534c706950e3d6c24'/>
<id>d289616b0fb452f7dd4cbb4534c706950e3d6c24</id>
<content type='text'>
Suffix ranges no longer allowed to set negative start values, to prevent
ranges with negative start from appearing even if total size protection
will be removed.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Suffix ranges no longer allowed to set negative start values, to prevent
ranges with negative start from appearing even if total size protection
will be removed.
</pre>
</div>
</content>
</entry>
<entry>
<title>Range filter: protect from total size overflows.</title>
<updated>2017-07-11T13:06:23+00:00</updated>
<author>
<name>Maxim Dounin</name>
<email>mdounin@mdounin.ru</email>
</author>
<published>2017-07-11T13:06:23+00:00</published>
<link rel='alternate' type='text/html' href='https://git.sigsegv.uk/nginx.git/commit/?id=92111c92e5860ff6338dc8ded8e3805189d02fc7'/>
<id>92111c92e5860ff6338dc8ded8e3805189d02fc7</id>
<content type='text'>
The overflow can be used to circumvent the restriction on total size of
ranges introduced in c2a91088b0c0 (1.1.2).  Additionally, overflow
allows producing ranges with negative start (such ranges can be created
by using a suffix, "bytes=-100"; normally this results in 200 due to
the total size check).  These can result in the following errors in logs:

[crit] ... pread() ... failed (22: Invalid argument)
[alert] ... sendfile() failed (22: Invalid argument)

When using cache, it can be also used to reveal cache file header.
It is believed that there are no other negative effects, at least with
standard nginx modules.

In theory, this can also result in memory disclosure and/or segmentation
faults if multiple ranges are allowed, and the response is returned in a
single in-memory buffer.  This never happens with standard nginx modules
though, as well as known 3rd party modules.

Fix is to properly protect from possible overflow when incrementing size.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The overflow can be used to circumvent the restriction on total size of
ranges introduced in c2a91088b0c0 (1.1.2).  Additionally, overflow
allows producing ranges with negative start (such ranges can be created
by using a suffix, "bytes=-100"; normally this results in 200 due to
the total size check).  These can result in the following errors in logs:

[crit] ... pread() ... failed (22: Invalid argument)
[alert] ... sendfile() failed (22: Invalid argument)

When using cache, it can be also used to reveal cache file header.
It is believed that there are no other negative effects, at least with
standard nginx modules.

In theory, this can also result in memory disclosure and/or segmentation
faults if multiple ranges are allowed, and the response is returned in a
single in-memory buffer.  This never happens with standard nginx modules
though, as well as known 3rd party modules.

Fix is to properly protect from possible overflow when incrementing size.
</pre>
</div>
</content>
</entry>
<entry>
<title>Variables: use ngx_http_variable_null_value where appropriate.</title>
<updated>2017-07-07T11:34:21+00:00</updated>
<author>
<name>Ruslan Ermilov</name>
<email>ru@nginx.com</email>
</author>
<published>2017-07-07T11:34:21+00:00</published>
<link rel='alternate' type='text/html' href='https://git.sigsegv.uk/nginx.git/commit/?id=a54e3193bfa0e0b912cdc394564307be5bb68c17'/>
<id>a54e3193bfa0e0b912cdc394564307be5bb68c17</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>Proxy: split configured header names and values.</title>
<updated>2017-03-15T22:55:35+00:00</updated>
<author>
<name>Piotr Sikora</name>
<email>piotrsikora@google.com</email>
</author>
<published>2017-03-15T22:55:35+00:00</published>
<link rel='alternate' type='text/html' href='https://git.sigsegv.uk/nginx.git/commit/?id=32e3d0e693b6520d0e087160519d173bb102f906'/>
<id>32e3d0e693b6520d0e087160519d173bb102f906</id>
<content type='text'>
Previously, each configured header was represented in one of two ways,
depending on whether or not its value included any variables.

If the value didn't include any variables, then it would be represented
as as a single script that contained complete header line with HTTP/1.1
delimiters, i.e.:

     "Header: value\r\n"

But if the value included any variables, then it would be represented
as a series of three scripts: first contained header name and the ": "
delimiter, second evaluated to header value, and third contained only
"\r\n", i.e.:

     "Header: "
     "$value"
     "\r\n"

This commit changes that, so that each configured header is represented
as a series of two scripts: first contains only header name, and second
contains (or evaluates to) only header value, i.e.:

    "Header"
    "$value"

or

    "Header"
    "value"

This not only makes things more consistent, but also allows header name
and value to be accessed separately.

Signed-off-by: Piotr Sikora &lt;piotrsikora@google.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Previously, each configured header was represented in one of two ways,
depending on whether or not its value included any variables.

If the value didn't include any variables, then it would be represented
as as a single script that contained complete header line with HTTP/1.1
delimiters, i.e.:

     "Header: value\r\n"

But if the value included any variables, then it would be represented
as a series of three scripts: first contained header name and the ": "
delimiter, second evaluated to header value, and third contained only
"\r\n", i.e.:

     "Header: "
     "$value"
     "\r\n"

This commit changes that, so that each configured header is represented
as a series of two scripts: first contains only header name, and second
contains (or evaluates to) only header value, i.e.:

    "Header"
    "$value"

or

    "Header"
    "value"

This not only makes things more consistent, but also allows header name
and value to be accessed separately.

Signed-off-by: Piotr Sikora &lt;piotrsikora@google.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>Range filter: allowed ranges on empty files (ticket #1031).</title>
<updated>2017-06-26T21:53:46+00:00</updated>
<author>
<name>Maxim Dounin</name>
<email>mdounin@mdounin.ru</email>
</author>
<published>2017-06-26T21:53:46+00:00</published>
<link rel='alternate' type='text/html' href='https://git.sigsegv.uk/nginx.git/commit/?id=774f179a9b523cff2233846283dc35a5582aa1d1'/>
<id>774f179a9b523cff2233846283dc35a5582aa1d1</id>
<content type='text'>
As per RFC 2616 / RFC 7233, any range request to an empty file
is expected to result in 416 Range Not Satisfiable response, as
there cannot be a "byte-range-spec whose first-byte-pos is less
than the current length of the entity-body".  On the other hand,
this makes use of byte-range requests inconvenient in some cases,
as reported for the slice module here:

http://mailman.nginx.org/pipermail/nginx-devel/2017-June/010177.html

This commit changes range filter to instead return 200 if the file
is empty and the range requested starts at 0.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
As per RFC 2616 / RFC 7233, any range request to an empty file
is expected to result in 416 Range Not Satisfiable response, as
there cannot be a "byte-range-spec whose first-byte-pos is less
than the current length of the entity-body".  On the other hand,
this makes use of byte-range requests inconvenient in some cases,
as reported for the slice module here:

http://mailman.nginx.org/pipermail/nginx-devel/2017-June/010177.html

This commit changes range filter to instead return 200 if the file
is empty and the range requested starts at 0.
</pre>
</div>
</content>
</entry>
<entry>
<title>Upstream: introduced ngx_http_upstream_ssl_handshake_handler().</title>
<updated>2017-06-22T18:09:06+00:00</updated>
<author>
<name>Maxim Dounin</name>
<email>mdounin@mdounin.ru</email>
</author>
<published>2017-06-22T18:09:06+00:00</published>
<link rel='alternate' type='text/html' href='https://git.sigsegv.uk/nginx.git/commit/?id=6433c841a0b66614e3ee448e14e1b32463c7106d'/>
<id>6433c841a0b66614e3ee448e14e1b32463c7106d</id>
<content type='text'>
This change reworks 13a5f4765887 to only run posted requests once,
with nothing on stack.  Running posted requests with other request
functions on stack may result in use-after-free in case of errors,
similar to the one reported in #788.

To only run posted request once, a separate function was introduced
to be used as ssl handshake handler in c-&gt;ssl-&gt;handler,
ngx_http_upstream_ssl_handshake_handler().  The ngx_http_run_posted_requests()
is only called in this function, and not in ngx_http_upstream_ssl_handshake()
which may be called directly on stack.

Additionaly, ngx_http_upstream_ssl_handshake_handler() now does appropriate
debug logging of the current subrequest, similar to what is done in other
event handlers.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This change reworks 13a5f4765887 to only run posted requests once,
with nothing on stack.  Running posted requests with other request
functions on stack may result in use-after-free in case of errors,
similar to the one reported in #788.

To only run posted request once, a separate function was introduced
to be used as ssl handshake handler in c-&gt;ssl-&gt;handler,
ngx_http_upstream_ssl_handshake_handler().  The ngx_http_run_posted_requests()
is only called in this function, and not in ngx_http_upstream_ssl_handshake()
which may be called directly on stack.

Additionaly, ngx_http_upstream_ssl_handshake_handler() now does appropriate
debug logging of the current subrequest, similar to what is done in other
event handlers.
</pre>
</div>
</content>
</entry>
<entry>
<title>Upstream: fixed running posted requests (ticket #788).</title>
<updated>2017-06-14T17:13:41+00:00</updated>
<author>
<name>Roman Arutyunyan</name>
<email>arut@nginx.com</email>
</author>
<published>2017-06-14T17:13:41+00:00</published>
<link rel='alternate' type='text/html' href='https://git.sigsegv.uk/nginx.git/commit/?id=efa61f42c10355263fd883e53f3e690fe01770a0'/>
<id>efa61f42c10355263fd883e53f3e690fe01770a0</id>
<content type='text'>
Previously, the upstream resolve handler always called
ngx_http_run_posted_requests() to run posted requests after processing the
resolver response.  However, if the handler was called directly from the
ngx_resolve_name() function (for example, if the resolver response was cached),
running posted requests from the handler could lead to the following errors:

- If the request was scheduled for termination, it could actually be terminated
in the resolve handler.  Upper stack frames could reference the freed request
object in this case.

- If a significant number of requests were posted, and for each of them the
resolve handler was called directly from the ngx_resolve_name() function,
posted requests could be run recursively and lead to stack overflow.

Now ngx_http_run_posted_requests() is only called from asynchronously invoked
resolve handlers.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Previously, the upstream resolve handler always called
ngx_http_run_posted_requests() to run posted requests after processing the
resolver response.  However, if the handler was called directly from the
ngx_resolve_name() function (for example, if the resolver response was cached),
running posted requests from the handler could lead to the following errors:

- If the request was scheduled for termination, it could actually be terminated
in the resolve handler.  Upper stack frames could reference the freed request
object in this case.

- If a significant number of requests were posted, and for each of them the
resolve handler was called directly from the ngx_resolve_name() function,
posted requests could be run recursively and lead to stack overflow.

Now ngx_http_run_posted_requests() is only called from asynchronously invoked
resolve handlers.
</pre>
</div>
</content>
</entry>
<entry>
<title>Headers filter: added "add_trailer" directive.</title>
<updated>2017-03-24T10:37:34+00:00</updated>
<author>
<name>Piotr Sikora</name>
<email>piotrsikora@google.com</email>
</author>
<published>2017-03-24T10:37:34+00:00</published>
<link rel='alternate' type='text/html' href='https://git.sigsegv.uk/nginx.git/commit/?id=8310d81dc7751c23ad9693908a593c9f0ff3b196'/>
<id>8310d81dc7751c23ad9693908a593c9f0ff3b196</id>
<content type='text'>
Trailers added using this directive are evaluated after response body
is processed by output filters (but before it's written to the wire),
so it's possible to use variables calculated from the response body
as the trailer value.

Signed-off-by: Piotr Sikora &lt;piotrsikora@google.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Trailers added using this directive are evaluated after response body
is processed by output filters (but before it's written to the wire),
so it's possible to use variables calculated from the response body
as the trailer value.

Signed-off-by: Piotr Sikora &lt;piotrsikora@google.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>HTTP/2: added support for trailers in HTTP responses.</title>
<updated>2017-03-24T10:37:34+00:00</updated>
<author>
<name>Piotr Sikora</name>
<email>piotrsikora@google.com</email>
</author>
<published>2017-03-24T10:37:34+00:00</published>
<link rel='alternate' type='text/html' href='https://git.sigsegv.uk/nginx.git/commit/?id=d85f2f9e927c2f6db51cca824ed83ff6657c2c92'/>
<id>d85f2f9e927c2f6db51cca824ed83ff6657c2c92</id>
<content type='text'>
Signed-off-by: Piotr Sikora &lt;piotrsikora@google.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Signed-off-by: Piotr Sikora &lt;piotrsikora@google.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>Added support for trailers in HTTP responses.</title>
<updated>2017-03-24T10:37:34+00:00</updated>
<author>
<name>Piotr Sikora</name>
<email>piotrsikora@google.com</email>
</author>
<published>2017-03-24T10:37:34+00:00</published>
<link rel='alternate' type='text/html' href='https://git.sigsegv.uk/nginx.git/commit/?id=cfdce50657cb8d25058de3d677f03cdef0d5de51'/>
<id>cfdce50657cb8d25058de3d677f03cdef0d5de51</id>
<content type='text'>
Example:

   ngx_table_elt_t  *h;

   h = ngx_list_push(&amp;r-&gt;headers_out.trailers);
   if (h == NULL) {
       return NGX_ERROR;
   }

   ngx_str_set(&amp;h-&gt;key, "Fun");
   ngx_str_set(&amp;h-&gt;value, "with trailers");
   h-&gt;hash = ngx_hash_key_lc(h-&gt;key.data, h-&gt;key.len);

The code above adds "Fun: with trailers" trailer to the response.

Modules that want to emit trailers must set r-&gt;expect_trailers = 1
in header filter, otherwise they might not be emitted for HTTP/1.1
responses that aren't already chunked.

This change also adds $sent_trailer_* variables.

Signed-off-by: Piotr Sikora &lt;piotrsikora@google.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Example:

   ngx_table_elt_t  *h;

   h = ngx_list_push(&amp;r-&gt;headers_out.trailers);
   if (h == NULL) {
       return NGX_ERROR;
   }

   ngx_str_set(&amp;h-&gt;key, "Fun");
   ngx_str_set(&amp;h-&gt;value, "with trailers");
   h-&gt;hash = ngx_hash_key_lc(h-&gt;key.data, h-&gt;key.len);

The code above adds "Fun: with trailers" trailer to the response.

Modules that want to emit trailers must set r-&gt;expect_trailers = 1
in header filter, otherwise they might not be emitted for HTTP/1.1
responses that aren't already chunked.

This change also adds $sent_trailer_* variables.

Signed-off-by: Piotr Sikora &lt;piotrsikora@google.com&gt;
</pre>
</div>
</content>
</entry>
</feed>
