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:45:04 UTC

[tomcat] branch 7.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 7.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git


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

commit 542e47cbd861fb26b703e1a2b5c10ea4824c3f5a
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 61ecf0e..072485c 100644
--- a/java/org/apache/catalina/connector/Response.java
+++ b/java/org/apache/catalina/connector/Response.java
@@ -29,8 +29,10 @@ 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.Set;
 
 import javax.servlet.ServletOutputStream;
 import javax.servlet.SessionTrackingMode;
@@ -915,9 +917,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<String>();
+        Enumeration<String> enumeration = getCoyoteResponse().getMimeHeaders().values(name);
+        Set<String> result = new LinkedHashSet<String>();
         while (enumeration.hasMoreElements()) {
             result.add(enumeration.nextElement());
         }
diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml
index e2a2cd4..9896a36 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -72,6 +72,10 @@
         <code>HttpServlet</code> is relied upon to generate the HEAD response
         and the GET response uses chunking. (markt)
       </fix>
+      <fix>
+        <bug>64166</bug>: Ensure that the names returned by
+        <code>HttpServletResponse.getHeaderNames()</code> are unique. (markt)
+      </fix>
     </changelog>
   </subsection>
 </section>


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