Bug 58177 - Mod Proxy forward trailers in http chunked request to backends
Summary: Mod Proxy forward trailers in http chunked request to backends
Status: NEW
Alias: None
Product: Apache httpd-2
Classification: Unclassified
Component: mod_proxy (show other bugs)
Version: 2.4.18
Hardware: All All
: P2 enhancement (vote)
Target Milestone: ---
Assignee: Apache HTTPD Bugs Mailing List
URL:
Keywords: PatchAvailable
Depends on:
Blocks:
 
Reported: 2015-07-24 09:16 UTC by Sachin Shetty
Modified: 2015-12-22 14:19 UTC (History)
1 user (show)



Attachments
HTTP Trailer patch for 2.4.16 (3.25 KB, patch)
2015-10-24 17:55 UTC, Daneel Yaitskov
Details | Diff
script sending test chunked request with a trailer (241 bytes, text/plain)
2015-10-24 17:57 UTC, Daneel Yaitskov
Details
HTTP Trailer patch for trunk (2.5) (3.29 KB, patch)
2015-10-24 18:01 UTC, Daneel Yaitskov
Details | Diff
proxy client trailers for 2.4.17 (3.25 KB, patch)
2015-11-01 08:17 UTC, Daneel Yaitskov
Details | Diff
proxy client trailers for 2.4.17 (3.25 KB, patch)
2015-11-02 20:22 UTC, Daneel Yaitskov
Details | Diff
proxy passes http trailers from client (3.25 KB, patch)
2015-12-22 14:19 UTC, Daneel Yaitskov
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Sachin Shetty 2015-07-24 09:16:50 UTC
As per http spec, we want clients to send us trailers in chunked requests.
However the request on the server side does not get the trailer at all.

This can be reproduced with Apache 2.4.16 and mod proxy

Request:
<<<<<
telnet somehost 80
POST /some-path HTTP/1.1
Authorization: Basic XXXX=
Host: somehost.domain.com
Transfer-Encoding: chunked
Trailer: My-Test-Trailer

50
11111111111111111111111111111111111111111111111111111111111111111111111111111111
0
My-Test-Trailer: some-value-new
>>>>>> 

Mod proxy is forwarding the request to apache tomcat in our case and it does not forward the trailers. We have verified that tomcat does get the trailers when the same request is sent to tomcat directly, so mod proxy is blocking them out.


Apparently mod proxy never uses the trailers stored in the request/response trailers as per the discussion in the user group: http://www.gossamer-threads.com/lists/apache/users/448909

This is very critical to us and blocking a feature rollout, I can help testing a patch if available.
Comment 1 Eric Covener 2015-07-24 13:12:13 UTC
Reclassifying as enhancement per Yann's assessment in the thread.  The trailers are hop-by-hop so they are not being "blocked".
Comment 2 Sachin Shetty 2015-08-06 07:09:16 UTC
Hi,

This is a crucial fix for us, if anybody can provide us with a patch, we can test it out. I can even work with my management and try to fund the patch development if possible.

Thanks
Sachin
Comment 3 Daneel Yaitskov 2015-10-24 17:55:18 UTC
Created attachment 33203 [details]
HTTP Trailer patch for 2.4.16

Enforces chunked encoding if trailers are presented.
Checks and filters trailer headers which are declared in the Trailer header.
Comment 4 Daneel Yaitskov 2015-10-24 17:57:31 UTC
Created attachment 33204 [details]
script sending test chunked request with a trailer
Comment 5 Daneel Yaitskov 2015-10-24 18:01:47 UTC
Created attachment 33205 [details]
HTTP Trailer patch for trunk (2.5)

I wasn't able to test this because I was stumbled with configure script generation.

So I tested only patch for 2.4.16.

The patch forward trailing headers in a request passing only those which names are predefined in the Trailer header.
Comment 6 Daneel Yaitskov 2015-11-01 08:17:02 UTC
Created attachment 33239 [details]
proxy client trailers for 2.4.17
Comment 7 Christophe JAILLET 2015-11-01 10:45:42 UTC
Hi,

a few remarks:
   - calling apr_bucket_immortal_create on a buffer allocated with apr_pstrcat is odd.

   - apr_strtok(mod_trailers, ", ",...
should maybe be
     apr_strtok(mod_trailers, ", \t",...
Comment 8 Daneel Yaitskov 2015-11-02 20:22:58 UTC
Created attachment 33249 [details]
proxy client trailers for 2.4.17

Changes after the review:

1. Split trailer list by tab, comma and space.
2. Replace apr_bucket_immortal_create with apr_bucket_pool_create for trailing headers.
Comment 9 Daneel Yaitskov 2015-12-22 14:19:00 UTC
Created attachment 33368 [details]
proxy passes http trailers from client