[ jetty-Bugs-1297901 ] ProxyHandler header propagation bug

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[ jetty-Bugs-1297901 ] ProxyHandler header propagation bug

SourceForge.net
Bugs item #1297901, was opened at 2005-09-21 11:21
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=107322&aid=1297901&group_id=7322

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Other
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: Aaron Hamid (aaron)
Assigned to: Nobody/Anonymous (nobody)
Summary: ProxyHandler header propagation bug

Initial Comment:
ProxyHandler has a bug when writing headers back to the
client.  It uses code like:

int h=0;
String hdr=connection.getHeaderFieldKey(h);
String val=connection.getHeaderField(h);
while(hdr!=null || val!=null)
{
    if (hdr!=null && val!=null &&
!_DontProxyHeaders.containsKey(hdr))
        response.addField(hdr,val);
    h++;
    hdr=connection.getHeaderFieldKey(h);
    val=connection.getHeaderField(h);
}

However, at least in JDK 1.5 getHeaderField(h) returns
null for the 0th field.  Since a null header field key
is used as a loop termination condition, I suspect the
headers are not being written back to the client.

The loop should either use a different condition for
the loop (e.g., connection.getHeaderFields().size()) or
use the connection.getHeaderFields() map instead.

(Using the map may lose the field order, depending on
what type of map is used internally by the
URLConnection implementation (e.g. LinkedHashMap would
preserve order), but that is the first thing I
implemented.  Probably using
connection.getHeaderFields().size() in combination with
getHeaderFieldKey/getHeaderField is better.)

Patch that fixes this bug attached.



----------------------------------------------------------------------

You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=107322&aid=1297901&group_id=7322


-------------------------------------------------------
SF.Net email is sponsored by:
Tame your development challenges with Apache's Geronimo App Server. Download
it for free - -and be entered to win a 42" plasma tv or your very own
Sony(tm)PSP.  Click here to play: http://sourceforge.net/geronimo.php
_______________________________________________
jetty-discuss mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/jetty-discuss