You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by ma...@apache.org on 2020/02/25 19:39:53 UTC

[tomcat] branch 9.0.x updated: BZ 64166. HttpServletResponse.getHeaderNames() now returns unique names

This is an automated email from the ASF dual-hosted git repository.

markt pushed a commit to branch 9.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/9.0.x by this push:
     new 90f5f2f  BZ 64166. HttpServletResponse.getHeaderNames() now returns unique names
90f5f2f is described below

commit 90f5f2f8528612bb7f07c9fe403c5218c050bec8
Author: Mark Thomas <ma...@apache.org>
AuthorDate: Tue Feb 25 14:16:44 2020 +0000

    BZ 64166. HttpServletResponse.getHeaderNames() now returns unique names
    
    https://bz.apache.org/bugzilla/show_bug.cgi?id=64166
---
 java/org/apache/catalina/connector/Response.java | 7 ++++---
 webapps/docs/changelog.xml                       | 4 ++++
 2 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/java/org/apache/catalina/connector/Response.java b/java/org/apache/catalina/connector/Response.java
index 37515ed..3900c30 100644
--- a/java/org/apache/catalina/connector/Response.java
+++ b/java/org/apache/catalina/connector/Response.java
@@ -31,9 +31,11 @@ import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Collection;
 import java.util.Enumeration;
+import java.util.LinkedHashSet;
 import java.util.List;
 import java.util.Locale;
 import java.util.Map;
+import java.util.Set;
 import java.util.function.Supplier;
 
 import javax.servlet.ServletOutputStream;
@@ -878,9 +880,8 @@ public class Response implements HttpServletResponse {
 
     @Override
     public Collection<String> getHeaders(String name) {
-        Enumeration<String> enumeration =
-                getCoyoteResponse().getMimeHeaders().values(name);
-        List<String> result = new ArrayList<>();
+        Enumeration<String> enumeration = getCoyoteResponse().getMimeHeaders().values(name);
+        Set<String> result = new LinkedHashSet<>();
         while (enumeration.hasMoreElements()) {
             result.add(enumeration.nextElement());
         }
diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml
index 45eb1b1..1c9ad17 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -64,6 +64,10 @@
       <fix>
         Missing store config attributes for Resources elements. (remm)
       </fix>
+      <fix>
+        <bug>64166</bug>: Ensure that the names returned by
+        <code>HttpServletResponse.getHeaderNames()</code> are unique. (markt)
+      </fix>
     </changelog>
   </subsection>
   <subsection name="Coyote">


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org