Honor time-out

This commit is contained in:
Petr Písař 2013-03-08 15:07:49 +01:00
parent 700a862eb0
commit 44c10702d8
2 changed files with 87 additions and 7 deletions

View File

@ -0,0 +1,75 @@
From 6794fa73e92d63e973b38f97299b4181bdd7ee8b Mon Sep 17 00:00:00 2001
From: Gisle Aas <gisle@aas.no>
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

View File

@ -1,11 +1,13 @@
Name: perl-libwww-perl
Version: 6.04
Release: 4%{?dist}
Release: 5%{?dist}
Summary: A Perl interface to the World-Wide Web
Group: Development/Libraries
License: GPL+ or Artistic
URL: http://search.cpan.org/dist/libwww-perl/
Source0: http://www.cpan.org/authors/id/G/GA/GAAS/libwww-perl-%{version}.tar.gz
# Fix time-out, bug #919448, CPAN RT#81799, in upstream after 6.04
Patch0: libwww-perl-6.04-With-Net-HTTP-6.04-we-don-t-need-our-own-can_read-an.patch
BuildArch: noarch
BuildRequires: perl(Digest::MD5)
BuildRequires: perl(Encode) >= 2.12
@ -28,14 +30,14 @@ BuildRequires: perl(IO::Socket)
BuildRequires: perl(LWP::MediaTypes) >= 6
BuildRequires: perl(MIME::Base64) >= 2.1
BuildRequires: perl(Net::FTP) >= 2.58
BuildRequires: perl(Net::HTTP) >= 6
BuildRequires: perl(Net::HTTP) >= 6.04
BuildRequires: perl(URI) >= 1.10
BuildRequires: perl(URI::Escape)
BuildRequires: perl(WWW::RobotRules) >= 6
# Tests only:
BuildRequires: perl(Config)
BuildRequires: perl(Test::More)
Requires: perl(:MODULE_COMPAT_%(eval "`%{__perl} -V:version`"; echo $version))
Requires: perl(:MODULE_COMPAT_%(eval "`perl -V:version`"; echo $version))
Requires: perl(Encode) >= 2.12
Requires: perl(File::Listing) >= 6
Requires: perl(HTML::Entities)
@ -51,7 +53,7 @@ Requires: perl(HTTP::Status) >= 6
Requires: perl(LWP::MediaTypes) >= 6
Requires: perl(MIME::Base64) >= 2.1
Requires: perl(Net::FTP) >= 2.58
Requires: perl(Net::HTTP) >= 6
Requires: perl(Net::HTTP) >= 6.04
Requires: perl(URI) >= 1.10
Requires: perl(URI::Escape)
Requires: perl(WWW::RobotRules) >= 6
@ -82,16 +84,16 @@ use and even classes that help you implement simple HTTP servers.
%prep
%setup -q -n libwww-perl-%{version}
%patch0 -p1
%build
# Install the aliases by default
%{__perl} Makefile.PL INSTALLDIRS=perl --aliases < /dev/null
perl Makefile.PL INSTALLDIRS=perl --aliases < /dev/null
make %{?_smp_mflags}
%install
make pure_install PERL_INSTALL_ROOT=$RPM_BUILD_ROOT
make pure_install DESTDIR=$RPM_BUILD_ROOT
find $RPM_BUILD_ROOT -type f -name .packlist -exec rm -f {} ';'
find $RPM_BUILD_ROOT -type d -depth -exec rmdir {} 2>/dev/null ';'
chmod -R u+w $RPM_BUILD_ROOT/*
%check
@ -108,6 +110,9 @@ make test
%{_mandir}/man3/*.3*
%changelog
* Fri Mar 08 2013 Petr Pisar <ppisar@redhat.com> - 6.04-5
- Honor time-out (bug #919448)
* Thu Feb 14 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 6.04-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild