]> git.kaiwu.me - nginx.git/commit
Added support for trailers in HTTP responses.
authorPiotr Sikora <piotrsikora@google.com>
Fri, 24 Mar 2017 10:37:34 +0000 (03:37 -0700)
committerPiotr Sikora <piotrsikora@google.com>
Fri, 24 Mar 2017 10:37:34 +0000 (03:37 -0700)
commitcfdce50657cb8d25058de3d677f03cdef0d5de51
tree122dd12203f4dcf5a6c2438fe13f31af8d8bce82
parentfa0992ed295ba83f711ca3d1ba8fc1baaa5760ca
Added support for trailers in HTTP responses.

Example:

   ngx_table_elt_t  *h;

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

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

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

Modules that want to emit trailers must set r->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 <piotrsikora@google.com>
src/http/modules/ngx_http_chunked_filter_module.c
src/http/ngx_http_core_module.c
src/http/ngx_http_request.c
src/http/ngx_http_request.h
src/http/ngx_http_variables.c