Created
February 5, 2011 07:37
-
-
Save xaicron/812294 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/lib/Furl/HTTP.pm b/lib/Furl/HTTP.pm | |
index f1c8226..15da518 100644 | |
--- a/lib/Furl/HTTP.pm | |
+++ b/lib/Furl/HTTP.pm | |
@@ -9,7 +9,7 @@ use Furl; | |
use Furl::ConnectionCache; | |
use Scalar::Util (); | |
-use Errno qw(EAGAIN ECONNRESET EINPROGRESS EINTR EWOULDBLOCK); | |
+use Errno qw(EAGAIN ECONNRESET EINPROGRESS EINTR EWOULDBLOCK ECONNABORTED); | |
use Fcntl qw(F_GETFL F_SETFL O_NONBLOCK SEEK_SET SEEK_END); | |
use Socket qw( | |
PF_INET SOCK_STREAM | |
@@ -380,7 +380,7 @@ sub request { | |
\$buf, $self->{bufsize}, length($buf), $timeout_at); | |
if(!$n) { # error or eof | |
if ($in_keepalive && length($buf) == 0 | |
- && (defined($n) || $!==ECONNRESET)) { | |
+ && (defined($n) || $!==ECONNRESET || (WIN32 && $! == ECONNABORTED))) { | |
# the server closes the connection (maybe because of keep-alive timeout) | |
return $self->request(%args); | |
} | |
@@ -526,7 +526,7 @@ sub connect :method { | |
_set_sockopts($sock); | |
if (connect($sock, $sock_addr)) { | |
# connected | |
- } elsif ($! == EINPROGRESS) { | |
+ } elsif ($! == EINPROGRESS || (WIN32 && $! == EWOULDBLOCK)) { | |
$self->do_select(1, $sock, $timeout_at) | |
or return (undef, "Cannot connect to ${host}:${port}: timeout"); | |
# connected |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment