SockJS/Middleware/JSessionID.pm

filter: Statementstmt 100% 24 / 24 Branchbran 62.5% 5 / 8 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 6 / 6 Podpod 100% 1 / 1 totaltotal 92.3% 36 / 39 CC 5 SCAR 8.9
CC
5
Cov
91%
__ANON__
4.1
call
2.0
BEGIN
1.0
CRAP 2.4
« SockJS/Transport/XHRPolling.pm ↑ Summary SockJS/Transport/Base.pm »
1 package SockJS::Middleware::JSessionID;
2  
3 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 1 ▶use parent 'Plack::Middleware';
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 1 ▶use Plack::Util;
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 3 ▶sub call {
Subroutine call: called CC=2 SCAR=7.0
Pod documented
11 3 my $self = shift;
12 3 my ($env) = @_;
13  
14 3 my $res = $self->app->(@_);
15 3 ▶ return $res unless $env->{'sockjs.transport'};
Branch: 1 branch
BranchTrueFalseTotal
unless $env->{"sockjs.transport"} 0 3 3
16  
17 return $self->response_cb(
18 3 ▶ $res => sub {
Subroutine __ANON__: called CC=4 SCAR=14.0
19 3 my $res = shift;
20  
21 3 my $h = Plack::Util::headers($res->[1]);
22  
23 3 ▶ if (my $cookie = $env->{HTTP_COOKIE}) {
Branch: 2 branches
BranchTrueFalseTotal
if (my $cookie = $env->{'HTTP_COOKIE'}) { } 2 1 3
elsif ($self->{'cookie'}) { } 1 0 1
24 2 ▶ if ($cookie =~ m/(?:^|;|\s)JSESSIONID\s*=\s*(.+?)(?:\s|;|$)/) {
Branch: 1 branch
BranchTrueFalseTotal
if ($cookie =~ /(?:^|;|\s)JSESSIONID\s*=\s*(.+?)(?:\s|;|$)/) 2 0 2
25 2 $h->push('Set-Cookie' => "JSESSIONID=$1; Path=/");
26 }
27 }
28 elsif ($self->{cookie}) {
29 1 $h->push('Set-Cookie' => 'JSESSIONID=dummy; Path=/');
30 }
31 }
32 3 );
33 }
34  
35 1 1;
« SockJS/Transport/XHRPolling.pm ↑ Summary SockJS/Transport/Base.pm »