From 280707b0fc717fdd8898242f21589f0c7c7d87be Mon Sep 17 00:00:00 2001 From: Gabriel Couto Date: Thu, 19 Jul 2018 05:34:56 +0000 Subject: HttpClientConnection.getHeaderFields should support multiple values for same header Bug: 537166 Change-Id: I1ba645968efe01a88f2484f030b7572228ba169c Signed-off-by: Gabriel Couto --- .../jgit/transport/http/apache/HttpClientConnection.java | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'org.eclipse.jgit.http.apache/src/org') 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> getHeaderFields() { Map> ret = new HashMap<>(); for (Header hdr : resp.getAllHeaders()) { - List list = new LinkedList<>(); - for (HeaderElement hdrElem : hdr.getElements()) + List 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; } -- cgit v1.2.3