line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package SockJS::Middleware::Cache; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
69809
|
use strict; |
|
1
|
|
|
|
|
13
|
|
|
1
|
|
|
|
|
27
|
|
4
|
1
|
|
|
1
|
|
4
|
use warnings; |
|
1
|
|
|
|
|
5
|
|
|
1
|
|
|
|
|
26
|
|
5
|
|
|
|
|
|
|
|
6
|
1
|
|
|
1
|
|
463
|
use parent 'Plack::Middleware'; |
|
1
|
|
|
|
|
285
|
|
|
1
|
|
|
|
|
5
|
|
7
|
|
|
|
|
|
|
|
8
|
1
|
|
|
1
|
|
14582
|
use Plack::Util; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
124
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
sub call { |
11
|
2
|
|
|
2
|
1
|
4027
|
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
|
|
41
|
my $res = shift; |
19
|
|
|
|
|
|
|
|
20
|
2
|
|
|
|
|
8
|
my $h = Plack::Util::headers( $res->[1] ); |
21
|
|
|
|
|
|
|
|
22
|
2
|
100
|
|
|
|
55
|
if ($env->{'sockjs.cacheable'}) { |
23
|
1
|
|
|
|
|
7
|
$h->set('Expires' => '31536000'); |
24
|
1
|
|
|
|
|
21
|
$h->set('Cache-Control' => 'public;max-age=31536000'); |
25
|
|
|
|
|
|
|
} |
26
|
|
|
|
|
|
|
else { |
27
|
1
|
|
|
|
|
12
|
$h->set('Cache-Control' => 'no-store, no-cache, no-transform, must-revalidate, max-age=0'); |
28
|
|
|
|
|
|
|
} |
29
|
|
|
|
|
|
|
} |
30
|
2
|
|
|
|
|
74
|
); |
31
|
|
|
|
|
|
|
} |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
1; |