Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
better CONNECT request handling
  • Loading branch information
kraih committed Dec 8, 2012
1 parent ac2d231 commit 0761cee
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions lib/Mojo/UserAgent.pm
Expand Up @@ -211,8 +211,11 @@ sub _connect {
sub _connect_proxy {
my ($self, $old, $cb) = @_;

# Start CONNECT request
# Check if CONNECT request is necessary
return undef unless $old->req->method ne 'CONNECT';
return undef unless my $new = $self->transactor->proxy_connect($old);

# Start CONNECT request
return $self->_start(
$new => sub {
my ($self, $tx) = @_;
Expand Down Expand Up @@ -278,9 +281,7 @@ sub _connection {
}

# CONNECT request to proxy required
if ($tx->req->method ne 'CONNECT') {
if (my $id = $self->_connect_proxy($tx, $cb)) { return $id }
}
if (my $id = $self->_connect_proxy($tx, $cb)) { return $id }

# Connect
warn "-- Connect ($proto:$host:$port)\n" if DEBUG;
Expand Down

0 comments on commit 0761cee

Please sign in to comment.