https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=29744

--- Comment #7 from David Cook <[email protected]> ---
Comment on attachment 132975
  --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=132975
Bug 29744: Harmonize psgi/plack detection methods

Review of attachment 132975:
 --> 
(https://bugs.koha-community.org/bugzilla3/page.cgi?id=splinter.html&bug=29744&attachment=132975)
-----------------------------------------------------------------

::: C4/Auth.pm
@@ +56,3 @@
>  
> +sub safe_exit {
> +    if   (C4::Context::psgi_env) { die 'psgi:exit' }

Ok, so the problem here isn't the BEGIN block, but rather that the old
psgi_env() checked only for "psgi." keys whereas the new C4::Context::psgi_env
checks for "psgi." keys or "plack." keys.

This is significant because CGI::Emulate::PSGI (which runs our CGI scripts as
PSGI functions) removes all "psgi." keys from the environment:
https://metacpan.org/dist/CGI-Emulate-PSGI/source/lib/CGI/Emulate/PSGI.pm#L53

That's why to detect Plack/PSGI in Koha we have to look for those "plack."
variables like plack.file.SCRIPT_NAME and plack.file.PATH_INFO, which are added
by Plack::App::File (via Plack::App::CGIBin.

It's fine for us to "exit" because CGI::Compile (used in Plack::App::WrapCGI)
redefines "exit" for us automatically.

Since we only seem to use C4::Auth::safe_exit in a CGI context, we don't
actually need this PSGI detection at all here.

-- 
You are receiving this mail because:
You are watching all bug changes.
_______________________________________________
Koha-bugs mailing list
[email protected]
https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/

Reply via email to