| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package UR::Service::WebServer::Server; |
|
2
|
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
88
|
use strict; |
|
|
1
|
|
|
|
|
1
|
|
|
|
1
|
|
|
|
|
23
|
|
|
4
|
1
|
|
|
1
|
|
3
|
use warnings; |
|
|
1
|
|
|
|
|
1
|
|
|
|
1
|
|
|
|
|
20
|
|
|
5
|
1
|
|
|
1
|
|
3
|
use base 'HTTP::Server::PSGI'; |
|
|
1
|
|
|
|
|
1
|
|
|
|
1
|
|
|
|
|
21
|
|
|
6
|
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
# Override new because the default constructor doesn't accept a 'port' argument of |
|
8
|
|
|
|
|
|
|
# undef to make the system pick a port |
|
9
|
|
|
|
|
|
|
sub new { |
|
10
|
5
|
|
|
5
|
0
|
17
|
my($class, %args) = @_; |
|
11
|
|
|
|
|
|
|
|
|
12
|
5
|
|
|
|
|
6
|
my %supplied_port_arg; |
|
13
|
5
|
50
|
|
|
|
13
|
if (exists $args{port}) { |
|
14
|
5
|
|
|
|
|
11
|
$supplied_port_arg{port} = delete $args{port}; |
|
15
|
|
|
|
|
|
|
} |
|
16
|
|
|
|
|
|
|
|
|
17
|
5
|
|
|
|
|
31
|
my $self = $class->SUPER::new(%args); |
|
18
|
5
|
50
|
|
|
|
99
|
if (%supplied_port_arg) { |
|
19
|
5
|
|
|
|
|
13
|
$self->{port} = $supplied_port_arg{port}; |
|
20
|
|
|
|
|
|
|
} |
|
21
|
5
|
|
|
|
|
18
|
return $self; |
|
22
|
|
|
|
|
|
|
} |
|
23
|
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
sub listen_sock { |
|
25
|
17
|
|
|
17
|
0
|
427
|
return shift->{listen_sock}; |
|
26
|
|
|
|
|
|
|
} |
|
27
|
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
# pre-fill read data for the test |
|
29
|
|
|
|
|
|
|
sub buffer_input { |
|
30
|
2
|
|
|
2
|
0
|
198
|
my $self = shift; |
|
31
|
2
|
|
|
|
|
6
|
$self->{__buffer_input__} = shift; |
|
32
|
|
|
|
|
|
|
} |
|
33
|
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
sub read_timeout { |
|
35
|
2
|
|
|
2
|
0
|
399
|
my $self = shift; |
|
36
|
2
|
|
|
|
|
3
|
my($sock, $buf, $len, $off, $timeout) = @_; |
|
37
|
2
|
50
|
|
|
|
6
|
if ($self->{__buffer_input__}) { |
|
38
|
|
|
|
|
|
|
$$buf = ref $self->{__buffer_input__} |
|
39
|
|
|
|
|
|
|
? $self->{__buffer_input__}->() |
|
40
|
2
|
50
|
|
|
|
6
|
: $self->{__buffer_input__}; |
|
41
|
2
|
|
|
|
|
3
|
delete $self->{__buffer_input__}; |
|
42
|
2
|
|
|
|
|
5
|
return length($$buf); |
|
43
|
|
|
|
|
|
|
} |
|
44
|
0
|
|
|
|
|
|
$self->SUPER::read_timeout(@_); |
|
45
|
|
|
|
|
|
|
} |
|
46
|
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
1; |
|
48
|
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
|