Branch Coverage

blib/lib/Perlbal/Test/WebServer.pm
Criterion Covered Total %
branch 69 88 78.4


line true false branch
24 9 48 if $testpid and $testpid == $$
32 0 78 if ($ENV{'TEST_PERLBAL_USE_EXISTING'})
38 43 35 if (my $child = fork)
42 0 43 unless $sock
46 0 0 defined $line ? :
0 43 unless $line and $line =~ /200 OK/
52 0 35 unless my $ssock = 'IO::Socket::INET'->new('LocalPort', $port, 'ReuseAddr', 1, 'Listen', 3)
55 0 81 unless $csock
56 46 35 if fork
57 0 35 unless setsockopt $csock, 6, 1, "\cA\000\000\000"
74 86 609 if (/^content-length:\s*(\d+)/i)
75 151 544 if not $_ or /^\r?\n/
77 5 151 unless $req
83 150 1 if ($req =~ m[^([A-Z]+) /?(\S+) HTTP/(1\.\d+)\r?\n?])
88 0 0 $3 eq '1.1' ? :
150 0 $3 eq '1.0' ? :
94 85 66 if ($clen)
95 0 85 if $method =~ /^GET|HEAD$/
97 0 85 if $clen != $read
107 0 151 if %opts
110 130 11 $content ? :
115 143 8 unless $code == 204
116 143 8 if $ctype
120 149 2 unless (defined $keeping_alive)
122 0 149 if ($httpver == 1)
123 0 0 if ($hdr_connection =~ /\bclose\b/i) { }
129 121 28 if ($httpver == 0 and $hdr_connection =~ /\bkeep-alive\b/i)
134 121 30 if ($keeping_alive) { }
151 30 121 unless $keeping_alive
156 0 150 unless (@cmds and defined $httpver and $msg)
162 1 149 if ($method eq 'OPTIONS')
176 4 167 if ($cmd =~ /^sleep:([\d\.]+)$/i)
187 2 169 if ($cmd =~ /^keepalive:([01])$/i)
191 128 43 if ($cmd eq 'status')
199 15 156 if ($cmd eq 'reqdecr')
203 1 170 if ($cmd =~ /^kill:(\d+):(\w+)$/)
207 8 163 if ($cmd =~ /^reproxy_url:(.+)/i)
213 2 169 if ($cmd =~ /^reproxy_url204:(.+)/i)
217 2 169 if ($cmd =~ /^reproxy_url_cached:(\d+):(.+)/i)
223 1 170 if ($cmd =~ /^reproxy_url_multi:((?:\d+:){2,})(\S+)/i)
233 6 165 if ($cmd =~ /^reproxy_file:(.+)/i)
237 1 170 if ($cmd =~ /^subreq:(\d+)$/)
245 1 0 if ($resp and $resp->content =~ /^pid = (\d+)$/m)
251 1 170 if ($cmd =~ /^reflect_request_headers$/)