Skip Menu |
 

This queue is for tickets about the libwww-perl CPAN distribution.

Report information
The Basics
Id: 1689
Status: resolved
Priority: 0/
Queue: libwww-perl

People
Owner: Nobody in particular
Requestors: dws [...] postcognitive.com
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 5.61
Fixed in: (no value)

Attachments


Subject: Misplaced local(*F) in HTTP::Daemon::send_file()
Download (untitled) / with headers
text/plain 495b
If you pass a filename to HTTP::Daemon::send_file() (instead of going through HTTP::Daemon::send_file_response(), which passes a reference to a typeglob), *F is localized improperly, and becomes unlocalized prematurely, causing sysread() to fail. The result is that no bytes are sent back down the socket. The workaround (attached) is to move "local(*F)" up a few lines. I'm running ActiveState 5.6.1, libwww-perl 5.51 (HTTP::Daemon.pm v 1.24, though that area of code is unchanged in 1.25).
Download Daemon.pm.diff
text/x-diff 514b
*** Daemon.pm Fri Oct 18 02:42:01 2002 --- Daemon.pm.fix Fri Oct 18 02:42:52 2002 *************** *** 768,776 **** sub send_file { my($self, $file) = @_; my $opened = 0; if (!ref($file)) { - local(*F); open(F, $file) || return undef; binmode(F); $file = \*F; --- 768,776 ---- sub send_file { my($self, $file) = @_; + local(*F); my $opened = 0; if (!ref($file)) { open(F, $file) || return undef; binmode(F); $file = \*F;
Date: Fri, 18 Oct 2002 13:14:50 -0700
To: bug-libwww-perl [...] rt.cpan.org
From: "Dave W. Smith" <dws [...] postcognitive.com>
Subject: Re: [cpan #1689] AutoReply: Misplaced local(*F) in HTTP::Daemon::send_file()
RT-Send-Cc:
Please retract the patch I submitted. It fixes the problem I was having, at the expense of breaking send_file_response(). The following patch repairs send_file() in a way that doesn't break send_file_response() My apologies for the first patch. *** Daemon.pm Fri Oct 18 02:42:01 2002 --- Daemon.pm.fix Fri Oct 18 16:05:01 2002 *************** *** 768,779 **** sub send_file { my($self, $file) = @_; my $opened = 0; if (!ref($file)) { ! local(*F); ! open(F, $file) || return undef; ! binmode(F); ! $file = \*F; $opened++; } my $cnt = 0; --- 768,779 ---- sub send_file { my($self, $file) = @_; + local(*FILE); my $opened = 0; if (!ref($file)) { ! open(FILE, $file) || return undef; ! binmode(FILE); ! $file = \*FILE; $opened++; } my $cnt = 0; At 03:18 10/18/02 -0400, you wrote: Show quoted text
> Greetings, > This message has been automatically generated in response to your > bug report about libwww-perl, a summary of which appears below. > >There is no need to reply to this message right now. Your bug in >libwww-perl has been assigned an ID of [cpan #1689]. Please include the string: > > [cpan #1689] > >in the subject line of all future correspondence about this issue. To do so, >you may reply to this message. > > Thank you, > bug-libwww-perl@rt.cpan.org > >------------------------------------------------------------------------- >If you pass a filename to HTTP::Daemon::send_file() (instead of going >through HTTP::Daemon::send_file_response(), which passes a reference to a >typeglob), *F is localized improperly, and becomes unlocalized >prematurely, causing sysread() to fail. The result is that no bytes are >sent back down the socket. > >The workaround (attached) is to move "local(*F)" up a few lines. > >I'm running ActiveState 5.6.1, libwww-perl 5.51 (HTTP::Daemon.pm v 1.24, >though that area of code is unchanged in 1.25).


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.