Wicket
  1. Wicket
  2. WICKET-4989

WicketTester should send copies of its cookies

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 1.5.9, 6.4.0
    • Fix Version/s: 1.5.10, 6.7.0
    • Component/s: wicket
    • Labels:
      None
    • Environment:
      any

      Description

      There are some bugs related to cookie handling in BaseWicketTester.

      Problem 1) a cookie set in the request should not be in the response unless manually set by the server code

      Problem 2) wicket tester sends the original cookie instance to the server. If the server code manipulates the cookie anyhow (e.g. change its value) but do not send it back explicitly in the response then the original cookie in WicketTester (the request cookie) is updated while it shouldn't be.

      A possible solutions for these problems can be found at:
      https://github.com/apache/wicket/pull/28

        Issue Links

          Activity

          Transition Time In Source Status Execution Times Last Executer Last Execution Date
          Open Open Resolved Resolved
          32d 17h 5m 1 Martin Grigorov 19/Feb/13 16:23
          Sven Meier made changes -
          Link This issue is related to WICKET-5147 [ WICKET-5147 ]
          Hide
          Martin Grigorov added a comment -

          One more thing that I believe is wrong in the current handling: some tests assert that a response cookie is in the response even after a redirect.
          A browser wont keep the cookie in all responses. It will be just in the first response (the redirect one) and from there on only the request headers will have the cookie, but not the headers for all following responses.
          I didn't change this behavior because it may break user applications.

          Show
          Martin Grigorov added a comment - One more thing that I believe is wrong in the current handling: some tests assert that a response cookie is in the response even after a redirect. A browser wont keep the cookie in all responses. It will be just in the first response (the redirect one) and from there on only the request headers will have the cookie, but not the headers for all following responses. I didn't change this behavior because it may break user applications.
          Martin Grigorov made changes -
          Status Open [ 1 ] Resolved [ 5 ]
          Fix Version/s 6.7.0 [ 12323964 ]
          Resolution Fixed [ 1 ]
          Hide
          Martin Grigorov added a comment -

          Now WicketTester keeps the cookies in the request. They are transferred to the next request unless there is a cookie in the lastResponse that has max-age==0 for a cookie with the same name, path and domain.
          MockHttpServlet(Request|Response)#getCookies() returns copies of the cookies so the request and response do not share the same instances.

          Show
          Martin Grigorov added a comment - Now WicketTester keeps the cookies in the request. They are transferred to the next request unless there is a cookie in the lastResponse that has max-age==0 for a cookie with the same name, path and domain. MockHttpServlet(Request|Response)#getCookies() returns copies of the cookies so the request and response do not share the same instances.
          Martin Grigorov made changes -
          Description There are many bugs related to the BaseWicketTester cookie handling. I picket two of then in the attached wicket-quickstart and i did some refactoring on a github-branch to fix this.

          https://github.com/apache/wicket/pull/28
          There are some bugs related to cookie handling in BaseWicketTester.

          Problem 1) a cookie set in the request should not be in the response unless manually set by the server code

          Problem 2) wicket tester sends the original cookie instance to the server. If the server code manipulates the cookie anyhow (e.g. change its value) but do not send it back explicitly in the response then the original cookie in WicketTester (the request cookie) is updated while it shouldn't be.

          A possible solutions for these problems can be found at:
          https://github.com/apache/wicket/pull/28
          Martin Grigorov made changes -
          Summary BaseWicketTester Cookie Bugs WicketTester should send copies of its cookies
          Martin Grigorov made changes -
          Fix Version/s 1.5.10 [ 12323510 ]
          Martin Grigorov made changes -
          Assignee Martin Grigorov [ mgrigorov ]
          Michael Mosmann made changes -
          Field Original Value New Value
          Attachment quickstart-basewickettester-bug.zip [ 12565394 ]
          Michael Mosmann created issue -

            People

            • Assignee:
              Martin Grigorov
              Reporter:
              Michael Mosmann
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development