Branch Coverage

blib/lib/HTTP/Proxy.pm
Criterion Covered Total %
branch 124 164 75.6


line true false branch
107 5 214 if (exists $params{$old})
116 142 734 exists $params{$_} ? :
118 73 0 unless (defined $$self{'via'})
119 73 0 $$self{'port'} != 80 ? :
132 4 70 @args ? :
136 0 214 unless $METHODS{$_}
142 1 64 if (@_)
144 1 0 if $self->agent
151 1 37 unless (defined $self->daemon)
170 785 3492 if @_
201 4 4 unless @_
202 3 1 if @_ == 1
216 36 0 if $engine->can('start')
219 13 77 if $self->max_connections and $self->conn >= $self->max_connections
221 13 0 if $engine->can('stop')
234 60 62 if $$self{'_init'}++
236 62 0 unless defined $self->daemon
237 62 0 unless defined $self->agent
272 64 0 unless $self->port
273 0 64 unless my $daemon = 'HTTP::Daemon'->new(%args)
282 0 64 unless my $agent = 'LWP::UserAgent'->new('env_proxy', 1, 'keep_alive', 2, 'parse_head', 0, 'timeout', $self->timeout)
319 13 77 unless (defined $req)
320 0 13 if $conn->reason ne 'No more requests from this connection'
325 1 76 $req->method eq 'CONNECT' ? :
329 0 77 unless (grep {$_ eq $req->method;} @HTTP::Proxy::METHODS)
339 5 72 unless (defined $req->uri->scheme)
340 4 1 if (my $host = $req->header('Host')) { }
354 1 75 unless ($self->is_protocol_supported(my $s = $req->uri->scheme))
377 1 74 if (not defined $self->response and $req->method eq 'CONNECT')
379 1 0 if $last
385 0 74 if defined $self->response
397 29 32 unless ($sent)
415 49 12 if ($chunked) { }
416 49 0 if length $data
429 45 29 unless ($sent)
440 0 74 if (length $data)
441 0 0 if ($chunked) { }
448 27 47 if $chunked
452 0 74 if (my $died = $response->header('X-Died'))
468 47 29 unless ($sent)
471 37 10 if ($chunked) { }
472 36 1 if length $content
480 0 75 if defined $req->uri->scheme and $req->uri->scheme =~ /^(?:ftp|gopher)$/ and $response->is_success
485 15 61 if $last or $served >= $self->max_keep_alive_requests
488 0 15 if not $last and $served < $self->max_keep_alive_requests
506 2 75 if $$self{'body'}{'response'}->will_modify
508 7 70 unless $response->header('Server')
510 7 70 unless $response->header('Date')
514 0 77 if ($conn->antique_client) { }
519 2 75 if ($code =~ /^(1\d\d|[23]04)$/) { }
4 71 elsif ($response->request and $response->request->method eq 'HEAD') { }
529 65 6 if ($conn->proto_ge('HTTP/1.1')) { }
532 8 57 if $served >= $self->max_keep_alive_requests
559 0 1 if (my $up = $self->agent->proxy('http')) { }
571 0 0 if ($code == 407) { }
0 0 elsif ($code != 200) { }
594 0 1 unless ($upstream)
626 1 1 $conn eq $_ ? :
634 1 1 unless (defined $read)
640 1 0 if ($read == 0)
670 35 19 unless $_[$i] =~ /^(mime|method|scheme|host|path|query)$/
675 1 30 if @_ % 2
684 30 0 if (defined $mime and $mime ne '')
685 1 29 unless $mime =~ m[/]
691 1 703 unless /$RX{'method'}/
692 28 0 @method ? :
697 1 27 unless $self->is_protocol_supported($_)
700 27 0 @scheme ? :
710 1 30 unless $message =~ /^(request|response)$/
713 1 29 unless ref $filter and $filter->isa('HTTP::Proxy::HeaderFilter') || $filter->isa('HTTP::Proxy::BodyFilter')
719 10 19 if $filter->isa('HTTP::Proxy::HeaderFilter')
720 19 10 if $filter->isa('HTTP::Proxy::BodyFilter')
724 1 28 if $message eq 'request'
729 0 18 if defined $mime and not +($self->response->content_type || '') =~ /$mime/
732 0 18 unless ($$self{'request'}->method || '') =~ /$method/
733 0 18 unless ($$self{'request'}->uri->scheme || '') =~ /$scheme/
734 0 18 unless ($$self{'request'}->uri->authority || '') =~ /$host/
735 0 18 unless ($$self{'request'}->uri->path || '') =~ /$path/
736 0 18 unless ($$self{'request'}->uri->query || '') =~ /$query/
749 2 102 unless ($self->agent->is_protocol_supported($scheme))
764 679 21 unless $self->logmask & $level or $level == -1
768 0 21 unless @lines