Skip Menu |
 

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

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

People
Owner: Nobody in particular
Requestors: njh [...] bandsman.co.uk
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: 5.836
Fixed in: (no value)



Subject: Fails on systems which must use send/recv not write/read
Download (untitled) / with headers
text/plain 3.3k
On systems (such as BeOS) where you must use the socket calls recv() and send() because read() and write() only work on files, LWP sends its data to filedescriptors such as the console rather than the socket. A fix for http.pm is (no doubt other protocols need fixing as well): *** Ohttp.pm Thu Aug 26 18:46:11 2010 --- http.pm Thu Aug 26 19:52:32 2010 *************** *** 211,217 **** { # Since this just writes out the header block it should almost # always succeed to send the whole buffer in a single write call. ! my $n = $socket->syswrite($req_buf, length($req_buf)); unless (defined $n) { redo WRITE if $!{EINTR}; if ($!{EAGAIN}) { --- 211,222 ---- { # Since this just writes out the header block it should almost # always succeed to send the whole buffer in a single write call. ! my $n; ! if($^O eq 'beos') { ! $n = send(*$socket, $req_buf, 0); ! } else { ! $n = $socket->syswrite($req_buf, length($req_buf)); ! } unless (defined $n) { redo WRITE if $!{EINTR}; if ($!{EAGAIN}) { *************** *** 295,301 **** if (defined($rbits) && $rbits =~ /[^\0]/) { # readable my $buf = $socket->_rbuf; ! my $n = $socket->sysread($buf, 1024, length($buf)); unless (defined $n) { die "read failed: $!" unless $!{EINTR} || $!{EAGAIN}; # if we get here the rest of the block will do nothing --- 300,313 ---- if (defined($rbits) && $rbits =~ /[^\0]/) { # readable my $buf = $socket->_rbuf; ! my $n; ! if($^O eq 'beos') { ! # No check of offset - let's hope it all goes ! recv(*$socket, $buf, 1024, 0); ! $n = length($buf); ! } else { ! $n = $socket->sysread($buf, 1024, length($buf)); ! } unless (defined $n) { die "read failed: $!" unless $!{EINTR} || $!{EAGAIN}; # if we get here the rest of the block will do nothing *************** *** 325,331 **** } } if (defined($wbits) && $wbits =~ /[^\0]/) { ! my $n = $socket->syswrite($$wbuf, length($$wbuf), $woffset); unless (defined $n) { die "write failed: $!" unless $!{EINTR} || $!{EAGAIN}; $n = 0; # will retry write on the next round --- 337,350 ---- } } if (defined($wbits) && $wbits =~ /[^\0]/) { ! my $n; ! if($^O eq 'beos') { ! # No check of offset - let's hope it all goes ! send(*$socket, $$wbuf, 0); ! $n = length($$wbuf); ! } else { ! $n = $socket->syswrite($$wbuf, length($$wbuf), $woffset); ! } unless (defined $n) { die "write failed: $!" unless $!{EINTR} || $!{EAGAIN}; $n = 0; # will retry write on the next round *************** *** 430,436 **** # use select to wait for some data to arrive $self->can_read(undef) || die "Assert"; } ! sysread($self, $_[0], $_[1], $_[2] || 0); } sub can_read { --- 449,460 ---- # use select to wait for some data to arrive $self->can_read(undef) || die "Assert"; } ! if($^O eq 'beos') { ! my $n = recv(*$self, $_[0], $_[1] || 0, 0); ! length($_[0]); ! } else { ! sysread($self, $_[0], $_[1], $_[2] || 0); ! } } sub can_read {


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.