Hi,
Off the back of Sandro's email earlier I was looking at the Query class and
notice that it uses a dictionary to store the response headers:
int i = 1;
> for (String key = connection.getHeaderFieldKey(i);
> key != null;
> key = connection.getHeaderFieldKey(++i)) {
> responseProperties.put(key, connection.getHeaderField(i));
> }
>
However, you can have multiple headers with the same name, e.g.
Set-Cookie: name=MyCookie; value=Some value
Set-Cookie: name=AnotherCookie; value=666
MyHeader: hello
MyHeader: world
The code above would overwrite proceeding values with the most recent one
retrieved so the result of the above would be a map with the following:
Set-Cookie: name=AnotherCookie; value=666
MyHeader: world
The obvious solution is to change
public final class RequestPropertiesDictionary
implements Dictionary<String, String>, Iterable<String>
To
public final class RequestPropertiesDictionary
implements Dictionary<String, String[]>, Iterable<String>
and fix the Query class to cope with an array, e.g.
for (String key = connection.getHeaderFieldKey(i);
key != null;
key = connection.getHeaderFieldKey(++i)) {
String[] values = responseProperties.get(key);
if (null == values) {
values = new String[1];
} else {
}
values[values.length - 1] = connection.getHeaderField(i)
responseProperties.put(key, );
}
Any thoughts?
If this is valid I'll create a JIRA issue and submit a fix (it's been a
while since I've committed anything!) and fix up anything dependent on the
existing version of RequestPropertiesDictionary.
Cheers,
Chris