From 5dd056ebbb152c073860f48388095ef8034b489c Mon Sep 17 00:00:00 2001 From: Julian Maurice Date: Thu, 19 Apr 2018 00:01:24 +0200 Subject: [PATCH] Bug 20582: Enable SetEnv middleware in bin/koha.psgi and make sure the psgi env is passed to CGI scripts Signed-off-by: Josef Moravec --- Koha/App/Plugin/CGIBinKoha.pm | 5 ++++- bin/koha.psgi | 2 ++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/Koha/App/Plugin/CGIBinKoha.pm b/Koha/App/Plugin/CGIBinKoha.pm index 13f8a2857d..05e89457c2 100644 --- a/Koha/App/Plugin/CGIBinKoha.pm +++ b/Koha/App/Plugin/CGIBinKoha.pm @@ -54,8 +54,11 @@ sub register { sub _psgi_env { my ($self, $c) = @_; + my $env = $c->req->env; + my $body = $c->req->body; - my $env = { + $env = { + %$env, 'psgi.input' => IO::Scalar->new(\$body), 'psgi.errors' => *STDERR, REQUEST_METHOD => $c->req->method, diff --git a/bin/koha.psgi b/bin/koha.psgi index 7857de3455..39a1002805 100755 --- a/bin/koha.psgi +++ b/bin/koha.psgi @@ -7,6 +7,8 @@ use Mojo::Server::PSGI; use Plack::Builder; builder { + enable '+Koha::Middleware::SetEnv'; + my $server = Mojo::Server::PSGI->new; $server->load_app("$FindBin::Bin/koha"); $server->to_psgi_app; -- 2.11.0