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   20679 use strict;
  1         2  
  1         27  
4 1     1   4 use parent 'Plack::Middleware';
  1         1  
  1         4  
5 1     1   36 use Plack::Util;
  1         2  
  1         132  
6              
7             sub call {
8 1     1 1 4 my($self, $env) = @_;
9             # Fixes buffer being cut off on redirect when keep-alive is active
10 1         15 my $res = $self->app->($env);
11              
12             Plack::Util::response_cb($res, sub {
13 1     1   2 my $res = shift;
14 1 50       5 if ($res->[0] =~ m!^30[123]$! ) {
15 1         11 Plack::Util::header_remove($res->[1], 'Content-Length');
16 1         11 Plack::Util::header_remove($res->[1], 'Content-Type');
17 1 50       15 return sub{ my $chunk; return unless defined $chunk; return ''; };
  2         3  
  2         12  
  0            
18             }
19              
20 0           return;
21 1         255 });
22              
23             }
24              
25             1;
26             __END__