Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGabriel Couto2018-07-19 05:34:56 +0000
committerDavid Pursehouse2018-07-23 05:56:14 +0000
commit280707b0fc717fdd8898242f21589f0c7c7d87be (patch)
tree5c6f8bf41a161cc8621f277dc0b9ca261e3beeb8 /org.eclipse.jgit.http.apache/src/org/eclipse/jgit
parent32798dcfdb00662a640f0ff2915766591d21e287 (diff)
downloadjgit-280707b0fc717fdd8898242f21589f0c7c7d87be.tar.gz
jgit-280707b0fc717fdd8898242f21589f0c7c7d87be.tar.xz
jgit-280707b0fc717fdd8898242f21589f0c7c7d87be.zip
HttpClientConnection.getHeaderFields should support multiple values for same header
Bug: 537166 Change-Id: I1ba645968efe01a88f2484f030b7572228ba169c Signed-off-by: Gabriel Couto <gmcouto@gmail.com>
Diffstat (limited to 'org.eclipse.jgit.http.apache/src/org/eclipse/jgit')
-rw-r--r--org.eclipse.jgit.http.apache/src/org/eclipse/jgit/transport/http/apache/HttpClientConnection.java10
1 files changed, 7 insertions, 3 deletions
diff --git a/org.eclipse.jgit.http.apache/src/org/eclipse/jgit/transport/http/apache/HttpClientConnection.java b/org.eclipse.jgit.http.apache/src/org/eclipse/jgit/transport/http/apache/HttpClientConnection.java
index 7f1fecb9bf..77c5dc0f3e 100644
--- a/org.eclipse.jgit.http.apache/src/org/eclipse/jgit/transport/http/apache/HttpClientConnection.java
+++ b/org.eclipse.jgit.http.apache/src/org/eclipse/jgit/transport/http/apache/HttpClientConnection.java
@@ -272,10 +272,14 @@ public class HttpClientConnection implements HttpConnection {
public Map<String, List<String>> getHeaderFields() {
Map<String, List<String>> ret = new HashMap<>();
for (Header hdr : resp.getAllHeaders()) {
- List<String> list = new LinkedList<>();
- for (HeaderElement hdrElem : hdr.getElements())
+ List<String> list = ret.get(hdr.getName());
+ if (list == null) {
+ list = new LinkedList<>();
+ ret.put(hdr.getName(), list);
+ }
+ for (HeaderElement hdrElem : hdr.getElements()) {
list.add(hdrElem.toString());
- ret.put(hdr.getName(), list);
+ }
}
return ret;
}

Back to the top