Mercurial > hg > nginx
comparison src/http/ngx_http_request.h @ 7034:1b068a4e82d8
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>
author | Piotr Sikora <piotrsikora@google.com> |
---|---|
date | Fri, 24 Mar 2017 03:37:34 -0700 |
parents | 9552758a786e |
children | f583559aadc7 |
comparison
equal
deleted
inserted
replaced
7033:ab5117642647 | 7034:1b068a4e82d8 |
---|---|
250 } ngx_http_headers_in_t; | 250 } ngx_http_headers_in_t; |
251 | 251 |
252 | 252 |
253 typedef struct { | 253 typedef struct { |
254 ngx_list_t headers; | 254 ngx_list_t headers; |
255 ngx_list_t trailers; | |
255 | 256 |
256 ngx_uint_t status; | 257 ngx_uint_t status; |
257 ngx_str_t status_line; | 258 ngx_str_t status_line; |
258 | 259 |
259 ngx_table_elt_t *server; | 260 ngx_table_elt_t *server; |
512 #endif | 513 #endif |
513 | 514 |
514 unsigned pipeline:1; | 515 unsigned pipeline:1; |
515 unsigned chunked:1; | 516 unsigned chunked:1; |
516 unsigned header_only:1; | 517 unsigned header_only:1; |
518 unsigned expect_trailers:1; | |
517 unsigned keepalive:1; | 519 unsigned keepalive:1; |
518 unsigned lingering_close:1; | 520 unsigned lingering_close:1; |
519 unsigned discard_body:1; | 521 unsigned discard_body:1; |
520 unsigned reading_body:1; | 522 unsigned reading_body:1; |
521 unsigned internal:1; | 523 unsigned internal:1; |