sukria/Dancer — Issue #715: Dancer::Handler::PSGI, FastCGI and %ENV
Author: polgab
Created: 2011-12-20 16:20:20+00:00
State: open

When using Dancer::Handler::PSGI with FastCGI (like dispatch.fcgi), %ENV is not updated with content from current request.

Here, a patch to apply to Dancer::Handler::PSGI.pm :

*** PSGI.pm.orig
--- PSGI.pm.new
***************
*** 20,25 ****
--- 20,26 ----

my $self = {};
bless $self, $class;
+ $self->{envinit} = {%ENV};
return $self;
}

***************
*** 84,89 ****
--- 85,92 ----

sub init_request_headers {
my ($self, $env) = @_;
+ %ENV = (%{$self->{envinit}},
+	map {($_ => $env->{$_})} grep {m/[A-Z_]+$/} keys %$env);
my $plack = Plack::Request->new($env);
Dancer::SharedData->headers($plack->headers);
}