File Coverage

blib/lib/Plack/Middleware/IIS7KeepAliveFix.pm
Criterion Covered Total %
statement 19 21 90.4
branch 2 4 50.0
condition n/a
subroutine 5 5 100.0
pod 1 1 100.0
total 27 31 87.1


line stmt bran cond sub pod time code
1             package Plack::Middleware::IIS7KeepAliveFix;
2              
3 1     1   24034 use strict;
  1         3  
  1         33  
4 1     1   6 use parent 'Plack::Middleware';
  1         2  
  1         5  
5 1     1   45 use Plack::Util;
  1         2  
  1         156  
6              
7             sub call {
8 1     1 1 3 my($self, $env) = @_;
9             # Fixes buffer being cut off on redirect when keep-alive is active
10 1         11 my $res = $self->app->($env);
11              
12             Plack::Util::response_cb($res, sub {
13 1     1   2 my $res = shift;
14 1 50       8 if ($res->[0] =~ m!^30[123]$! ) {
15 1         5 Plack::Util::header_remove($res->[1], 'Content-Length');
16 1         4 Plack::Util::header_remove($res->[1], 'Content-Type');
17 1 50       5 return sub{ my $chunk; return unless defined $chunk; return ''; };
  2         3  
  2         8  
  0            
18             }
19              
20 0           return;
21 1         324 });
22              
23             }
24              
25             1;
26             __END__