summaryrefslogtreecommitdiff
path: root/Master/tlpkg/tlperl/lib/LWP/Protocol/http.pm
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2015-04-26 22:16:26 +0000
committerKarl Berry <karl@freefriends.org>2015-04-26 22:16:26 +0000
commit342e672574c4e67d510e46ab6acd0e21a7d0cf54 (patch)
tree79e04202d08c0404bbd780bd26c1e34710e539b6 /Master/tlpkg/tlperl/lib/LWP/Protocol/http.pm
parentbe2706af7c57a0ef0f4d4e9f684ca4ef74922a82 (diff)
(tl)perl 5.20.2 for windows, from siep
git-svn-id: svn://tug.org/texlive/trunk@37064 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/tlpkg/tlperl/lib/LWP/Protocol/http.pm')
-rw-r--r--Master/tlpkg/tlperl/lib/LWP/Protocol/http.pm16
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;