Branch Coverage

blib/lib/HTTP/Proxy.pm
Criterion Covered Total %
branch 112 160 70.0


line true false branch
107 5 205 if (exists $params{$old})
116 136 774 exists $params{$_} ? :
128 4 67 @args ? :
132 0 205 unless $METHODS{$_}
138 1 61 if (@_)
140 1 0 if $self->agent
147 1 36 unless (defined $self->daemon)
166 774 3404 if @_
197 4 4 unless @_
198 3 1 if @_ == 1
212 34 0 if $engine->can('start')
215 12 69 if $self->max_connections and $self->conn >= $self->max_connections
217 12 0 if $engine->can('stop')
230 58 59 if $$self{'_init'}++
232 59 0 unless defined $self->daemon
233 59 0 unless defined $self->agent
268 61 0 unless $self->port
269 0 61 unless my $daemon = 'HTTP::Daemon'->new(%args)
278 0 61 unless my $agent = 'LWP::UserAgent'->new('env_proxy', 1, 'keep_alive', 2, 'parse_head', 0, 'timeout', $self->timeout)
315 13 76 unless (defined $req)
316 0 13 if $conn->reason ne 'No more requests from this connection'
321 0 76 $req->method eq 'CONNECT' ? :
325 0 76 unless (grep {$_ eq $req->method;} @HTTP::Proxy::METHODS)
335 5 71 unless (defined $req->uri->scheme)
336 4 1 if (my $host = $req->header('Host')) { }
350 1 74 unless ($self->is_protocol_supported(my $s = $req->uri->scheme))
373 0 74 if (not defined $self->response and $req->method eq 'CONNECT')
375 0 0 if $last
381 0 74 if defined $self->response
393 29 33 unless ($sent)
411 49 13 if ($chunked) { }
412 49 0 if length $data
425 45 29 unless ($sent)
436 0 74 if (length $data)
437 0 0 if ($chunked) { }
444 27 47 if $chunked
448 0 74 if (my $died = $response->header('X-Died'))
464 47 29 unless ($sent)
467 37 10 if ($chunked) { }
468 36 1 if length $content
476 0 75 if defined $req->uri->scheme and $req->uri->scheme =~ /^(?:ftp|gopher)$/ and $response->is_success
481 15 61 if $last or $served >= $self->max_keep_alive_requests
484 0 15 if not $last and $served < $self->max_keep_alive_requests
502 2 74 if $$self{'body'}{'response'}->will_modify
504 6 70 unless $response->header('Server')
506 6 70 unless $response->header('Date')
510 0 76 if ($conn->antique_client) { }
515 2 74 if ($code =~ /^(1\d\d|[23]04)$/) { }
4 70 elsif ($response->request and $response->request->method eq 'HEAD') { }
525 64 6 if ($conn->proto_ge('HTTP/1.1')) { }
528 8 56 if $served >= $self->max_keep_alive_requests
555 0 0 if (my $up = $self->agent->proxy('http')) { }
567 0 0 if ($code == 407) { }
0 0 elsif ($code != 200) { }
590 0 0 unless ($upstream)
619 0 0 $conn eq $_ ? :
627 0 0 unless (defined $read)
633 0 0 if ($read == 0)
663 35 19 unless $_[$i] =~ /^(mime|method|scheme|host|path|query)$/
668 1 30 if @_ % 2
677 30 0 if (defined $mime and $mime ne '')
678 1 29 unless $mime =~ m[/]
684 1 703 unless /$RX{'method'}/
685 28 0 @method ? :
690 1 27 unless $self->is_protocol_supported($_)
693 27 0 @scheme ? :
703 1 30 unless $message =~ /^(request|response)$/
706 1 29 unless ref $filter and $filter->isa('HTTP::Proxy::HeaderFilter') || $filter->isa('HTTP::Proxy::BodyFilter')
712 10 19 if $filter->isa('HTTP::Proxy::HeaderFilter')
713 19 10 if $filter->isa('HTTP::Proxy::BodyFilter')
717 1 28 if $message eq 'request'
722 0 18 if defined $mime and not +($self->response->content_type || '') =~ /$mime/
725 0 18 unless ($$self{'request'}->method || '') =~ /$method/
726 0 18 unless ($$self{'request'}->uri->scheme || '') =~ /$scheme/
727 0 18 unless ($$self{'request'}->uri->authority || '') =~ /$host/
728 0 18 unless ($$self{'request'}->uri->path || '') =~ /$path/
729 0 18 unless ($$self{'request'}->uri->query || '') =~ /$query/
742 2 101 unless ($self->agent->is_protocol_supported($scheme))
757 665 20 unless $self->logmask & $level or $level == -1
761 0 20 unless @lines