Thanks!  That patch does work for the test case I created locally.

I worry that some page might send a different code in a situation where 
a browser might try to get partial content.  For instance, some sites 
have large, complicated 404 pages.  Or even worse:
http://xrotwang.wordpress.com/2007/09/03/i-didnt-expect-openaccess-but/

But it looks like WGet ignores any content after 404s, and I don't know 
of anything else except Polipo that might request partial content.  So I 
guess it should work in general.

Thanks again!

Ken

Juliusz Chroboczek wrote:
>> I ran into another Polipo bug the other day, again using wget -c.  I was 
>> trying to continue a download that got cut off by the known 
>> uncachable/truncate bug.  The file was on one of those free file storage 
>> sites, so when trying to get it, it sends a 302 Found response with a 
>> Location: for the actual file.  This has worked before without Polipo, 
>> but Polipo-20080907 sent a "416 Requested range not satisfiable" error.
>>     
>
> Yep.  Polipo will honour a range request even for a non-200 instance.
> While that's not strictly forbidden by RFC 2616 (if it is, I cannot find
> where), but I think it might be a good idea to avoid doing so.
>
> I've just committed the attached patch, please tell me if it solves your
> problem.
>
>   
>> For now, I added an if at the beginning of the httpServeObject function 
>> to set request->from = 0 if object->code is a redirect:
>>
>> if(request->from > 0 && object->code > 300 && (object->code < 304 || 
>> object->code == 307)) {
>>     request->from = i = j = 0;
>> }
>>     
>
> That's the right approach, but the wrong place to do so.  See the attached
> patch.
>
>   
>> I also tried extending the if for anything but a 206 Partial content; 
>> but for some reason object->code was 200 for partial content.
>>     
>
> Yep.  Polipo caches instances, not entities.  So we need to distinguish the
> code of an instance (200 in this case) from the code of an entity (206).
>
>                                         Juliusz
>
> Thu Dec  4 22:57:05 CET 2008  Juliusz Chroboczek <[EMAIL PROTECTED]>
>   * Don't honour range requests for non-200 instances.
> diff -rN -u old-polipo/client.c new-polipo/client.c
> --- old-polipo/client.c 2008-12-04 22:57:28.000000000 +0100
> +++ new-polipo/client.c 2008-12-04 22:57:28.000000000 +0100
> @@ -1148,6 +1148,13 @@
>      objectFillFromDisk(object, request->from,
>                         request->method == METHOD_HEAD ? 0 : 1);
>  
> +    /* The spec doesn't strictly forbid 206 for non-200 instances, but doing
> +       that breaks some client software. */
> +    if(object->code && object->code != 200) {
> +        request->from = 0;
> +        request->to = -1;
> +    }
> +
>      if(request->condition && request->condition->ifrange) {
>          if(!object->etag || 
>             strcmp(object->etag, request->condition->ifrange) != 0) {
>
>   

------------------------------------------------------------------------------
SF.Net email is Sponsored by MIX09, March 18-20, 2009 in Las Vegas, Nevada.
The future of the web can't happen without you.  Join us at MIX09 to help
pave the way to the Next Web now. Learn more and register at
http://ad.doubleclick.net/clk;208669438;13503038;i?http://2009.visitmix.com/
_______________________________________________
Polipo-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/polipo-users

Reply via email to