SockJS/Middleware/Http10.pm untested

filter: Statementstmt 0.0% 0 / 21 Branchbran 0.0% 0 / 2 Conditioncond 0.0% 0 / 6 MC/DCmcdc 0.0% 0 / 3 Subroutinesub 0.0% 0 / 5 Podpod 0.0% 0 / 1 totaltotal 0.0% 0 / 38 CC 2 SCAR 12.0
CC
2
Cov
0%
call
6.0
BEGIN
2.0
BEGIN
2.0
CRAP 3.3
1 package SockJS::Middleware::Http10;
2  
3 use strict;
4 use warnings;
5  
6 use parent 'Plack::Middleware';
7  
8 use Plack::Util;
9  
10 sub call {
11 my $self = shift;
12 my ($env) = @_;
13  
14 my $res = $self->app->($env);
15  
16 $self->response_cb(
17 $res => sub {
18 my $res = shift;
19 my $h = Plack::Util::headers( $res->[1] );
20  
21 if ( $env->{'SERVER_PROTOCOL'} eq 'HTTP/1.0'
22 && !$h->exists('Content-Length')
23 && !$h->exists('Connection') )
24 {
25 $h->set( 'Connection' => 'close' );
26 return;
27 }
28 }
29 );
30 }
31  
32 1;