File tree Expand file tree Collapse file tree 2 files changed +14
-11
lines changed Expand file tree Collapse file tree 2 files changed +14
-11
lines changed Original file line number Diff line number Diff line change @@ -578,16 +578,8 @@ host has closed its end of the socket.
578578sub connected {
579579 my ($self ) = @_ ;
580580
581- # If a socket exists...
582- if ($self -> {handle } && $self -> {handle }{fh }) {
583- my $socket = $self -> {handle }{fh };
584-
585- # ...and is connected, return the peer host and port.
586- if ($socket -> connected) {
587- return wantarray
588- ? ($socket -> peerhost, $socket -> peerport)
589- : join (' :' , $socket -> peerhost, $socket -> peerport);
590- }
581+ if ( $self -> {handle } ) {
582+ return $self -> {handle }-> connected;
591583 }
592584 return ;
593585}
@@ -670,7 +662,7 @@ sub _request {
670662 }
671663
672664 if ( $self -> {keep_alive }
673- && $self -> connected
665+ && $handle -> connected
674666 && $known_message_length
675667 && $response -> {protocol } eq ' HTTP/1.1'
676668 && ($response -> {headers }{connection } || ' ' ) ne ' close'
@@ -1120,6 +1112,16 @@ sub connect {
11201112 return $self ;
11211113}
11221114
1115+ sub connected {
1116+ my ($self ) = @_ ;
1117+ if ( $self -> {fh } && $self -> {fh }-> connected ) {
1118+ return wantarray
1119+ ? ( $self -> {fh }-> peerhost, $self -> {fh }-> peerport )
1120+ : join ( ' :' , $self -> {fh }-> peerhost, $self -> {fh }-> peerport );
1121+ }
1122+ return ;
1123+ }
1124+
11231125sub start_ssl {
11241126 my ($self , $host ) = @_ ;
11251127
Original file line number Diff line number Diff line change @@ -173,6 +173,7 @@ sub sort_headers {
173173 $self -> {fh } = shift @res_fh ;
174174 };
175175 *HTTP::Tiny::Handle::close = sub { 1 }; # don't close our temps
176+ *HTTP::Tiny::Handle::connected = sub { 1 };
176177
177178 # don't try to proxy in mock-mode
178179 delete $ENV {$_ } for map { $_ , uc ($_ ) } qw/ http_proxy https_proxy all_proxy/ ;
You can’t perform that action at this time.
0 commit comments