Mantis - Resin
Viewing Issue Advanced Details
2900 major always 09-04-08 02:02 09-19-08 11:12
ksullivan  
ferg  
high  
closed 3.1.7  
fixed  
none    
none 3.2.1  
0002900: Repeated headers not passed in response
Issue 2637 reports that the bug with repeated header names going from the client to the Origin Server are passed - this seems to work in 3.1.7. It is also reported that repeated headers, e.g. Set-Cookie headers are passed on the way back from the Origin Server to the client. This does not seem to be working in 3.1.7.

The code (from file HttpProxyServlet.java) that deals with passing the headers back in the response is (irrelevant stuff snipped):
      Iterator iter = rs.getAttributeNames();
      while (iter.hasNext()) {
    String name = (String) iter.next();
      res.addHeader(name, (String) rs.getAttribute(name));
      }

rs.getAttributeNames() only returns one instance of each header name. Even if it didn't, rs.getAttribute(name) would only be able to return one of the values assigned to the header.
 HttpStream.java [^] (19,647 bytes) 09-07-08 10:55

Notes
(0003391)
ksullivan   
09-05-08 02:12   
This is a high priority blocking issue for us. Is someone able to look at this? I even have the code that needs inserted into HttpStream.java to implement this fix.
(0003406)
ksullivan   
09-07-08 11:03   
Attached is the patched version of HttpStream.java to implement a fix for this issue. That file goes in: resin-3.1.7/modules/util/src/com/caucho/vfs. The code change to HttpProxyServlet.java is given here:

Replace Line 213: res.addHeader(name, (String) rs.getAttribute(name));
with:
Object value = rs.getAttribute(name);
if (value instanceof String[]) {
    String []values = (String []) value;
    for (int i = 0; i < values.length; i++) {
        res.addHeader(name, values[i]);
    }
}
else {
    res.addHeader(name, (String)value);
}