Gisle Aas wrote:
>
> Norton Allen <[EMAIL PROTECTED]> writes:
>
> > If you like, I can make it right throughout.
>
> That would be nice!
OK, this one has all three "short write"s excised. I
have not tested the CODE version, since I don't even
know how it's supposed to work, but all three are
treated identically.
-Norton
*** ../ORIG/libwww-perl-5.53/lib/LWP/Protocol/http.pm Fri Apr 6 22:13:25 2001
--- libwww-perl-5.53/lib/LWP/Protocol/http.pm Tue Aug 7 16:33:32 2001
***************
*** 156,182 ****
my $buf = $request_line . $h->as_string($CRLF) . $CRLF;
my $n; # used for return value from syswrite/sysread
! die "write timeout" if $timeout && !$sel->can_write($timeout);
! $n = $socket->syswrite($buf, length($buf));
! die $! unless defined($n);
! die "short write" unless $n == length($buf);
LWP::Debug::conns($buf);
if ($ctype eq 'CODE') {
while ( ($buf = &$cont_ref()), defined($buf) && length($buf)) {
! die "write timeout" if $timeout && !$sel->can_write($timeout);
! $n = $socket->syswrite($buf, length($buf));
! die $! unless defined($n);
! die "short write" unless $n == length($buf);
LWP::Debug::conns($buf);
}
}
elsif (defined($$cont_ref) && length($$cont_ref)) {
! die "write timeout" if $timeout && !$sel->can_write($timeout);
! $n = $socket->syswrite($$cont_ref, length($$cont_ref));
! die $! unless defined($n);
! die "short write" unless $n == length($$cont_ref);
LWP::Debug::conns($buf);
}
--- 156,194 ----
my $buf = $request_line . $h->as_string($CRLF) . $CRLF;
my $n; # used for return value from syswrite/sysread
+ my $length = length($buf);
+ my $offset = 0;
! while ( $offset < $length ) {
! die "write timeout" if $timeout && !$sel->can_write($timeout);
! $n = $socket->syswrite($buf, $length-$offset, $offset );
! die $! unless defined($n);
! $offset += $n;
! }
LWP::Debug::conns($buf);
if ($ctype eq 'CODE') {
while ( ($buf = &$cont_ref()), defined($buf) && length($buf)) {
! $length = length($buf);
! $offset = 0;
! while ( $offset < $length ) {
! die "write timeout" if $timeout && !$sel->can_write($timeout);
! $n = $socket->syswrite($buf, $length-$offset, $offset );
! die $! unless defined($n);
! $offset += $n;
! }
LWP::Debug::conns($buf);
}
}
elsif (defined($$cont_ref) && length($$cont_ref)) {
! $length = length($$cont_ref);
! $offset = 0;
! while ( $offset < $length ) {
! die "write timeout" if $timeout && !$sel->can_write($timeout);
! $n = $socket->syswrite($$cont_ref, $length-$offset, $offset );
! die $! unless defined($n);
! $offset += $n;
! }
LWP::Debug::conns($buf);
}