-
Notifications
You must be signed in to change notification settings - Fork 104
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PHP, X-Sendfile and Content-Length #846
Comments
From rng.hart...@gmail.com on July 12, 2011 11:37:18 GET /file.php?file=complete_filename HTTP/1.1 HTTP/1.1 200 OK The complete_filename indeed does not have an extension as it is an encrypted/binary file. |
From daniel@d15.biz on October 13, 2011 05:50:18 As a workaround, perhaps add a separate behaviour rule for /file.php to forbid GZip. I didn't test this, but it should keep GZip enabled for all other pages, and only disable it for file.php |
The following is actually the problem here. In a few occasions content-length should not be set by the handler. https://github.com/cherokee/webserver/blob/master/cherokee/handler_cgi_base.c#L1083 An example is when we are using gzip, because with gzip enabled the content-length (should become) shorter than without. https://github.com/cherokee/webserver/blob/master/cherokee/connection.c#L1413 I envision the following solution here: X-Sendfile takes priority over content encoding. In some sense thing will result in the fact that X-Sendfile based replies are not encoded. My guess is that if you know what you are doing, and use X-Sendfile, you don't want your webserver to smartass on what you are sending. |
Original author: alobbs (July 12, 2011 09:15:15)
http://lists.octality.com/pipermail/cherokee/2011-June/014903.html
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.
Also, the transfer is gzipped (Content-Encoding: gzip) and cherokees
access.log reports differing sizes for the same file. Could that have to
do with gzip?
Original issue: http://code.google.com/p/cherokee/issues/detail?id=1228
The text was updated successfully, but these errors were encountered: