alvaro at octality
Jul 12, 2011, 2:22 AM
Post #2 of 2
Re: X-Sendfile downloads get truncated sometimes (possibly IE only)
[In reply to]
On Wed, Jun 29, 2011 at 12:22 PM, Ringo Hartmann <r.hartmann [at] wabnitz>wrote:
> After switching to X-Sendfile, everything looked good. However, we
> received notice that some downloads are still being truncated every once
> in a while. We have not been able to pinpoint the cause yet, but we have
> only seen it happen with IE 8 (other versions could be affected too).
> file.php produces 4 headers:
> Content-Type: application/force-download
> Content-Length: filesize($filepath)
> Content-Disposition: attachment; filename="$filename"
> X-Sendfile: $filepath
> Sniffing the traffic between pound and cherokee revealed that
> Content-Length is NOT being sent out by cherokee. Thus, the
> client/browser does NOT know about the total filesize and cannot even
> detect if the file was completely transferred or not.
Well, that depends on the complete response header. If it replied using
HTTP/1.0 or a "Connection: close" entry it'd be fine to skip the
I'm logging a bug report for this <http://bugs.cherokee-project.com/1228>,
so we ensure it's checked out properly. Please, do not hesitate to add any
information about the issue (the complete response, for instance).
Why are downloads truncated sometimes?
Probably because of a bug, either in Cherokee, Pounce or IE8.
> Why does cherokee not send Content-Length although it is explicitly
> given by the PHP backend?
Most likely because the response will be GZip'ed, so the Content-Length you
sent is not longer valid.
> Why are access logs reporting differing sizes for the same file?
Because of a bug we fixed already in the latest versions. The temporal
buffers used for the compression changed its size from one request to the
next, so the compression was not always the same.