| 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
| |||||||||||||||
| 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
| |||||||||||||||
| 24 | 2 | ▶ | if ($cookie =~ m/(?:^|;|\s)JSESSIONID\s*=\s*(.+?)(?:\s|;|$)/) { | ||||||||||||
|
Branch: 1 branch
| |||||||||||||||
| 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; | |||||||||||||