Skip to content

Commit

Permalink
small optimization
Browse files Browse the repository at this point in the history
  • Loading branch information
kraih committed Oct 21, 2013
1 parent 29815df commit 2529541
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/Mojo/UserAgent/Proxy.pm
Expand Up @@ -18,16 +18,16 @@ sub inject {
$self->detect if $ENV{MOJO_PROXY};
my $req = $tx->req;
my $url = $req->url;
return unless $self->is_needed($url->host);
return if !$self->is_needed($url->host) || defined $req->proxy;

# HTTP proxy
my $proto = $url->protocol;
my $http = $self->http;
$req->proxy($http) if $http && !defined $req->proxy && $proto eq 'http';
$req->proxy($http) if $http && $proto eq 'http';

# HTTPS proxy
my $https = $self->https;
$req->proxy($https) if $https && !defined $req->proxy && $proto eq 'https';
$req->proxy($https) if $https && $proto eq 'https';
}

sub is_needed {
Expand Down

0 comments on commit 2529541

Please sign in to comment.