Mantis - Resin
Viewing Issue Advanced Details
2637 crash always 04-29-08 17:46 05-12-08 13:25
remilon  
ferg  
normal  
closed 3.1.5  
fixed  
none    
none 3.1.7  
0002637: HttpProxyServlet doesn't pass headers correctly
We tried out using HttpProxyServlet to proxy requests to a backend legacy server that is setting multiple cookies. However, a response that leaves the backend looking something like this:

HTTP/1.x 200 OK
Set-Cookie: A=1; path=/; domain=example.com
Set-Cookie: B=2; path=/; domain=example.com
Set-Cookie: C=3; path=/; domain=example.com
Content-Language: en-US
Expires: Thu, 01 Nov 2007 21:15:45 GMT
Content-Encoding: gzip
Content-Type: text/html; charset=ISO-8859-1
Content-Length: 7462
Date: Wed, 30 Apr 2008 00:35:50 GMT

Arrives at the client looking something like this:

HTTP/1.x 200 OK
Set-Cookie: C=3; path=/; domain=example.com
Content-Language: en-US
Expires: Thu, 01 Nov 2007 21:15:45 GMT
Content-Encoding: gzip
Content-Type: text/html; charset=ISO-8859-1
Content-Length: 7462
Date: Wed, 30 Apr 2008 00:35:50 GMT

Digging in to the source a bit, it looks like the underlying HttpStream uses a HashMap to keep header values, thus overwriting headers with the same name. Also, although we only saw it with Set-Cookie, this would make any multi-line headers not function properly.

Notes
(0003028)
remilon   
04-29-08 18:02   
It looks like the same HttpStream is used for the request and response, so headers on multiple lines coming from the client would also be overwritten.
(0003047)
ferg   
05-12-08 13:25   
server/196{b,c}