line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Plack::Middleware::TimeOverHTTP; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
# ABSTRACT: time over HTTP middleware |
4
|
|
|
|
|
|
|
|
5
|
1
|
|
|
1
|
|
466
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
22
|
|
6
|
1
|
|
|
1
|
|
4
|
use warnings; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
20
|
|
7
|
|
|
|
|
|
|
|
8
|
1
|
|
|
1
|
|
4
|
use parent 'Plack::Middleware'; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
4
|
|
9
|
|
|
|
|
|
|
|
10
|
1
|
|
|
1
|
|
48
|
use HTTP::Status qw/ :constants /; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
302
|
|
11
|
1
|
|
|
1
|
|
442
|
use Time::HiRes qw/ clock_gettime CLOCK_REALTIME /; |
|
1
|
|
|
|
|
1069
|
|
|
1
|
|
|
|
|
4
|
|
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
our $VERSION = 'v0.1.0'; |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
sub call { |
16
|
2
|
|
|
2
|
1
|
18655
|
my ( $self, $env ) = @_; |
17
|
|
|
|
|
|
|
|
18
|
2
|
50
|
|
|
|
7
|
unless ( $env->{REQUEST_URI} eq '/.well-known/time' ) { |
19
|
0
|
|
|
|
|
0
|
return $self->app->($env); |
20
|
|
|
|
|
|
|
} |
21
|
|
|
|
|
|
|
|
22
|
2
|
100
|
|
|
|
5
|
unless ( $env->{REQUEST_METHOD} eq 'HEAD' ) { |
23
|
1
|
|
|
|
|
5
|
return [ HTTP_METHOD_NOT_ALLOWED, [], [] ]; |
24
|
|
|
|
|
|
|
} |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
[ |
27
|
1
|
|
|
|
|
5
|
HTTP_NO_CONTENT, |
28
|
|
|
|
|
|
|
[ |
29
|
|
|
|
|
|
|
'X-HTTPSTIME' => clock_gettime(CLOCK_REALTIME), |
30
|
|
|
|
|
|
|
], |
31
|
|
|
|
|
|
|
[], |
32
|
|
|
|
|
|
|
]; |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
} |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
1; |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
__END__ |