Skip to content

Commit

Permalink
a few more CONNECT tests
Browse files Browse the repository at this point in the history
  • Loading branch information
kraih committed Jun 16, 2016
1 parent d5a5b63 commit aba6466
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
2 changes: 1 addition & 1 deletion lib/Mojo/UserAgent.pm
Expand Up @@ -239,7 +239,7 @@ sub _finish {
return $new->client_read($old->res->content->leftovers);
}

# CONNECT requests always have a followup request
# CONNECT requests always have a follow-up request
$self->_reuse($id, $close) unless uc $old->req->method eq 'CONNECT';
if ($res->is_status_class(400) || $res->is_status_class(500)) {
$res->error({message => $res->message, code => $res->code});
Expand Down
12 changes: 8 additions & 4 deletions t/mojo/websocket_proxy_tls.t
Expand Up @@ -252,12 +252,16 @@ ok $sent > 25, 'sent enough';
# Blocking proxy requests
$ua->proxy->https("http://sri:secr3t\@127.0.0.1:$proxy");
my $tx = $ua->max_connections(0)->get("https://127.0.0.1:$port/proxy");
is $tx->res->code, 200, 'right status';
is $tx->res->body, "https://127.0.0.1:$port/proxy", 'right content';
is $tx->res->code, 200, 'right status';
is $tx->res->body, "https://127.0.0.1:$port/proxy", 'right content';
is $tx->req->method, 'GET', 'right method';
is $tx->previous->req->method, 'CONNECT', 'right method';
$tx = $ua->max_connections(5)->get("https://127.0.0.1:$port/proxy");
ok !$tx->kept_alive, 'connection was not kept alive';
is $tx->res->code, 200, 'right status';
is $tx->res->body, "https://127.0.0.1:$port/proxy", 'right content';
is $tx->res->code, 200, 'right status';
is $tx->res->body, "https://127.0.0.1:$port/proxy", 'right content';
is $tx->req->method, 'GET', 'right method';
is $tx->previous->req->method, 'CONNECT', 'right method';

# Proxy WebSocket with bad target
$ua->proxy->https("http://127.0.0.1:$proxy");
Expand Down

0 comments on commit aba6466

Please sign in to comment.