On 25/02/2020 20:47, Christopher Schultz wrote: > Mark, > > On 2/25/20 14:38, ma...@apache.org wrote: >> This is an automated email from the ASF dual-hosted git >> repository. > >> markt pushed a commit to branch master in repository >> https://gitbox.apache.org/repos/asf/tomcat.git > > >> The following commit(s) were added to refs/heads/master by this >> push: new e9ee933 BZ 64166. HttpServletResponse.getHeaderNames() >> now returns unique names e9ee933 is described below > >> commit e9ee9338f3b4c694b7fd90b69ed468dbdeff5a76 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 >> fce5570..9ec0b5d 100644 --- >> a/java/org/apache/catalina/connector/Response.java +++ >> b/java/org/apache/catalina/connector/Response.java @@ -30,9 +30,11 >> @@ import java.util.ArrayList; import java.util.Arrays; import >> java.util.Collection; import java.util.Enumeration; +import >> java.util.LinkedHashSet; > > Is header order actually important?
Probably not but it might be for custom headers. I didn't want to change the order to be on the safe side. Mark > AFAICT, the only time order matters is when header[0] is used for > "status code" which is not uncommon, but weird. > >> import java.util.List; import java.util.Locale; import >> java.util.Map; +import java.util.Set; import >> java.util.function.Supplier; > >> import jakarta.servlet.ServletOutputStream; @@ -868,9 +870,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 >> 5632768..dd93f38 100644 --- a/webapps/docs/changelog.xml +++ >> b/webapps/docs/changelog.xml @@ -59,6 +59,10 @@ Add extension point >> to DeltaSession to improve subclassing. Patch provided by ThStock. >> (schultz) </add> + <fix> + <bug>64166</bug>: Ensure >> that the names returned by + >> <code>HttpServletResponse.getHeaderNames()</code> are unique. >> (markt) + </fix> </changelog> </subsection> <subsection >> name="Coyote"> > > -chris > > --------------------------------------------------------------------- > To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org > For additional commands, e-mail: dev-h...@tomcat.apache.org > --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org