Branch Coverage

blib/lib/Net/Proxy/Type.pm
Criterion Covered Total %
branch 81 174 46.5


line true false branch
76 1 0 if defined $_[0]
105 1 0 if (defined $_[0])
106 0 1 unless ($$self{'host'}) = $_[0] =~ m[^http://([^:/]+)]
118 1 0 if (defined $_[0])
119 0 1 unless ($$self{'https_host'}, $$self{'https_pathquery'}) = $_[0] =~ m[^https://([^:/]+)(/.*)?]
142 0 6 if (@_ == 3) { }
0 6 elsif (($proxyaddr, $proxyport) = _parse_proxyaddr($_[0])) { }
6 0 elsif (@_ == 2) { }
158 0 13 if (defined $checkmask)
159 0 0 unless ($checkers[$i] & $checkmask)
166 3 10 if ($ok) { }
2 8 elsif (not defined $ok) { }
168 3 0 if @found == $max
176 1 5 unless (@found)
188 1 5 wantarray ? :
210 0 0 if ($$t[1] > $con_time)
215 0 0 wantarray ? :
230 0 3 unless my($socket, $con_time) = $self->_create_socket($proxyaddr, $proxyport)
234 0 3 unless ($self->_http_request($socket))
239 1 2 if (not $$self{'http_strict'}) { }
243 0 1 if ($code == 407 and $$self{'noauth'})
248 0 1 if (not $rc or substr($buf, 0, 4) ne 'HTTP')
254 1 1 unless ($self->_is_strict_response($socket, $$self{'keyword'}))
260 1 1 wantarray ? :
264 1 0 wantarray ? :
271 2 5 unless my($socket, $con_time) = $self->_create_socket($proxyaddr, $proxyport)
274 0 5 unless $self->_write_to_socket($socket, 'CONNECT ' . $$self{'host'} . ':80 HTTP/1.1' . "\r\n" . 'Host: ' . $$self{'host'} . ':80' . "\r\n" . "\r\n")
279 1 4 unless $self->_read_from_socket($socket, my $headers, "\r\n\r\n", 2000)
281 0 4 unless my($code) = $headers =~ m[^HTTP/\d.\d (\d{3})]
283 0 0 if ($code == 407 and $$self{'noauth'} || $$self{'connect_strict'})
286 3 1 if ($code < 200 || $code >= 300 and $code != 407)
289 0 1 if ($$self{'connect_strict'})
290 0 0 unless ($self->_http_request($socket))
294 0 0 unless ($self->_is_strict_response($socket, $$self{'keyword'}))
300 1 0 wantarray ? :
304 3 1 wantarray ? :
311 0 4 unless my($socket, $con_time) = $self->_create_socket($proxyaddr, $proxyport)
314 0 4 unless $self->_write_to_socket($socket, 'CONNECT ' . $$self{'https_host'} . ':443 HTTP/1.1' . "\r\n" . 'Host: ' . $$self{'https_host'} . ':443' . "\r\n" . "\r\n")
318 2 2 unless $self->_read_from_socket($socket, my $headers, "\r\n\r\n", 2000)
320 0 2 unless my($code) = $headers =~ m[^HTTP/\d.\d (\d{3})]
322 0 0 if ($code == 407 and $$self{'noauth'} || $$self{'https_strict'})
325 0 2 if ($code < 200 || $code >= 300 and $code != 407)
329 1 1 if ($$self{'https_strict'})
333 1 0 unless ('IO::Socket::SSL'->start_SSL($socket, 'Timeout', $$self{'read_timeout'}))
338 0 0 unless $self->_write_to_socket($socket, 'GET ' . ($$self{'https_pathquery'} || '/') . ' HTTP/' . $$self{'http_ver'} . "\r\n" . 'Host: ' . $$self{'https_host'} . "\r\n" . "\r\n")
344 0 0 unless ($self->_is_strict_response($socket, $$self{'https_keyword'}))
350 1 0 wantarray ? :
354 2 1 wantarray ? :
362 0 1 unless my($socket, $con_time) = $self->_create_socket($proxyaddr, $proxyport)
365 0 1 unless ($self->_write_to_socket($socket, "\cD\cA\000P" . inet_aton($$self{'host'}) . "\000"))
371 0 0 if (not $rc or substr($buf, 0, 1) ne "\000" or substr($buf, 1, 1) ne 'Z')
375 0 0 if ($$self{'socks4_strict'})
376 0 0 unless ($self->_http_request($socket))
380 0 0 unless ($self->_is_strict_response($socket, $$self{'keyword'}))
386 0 0 wantarray ? :
390 1 0 wantarray ? :
398 0 1 unless my($socket, $con_time) = $self->_create_socket($proxyaddr, $proxyport)
401 0 1 unless ($self->_write_to_socket($socket, "\cE\cA\000"))
407 1 0 unless ($rc)
412 0 0 if ($c eq "\cA" or $c eq "\cB" or $c eq "\377") { }
414 0 0 if ($$self{'noauth'} or $$self{'socks5_strict'})
419 0 0 if ($c ne "\000")
423 0 0 unless ($self->_write_to_socket($socket, "\cE\cA\000\cA" . inet_aton($$self{'host'}) . "\000P"))
430 0 0 if (not $rc or substr($buf, 1, 1) ne "\000")
434 0 0 if ($$self{'socks5_strict'})
435 0 0 unless ($self->_http_request($socket))
439 0 0 unless ($self->_is_strict_response($socket, $$self{'keyword'}))
446 0 0 wantarray ? :
450 1 0 wantarray ? :
466 1 1 unless $self->_read_from_socket($socket, my $headers, "\r\n\r\n", 4096)
468 0 1 unless my($code) = $headers =~ m[HTTP/\d\.\d (\d{3})]
470 0 1 if ((caller 1)[3] eq 'Net::Proxy::Type::is_http' and $code == 407 and $$self{'noauth'})
486 0 14 unless ($selector->can_write(1))
492 14 0 if ($rc > 0) { }
0 0 elsif ($! != 11 and $! != 11) { }
495 14 0 if (length $msg == 0)
514 3 11 if (@_ == 2) { }
527 6 12 unless ($selector->can_read(1))
533 12 0 if (defined $rc) { }
0 0 elsif ($! != 11 and $! != 11) { }
535 8 4 if ($rc > 0) { }
538 8 0 if ($num_limit == 0 or defined $str_limit and ($limit_idx = index($_[0], $str_limit)) != -1)
539 7 1 if (defined $limit_idx and $limit_idx >= 0)
563 0 16 unless (defined $proxyport)
564 0 0 unless ($proxyaddr, $proxyport) = _parse_proxyaddr($proxyaddr)
569 2 14 unless my $socket = $self->_open_socket($proxyaddr, $proxyport)
586 6 0 unless my($host, $port) = $proxyaddr =~ /^([^:]+):(\d+)$/