windows 为什么在 Lighttpd 提供的 IE 中下载某些 PDF 时会挂起

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/420295/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-15 11:47:39  来源:igfitidea点击:

Why do some PDFs hang when downloading in IE when served by Lighttpd

windowsinternet-explorerpdflighttpd

提问by DavidM

We have a number of PDFs hosted using Lighttpd but when they are downloaded in IE (7.0.5730.13), the file download hangs at the end and does not complete. For example

我们有许多使用 Lighttpd 托管的 PDF,但是当它们在 IE (7.0.5730.13) 中下载时,文件下载在最后挂起并且没有完成。例如

http://static.vouchercodes.co.uk/printable/87-burger-king-voucher.pdf

http://static.vouchercodes.co.uk/printable/87-burger-king-voucher.pdf

http://static.vouchercodes.co.uk/printable/10-gbk.pdf

http://static.vouchercodes.co.uk/printable/10-gbk.pdf

This works fine in Firefox (3.0.5) both on OSX 10.5 and Windows XP but not on IE 7.

这在 OSX 10.5 和 Windows XP 上的 Firefox (3.0.5) 中都可以正常工作,但不适用于 IE 7。

A screenshot of the hung download can be seen at http://www.mytton.net/so-pdf-q.png

可以在http://www.mytton.net/so-pdf-q.png看到挂起下载的屏幕截图

This is not localised to one machine and has been replicated on other IE7 Windows PCs. The problem affects only the PDFs on the vouchercodes.co.uk site as other sites with PDFs work fine.

这不是本地化到一台机器,而是在其他 IE7 Windows PC 上复制。该问题仅影响 Vouchercodes.co.uk 站点上的 PDF,因为其他带有 PDF 的站点工作正常。

It has also been replicated with other versions of IE7/IE6 but not consistently.

它也被其他版本的 IE7/IE6 复制,但不一致。

回答by WiseTechi

I believe this is a progressive download issue of the acrobat plugin under IE.

相信这是IE下acrobat插件的渐进式下载问题。

Your lighttpd server is answering a HTTP/1.1 206 Partial Contentwhich sometimes leads to a strange stalling of the downloading progress within the acrobat client

您的 lighttpd 服务器正在回答 a HTTP/1.1 206 Partial Content,这有时会导致 acrobat 客户端中的下载进度出现奇怪的停顿

Some leads to workaround the issue :

一些导致解决此问题的方法:

  • Do not use the "Save As Optimised for Fast Web View" option when creating the pdf file
  • Uncheck the "Allow Background Download of Entire File" preferences of the Acrobat Reader
  • Disable byteserving capacity of the server (but this is obviously not recommended)
  • 创建 pdf 文件时不要使用“另存为优化快速 Web 查看”选项
  • 取消选中 Acrobat Reader 的“允许后台下载整个文件”首选项
  • 禁用服务器的字节服务能力(但显然不推荐这样做)

回答by DavidM

The problem is related to byteserving. See the Byteserving section of http://httpd.apache.org/docs/1.3/misc/known_client_problems.html

问题与字节服务有关。请参阅http://httpd.apache.org/docs/1.3/misc/known_client_problems.html的 Byteserving 部分

The Adobe Acrobat Reader plugin makes extensive use of byteranges and prior to version 3.01 supports only the multipart/x-byterange response. Unfortunately there is no clue that it is the plugin making the request. If the plugin is used with Navigator, the above workaround works fine. But if the plugin is used with MSIE 3 (on Windows) the workaround won't work because MSIE 3 doesn't give the Range-Request clue that Navigator does. To workaround this, Apache special cases "MSIE 3" in the User-Agent and serves multipart/x-byteranges. Note that the necessity for this with MSIE 3 is actually due to the Acrobat plugin, not due to the browser.

Adobe Acrobat Reader 插件广泛使用字节范围,并且在 3.01 版之前仅支持 multipart/x-byterange 响应。不幸的是,没有线索表明它是发出请求的插件。如果该插件与 Navigator 一起使用,则上述解决方法可以正常工作。但是,如果该插件与 MSIE 3(在 Windows 上)一起使用,则变通方法将不起作用,因为 MSIE 3 没有像 Navigator 那样提供 Range-Request 线索。为了解决这个问题,Apache 在 User-Agent 中使用了特殊情况“MSIE 3”并提供 multipart/x-byteranges。请注意,MSIE 3 的必要性实际上是由于 Acrobat 插件,而不是浏览器。

This is also an issue in Lighttpd and is documented at http://redmine.lighttpd.net/issues/show/171with a workaround (tested and works) at note 8.

这也是 Lighttpd 中的一个问题,并在http://redmine.lighttpd.net/issues/show/171 中进行了记录,并在注释 8 中提供了解决方法(已测试并有效)。