Branch Coverage

blib/lib/Perlbal/HTTPHeaders.pm
Criterion Covered Total %
branch 56 106 52.8


line true false branch
56 80 275 if (@_) { }
59 0 275 unless $self->response_code
66 80 0 unless ref $self
86 380 0 unless ref $self
101 152 228 $is_response ? :
105 152 228 if ($is_response) { }
109 0 152 unless $$self{'responseLine'} =~ m[^HTTP\/(\d+)\.(\d+)\s+(\d+)(?:\s+(.*))$]
116 0 152 unless (defined $ver_ma)
125 1 227 unless $$self{'requestLine'} =~ m[^(\w+) ((?:\*|(?:\S*?)))(?: HTTP/(\d+)\.(\d+))$]
134 0 227 if ($$self{'uri'} =~ m[^http://([^/:]+?)(?::\d+)?(/.*)?$])
140 0 227 unless (defined $ver_ma)
150 0 1003 if ($line =~ /^\s/) { }
1003 0 elsif ($line =~ m(^([^\x00-\x20\x7f()<>\@,;:\\\"/\[\]?={}]+):\s*(.*)$)) { }
151 0 0 unless defined $last_header
162 2 1001 if (defined $$self{'headers'}{$last_header}) { }
163 0 2 if ($last_header eq 'set-cookie') { }
185 0 379 if defined $absoluteURIHost
189 0 227 if not $is_response and $$self{'vernum'} >= 1001 and not $self->header('Host')
198 126 82 if $$self{'codetext'}
206 160 0 if (not defined $$self{'code'} or $code != $$self{'code'})
208 160 0 if ($$self{'responseLine'})
231 0 0 unless $$self{'requestLine'}
235 0 0 unless defined $uri and length $uri
239 0 0 if ($ver == 0.9) { }
250 488 0 unless $_[1]
257 2695 1403 unless @_
262 1105 298 unless (exists $$self{'headers'}{$key})
272 0 1 unless $$self{'headers'}
307 0 343 unless $ver =~ /^(\d+)\.(\d+)$/
311 135 208 if ($$self{'type'} eq 'req') { }
327 197 147 if ($$self{'type'} eq 'req') { }
147 0 elsif ($$self{'type'} eq 'res' or $$self{'type'} eq 'httpres') { }
329 1 196 if $$self{'method'} eq 'HEAD'
332 7 140 if ($$self{'code'} == 304 or $$self{'code'} == 204 or $$self{'code'} >= 100 and $$self{'code'} <= 199)
340 282 54 if (defined(my $clen = $self->header('Content-Length')))
359 0 203 unless my $res = $_[1]
365 168 35 if ($self->version_number < 1001)
367 20 148 unless $conn =~ /\bkeep-alive\b/i
371 34 149 if $conn =~ /\bclose\b/i
377 0 0 if defined $res->header('Content-length') or $res->response_code == 304 or $res->response_code == 204 or $self->request_method eq 'HEAD'
403 0 359 unless $req or $is_options
409 74 285 if $conn =~ /\bclose\b/i
412 285 0 if ($self->version_number < 1001)
415 1 0 if $conn =~ /\bkeep-alive\b/i and $is_options || defined $self->header('Content-length') || $req->request_method eq 'HEAD' || $self->response_code == 304 || $self->response_code == 204
447 0 0 unless $range and defined $size and $range =~ /^bytes=(\d*)-(\d*)$/
454 0 0 if $range_start eq ''
455 0 0 if $range_end eq ''
456 0 0 unless defined $range_start or defined $range_end
458 0 0 if (defined $range_start and defined $range_end and $range_start > $range_end) { }
0 0 elsif (not defined $range_start and defined $range_end and $range_end == 0) { }
0 0 elsif (defined $range_start and $size <= $range_start) { }
466 0 0 unless defined $range_start
467 0 0 unless defined $range_end and $range_end < $size