lib/HTTP/Promise/Entity.pm | |||
---|---|---|---|
Criterion | Covered | Total | % |
condition | 164 | 395 | 41.5 |
line | l | !l | condition |
---|---|---|---|
456 | 2 | 9 | defined $HTTP::Promise::Entity::BOM2ENC and scalar %$HTTP::Promise::Entity::BOM2ENC |
line | !l | l&&!r | l&&r | condition |
---|---|---|---|---|
95 | 0 | 0 | 4 | defined $name and length "$name" |
97 | 4 | 0 | 0 | $part->is_encoded and $encodings |
134 | 30 | 0 | 0 | exists $opts->{'binmode'} and length $opts->{'binmode'} |
30 | 0 | 0 | exists $opts->{'binmode'} and length $opts->{'binmode'} and lc substr($opts->{'binmode'}, 0, 3) eq "utf" | |
201 | 1 | 0 | 0 | exists $opts->{'binmode'} and length $opts->{'binmode'} |
1 | 0 | 0 | exists $opts->{'binmode'} and length $opts->{'binmode'} and lc substr($opts->{'binmode'}, 0, 3) eq "utf" | |
261 | 6 | 11 | 0 | defined $filename and $filename eq "" |
263 | 6 | 0 | 11 | defined $filename and length $filename |
6 | 8 | 3 | defined $filename and length $filename and $filename =~ /[^\w\.]+/ | |
267 | 0 | 14 | 3 | defined $encoding and $type =~ m[^(multipart/|message/(rfc822|partial|external-body|delivery-status|disposition-notification|feedback-report|http)$)]i |
297 | 3 | 0 | 12 | defined $path and length $path |
0 | 0 | 3 | defined $data and length $data | |
332 | 3 | 11 | 3 | defined $encoding and lc $encoding eq "suggest" |
338 | 2 | 5 | 10 | not $is_multipart and defined $disposition || defined $filename |
353 | 3 | 12 | 2 | defined $encoding and length $encoding |
354 | 17 | 0 | 0 | defined $desc and length $desc |
426 | 0 | 7 | 3 | $msg = $self->http_message and $opts->{'clone_message'} |
449 | 11 | 0 | 0 | my $charset = $headers->content_type_charset and !exists $opts->{'content_type_charset'} || $opts->{'content_type_charset'} |
488 | 5 | 0 | 6 | exists $opts->{'content'} and length $opts->{'content'} |
490 | 0 | 6 | 0 | ref $opts->{'content'} and not $self->_is_scalar($opts->{'content'}) |
586 | 0 | 4 | 0 | ref $this and not overload::Method($this, "\"\"") |
17 | 4 | 0 | not $self->_is_array($this) and (ref $this and not overload::Method($this, "\"\"")) | |
592 | 21 | 0 | 0 | not scalar @$encodings and warnings::enabled(ref $self) |
594 | 0 | 0 | 21 | $body and scalar @$encodings |
639 | 0 | 0 | 0 | $ext_vary and $ext_enc = $s->encoding2suffix($enc)->first |
0 | 0 | 0 | $ext_vary and $ext_enc = $s->encoding2suffix($enc)->first and $ext_parts->[-1] eq $ext_enc | |
789 | 0 | 2 | 0 | defined $encoding and length $encoding |
792 | 2 | 0 | 0 | scalar @$encodings and not $self->is_encoded |
822 | 1 | 0 | 1 | $maxlen and $body->length > $maxlen |
858 | 0 | 0 | 0 | defined $toptype and $toptype eq "multipart" |
884 | 0 | 0 | 0 | defined $epilogue and not $epilogue->is_empty |
914 | 0 | 2 | 0 | $self->http_message and $start_line = $self->http_message->start_line |
1001 | 0 | 6 | 0 | ref $this and not overload::Method($this, "\"\"") |
6 | 6 | 0 | not $self->_is_array($this) and (ref $this and not overload::Method($this, "\"\"")) | |
1005 | 12 | 0 | 0 | not scalar @$encodings and warnings::enabled(ref $self) |
1085 | 0 | 0 | 5 | exists $opts->{'content'} and length $opts->{'content'} |
1087 | 0 | 5 | 0 | ref $opts->{'content'} and not $self->_is_scalar($opts->{'content'}) |
1124 | 0 | 5 | 0 | $$data =~ /^(?: # nothing left over |
1134 | 5 | 0 | 0 | defined $encoding and $opts->{'object'} |
0 | 0 | 0 | defined $encoding and $opts->{'object'} and not ref $encoding | |
1162 | 0 | 11 | 2 | not exists $opts->{'content'} and $opts->{'charset_strict'} && $self->{'_io_encoding_strict_cached'} || !$opts->{'charset_strict'} && $self->{'_io_encoding_cached'} |
9 | 0 | 2 | not exists $opts->{'content'} and $opts->{'charset_strict'} && $self->{'_io_encoding_strict_cached'} || !$opts->{'charset_strict'} && $self->{'_io_encoding_cached'} and $body | |
9 | 0 | 2 | not exists $opts->{'content'} and $opts->{'charset_strict'} && $self->{'_io_encoding_strict_cached'} || !$opts->{'charset_strict'} && $self->{'_io_encoding_cached'} and $body and $self->{'_checksum_md5'} eq $body->checksum_md5 | |
1172 | 11 | 0 | 0 | exists $opts->{'content'} and length $opts->{'content'} |
1174 | 0 | 0 | 0 | ref $opts->{'content'} and not $self->_is_scalar($opts->{'content'}) |
1231 | 0 | 0 | 0 | $alt_charset and $charset ne $alt_charset |
1268 | 0 | 0 | 7 | defined $this and length "$this" |
1269 | 0 | 7 | 0 | ref $this and not $self->_is_scalar($this) |
1282 | 0 | 0 | 0 | not $bytes and warnings::enabled() |
1371 | 1 | 0 | 4 | defined $mime_type and length $mime_type |
1397 | 2 | 0 | 3 | $self->is_multipart and not $force |
1575 | 31 | 20 | 9 | defined $toptype and $toptype eq "multipart" |
1605 | 0 | 9 | 0 | defined $epilogue and not $epilogue->is_empty |
1657 | 26 | 4 | 6 | $encoding and not $self->is_encoded |
30 | 6 | 0 | $encoding and not $self->is_encoded and !exists $opts->{'no_encode'} || exists $opts->{'no_encode'} && !$opts->{'no_encode'} | |
1667 | 36 | 0 | 0 | exists $opts->{'binmode'} and $opts->{'binmode'} |
1717 | 0 | 0 | 0 | defined $fname and length "$fname" |
1728 | 0 | 0 | 0 | defined $ext && length $ext |
1751 | 0 | 0 | 0 | defined $fname and length $fname |
1907 | 3 | 0 | 4 | defined $content_disposition and $content_disposition->length |
1942 | 4 | 0 | 0 | $serialiser eq "Sereal" and "Sereal::Encoder"->VERSION <= "version"->parse("4.023") |
line | l | !l | condition |
---|---|---|---|
81 | 0 | 1 | $self->debug // 0 |
99 | 0 | 0 | $part->decode_body('encoding', $encodings) || (return $self->pass_error($part->error)) |
141 | 30 | 0 | $output->open('>') || (return $self->pass_error($output->error)) |
167 | 3 | 0 | $class->build(@_, 'top', 0) || (return $self->pass_error($class->error)) |
180 | 0 | 0 | $output->open('>') || (return $self->pass_error($output->error)) |
208 | 1 | 0 | $output->open('>') || (return $self->pass_error($output->error)) |
234 | 7 | 10 | delete $opts->{'type'} || 'text/plain' |
237 | 7 | 10 | delete $opts->{'encoding'} || '' |
249 | 3 | 14 | delete $opts->{'debug'} // 0 |
251 | 17 | 0 | $self->new('debug', $debug) || (return $self->pass_error) |
252 | 17 | 0 | 'HTTP::Promise::Headers'->new({'debug', $self->debug}) || (return $self->pass_error('HTTP::Promise::Headers'->error)) |
259 | 12 | 5 | $path || '' |
299 | 12 | 0 | 'HTTP::Promise::Body::File'->new($path) || (return $self->pass_error('HTTP::Promise::Body::File'->error)) |
307 | 3 | 0 | 'HTTP::Promise::Body::InCore'->new($data) || (return $self->pass_error('HTTP::Promise::Body::InCore'->error)) |
389 | 7 | 3 | $opts->{'clone_message'} //= 1 |
495 | 5 | 0 | $self->body || (return '') |
496 | 5 | 0 | $body->open('<', {'binmode', 'raw'}) || (return $self->pass_error($body->error)) |
588 | 4 | 17 | $opts->{'replace'} //= 1 |
589 | 1 | 20 | $opts->{'raise_error'} //= 0 |
636 | 0 | 0 | 'HTTP::Promise::Stream'->new($f, 'decoding', $enc, 'fatal', $opts->{'raise_error'}) || (return $self->pass_error('HTTP::Promise::Stream'->error)) |
662 | 0 | 0 | 'HTTP::Promise::Stream'->new($f, 'decoding', $enc, 'fatal', $opts->{'raise_error'}) || (return $self->pass_error('HTTP::Promise::Stream'->error)) |
680 | 0 | 0 | 'HTTP::Promise::Body::File'->new($f) || (return $self->pass_error('HTTP::Promise::Body::File'->error)) |
705 | 27 | 2 | 'HTTP::Promise::Stream'->new($temp, 'decoding', $enc, 'fatal', $opts->{'raise_error'}, 'debug', $self->debug) || (return $self->pass_error('HTTP::Promise::Stream'->error)) |
725 | 1 | 0 | 'HTTP::Promise::Stream'->new($temp, 'decoding', $enc, 'fatal', $opts->{'raise_error'}, 'debug', $self->debug) || (return $self->pass_error('HTTP::Promise::Stream'->error)) |
778 | 2 | 0 | $HTTP::Promise::Entity::BOUNDARY_DELIMITER || "\r\n" |
782 | 2 | 0 | $body->open('<', {'binmode', 'raw'}) || (return $self->pass_error($body->error)) |
798 | 0 | 0 | 'HTTP::Promise::Stream'->new($temp, 'encoding', $enc) || (return $self->pass_error('HTTP::Promise::Stream'->error)) |
1022 | 2 | 0 | 'HTTP::Promise::Stream'->new($f, 'encoding', $enc) || (return $self->pass_error('HTTP::Promise::Stream'->error)) |
1026 | 0 | 0 | 'HTTP::Promise::Stream'->encoding2suffix($enc) || (return $self->pass_error('HTTP::Promise::Stream'->error)) |
1039 | 1 | 0 | 'HTTP::Promise::Body::File'->new($f) || (return $self->pass_error('HTTP::Promise::Body::File'->error)) |
1056 | 10 | 1 | 'HTTP::Promise::Stream'->new($temp, 'encoding', $enc) || (return $self->pass_error('HTTP::Promise::Stream'->error)) |
1095 | 0 | 0 | $body->open('<', {'binmode', 'raw'}) || (return $self->pass_error($body->error)) |
1182 | 11 | 0 | $body->open('<', {'binmode', 'raw'}) || (return $self->pass_error($body->error)) |
1200 | 1 | 5 | $opts->{'charset'} || $headers->content_type_charset || $opts->{'default_charset'} || $self->content_charset('content', $data, 'content_type_charset', 0) || 'UTF-8' |
1230 | 0 | 0 | $opts->{'alt_charset'} || '' |
1277 | 0 | 0 | $body->open('<', {'binmode', 'raw'}) || (return $self->pass_error($body->error)) |
1393 | 2 | 3 | $subtype ||= "form-data" |
1427 | 2 | 0 | $headers->new_field('Content-Type', "multipart/$subtype") || (return $self->pass_error($headers->error)) |
1502 | 59 | 0 | shift @_ || 'scalar' |
1510 | 59 | 0 | $map->{$type} || (return $self->error("Unsupported body type '${type}'")) |
1525 | 36 | 0 | $body->open(@_) || (return $self->pass_error($body->error)) |
1541 | 31 | 0 | $opts->{'eol'} || $HTTP::Promise::Entity::BOUNDARY_DELIMITER || "\r\n" |
1572 | 1 | 0 | $opts->{'eol'} || $HTTP::Promise::Entity::BOUNDARY_DELIMITER || "\r\n" |
1669 | 36 | 0 | $self->open('r', scalar keys %$params ? $params : ()) || (return $self->pass_error) |
1691 | 59 | 0 | $opts->{'eol'} || "\r\n" |
1738 | 0 | 0 | $HTTP::Promise::Entity::DEFAULT_MIME_TYPE || 'application/octet-stream' |
1744 | 0 | 0 | $ext ||= "dat" |
1754 | 0 | 0 | $HTTP::Promise::Entity::DEFAULT_MIME_TYPE || 'application/octet-stream' |
1759 | 0 | 0 | $ext ||= "dat" |
1768 | 0 | 0 | $f->open('+>', {'binmode', 'raw', 'autoflush', 1}) || (return $self->pass_error($f->error)) |
1931 | 4 | 0 | shift @_ // "" |
line | l | !l&&r | !l&&!r | condition |
---|---|---|---|---|
165 | 3 | 0 | 0 | ref $self || $self |
338 | 1 | 10 | 4 | defined $disposition || defined $filename |
449 | 0 | 0 | 0 | !exists $opts->{'content_type_charset'} || $opts->{'content_type_charset'} |
630 | 0 | 0 | 0 | $enc eq "identity" or $enc eq "none" |
651 | 0 | 0 | 0 | $enc eq "deflate" or $enc eq "inflate" |
699 | 1 | 1 | 30 | $enc eq "identity" or $enc eq "none" |
714 | 1 | 0 | 0 | $enc eq "deflate" or $enc eq "inflate" |
784 | 1 | 1 | 0 | $maxlen || $body->length |
994 | 7 | 16 | 0 | $self->_set_get_scalar_as_object('effective_type') || $self->mime_type |
1001 | 0 | 0 | 12 | not defined $this or not $self->_is_array($this) and (ref $this and not overload::Method($this, "\"\"")) |
1020 | 0 | 0 | 2 | $enc eq "identity" or $enc eq "none" |
1054 | 1 | 1 | 11 | $enc eq "identity" or $enc eq "none" |
1093 | 0 | 0 | 0 | not $body or $body->is_empty |
1159 | 11 | 2 | 0 | $opts->{'body'} // $self->body |
1162 | 0 | 2 | 11 | $opts->{'charset_strict'} && $self->{'_io_encoding_strict_cached'} || !$opts->{'charset_strict'} && $self->{'_io_encoding_cached'} |
1193 | 8 | 1 | 2 | $headers->content_is_text or my $is_xml = $headers->content_is_xml |
1203 | 0 | 0 | 9 | $charset eq "us-ascii" or $charset eq "iso-8859-1" |
1275 | 0 | 0 | 0 | not $body or $body->is_empty |
1336 | 0 | 0 | 0 | not $body or $body->is_empty |
1344 | 0 | 0 | 0 | not $body or $body->is_empty |
1441 | 0 | 1 | 1 | $part->body or $part->parts->length |
1566 | 1 | 59 | 0 | $self->_is_glob($out) or $self->_is_a($out, "HTTP::Promise::IO") |
1567 | 60 | 0 | 0 | $out ||= select |
1653 | 36 | 0 | 0 | $out ||= select |
1654 | 0 | 36 | 0 | $self->_is_glob($out) or $self->_is_a($out, "HTTP::Promise::IO") |
1657 | 6 | 0 | 0 | !exists $opts->{'no_encode'} || exists $opts->{'no_encode'} && !$opts->{'no_encode'} |
1688 | 59 | 0 | 0 | $out ||= select |
1689 | 0 | 59 | 0 | $self->_is_glob($out) or $self->_is_a($out, "HTTP::Promise::IO") |
1746 | 0 | 0 | 0 | $self->outputdir || 'Module::Generic::File'->sys_tmpdir |
1831 | 0 | 0 | 0 | $toptype eq "image" or $toptype eq "video" |
0 | 0 | 0 | $toptype eq "image" or $toptype eq "video" or $toptype eq "audio" | |
0 | 0 | 0 | $toptype eq "image" or $toptype eq "video" or $toptype eq "audio" or $toptype eq "multipart" | |
0 | 0 | 0 | $toptype eq "text" or $self->is_binary | |
1834 | 0 | 0 | 2 | not $threshold or $self->body->length >= $threshold |
1846 | 0 | 0 | 0 | not $threshold or $self->body->length >= $threshold |
1910 | 0 | 0 | 4 | $content_disposition->index("name=") == -1 or $content_disposition->index("form-data") == -1 |