Skip Menu |

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

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

People
Owner: Nobody in particular
Requestors: YKAR [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in:
  • 5.812
  • 5.813
  • 5.814
  • 5.815
  • 5.816
  • 5.817
  • 5.818
  • 5.819
  • 5.820
Fixed in: (no value)



Subject: redo used incorrectly in LWP::Protocol::http
'redo' statement is used inside 'do' statement: 174 if (!$has_content || $write_wait || $has_content > 8*1024) { 175 do { 176 # Since this just writes out the header block it should almost 177 # always succeed to send the whole buffer in a single write call. 178 my $n = $socket->syswrite($req_buf, length($req_buf)); 179 unless (defined $n) { 180 redo if $!{EINTR}; 181 if ($!{EAGAIN}) { 182 select(undef, undef, undef, 0.1); 183 redo; 184 } 185 die "write failed: $!"; 186 } This redo propogated to higher level loop (for example if $ua->request is used inside loop). Please enclose this construction like described in perlsyn: See "do" in perlfunc. Note also that the loop control statements described later will NOT work in this construct, because modifiers don't take loop labels. Sorry. You can always put another block inside of it (for "next") or around it (for "last") to do that sort of thing. For "next", just double the braces: do {{ next if $x == $y; # do something here }} until $x++ > $z; PS. Probably also broken in 5.811 Thank you in advance!
Thanks. I've now committed the following patch to the repo: commit b29a383e07dcfa80ce023af0c7d26098c0d8eb19 Author: Yuri Karaban <tech@askold.net> Date: Mon Nov 24 20:30:18 2008 +0100 redo used incorrectly in LWP::Protocol::http [RT#41116] diff --git a/lib/LWP/Protocol/http.pm b/lib/LWP/Protocol/http.pm index 8b30f05..4c61755 100644 --- a/lib/LWP/Protocol/http.pm +++ b/lib/LWP/Protocol/http.pm @@ -203,15 +203,16 @@ sub request #print "------\n$req_buf\n------\n"; if (!$has_content || $write_wait || $has_content > 8*1024) { - do { + WRITE: + { # 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 if $!{EINTR}; + redo WRITE if $!{EINTR}; if ($!{EAGAIN}) { select(undef, undef, undef, 0.1); - redo; + redo WRITE; } die "write failed: $!"; } @@ -221,8 +222,8 @@ sub request else { select(undef, undef, undef, 0.5); } + redo WRITE if length $req_buf; } - while (length $req_buf); } my($code, $mess, @junk);