From 6794fa73e92d63e973b38f97299b4181bdd7ee8b Mon Sep 17 00:00:00 2001 From: Gisle Aas Date: Thu, 8 Nov 2012 21:07:33 +0100 Subject: [PATCH] With Net::HTTP 6.04 we don't need our own can_read() and sysread override --- Makefile.PL | 2 +- lib/LWP/Protocol/http.pm | 37 ------------------------------------- 2 files changed, 1 insertion(+), 38 deletions(-) diff --git a/Makefile.PL b/Makefile.PL index a6f808e..87075b4 100644 --- a/Makefile.PL +++ b/Makefile.PL @@ -61,7 +61,7 @@ WriteMakefile( 'LWP::MediaTypes' => 6, 'MIME::Base64' => "2.1", 'Net::FTP' => "2.58", - 'Net::HTTP' => 6, + 'Net::HTTP' => "6.04", 'URI' => "1.10", 'URI::Escape' => 0, 'WWW::RobotRules' => 6, diff --git a/lib/LWP/Protocol/http.pm b/lib/LWP/Protocol/http.pm index 8d7c6d9..d0583d4 100644 --- a/lib/LWP/Protocol/http.pm +++ b/lib/LWP/Protocol/http.pm @@ -446,43 +446,6 @@ sub request #----------------------------------------------------------- package LWP::Protocol::http::SocketMethods; -sub sysread { - my $self = shift; - if (my $timeout = ${*$self}{io_socket_timeout}) { - die "read timeout" unless $self->can_read($timeout); - } - else { - # since we have made the socket non-blocking we - # use select to wait for some data to arrive - $self->can_read(undef) || die "Assert"; - } - sysread($self, $_[0], $_[1], $_[2] || 0); -} - -sub can_read { - my($self, $timeout) = @_; - my $fbits = ''; - vec($fbits, fileno($self), 1) = 1; - SELECT: - { - my $before; - $before = time if $timeout; - my $nfound = select($fbits, undef, undef, $timeout); - if ($nfound < 0) { - if ($!{EINTR} || $!{EAGAIN}) { - # don't really think EAGAIN can happen here - if ($timeout) { - $timeout -= time - $before; - $timeout = 0 if $timeout < 0; - } - redo SELECT; - } - die "select failed: $!"; - } - return $nfound > 0; - } -} - sub ping { my $self = shift; !$self->can_read(0); -- 1.8.1.4