Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 28 Jan 2013 22:58:56 +0100 (CET)
From:      Slaven Rezic <eserte@cvrsnica.herceg.de>
To:        FreeBSD-gnats-submit@freebsd.org
Subject:   ports/175658: www/p5-libwww: read timeout does not work with 6.04
Message-ID:  <201301282158.r0SLwu2s096441@cvrsnica.herceg.de>
Resent-Message-ID: <201301282200.r0SM008c055536@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         175658
>Category:       ports
>Synopsis:       www/p5-libwww: read timeout does not work with 6.04
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Mon Jan 28 22:00:00 UTC 2013
>Closed-Date:
>Last-Modified:
>Originator:     Slaven Rezic
>Release:        FreeBSD 9.0-RELEASE amd64
>Organization:
www.rezic.de
>Environment:
System: FreeBSD cvrsnica.herceg.de 9.0-RELEASE FreeBSD 9.0-RELEASE #0: Tue Jan 3 07:46:30 UTC 2012 root@farrell.cse.buffalo.edu:/usr/obj/usr/src/sys/GENERIC amd64


	
>Description:
	See https://rt.cpan.org/Ticket/Display.html?id=81799 for a
	detailed report.

>How-To-Repeat:
	lwp-request -t 5 $SOME_HANGING_URL

>Fix:

	Here's the proposed patch incorporated into the freebsd port:

diff --git c/Makefile w/Makefile
index 5de5865..e50870d 100644
--- c/Makefile
+++ w/Makefile
@@ -3,6 +3,7 @@
 
 PORTNAME=	libwww
 PORTVERSION=	6.04
+PORTREVISION=	1
 CATEGORIES=	www devel perl5
 MASTER_SITES=	CPAN/LWP
 PKGNAMEPREFIX=	p5-
@@ -28,6 +29,8 @@ RUN_DEPENDS:=	${BUILD_DEPENDS}
 
 OPTIONS_DEFINE=	HTTPS
 
+PATCH_STRIP=	-p1
+
 CONFIGURE_ARGS=	--aliases
 PERL_CONFIGURE=	yes
 
diff --git c/files/patch-read-timeout w/files/patch-read-timeout
new file mode 100644
index 0000000..d35c5b9
--- /dev/null
+++ w/files/patch-read-timeout
@@ -0,0 +1,67 @@
+commit 6794fa73e92d63e973b38f97299b4181bdd7ee8b
+Author: Gisle Aas <gisle@aas.no>
+Date:   Thu Nov 8 21:07:33 2012 +0100
+
+    With Net::HTTP 6.04 we don't need our own can_read() and sysread override
+
+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);



>Release-Note:
>Audit-Trail:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201301282158.r0SLwu2s096441>