[patch] Negative Content-Length
Dominic Mitchell <[email protected]>
| Newsgroups | gmane.comp.lang.perl.modules.lwp |
|---|---|
| Organization | semantico |
| Message-ID | <[email protected]> |
I've got a problem with an Apache server serving up files with a negative Content-Length header (because the file is over 2Gb). Unfortunately, it causes LWP to not download the file at all. I'd like to propose this small change to be allow :read_size_hint to be used if the Content-Length is negative. It seems to be sensible to me as a way of allowing the problem to be worked around. Does the patch look reasonable? -Dom
libwww-negative-content-length.patch
(text/plain, 390 B)
--- lib/Net/HTTP/Methods.pm.orig 2005-08-02 17:39:40.775697019 +0100
+++ lib/Net/HTTP/Methods.pm 2005-08-02 17:26:35.000000000 +0100
@@ -479,7 +479,7 @@
return 0;
}
my $n = $bytes;
- $n = $size if $size && $size < $n;
+ $n = $size if $size && ($n < 0 || $size < $n);
$n = my_read($self, $$buf_ref, $n);
return undef unless defined $n;
${*$self}{'http_bytes'} = $bytes - $n;