Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

issue#348. Fixed CSRF tokens not sessioned when using scope and memory_sessions #349

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

alxtuz
Copy link
Collaborator

@alxtuz alxtuz commented Oct 4, 2024

Changed the signature of sessions' functions so that they will be initialized only once on server run, not for every handler. Unfortunately, there's a side effect - session middlewares will be initialized even if they are not used in an application.

…tialized only once on server run, not for every handler
let sql_sessions = Sql_session.sql_sessions
let memory_sessions = Session.memory_sessions ()
let cookie_sessions = Session.cookie_sessions ()
let sql_sessions = Sql_session.sql_sessions ()
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At first glance, this looks like whatever is delayed by the extra unit parameter, will be triggered once per process, rather than once per server (or once per scope). With this change, can there be two concurrent uses of two different memory_session middlewares in one process?

@@ -1583,15 +1583,15 @@ val invalidate_session : request -> unit promise

(** {2 Back ends} *)

val memory_sessions : ?lifetime:float -> middleware
val memory_sessions : middleware
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What happened to the ?lifetime parameter?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants