Mercurial > hg > nginx-quic
comparison src/http/ngx_http_core_module.c @ 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 | 6d0e0d982ec0 |
children | cce6936ed2f4 |
comparison
equal
deleted
inserted
replaced
7033:ab5117642647 | 7034:1b068a4e82d8 |
---|---|
2477 if (sr->ctx == NULL) { | 2477 if (sr->ctx == NULL) { |
2478 return NGX_ERROR; | 2478 return NGX_ERROR; |
2479 } | 2479 } |
2480 | 2480 |
2481 if (ngx_list_init(&sr->headers_out.headers, r->pool, 20, | 2481 if (ngx_list_init(&sr->headers_out.headers, r->pool, 20, |
2482 sizeof(ngx_table_elt_t)) | |
2483 != NGX_OK) | |
2484 { | |
2485 return NGX_ERROR; | |
2486 } | |
2487 | |
2488 if (ngx_list_init(&sr->headers_out.trailers, r->pool, 4, | |
2482 sizeof(ngx_table_elt_t)) | 2489 sizeof(ngx_table_elt_t)) |
2483 != NGX_OK) | 2490 != NGX_OK) |
2484 { | 2491 { |
2485 return NGX_ERROR; | 2492 return NGX_ERROR; |
2486 } | 2493 } |