Uploaded image for project: 'Immutant'
  1. Immutant
  2. IMMUTANT-316

Setting :max-age to -1 on immutant session cookie attributes does nothing

    Details

    • Type: Bug
    • Status: Resolved (View Workflow)
    • Priority: Minor
    • Resolution: Done
    • Affects Version/s: 1.0.0.cr1
    • Fix Version/s: 1.0.0
    • Labels:
      None
    • Steps to Reproduce:
      Hide

      Do (immutant.web.session/set-session-cookie-attributes! :max-age -1)
      Create web handler that returns something in the :session key, and wrap that in ring's wrap-session middleware
      Examine the resulting cookie - it will have no Max-Age or Expiration set

      Show
      Do (immutant.web.session/set-session-cookie-attributes! :max-age -1) Create web handler that returns something in the :session key, and wrap that in ring's wrap-session middleware Examine the resulting cookie - it will have no Max-Age or Expiration set

      Description

      The documentation (http://immutant.org/documentation/current/web.html#web-session-options) and API docs (http://immutant.org/documentation/current/apidoc/immutant.web.session.html) say that setting the cookie attribute :max-age to -1 should result in a non-expiring session.

      The resulting cookie sent the browser doesn't have any Max-Age or Expires set, which means the cookies expiry will be set to the browser default. In most (all?) browsers, this means it will be deleted when the window is closed.

      Most sites set explicit expiration dates at arbitrarily distant future dates in order to simulate non-expiring sessions.

      Setting :max-age -1 should result in an effectively non-expiring session. Using the date that corresponds with epoch timestamp 2^32-1 is one possible candidate.

        Gliffy Diagrams

          Attachments

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                mgaare Michael Gaare
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: