Author: markt Date: Thu Aug 4 17:00:01 2016 New Revision: 1755214 URL: http://svn.apache.org/viewvc?rev=1755214&view=rev Log: Fix cookie header test so it correctly handles multiple cookies
Modified: tomcat/trunk/test/org/apache/tomcat/util/http/TestCookieParsing.java Modified: tomcat/trunk/test/org/apache/tomcat/util/http/TestCookieParsing.java URL: http://svn.apache.org/viewvc/tomcat/trunk/test/org/apache/tomcat/util/http/TestCookieParsing.java?rev=1755214&r1=1755213&r2=1755214&view=diff ============================================================================== --- tomcat/trunk/test/org/apache/tomcat/util/http/TestCookieParsing.java (original) +++ tomcat/trunk/test/org/apache/tomcat/util/http/TestCookieParsing.java Thu Aug 4 17:00:01 2016 @@ -17,6 +17,7 @@ package org.apache.tomcat.util.http; import java.io.IOException; +import java.util.Enumeration; import javax.servlet.ServletException; import javax.servlet.http.Cookie; @@ -48,7 +49,7 @@ public class TestCookieParsing extends T private static final String COOKIES_WITH_SEPS_TRUNC = "name=val"; private static final String[] COOKIES_WITH_QUOTES = new String[] { - "name=\"val\\\"ue\"" }; + "name=\"val\\\"ue\"", "name=\"value\"" }; @Test public void testLegacyWithEquals() throws Exception { @@ -306,7 +307,11 @@ public class TestCookieParsing extends T throws ServletException, IOException { req.getCookies(); // Never do this in production code. It triggers an XSS. - resp.getWriter().write(req.getHeader("Cookie")); + Enumeration<String> cookieHeaders = req.getHeaders("Cookie"); + while (cookieHeaders.hasMoreElements()) { + String cookieHeader = cookieHeaders.nextElement(); + resp.getWriter().write(cookieHeader); + } resp.flushBuffer(); } } --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org