Correctly resolve HTTP headers with multiple values on Android.

No longer clobbering one of the values if the server set a HTTP header
multiple times e.g.:

Header1: value-one
Header1: value-two
This commit is contained in:
Hristo Deshev
2016-07-04 15:58:31 +03:00
parent 8ba13be39a
commit 162450e76e

View File

@@ -138,13 +138,13 @@ public class Async
return; return;
} }
for (int i = 0; i < size - 1; i++) for (Map.Entry<String, List<String>> entry: headers.entrySet()) {
{ String key = entry.getKey();
String key = connection.getHeaderFieldKey(i); for (String value: entry.getValue()) {
String value = connection.getHeaderField(key);
this.headers.add(new KeyValuePair(key, value)); this.headers.add(new KeyValuePair(key, value));
} }
} }
}
public void readResponseStream(HttpURLConnection connection, Stack<Closeable> openedStreams, RequestOptions options) throws IOException public void readResponseStream(HttpURLConnection connection, Stack<Closeable> openedStreams, RequestOptions options) throws IOException
{ {