Branch Coverage

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


line true false branch
108 5 217 if (exists $params{$old})
117 143 819 exists $params{$_} ? :
119 73 1 unless (defined $$self{'via'})
120 73 0 $$self{'port'} != 80 ? :
136 4 70 @args ? :
140 0 214 unless $METHODS{$_}
146 1 64 if (@_)
148 1 0 if $self->agent
155 1 37 unless (defined $self->daemon)
174 785 3477 if @_
205 4 4 unless @_
206 3 1 if @_ == 1
220 36 0 if $engine->can('start')
223 13 68 if $self->max_connections and $self->conn >= $self->max_connections
225 13 0 if $engine->can('stop')
238 60 62 if $$self{'_init'}++
240 62 0 unless defined $self->daemon
241 62 0 unless defined $self->agent
276 64 0 unless $self->port
277 0 64 unless my $daemon = 'HTTP::Daemon'->new(%args)
286 0 64 unless my $agent = 'LWP::UserAgent'->new('env_proxy', 1, 'keep_alive', 2, 'parse_head', 0, 'timeout', $self->timeout)
323 13 77 unless (defined $req)
324 0 13 if $conn->reason ne 'No more requests from this connection'
329 1 76 $req->method eq 'CONNECT' ? :
333 0 77 unless (grep {$_ eq $req->method;} @HTTP::Proxy::METHODS)
343 5 72 unless (defined $req->uri->scheme)
344 4 1 if (my $host = $req->header('Host')) { }
358 1 75 unless ($self->is_protocol_supported(my $s = $req->uri->scheme))
381 1 74 if (not defined $self->response and $req->method eq 'CONNECT')
383 1 0 if $last
389 0 74 if defined $self->response
401 29 32 unless ($sent)
419 48 13 if ($chunked) { }
420 48 0 if length $data
433 45 29 unless ($sent)
444 0 74 if (length $data)
445 0 0 if ($chunked) { }
452 27 47 if $chunked
456 0 74 if (my $died = $response->header('X-Died'))
472 47 29 unless ($sent)
475 37 10 if ($chunked) { }
476 36 1 if length $content
484 0 75 if defined $req->uri->scheme and $req->uri->scheme =~ /^(?:ftp|gopher)$/ and $response->is_success
489 15 61 if $last or $served >= $self->max_keep_alive_requests
492 0 15 if not $last and $served < $self->max_keep_alive_requests
510 2 75 if $$self{'body'}{'response'}->will_modify
512 7 70 unless $response->header('Server')
514 7 70 unless $response->header('Date')
518 0 77 if ($conn->antique_client) { }
523 2 75 if ($code =~ /^(1\d\d|[23]04)$/) { }
4 71 elsif ($response->request and $response->request->method eq 'HEAD') { }
533 65 6 if ($conn->proto_ge('HTTP/1.1')) { }
536 8 57 if $served >= $self->max_keep_alive_requests
563 0 1 if (my $up = $self->agent->proxy('http')) { }
575 0 0 if ($code == 407) { }
0 0 elsif ($code != 200) { }
598 0 1 unless ($upstream)
630 0 2 $conn eq $_ ? :
638 0 2 unless (defined $read)
644 1 1 if ($read == 0)
674 35 19 unless $_[$i] =~ /^(mime|method|scheme|host|path|query)$/
679 1 30 if @_ % 2
688 30 0 if (defined $mime and $mime ne '')
689 1 29 unless $mime =~ m[/]
695 1 703 unless /$RX{'method'}/
696 28 0 @method ? :
701 1 27 unless $self->is_protocol_supported($_)
704 27 0 @scheme ? :
714 1 30 unless $message =~ /^(request|response)$/
717 1 29 unless ref $filter and $filter->isa('HTTP::Proxy::HeaderFilter') || $filter->isa('HTTP::Proxy::BodyFilter')
723 10 19 if $filter->isa('HTTP::Proxy::HeaderFilter')
724 19 10 if $filter->isa('HTTP::Proxy::BodyFilter')
728 1 28 if $message eq 'request'
733 0 18 if defined $mime and not +($self->response->content_type || '') =~ /$mime/
736 0 18 unless ($$self{'request'}->method || '') =~ /$method/
737 0 18 unless ($$self{'request'}->uri->scheme || '') =~ /$scheme/
738 0 18 unless ($$self{'request'}->uri->authority || '') =~ /$host/
739 0 18 unless ($$self{'request'}->uri->path || '') =~ /$path/
740 0 18 unless ($$self{'request'}->uri->query || '') =~ /$query/
753 2 102 unless ($self->agent->is_protocol_supported($scheme))
768 681 20 unless $self->logmask & $level or $level == -1
772 0 20 unless @lines