AnyEvent-Connector

 view release on metacpan or  search on metacpan

lib/AnyEvent/Connector.pm  view on Meta::CPAN


Setting empty string or empty array-ref to C<no_proxy> disables the no_proxy setting done by C<env_proxy> option.

=item C<env_proxy> => STR (optional)

String of protocol specifier. If specified, proxy settings for that
protocol are loaded from environment variables, and C<$conn> is
created.

For example, if C<"http"> is specified, C<http_proxy> (or
C<HTTP_PROXY>) and C<no_proxy> (or C<NO_PROXY>) environment variables
are used to set C<proxy> and C<no_proxy> options, respectively.

C<proxy> and C<no_proxy> options have precedence over C<env_proxy>
option.

=back

=head1 OBJECT METHOD

=head2 $guard = $conn->tcp_connect($host, $port, $connect_cb, $prepare_cb)

t/env_proxy.t  view on Meta::CPAN

use strict;
use warnings;
use Test::More;
use AnyEvent::Connector;

foreach my $e (qw{http_proxy HTTP_PROXY no_proxy NO_PROXY ftp_proxy FTP_PROXY}) {
    delete $ENV{$e};
}

subtest "env_proxy no no_proxy", sub {
    local $ENV{http_proxy} = "http://foobar.ne.jp:8080";
    my $c = AnyEvent::Connector->new(
        env_proxy => "http"
    );
    is $c->proxy_for("www.foobar.net", 80), "http://foobar.ne.jp:8080";
};



( run in 2.518 seconds using v1.01-cache-2.11-cpan-d7a12ab2c7f )