Skip to content

Commit

Permalink
set plack.proxy variables in on_headers
Browse files Browse the repository at this point in the history
  • Loading branch information
leedo committed Jan 18, 2011
1 parent 82820dd commit 51524eb
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions lib/Plack/App/Proxy.pm
Expand Up @@ -92,6 +92,11 @@ sub call {
my $headers = shift;

if ($headers->{Status} !~ /^59\d+/) {
$env->{'plack.proxy.last_protocol'} = $headers->{HTTPVersion};
$env->{'plack.proxy.last_status'} = $headers->{Status};
$env->{'plack.proxy.last_reason'} = $headers->{Reason};
$env->{'plack.proxy.last_url'} = $headers->{URL};

$writer = $respond->([
$headers->{Status},
[$self->response_headers($headers)],
Expand All @@ -106,11 +111,6 @@ sub call {
sub {
my (undef, $headers) = @_;

$env->{'plack.proxy.last_protocol'} = $headers->{HTTPVersion};
$env->{'plack.proxy.last_status'} = $headers->{Status};
$env->{'plack.proxy.last_reason'} = $headers->{Reason};
$env->{'plack.proxy.last_url'} = $headers->{URL};

if (!$writer and $headers->{Status} =~ /^59\d/) {
$respond->([502, ["Content-Type","text/html"], ["Gateway error"]]);
}
Expand Down

0 comments on commit 51524eb

Please sign in to comment.