Branch Coverage

blib/lib/HTTP/Parser.pm
Criterion Covered Total %
branch 33 76 43.4


line true false branch
76 2 2 unless exists $p{'response'} or exists $p{'request'}
77 0 4 unless $p{'request'} or $p{'response'}
140 0 13 unless defined $s
145 5 8 if ($$self{'state'} eq 'blank')
147 1 4 unless length $$self{'data'}
152 11 1 if ($$self{'state'} eq 'header') { }
1 0 elsif ($$self{'state'} eq 'body') { }
0 0 elsif ($$self{'state'} eq 'chunked') { }
0 0 elsif ($$self{'state'} eq 'trailer') { }
154 4 7 if ($$self{'data'} =~ /^(.*?)\x0d?\x0a\x0d?\x0a/s)
170 0 0 if $$self{'data'} =~ /^(.*?)\x0d?\x0a\x0d?\x0a/s
229 4 0 unless $trailer
234 0 5 if (s/^[ \t]+//) { }
235 0 0 unless @out
244 4 0 if (not $trailer) { }
248 2 2 if ($request =~ m[^HTTP/(\d+)\.(\d+)]i) { }
249 1 1 unless $$self{'response'}
259 0 2 unless $http and $http =~ m[^HTTP/(\d+)\.(\d+)$]i
262 0 2 unless $$self{'request'}
268 2 0 if $uri =~ m[^/]
282 0 5 unless $header =~ s/^($token):[\t ]*//
287 0 3 if $trailer
290 1 2 if (my $length = $obj->header('content_length'))
292 0 1 unless $length =~ /^(\d+)$/
298 0 2 if (my(@te) = $obj->header('transfer_encoding'))
299 0 0 if (grep {lc $_ eq 'chunked';} @te)
315 0 2 if ($$self{'response'})
316 0 0 if (not defined $obj->header('content_length') and $self->object->code ne '204' and $self->object->code ne '304' and not $self->object->code =~ /1\d\d/)
326 0 0 if length $self->data
349 0 2 if ($$self{'no_content_length'})
354 1 1 if (length $$self{'data'} >= $length)
372 0 0 unless ($$self{'chunk'})
373 0 0 if ($$self{'data'} =~ s/^([0-9a-fA-F]+)[^\x0d\x0a]*?\x0d?\x0a//) { }
376 0 0 unless ($$self{'chunk'} = hex $1)
381 0 0 if $$self{'data'} =~ /^(.*?)\x0d?\x0a\x0d?\x0a/s
387 0 0 if $$self{'data'} =~ /\x0d?\x0a/
394 0 0 if ($$self{'chunk'})
397 0 0 if (length $$self{'data'} > $$self{'chunk'} and substr($$self{'data'}, $$self{'chunk'}, 2) =~ /^(\x0d?\x0a)/)