[PATCH 3 of 3] Upstream: add support for trailers in HTTP responses

Piotr Sikora piotrsikora at google.com
Mon Apr 3 09:33:43 UTC 2017


Hey,

> +static ngx_int_t
> +ngx_http_upstream_copy_trailer(ngx_http_request_t *r,
> +    ngx_table_elt_t *h, ngx_uint_t offset)
> +{
> +    ngx_table_elt_t  *ho;
> +
> +    if (!r->upstream->conf->pass_trailers
> +        || !r->allow_trailers || !r->expect_trailers)
> +    {
> +        return NGX_OK;
> +    }
> +
> +    ho = ngx_list_push(&r->headers_out.headers);
> +    if (ho == NULL) {
> +        return NGX_ERROR;
> +    }
> +
> +    *ho = *h;
> +
> +    return NGX_OK;
> +}

Patch updated so that "Trailer" header is only forwarded with trailers.

Best regards,
Piotr Sikora


More information about the nginx-devel mailing list