Hrvoje Niksic                                                      
                     
                    <hniksic@arsdigita        To:     Wget List <[EMAIL PROTECTED]>      
                     
                    .com>                     cc:                                      
                     
                    Sent by:                  Subject:     Re: windows, continue bug   
                     
                    [EMAIL PROTECTED]                                                 
                     
                    sdigita.de                                                         
                     
                                                                                       
                     
                                                                                       
                     
                    08/05/01 12:52                                                     
                     
                                                                                       
                     
                                                                                       
                     







> [EMAIL PROTECTED] writes:
>
> > I don't know about Heiko, but I got the sources from the CVS shortly
after
> > he posted his "windows, continue bug" message to the list.
>
> And yet the http.c code you showed looked different from what I
> assumed was the latest version.
>
> > It seems to me that your "fix" doesn't work.
>
> It wasn't supposed to fix the problem you had; it was a minor
> optimization.
>
> In the meantime I believe I found and fixed the real problem; updating
> to the latest CVS sources should fix the problem Heiko was seeing.
>


At least the CVS version I downloaded on 9th of May still has the problem:

wget -c http://some.random.com/              results in
"The file is already fully retrieved, nothing to do." and nothing is
downloaded :-(

I ran it under the debugger, this is what I saw:

In gethttp at http.c(1193), where the code is
     if( hs->restval >= contlen )
     {
          //say fully retrieved and bail with RETRUNNEEDED
     }

hs->restval is 0 and contlen is -1
contlen is -1 because the server didn't bother to send Content-Length :-(

(we got here because contrange was -1 [line 1172] and opt.always_rest was 1
[line 1190] )

Regardless what the comments say, wget didn't send any 'Range' request for
the server to honor.


It seems to me that:
IF the server doesn't send content-range, AND
   opt.always_reset==1 ( wget -c ) AND
   the server doesn't send Content-Length (so contlen==-1)
THEN
   hs->restval (at least 0) will always be >= contlen (-1),
   hence gethttp will abort with RETRUNNEEDED (why does it need a retrun ?
:-)
ENDIF

In other words, wget -c ... on a "lazy" (one that doesn't send
Content-Length) server will NOT download anything. This is not good, the
logic around here is faulty or the values aren't set up correctly.

--
Csaba R�duly, Software Engineer                     Sophos Anti-Virus
email: [EMAIL PROTECTED]                  http://www.sophos.com
US support: +1 888 SOPHOS 9               UK Support: +44 1235 559933


Reply via email to