Condition Coverage

lib/HTTP/Promise/Parser.pm
Criterion Covered Total %
condition 89 217 41.0


and 3 conditions

line !l l&&!r l&&r condition
99 0 0 35 defined $dir and length $dir
115 0 0 0 ref $this and not $self->_is_scalar($this)
133 0 0 0 ref $this and not $self->_is_scalar($this)
153 2 0 0 ref $this and not $self->_is_scalar($this)
156 0 0 2 defined $$ref and length $$ref
229 1 0 0 ref $_[0] and not overload::Method($_[0], "\"\"")
313 3 1 0 $self->error->code == 400 and length $buff > $max
335 5 0 9 $opts->{'request'} || $opts->{'response'} and $def->{'protocol'}
453 18 21 4 pos $$str == 0 and not $$str =~ /^$HTTP::Promise::Parser::HEADER/
496 0 7 3 exists $opts->{'request'} || exists $opts->{'response'} and length $opts->{'request'} || length $opts->{'response'}
542 10 0 0 $len == -2 and $max_headers_size > 0
10 0 0 $len == -2 and $max_headers_size > 0 and length $$str > $max_headers_size
606 0 0 8 exists $r->{'_request_uri'} and length $r->{'_request_uri'}
661 0 4 10 length $hdr and not $hdr =~ /^$HTTP::Promise::Parser::CRLF$/
679 4 9 1 defined $mime_type and $mime_type eq "multipart/form-data"
885 22 0 1 defined $len and not defined $read_until
896 0 0 0 $type eq "application/x-www-form-urlencoded" and $self->decode_body
925 1 0 0 $total_bytes != $len and warnings::enabled(ref $self)
952 0 0 0 $type eq "application/x-www-form-urlencoded" and $self->decode_body
980 0 0 0 defined $file and $mime_type eq $default_mime
991 0 0 0 $mtype and $mtype ne $default_mime
999 0 0 0 $new_ext and $new_ext ne $ext
1016 13 9 1 defined $type and $type eq "application/x-www-form-urlencoded"
1029 19 0 4 $enc and $body->length
19 0 4 $enc and $body->length and $self->decode_body($enc)
1041 0 0 10 defined $str and length $str

or 2 conditions

