我正在使用Apache服务器,它正在发送Content-Length = 0值,这是防止文件下载,请参阅http://www.youtubedroid.com/download2.php?v=_3XcMEKNws0&title=Akhila+%2CMumbai+reloaded%2CSuper+舞者+ 2&hq = 0 ,这里是我的.htaccess内容:
SetEnv no-gzip dont-vary
这里是服务器发送的头文件:
HTTP/1.1 200 OK Date: Tue, 15 Dec 2009 06:12:11 GMT Server: Apache/2.2.14 (Unix) mod_ssl/2.2.14 OpenSSL/0.9.8e-fips-rhel5 mod_bwlimited/1.4 X-Powered-By: PHP/5.2.11 Content-Description: File Transfer Content-Disposition: attachment; filename="Akhila ,Mumbai reloaded,Super dancer 2.mp3" Content-Transfer-Encoding: binary Expires: 0 Cache-Control: must-revalidate, post-check=0, pre-check=0 Pragma: public X-Sendfile: ./tmp/64eb3b185e38af95c15405ffb0606e76.mp3 Content-Length: 0 Keep-Alive: timeout=5, max=95 Connection: Keep-Alive Content-Type: application/octet-stream
PLS。 告诉如何解决这个问题?
X-Sendfile头文件不会被apache发送,所以你可能没有在该虚拟主机中启用xsendfile。 当启用XSendFile时,apache将删除X-SendFile标题并将发送该文件。
RFC说
如果这两个长度不同(即,如果存在Transfer-Encoding头部字段),则不应发送Content-Length头部字段。 如果同时收到一个Transfer-Encoding头域和一个Content-Length头域,则后者必须被忽略。
所以它看起来像你的服务器正在为这个特定的请求正常工作。 这意味着修正是在标题中发送正确的文件长度,而不是发送Content-Transfer-Encoding标头,如果你有控制应用程序发送的级别。