line |
true |
false |
branch |
51
|
0 |
83 |
if (defined $ENV{'SERVER_STARTER_PORT'}) |
53
|
0 |
0 |
if ($hostport =~ /(.*):(\d+)/) { } |
59
|
0 |
0 |
unless $listen_sock = "IO::Socket::INET"->new("Proto", "tcp") |
62
|
0 |
0 |
unless $listen_sock->fdopen($fd, "w") |
68
|
22 |
144 |
if defined $args{$_} |
101
|
0 |
83 |
defined $args{'socket_path'} ? : |
|
3 |
80 |
exists $args{'keepalive'} && !$args{'keepalive'} ? : |
|
0 |
83 |
defined $args{'max_readahead_reqs'} ? : |
|
0 |
83 |
defined $args{'min_readahead_reqs'} ? : |
|
0 |
83 |
defined $args{'min_reqs_per_child'} ? : |
|
0 |
83 |
defined $args{'err_respawn_interval'} ? : |
|
0 |
83 |
defined $listen_sock ? : |
111
|
0 |
83 |
if (my $path = $self->{'socket_path'}) { } |
112
|
0 |
0 |
if (-S $path) |
114
|
0 |
0 |
unless unlink $path |
119
|
0 |
0 |
unless $self->{'listen_sock'} = "IO::Socket::UNIX"->new("Listen", 128, "Local", $path) |
131
|
0 |
83 |
unless $self->{'listen_sock'} ||= "IO::Socket::INET"->new("Listen", 128, "LocalPort", $self->{'port'}, "LocalAddr", $self->{'host'}, "Proto", "tcp", "ReuseAddr", 1) |
135
|
83 |
0 |
if ($^O eq "linux" and not $self->{'use_unix_domain'}) |
137
|
83 |
0 |
if setsockopt $self->{'listen_sock'}, 6, 9, 1 |
156
|
0 |
333 |
unless my(@pair) = &portable_socketpair() |
165
|
0 |
83 |
unless my(@fdpass_sock) = &portable_socketpair() |
181
|
12 |
71 |
if ($pid) { } |
|
71 |
0 |
elsif (defined $pid) { } |
200
|
0 |
0 |
unless (exists $self->{'sockets'}{$sockid}) |
208
|
0 |
0 |
unless (exists $self->{'sockets'}{$sockid}) |
211
|
0 |
0 |
if (_getpeername($self->{'sockets'}{$sockid}[1], my $addr) < 0) |
219
|
0 |
0 |
unless ($ret) |
220
|
0 |
0 |
if ($! == 11 or $! == 11 or $! == 4) |
244
|
36 |
83 |
if $stats eq $prev_stats and @_ |
254
|
0 |
57 |
unless $buf |
255
|
57 |
0 |
if ($buf =~ /total=(\d+)&/) |
256
|
0 |
57 |
if $1 >= $self->{'max_keepalive_connection'} |
282
|
0 |
12 |
unless $close_all |
287
|
23 |
12 |
if $kid >= 0 |
298
|
0 |
13 |
if keys %{$$self{"sockets"};} |
313
|
0 |
0 |
if ($self->{'sockets'}{$key}[4] == 0 and $self->{'sockets'}{$key}[3] == 0 and $time - $self->{'sockets'}{$key}[2] > $self->{'timeout'}) { } |
|
0 |
0 |
elsif ($self->{'sockets'}{$key}[4] == 0 and $self->{'sockets'}{$key}[3] > 0 and $time - $self->{'sockets'}{$key}[2] > $self->{'keepalive_timeout'}) { } |
335
|
0 |
37 |
unless $sock |
345
|
260622 |
0 |
if ($state->{'state'} eq "cmd") |
347
|
0 |
0 |
if (not defined $ret and $! == 4 || $! == 11 || $! == 11) |
350
|
0 |
260622 |
unless (defined $ret) |
354
|
260622 |
0 |
if (defined $buf and length $buf == 0) |
358
|
0 |
0 |
if length $state->{'buf'} < 28 |
364
|
0 |
0 |
if ($method eq 'push') { } |
|
0 |
0 |
elsif ($method eq 'keep') { } |
|
0 |
0 |
elsif ($method eq 'clos') { } |
370
|
0 |
0 |
if (exists $self->{'sockets'}{$sockid}) |
386
|
0 |
0 |
if ($state->{'state'} eq "recv_fd") |
388
|
0 |
0 |
if ($fd < 0 and $! == 4 || $! == 11 || $! == 11) |
392
|
0 |
0 |
if ($fd <= 0) |
436
|
0 |
71 |
if (defined $self->{'err_respawn_interval'}) |
444
|
160 |
305 |
if ($self->{'workers'}{$wid}{'running'} and $self->{'workers'}{$wid}{'running'} == $exit_pid) |
453
|
343 |
578 |
unless ($self->{'workers'}{$wid}{'running'}) |
462
|
285 |
0 |
if (defined $next) { } |
475
|
0 |
58 |
unless $next |
477
|
58 |
196 |
if $wid == $next |
484
|
0 |
58 |
unless open $self->{'stats_fh'}, "<", $self->{'stats_filename'} |
507
|
0 |
35 |
if $self->{'term_received'} > 1 |
521
|
35 |
348 |
if $self->{'term_received'} and not $next_conn |
523
|
0 |
348 |
if ($next_conn and $next_conn->{'buf'}) { } |
530
|
74 |
274 |
if ($next_conn) |
535
|
280 |
68 |
if (select($rfd, undef, undef, 1) > 0) |
538
|
286 |
347 |
if (not defined $rfd or vec $rfd, $try_read_fd, 1) |
539
|
74 |
212 |
if ($next_conn and fileno $next_conn->{'fh'} == $try_read_fd) |
548
|
274 |
74 |
unless ($conn) |
552
|
0 |
159 |
if ($conn and $next_conn and $conn != $next_conn) |
556
|
0 |
348 |
if (not $conn and $next_conn) |
564
|
189 |
159 |
unless $conn |
585
|
159 |
0 |
if $ENV{'HARNESS_ACTIVE'} |
588
|
0 |
159 |
if (exists $conn->{'buf'}) { } |
594
|
0 |
159 |
if (not defined $ret and $! == 11 || $! == 11 || $! == 4) { } |
|
64 |
95 |
elsif (defined $ret and $ret == 0) { } |
601
|
14 |
50 |
unless $conn->{'direct'} |
607
|
0 |
95 |
if $self->{'term_received'} or $self->{'stop_accept'} |
608
|
1 |
94 |
if $self->{'disable_keepalive'} |
615
|
18 |
77 |
if ($env->{'psgix.harakiri.commit'}) |
621
|
3 |
92 |
unless ($keepalive) |
624
|
0 |
3 |
unless $conn->{'direct'} |
629
|
0 |
92 |
if (defined $pipelined_buf and length $pipelined_buf) |
636
|
74 |
18 |
if ($conn->{'reqs'} < $max_readahead_reqs and $proc_req_count <= $max_reqs_per_child) |
651
|
0 |
13 |
if $children_left |
663
|
18 |
0 |
if ($conn->{'direct'}) { } |
668
|
0 |
0 |
if not defined $ret and $! != 11 and $! != 11 and $! != 4 |
683
|
185 |
21 |
if (fileno $sock == fileno $self->{'listen_sock'}) { } |
|
21 |
0 |
elsif (fileno $sock == fileno $self->{'fdpass_sock'}[1]) { } |
685
|
0 |
185 |
if ($have_accept4) { } |
690
|
71 |
114 |
if $peer |
692
|
0 |
0 |
if (not $peer and ($! != 4 and $! != 11 and $! != 11 and $! != 29)) |
696
|
114 |
71 |
unless $peer |
697
|
71 |
0 |
unless ($self->{'use_unix_domain'}) |
698
|
0 |
71 |
unless setsockopt $fh, 6, 1, 1 |
702
|
0 |
71 |
if ($self->{'use_unix_domain'}) { } |
720
|
0 |
0 |
if ($fd < 0 and ($! != 4 and $! != 11 and $! != 11 and $! != 29)) |
723
|
7 |
14 |
if $fd <= 0 |
725
|
0 |
14 |
if (_getpeername($fd, $peer) < 0) |
728
|
0 |
14 |
unless open my $fh, ">>&=" . $fd |
731
|
0 |
14 |
if ($self->{'use_unix_domain'}) { } |
748
|
189 |
85 |
unless $conn |
762
|
95 |
1 |
if (defined $prebuf) { } |
771
|
1 |
0 |
$is_keepalive ? : |
|
1 |
0 |
unless $rlen = $self->read_timeout($conn, \$buf, 131072 - length($buf), length $buf, $is_keepalive ? $self->{'keepalive_timeout'} : $self->{'timeout'}) |
775
|
94 |
1 |
if ($reqlen >= 0) |
778
|
93 |
1 |
if ($use_keepalive) |
779
|
92 |
1 |
if ($protocol eq 'HTTP/1.1') { } |
780
|
12 |
80 |
if (my $c = $env->{'HTTP_CONNECTION'}) |
781
|
0 |
12 |
if $c =~ /^\s*close\s*/i |
786
|
0 |
1 |
if (my $c = $env->{'HTTP_CONNECTION'}) { } |
787
|
0 |
0 |
unless $c =~ /^\s*keep-alive\s*/i |
793
|
57 |
36 |
if ($use_keepalive and $reqs <= 1) |
799
|
5 |
89 |
if (my $cl = $env->{'CONTENT_LENGTH'}) { } |
|
1 |
88 |
elsif ($chunked) { } |
803
|
2 |
4 |
if (length $buf) { } |
809
|
1 |
3 |
unless $self->read_timeout($conn, \$chunk, $cl, 0, $self->{'timeout'}) |
822
|
1 |
2 |
if (length $buf) { } |
828
|
0 |
2 |
unless $self->read_timeout($conn, \$chunk, 65536, 0, $self->{'timeout'}) |
835
|
1 |
15 |
if ($chunk_len == 0) { } |
|
0 |
15 |
elsif (length $chunk_buffer < $chunk_len + 2) { } |
850
|
0 |
88 |
if ($buf =~ /^(?:GET|HEAD)/) |
857
|
0 |
93 |
if ($env->{'HTTP_EXPECT'}) |
858
|
0 |
0 |
if ($env->{'HTTP_EXPECT'} eq '100-continue') { } |
859
|
0 |
0 |
unless $self->write_all($conn, "HTTP/1.1 100 Continue\r\n\r\n") |
870
|
1 |
0 |
if ($reqlen == -2) { } |
|
0 |
0 |
elsif ($reqlen == -1) { } |
878
|
90 |
3 |
if (ref $res eq 'ARRAY') { } |
|
3 |
0 |
elsif (ref $res eq 'CODE') { } |
904
|
0 |
106 |
if ($lck eq 'connection') { } |
905
|
0 |
0 |
if $$use_keepalive_r and lc $v ne "keep-alive" |
912
|
93 |
0 |
unless (exists $send_headers{'server'}) |
915
|
93 |
0 |
unless (exists $send_headers{'date'}) |
921
|
0 |
93 |
if ($protocol eq 'HTTP/1.0') { } |
|
93 |
0 |
elsif ($protocol eq 'HTTP/1.1') { } |
922
|
0 |
0 |
if ($$use_keepalive_r) |
923
|
0 |
0 |
if (defined $send_headers{'content-length'} or defined $send_headers{'transfer-encoding'}) { } |
|
0 |
0 |
elsif (not Plack::Util::status_with_no_entity_body($status_code) and defined(my $cl = Plack::Util::content_length($body))) { } |
935
|
0 |
0 |
if $$use_keepalive_r |
936
|
0 |
0 |
unless $$use_keepalive_r |
939
|
4 |
89 |
if (defined $send_headers{'content-length'} or defined $send_headers{'transfer-encoding'}) { } |
|
88 |
1 |
elsif (not Plack::Util::status_with_no_entity_body($status_code)) { } |
946
|
1 |
92 |
unless $$use_keepalive_r |
953
|
83 |
3 |
if (defined $body and ref $body eq "ARRAY" and @$body == 1 and length $body->[0] < 8192) |
957
|
82 |
1 |
if ($use_chunked) |
964
|
0 |
83 |
unless $len |
968
|
0 |
0 |
if ($have_sendfile and not $use_chunked and defined $body and ref $body ne "ARRAY" and fileno $body) |
974
|
0 |
0 |
if ($^O eq "linux" and not $self->{'use_unix_domain'}) |
975
|
0 |
0 |
if setsockopt $conn, 6, 3, 1 |
979
|
0 |
0 |
unless $self->write_all($conn, join("", @lines), $self->{'timeout'}) |
982
|
0 |
0 |
if ($use_cork and $$use_keepalive_r and not $self->{'use_unix_domain'}) |
989
|
0 |
10 |
unless $self->write_all($conn, join("", @lines), $self->{'timeout'}) |
991
|
8 |
2 |
if (defined $body) { } |
994
|
3 |
5 |
ref $body eq 'ARRAY' ? : |
998
|
10 |
0 |
unless ($failed) |
1001
|
7 |
3 |
if ($use_chunked) |
1003
|
0 |
7 |
unless $len |
1005
|
2 |
5 |
if ($body_count == 0) |
1011
|
0 |
10 |
unless $self->write_all($conn, $buf, $self->{'timeout'}) |
1015
|
2 |
6 |
if $use_chunked and not $completed |
1020
|
5 |
0 |
if ($use_chunked) |
1022
|
1 |
4 |
unless $len |
1028
|
2 |
0 |
if $use_chunked |
1036
|
0 |
116 |
if (defined $min) { } |
1048
|
2 |
5 |
unless ($is_write or delete $self->{'_is_deferred_accept'}) |
1053
|
111 |
9 |
if ($is_write and $is_write == 1) { } |
|
0 |
9 |
elsif ($is_write and $is_write == 2) { } |
1054
|
111 |
0 |
if $ret = syswrite($sock, $buf, $len, $off) |
1057
|
0 |
0 |
if $ret = Sys::Sendfile::sendfile($sock, $buf, $len) |
1059
|
0 |
0 |
if defined $ret and $ret == 0 and $! == 11 |
1061
|
5 |
4 |
if $ret = sysread($sock, $$buf, $len, $off) |
1064
|
2 |
2 |
unless (not defined $ret and $! == 4 || $! == 11 || $! == 11) |
1074
|
0 |
4 |
if ($is_write) { } |
1082
|
4 |
0 |
if $nfound |
1083
|
0 |
0 |
if $timeout <= 0 |
1097
|
0 |
0 |
unless my $ret = $self->sendfile_timeout($sock, $fh, $len, $off, $timeout) |
1100
|
0 |
0 |
if $cl != $off |