Ticket #1020 (closed defect: fixed)
Opened 7 years ago
Last modified 5 years ago
PDF files (maybe all binary files) are not downloadable using Internet Explorer
| Reported by: | aguilr at alum dot rpi dot edu | Owned by: | cmlenz |
|---|---|---|---|
| Priority: | high | Milestone: | 0.8.2 |
| Component: | general | Version: | 0.8.1 |
| Severity: | normal | Keywords: | |
| Cc: | skolgan@…, oohlaf@… | ||
| Release Notes: | |||
| API Changes: | |||
Description (last modified by cmlenz) (diff)
When trying to download a binary file, PDF in this case, IE will give the following error:
---
Internet Explorer cannot download ...database.pdf?rev=30&format=raw from trac.site.com
Internet Explorer was not able to open this Internet site. The requested site is either unavailable or cannot be found. Please try again later.
---
I've confirmed this works on IE 5.5 and 6 for Windows. I posted this question on the mailing list. Matt Good mentioned it may be:
- IE trying to be smart but really isn't. It may be possible to trick it by adding "&dummy=something.pdf" to the URL.
I tried that but it didn't work
- IE is expecting the PDF file to be transmitted in it's entirety instead of bit's at a time (streamed?).
Is the python code buffering the entire PDF before it transmits it? If not, that may be the solution.
At the moment this is affecting the way we use Trac because we keep files like ERD documents and other resources for our project in PDF format. All our Windows/IE users are unable to access these documents from the Trac site.
Thanks!
Attachments
Change History
comment:1 Changed 7 years ago by anonymous
- Cc trac@… added
comment:2 Changed 7 years ago by jonas
- Cc trac@… removed
I don't have any idea why IE behaves this way. Loading the whole (potentially very large) file into memory before sending it to the browser doesn't sound like something you want your webserver to do. There must be a better way to fix this.
Please don't cc the trac-list directly. Ticket notifications can generate a bit too much traffic. Send an ordinary mail instead, I'm sure someone on the list knows a better way around this IE bug.
comment:3 Changed 7 years ago by anonymous
In the past I had a website I mantained showing a similar problem with PDFs. In the end we found that the website in IIS was set to have content expiration set to immediately. Once this was removed, download of PDFs worked fine.
comment:4 Changed 7 years ago by zoltan.podlovics@…
- Summary changed from PDF files (maybe all binary files) are not downloadable using Internet Explorer to It's a well known IE & Acrobat Reader bug
It's a well known IE & Acrobat Reader bug. IE will create a temporary file when you try to view or download a PDF file,
but before Acrobat Reader takes control IE will _delete_ this
file.
Here is the workaround:
(you must have these HTTP headers for IE & Acrobat Reader)
Pragma: no-cache Cache-control: private Content-type: application/pdf Content-length: size_in_bytes
Or alternatively you can force the Content-type to application/octet-stream to prevent loading Acrobat
Reader.
Regards,
Zoltan
comment:5 Changed 7 years ago by zoltan.podlovics@…
- Summary changed from It's a well known IE & Acrobat Reader bug to PDF files (maybe all binary files) are not downloadable using Internet Explorer
Summary changed back to the original.
comment:6 Changed 7 years ago by skolgan@…
- Cc skolgan@… added
It's also showing up when downloading a .zip files that are in SVN repo... changing svn:mime-type to application/octet-stream doesn't help either :(
comment:7 Changed 7 years ago by pkou at ua.fm
Also, the problem is described in Microsoft knowledge base, issue KB316431.
comment:8 Changed 7 years ago by cmlenz
- Milestone set to 0.8.1
- Resolution set to fixed
- Status changed from new to closed
comment:9 Changed 7 years ago by oohlaf@…
- Cc oohlaf@… added
- Resolution fixed deleted
- Status changed from closed to reopened
- Version changed from 0.8 to 0.8.1
comment:10 Changed 7 years ago by anonymous
- Resolution set to fixed
- Severity changed from normal to minor
- Status changed from reopened to closed
comment:11 Changed 7 years ago by cmlenz
- Description modified (diff)
- Milestone 0.8.1 deleted
- Resolution fixed deleted
- Severity changed from minor to normal
- Status changed from closed to reopened
Erm, don't just close a ticket without comment, please.
comment:12 Changed 7 years ago by oohlaf@…
To clarify:
While I understand that the problem is fixed in the development version, it might be useful information in case it is decided to do another bugfix release 0.8.2.
As I only use the released versions, and not development snapshots. So in the meantime I commented the line out in File.py.
comment:13 Changed 7 years ago by cmlenz
- Milestone set to 0.8.2
Understood. We haven't yet decided (or even discussed) whether there will be another minor release of the 0.8 branch, but this ticket would be a candidate for inclusion.
comment:14 Changed 7 years ago by anonymous
Its all files and only an SSL problem. To manually fix it you can edit:
File.py and comment out the lines as shown below:
# self.req.send_header('Pragma', 'no-cache')
self.req.send_header('Expires', 'Mon, 26 Jul 1997 05:00:00 GMT')
# self.req.send_header('Cache-Control',
# 'no-store, no-cache, must-revalidate, max-age=0')
# self.req.send_header('Cache-Control', 'post-check=0, pre-check=0')
self.req.end_headers()
Then you use the py_compile script to compile the byte-code object files and trac should be fixed. A little annoying but not too bad.
comment:15 Changed 7 years ago by cmlenz
- Owner changed from jonas to cmlenz
- Status changed from reopened to new
comment:16 follow-up: ↓ 17 Changed 7 years ago by cmlenz
- Resolution set to fixed
- Status changed from new to closed
Fixed in the 0.8-stable branch in [1479].
comment:17 in reply to: ↑ 16 Changed 5 years ago by edgewall @…
Greetings,
Many thanks for this artical - it helped me to get to my solution. In my case, I'm running Apache and serving a dynamically generated PDF file that downloads fine in all popular browsers but IE. My working solution was to add the following lines prior to my other header outputs:
/
- The following Pragma and Cache-Control lines are necessary
- as the overcome an issue that IE has in some server configurations
- when the no-cach header is sent. The two lines override these
- headers, allowing IE to proceed. When not turned on, the error IE
- provides is:
- Internet Explorer cannot download <item URL here instead of item file name> from <domain>.
- Internet Explorer was not able to open this Internet site. The requested site is either
- unavailable or cannot be found. Please try again later. */
header("Pragma: public");
header("Cache-Control: max-age=0");
Sean P. O. MacCath?-Moran
www.emanaton.com



Has anyone had a chance to look into this bug?