line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package SockJS::Middleware::Cache; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
73776
|
use strict; |
|
1
|
|
|
|
|
11
|
|
|
1
|
|
|
|
|
28
|
|
4
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
26
|
|
5
|
|
|
|
|
|
|
|
6
|
1
|
|
|
1
|
|
451
|
use parent 'Plack::Middleware'; |
|
1
|
|
|
|
|
305
|
|
|
1
|
|
|
|
|
5
|
|
7
|
|
|
|
|
|
|
|
8
|
1
|
|
|
1
|
|
14757
|
use Plack::Util; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
137
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
sub call { |
11
|
2
|
|
|
2
|
1
|
4091
|
my $self = shift; |
12
|
2
|
|
|
|
|
5
|
my ($env) = @_; |
13
|
|
|
|
|
|
|
|
14
|
2
|
|
|
|
|
9
|
my $res = $self->app->(@_); |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
return $self->response_cb( |
17
|
|
|
|
|
|
|
$res => sub { |
18
|
2
|
|
|
2
|
|
40
|
my $res = shift; |
19
|
|
|
|
|
|
|
|
20
|
2
|
|
|
|
|
8
|
my $h = Plack::Util::headers( $res->[1] ); |
21
|
|
|
|
|
|
|
|
22
|
2
|
100
|
|
|
|
74
|
if ($env->{'sockjs.cacheable'}) { |
23
|
1
|
|
|
|
|
6
|
$h->set('Expires' => '31536000'); |
24
|
1
|
|
|
|
|
24
|
$h->set('Cache-Control' => 'public;max-age=31536000'); |
25
|
|
|
|
|
|
|
} |
26
|
|
|
|
|
|
|
else { |
27
|
1
|
|
|
|
|
13
|
$h->set('Cache-Control' => 'no-store, no-cache, no-transform, must-revalidate, max-age=0'); |
28
|
|
|
|
|
|
|
} |
29
|
|
|
|
|
|
|
} |
30
|
2
|
|
|
|
|
80
|
); |
31
|
|
|
|
|
|
|
} |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
1; |