diff options
Diffstat (limited to 'Master/tlpkg/tlperl/lib/LWP/Protocol/http.pm')
-rw-r--r-- | Master/tlpkg/tlperl/lib/LWP/Protocol/http.pm | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/Master/tlpkg/tlperl/lib/LWP/Protocol/http.pm b/Master/tlpkg/tlperl/lib/LWP/Protocol/http.pm index a75e147650a..23c361f7055 100644 --- a/Master/tlpkg/tlperl/lib/LWP/Protocol/http.pm +++ b/Master/tlpkg/tlperl/lib/LWP/Protocol/http.pm @@ -17,6 +17,12 @@ sub _new_socket { my($self, $host, $port, $timeout) = @_; + # IPv6 literal IP address should be [bracketed] to remove + # ambiguity between ip address and port number. + if ( ($host =~ /:/) && ($host !~ /^\[/) ) { + $host = "[$host]"; + } + local($^W) = 0; # IO::Socket::INET can be noisy my $sock = $self->socket_class->new(PeerAddr => $host, PeerPort => $port, @@ -276,7 +282,7 @@ sub request my $n = $socket->syswrite($req_buf, length($req_buf)); unless (defined $n) { redo WRITE if $!{EINTR}; - if ($!{EAGAIN}) { + if ($!{EWOULDBLOCK} || $!{EAGAIN}) { select(undef, undef, undef, 0.1); redo WRITE; } @@ -346,7 +352,7 @@ sub request { my $nfound = select($rbits, $wbits, undef, $sel_timeout); if ($nfound < 0) { - if ($!{EINTR} || $!{EAGAIN}) { + if ($!{EINTR} || $!{EWOULDBLOCK} || $!{EAGAIN}) { if ($time_before) { $sel_timeout = $sel_timeout_before - (time - $time_before); $sel_timeout = 0 if $sel_timeout < 0; @@ -367,7 +373,7 @@ sub request my $buf = $socket->_rbuf; my $n = $socket->sysread($buf, 1024, length($buf)); unless (defined $n) { - die "read failed: $!" unless $!{EINTR} || $!{EAGAIN}; + die "read failed: $!" unless $!{EINTR} || $!{EWOULDBLOCK} || $!{EAGAIN}; # if we get here the rest of the block will do nothing # and we will retry the read on the next round } @@ -398,7 +404,7 @@ sub request if (defined($wbits) && $wbits =~ /[^\0]/) { my $n = $socket->syswrite($$wbuf, length($$wbuf), $woffset); unless (defined $n) { - die "write failed: $!" unless $!{EINTR} || $!{EAGAIN}; + die "write failed: $!" unless $!{EINTR} || $!{EWOULDBLOCK} || $!{EAGAIN}; $n = 0; # will retry write on the next round } elsif ($n == 0) { @@ -455,7 +461,7 @@ sub request { $n = $socket->read_entity_body($buf, $size); unless (defined $n) { - redo READ if $!{EINTR} || $!{EAGAIN} || $!{ENOTTY}; + redo READ if $!{EINTR} || $!{EWOULDBLOCK} || $!{EAGAIN} || $!{ENOTTY}; die "read failed: $!"; } redo READ if $n == -1; |