Uploaded image for project: 'Undertow'
  1. Undertow
  2. UNDERTOW-1489

Can't add more than one cookie with the same name

    XMLWordPrintable

Details

    • Hide

      Just add the following code to a scriptlet on a JSP (or use the attached test.jsp:

          javax.servlet.http.Cookie c = new javax.servlet.http.Cookie("test", "test");
          c.setPath("/test");
      
          javax.servlet.http.Cookie cc = new javax.servlet.http.Cookie("test", "test");
          cc.setPath("/test2");
      
          response.addCookie(c);
          response.addCookie(cc);
      

      When the JSP is invoked we get the headers:

      Connection: keep-alive
      Content-Length: 183
      Content-Type: text/html;charset=UTF-8
      Date: Fri, 25 Jan 2019 14:30:41 GMT
      Server: JBoss-EAP/7
      Set-Cookie: test=test; path=/test2
      X-Powered-By: Undertow/1, JSP/2.3

      As it can be seen, only the second path has been added.

      Show
      Just add the following code to a scriptlet on a JSP (or use the attached test.jsp: javax.servlet.http.Cookie c = new javax.servlet.http.Cookie( "test" , "test" ); c.setPath( "/test" ); javax.servlet.http.Cookie cc = new javax.servlet.http.Cookie( "test" , "test" ); cc.setPath( "/test2" ); response.addCookie(c); response.addCookie(cc); When the JSP is invoked we get the headers: Connection: keep-alive Content-Length: 183 Content-Type: text/html;charset=UTF-8 Date: Fri, 25 Jan 2019 14:30:41 GMT Server: JBoss-EAP/7 Set-Cookie: test=test; path=/test2 X-Powered-By: Undertow/1, JSP/2.3 As it can be seen, only the second path has been added.

    Description

      When trying to add two cookies with the same name but different path the cookie is overwritten, and only the last path is actually set.

      This contrasts with the behavior of EAP 6.x where the two cookies are set correctly.

      Attachments

        Issue Links

          Activity

            People

              flaviarnn Flavia Rainone
              rhn-support-ivassile Ilia Vassilev
              Votes:
              1 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: