Coder Social home page Coder Social logo

cgi-session's People

Contributors

chorny avatar markstos avatar ronsavage avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

cgi-session's Issues

Expired sessions and using new()

Basic set up:
my $session = new CGI::Session();
....
print $session->header(); # creates a session cookie, rather one that has an expiry
$session->expiry("+5s"); # now the session has an expiry!

Next access (after 5 seconds) will cause the browser to send the session cookie (which is still valid), CGI::Session finds that the session has actually expired and so will generate a new session. However, the expired and deleted status flags are NOT cleared, hence the header() call will issue the NEW session cookie value with a date of -1d, hence scrubbing the new session cookie from the browser.

Note, the above code is to demonstrate the problem - my code is a lot more involved including redirects to 3rd party authentication, and print $session->header() is only used on the first initialization of the session, it's not repeated while a session is still "valid" (I want to check the session on the server side as it's not always possible to update the cookie expiry during the lifetime of a session).

Ugly workaround in my code:
my $session = new CGI::Session();
if ($session->is_expired && $session->is_new) {
$session->_unset_status( CGI::Session::STATUS_DELETED | CGI::Session::STATUS_EXPIRED );
}
....

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.