Edgewall Software

Ticket #1020 (closed defect: fixed)

Opened 4 years ago

Last modified 2 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@…

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

  Changed 4 years ago by anonymous

  • cc trac@… added

Has anyone had a chance to look into this bug?

  Changed 4 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.

  Changed 4 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.

  Changed 4 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

  Changed 4 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.

  Changed 4 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 :(

  Changed 4 years ago by pkou at ua.fm

Also, the problem is described in Microsoft knowledge base, issue KB316431.

  Changed 4 years ago by cmlenz

  • status changed from new to closed
  • resolution set to fixed
  • milestone set to 0.8.1

Should be fixed in [1248], ported to stable in [1249].

  Changed 4 years ago by oohlaf@…

  • cc oohlaf@… added
  • status changed from closed to reopened
  • version changed from 0.8 to 0.8.1
  • resolution fixed deleted

I just ran into this problem again using trac 0.8.1 from Debian and serving PDF files over SSL.

The backport fix in changeset [1249] forgot to remove the pragma: nocache statement (as [1248] also does).

  Changed 4 years ago by anonymous

  • status changed from reopened to closed
  • resolution set to fixed
  • severity changed from normal to minor

  Changed 4 years ago by cmlenz

  • status changed from closed to reopened
  • severity changed from minor to normal
  • resolution fixed deleted
  • description modified (diff)
  • milestone 0.8.1 deleted

Erm, don't just close a ticket without comment, please.

  Changed 4 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.

  Changed 4 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.

  Changed 4 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.

  Changed 4 years ago by cmlenz

  • owner changed from jonas to cmlenz
  • status changed from reopened to new

follow-up: ↓ 17   Changed 4 years ago by cmlenz

  • status changed from new to closed
  • resolution set to fixed

Fixed in the 0.8-stable branch in [1479].

in reply to: ↑ 16   Changed 2 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

Add/Change #1020 (PDF files (maybe all binary files) are not downloadable using Internet Explorer)

Author



Change Properties
<Author field>
Action
as closed
Next status will be 'reopened'
to The owner will change from cmlenz. Next status will be 'closed'
 
Note: See TracTickets for help on using tickets.