line l !l condition
187 0 0 $var->open('+>') || (return $self->pass_error($var->error))
192 0 0 $self->new_tempfile($tmpdir ? ('dir', $tmpdir) : ()) || (return $self->pass_error)
204 23 0 shift @_ || (return $self->error('Nothing to parse was provided.'))
215 17 0 'Module::Generic::Scalar::IO'->new($this, '<') || (return $self->pass_error('Module::Generic::Scalar::IO'->error))
220 2 0 $self->new_file($this) || (return $self->pass_error)
221 1 1 $f->open('<', {'binmode', 'raw'}) || (return $self->pass_error($f->error))
247 20 0 'HTTP::Promise::IO'->new($fh, 'max_read_buffer', $self->max_read_buffer, 'debug', $self->debug) || (return $self->pass_error('HTTP::Promise::IO'->error))
322 14 0 $def->{'headers'} || (return $self->error('No headers object set by parse_headers_xs() !'))
344 6 1 'HTTP::Promise::Request'->new(@$def{'method', 'uri', 'headers'}, {'protocol', $def->{'protocol'}, 'version', $def->{'version'}, 'debug', $HTTP::Promise::Parser::DEBUG}) || (return $self->pass_error('HTTP::Promise::Request'->error))
354 2 0 'HTTP::Promise::Response'->new(@$def{'code', 'status', 'headers'}, {'protocol', $def->{'protocol'}, 'version', $def->{'version'}, 'debug', $HTTP::Promise::Parser::DEBUG}) || (return $self->pass_error('HTTP::Promise::Response'->error))
371 3 0 $self->parse_multi_part('entity', $ent, 'reader', $reader) || (return $self->pass_error)
389 10 0 $self->parse_singleton('entity', $ent, 'reader', $reader) || (return $self->pass_error)
401 0 57 $opts->{'convert_dash'} //= 0
402 13 44 $opts->{'no_headers_ok'} //= 0
494 10 0 $self->_get_args(shift @_) || (return $self->pass_error)
501 10 0 $self->max_headers_size // 0
612 10 0 $self->parse_version($r->{'_protocol'}) || (return $self->pass_error)
627 4 0 $opts->{'entity'} || (return $self->error({'code', 500, 'message', 'No entity object was provided.'}))
629 4 0 $opts->{'reader'} || (return $self->error({'code', 500, 'message', 'No reader object was provided.'}))
630 4 0 $ent->headers || (return $self->error({'code', 500, 'message', 'No headers object found in entity object.'}))
633 4 0 $headers->new_field('Content-Type', $ct) || (return $self->pass_error($headers->error))
634 4 0 $h->boundary || (return $self->error("No boundary could be found in the Content-Type header '${ct}'"))
637 4 0 $HTTP::Promise::Parser::DEFAULT_MIME_TYPE || 'application/octet-stream'
663 10 0 $self->parse_headers($hdr) || (return $self->pass_error)
677 14 0 'HTTP::Promise::Entity'->new('headers', $ph, 'debug', $self->debug) || (return $self->pass_error('HTTP::Promise::Entity'->error))
682 1 0 $self->parse_multi_part('entity', $part_ent, 'reader', $reader) || (return $self->pass_error)
713 13 0 $self->parse_singleton('entity', $part_ent, 'reader', $reader, 'read_until', qr/$HTTP::Promise::Parser::CRLF--$boundary(?:\-{2})?$HTTP::Promise::Parser::CRLF/) || (return $self->pass_error)
732 0 0 shift @_ || (return $self->error('No file to open was provided.'))
735 0 0 $self->new_file($expr) || (return $self->pass_error)
737 0 0 $f->open || (return $self->pass_error($f->error))
739 0 0 $self->parse($io) || (return $self->pass_error)
748 0 0 $self->_get_args(shift @_) || (return $self->pass_error)
750 0 0 $self->parse_request_headers($str, $opts) || (return $self->pass_error)
759 1 0 $self->_get_args(shift @_) || (return $self->pass_error)
768 0 0 $self->_get_args(shift @_) || (return $self->pass_error)
771 0 0 $3 || 'HTTP/0.9'
785 19 0 $self->_get_args(shift @_) || (return $self->pass_error)
786 10 9 $self->parse_headers($str, @_) || (return $self->pass_error)
800 0 0 $self->_get_args(shift @_) || (return $self->pass_error)
802 0 0 $self->parse_response_headers($str, $opts) || (return $self->pass_error)
811 0 0 $self->_get_args(shift @_) || (return $self->pass_error)
820 0 0 $self->_get_args(shift @_) || (return $self->pass_error)
837 13 0 $self->_get_args(shift @_) || (return $self->pass_error)
840 8 5 $self->parse_headers($str, $opts) || (return $self->pass_error)
853 23 0 $opts->{'entity'} || (return $self->error({'code', 500, 'message', 'No entity object was provided.'}))
855 23 0 $opts->{'reader'} || (return $self->error({'code', 500, 'message', 'No reader object was provided.'}))
856 23 0 $ent->headers || (return $self->error({'code', 500, 'message', 'No headers object found in entity object.'}))
864 23 0 $HTTP::Promise::Parser::DEFAULT_MIME_TYPE || 'application/octet-stream'
879 0 0 $ext ||= "dat"
880 0 0 $self->new_tempfile('extension', $ext) || (return $self->pass_error)
901 0 0 &$get_temp_file() || (return $self->pass_error)
902 0 0 $file->open('+>', {'binmode', 'raw', 'autoflush', 1}) || (return $self->pass_error($file->error))
957 0 0 &$get_temp_file() || (return $self->pass_error)
958 0 0 $file->open('+>', {'binmode', 'raw', 'autoflush', 1}) || (return $self->pass_error($file->error))
1001 0 0 $file->extension($ext) || (return $self->pass_error($file->error))
1002 0 0 $file->move($new_file) || (return $self->pass_error($file->error))
1008 0 0 $ent->new_body('file', $file) || (return $self->pass_error($ent->error))
1018 1 0 $ent->new_body('form', $data) || (return $self->pass_error($ent->error))
1023 22 0 $ent->new_body('string', $data) || (return $self->pass_error($ent->error))

or 3 conditions

line l !l&&r !l&&!r condition
256 4 0 18 $opts->{'request'} or $opts->{'response'}
299 7 2 9 $opts->{'request'} or $opts->{'response'}
335 7 2 5 $opts->{'request'} || $opts->{'response'}
496 8 2 0 exists $opts->{'request'} || exists $opts->{'response'}
8 2 0 length $opts->{'request'} || length $opts->{'response'}
1077 0 1 5 substr($$ref, $n, 1) eq "\r" or substr($$ref, $n, 1) eq "\n"
1079 0 3 5 substr($$ref, $n - 1, 1) eq "\r" or substr($$ref, $n - 1, 1) eq "\n"