From 66cbf9fee7075b07a74790f2df56ff719f255ac0 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Thu, 4 May 2023 11:40:41 +0200 Subject: [PATCH] Bug 17427: Retrieve sessionID from HTTP_COOKIE To make some tests pass (t/db_dependent/Auth.t) and mimick what did CGI::Session, but that is certainly useless and the tests should be adjusted. Commit modified, added ';' see comment 78 - if ( $http_cookie && $http_cookie =~ m{CGISESSID=([^,:]*)} ) { + if ( $http_cookie && $http_cookie =~ m{CGISESSID=([^,:;]*)} ) { sessionID was "a035bf508448b8b3ecd1ca23609b90b3; bib_list=; KohaOpacLanguage=; JWT= " --- C4/Auth.pm | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/C4/Auth.pm b/C4/Auth.pm index 6ca328ec856..fb40b1ca4c8 100644 --- a/C4/Auth.pm +++ b/C4/Auth.pm @@ -1861,6 +1861,12 @@ sub _get_session_params { sub get_session { my $sessionID = shift; my $params = _get_session_params(); + unless ( $sessionID ) { + my $http_cookie = $ENV{HTTP_COOKIE}; + if ( $http_cookie && $http_cookie =~ m{CGISESSID=([^,:;]*)} ) { + $sessionID = $1; + } + } my $session = Data::Session->new( %$params, ($sessionID ? ( id => $sessionID ) : () ) ) || die $Data::Session::errstr; $session->new_session unless $sessionID; return $session; -- 2.25.1