Closed Bug 318199 Opened 19 years ago Closed 19 years ago

dmg files don't download in Safari Version 2.0.2 (416.13)

Categories

(mozilla.org :: FTP: Mirrors, task)

PowerPC
macOS
task
Not set
major

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: joe, Unassigned)

References

()

Details

Attachments

(2 files)

Using Safari Version 2.0.2 (416.13) (Mac OS X 10.4.3), when I click on "Download Firefox" from mozilla.com, I just get binary data in my browser window. Downloading dmg files from anywhere else properly sets it up to download. Even when I do manually try downloading, the file is automatically named Firefox 1.5.dmg.html. I suspect MIME type troubles, although I wasn't able to verify anything by using telnet and HTTP HEAD commands.
Retrieving firefox/releases/1.5/mac/en-US/Firefox%201.5.dmg Target MIME Type: application/octet-stream Mirror name size date mime-type ftp.chg.ru 9898515 Mon, 28 Nov 2005 22:40:17 GMT application/octet-stream mozilla.isc.org 9898515 Mon, 28 Nov 2005 22:40:17 GMT application/octet-stream mozilla.cs.utah.edu 9898515 Mon, 28 Nov 2005 22:40:17 GMT application/octet-stream ftp.scarlet.be 9898515 Mon, 28 Nov 2005 22:40:17 GMT application/octet-stream sunsite.rediris.es 9898515 Mon, 28 Nov 2005 22:40:17 GMT application/octet-stream www.artfiles.org 9898515 Mon, 28 Nov 2005 22:40:17 GMT application/octet-stream mirror.switch.ch 9898515 Mon, 28 Nov 2005 22:40:17 GMT application/octet-stream 130.239.18.173 9898515 Mon, 28 Nov 2005 22:40:17 GMT application/octet-stream ftp.rz.tu-bs.de 9898515 Mon, 28 Nov 2005 22:40:17 GMT application/x-apple-diskimage www.mirrorservice.org 9898515 Mon, 28 Nov 2005 22:40:17 GMT application/x-apple-diskimage mirror.mcs.anl.gov 9898515 Mon, 28 Nov 2005 22:40:17 GMT application/octet-stream mozilla.mirrors.tds.net 9898515 Mon, 28 Nov 2005 22:40:17 GMT application/octet-stream ftp-mozilla.netscape.com 9898515 Mon, 28 Nov 2005 22:40:17 GMT application/octet-stream mozilla.mirrors.easynews.com 9898515 Mon, 28 Nov 2005 22:40:17 GMT application/octet-stream www.portal-to-web.de 0 text/html --> http://www.portal-to-web.de/pub/mozilla/firefox/releases/1.5/mac/en-US/Firefox%201.5.dmg HTTP/1.1 404 Not Found Date: Wed, 30 Nov 2005 01:24:58 GMT Server: Apache/2 Content-Type: text/html; charset=iso-8859-1 <<---<< ftp.rz.tu-bs.de 9898515 Mon, 28 Nov 2005 22:40:17 GMT application/x-apple-diskimage 130.239.18.137 9898515 Mon, 28 Nov 2005 22:40:17 GMT application/octet-stream 130.239.18.142 9898515 Mon, 28 Nov 2005 22:40:17 GMT application/octet-stream 130.239.18.165 9898515 Mon, 28 Nov 2005 22:40:17 GMT application/octet-stream mozilla.arcticnetwork.ca 0 text/html --> http://mozilla.arcticnetwork.ca/firefox/releases/1.5/mac/en-US/Firefox%201.5.dmg HTTP/1.1 404 Not Found Date: Wed, 30 Nov 2005 01:25:01 GMT Server: Apache/2.0.54 (FreeBSD) PHP/4.3.11 Content-Type: text/html; charset=iso-8859-1 <<---<< archive.progeny.com 9898515 Mon, 28 Nov 2005 22:40:17 GMT application/octet-stream ftp.yi.se 0 text/html --> http://ftp.yi.se/pub/software/mozilla/firefox/releases/1.5/mac/en-US/Firefox%201.5.dmg HTTP/1.1 404 Not Found Date: Wed, 30 Nov 2005 01:28:08 GMT Server: Apache/1.3.33 (Debian GNU/Linux) PHP/4.4.1-0.dotdeb.3 mod_gzip/1.3.26.1a mod_ssl/2.8.24 OpenSSL/0.9.7g Content-Type: text/html; charset=iso-8859-1 <<---<< mozilla.cachefly.net 0 text/html --> http://mozilla.cachefly.net/firefox/releases/1.5/mac/en-US/Firefox%201.5.dmg HTTP/1.1 200 OK Date: Wed, 30 Nov 2005 01:25:05 GMT Content-type: text/html Content-Length: 0 Server: BestHop 2.4.4 <<---<< mozilla.nedmirror.nl 0 text/html --> http://mozilla.nedmirror.nl/firefox/releases/1.5/mac/en-US/Firefox%201.5.dmg HTTP/1.1 404 Not Found Date: Wed, 30 Nov 2005 01:25:08 GMT Server: Apache/1.3.33 (Unix) mod_layout/3.2.1 Content-Type: text/html; charset=iso-8859-1 <<---<< mozilla-chi.osuosl.org 9898515 Mon, 28 Nov 2005 22:40:17 GMT application/octet-stream mozilla-atl.osuosl.org 9898515 Mon, 28 Nov 2005 22:40:17 GMT application/octet-stream mozilla-osl.osuosl.org 9898515 Mon, 28 Nov 2005 22:40:17 GMT application/octet-stream Total servers: 27 application/octet-stream 19 application/x-apple-diskimage 3 text/html 5 ================= This is using the check script that pulls the mirror data for that specific product (Firefox 1.5) and OS (osx) out of bouncer... How come bouncer hasn't pulled the ones that are 404? Joe: also, what's your locale? The above list assumes en-US.
en-US, yes. (Well, potentially en-CA, but I don't think that a) firefox is localized to en-CA and b) it's unlikely Safari's advertising it.)
actually, my test script was busted. It was sending an ftp.mozilla.org host header to all of those servers, and they don't all answer to that domain name. :) Got rid of that, and they all pass with either application/octet-stream or application/x-apple-diskimage Sounds a lot like a Safari bug.
(In reply to comment #3) > Sounds a lot like a Safari bug. Sounds a LOT like a Safari bug. Confirmed that Safari does indeed open it as garbage text in a window if you hit the URL in the following command line. [dave@g4tower misc]$ curl -v -H 'User-Agent: Mozilla/5.0 (Macintosh; U; PPC Mac OS X; sv-se) AppleWebKit/416.11 (KHTML, like Gecko) Safari/416.12' http://130.239.18.137/pub/mozilla.org/firefox/releases/1.5/mac/en-US/Firefox%201.5.dmg * About to connect() to 130.239.18.137 port 80 * Trying 130.239.18.137... * connected * Connected to 130.239.18.137 (130.239.18.137) port 80 > GET /pub/mozilla.org/firefox/releases/1.5/mac/en-US/Firefox%201.5.dmg HTTP/1.1 Host: 130.239.18.137 Pragma: no-cache Accept: */* User-Agent: Mozilla/5.0 (Macintosh; U; PPC Mac OS X; en) AppleWebKit/416.11 (KHTML, like Gecko) Safari/416.12 < HTTP/1.1 200 OK < Date: Wed, 30 Nov 2005 02:24:28 GMT < Server: Apache/2.0.54 (Unix) < Last-Modified: Mon, 28 Nov 2005 22:40:17 GMT < ETag: "4ee69-970a13-c983b640" < Accept-Ranges: bytes < Content-Length: 9898515 < Content-Type: application/octet-stream Sure looks like it's sending the right headers to me.
The relevant two packets from a firefox download.
the relevant two packets from downloading a .dmg of QuickSilver.
From my Firefox download: HTTP/1.1 200 OK\r\n Response Code: 200 Date: Wed, 30 Nov 2005 02:21:55 GMT\r\n Content-type: application/octet-stream\r\n Last-Modified: Mon, 28 Nov 2005 22:40:17 GMT\r\n Content-Length: 9898515\r\n Server: BestHop 2.4.4\r\n \r\n That looks good to me. I have no idea what Safari's problem is.
(In reply to comment #5) > Created an attachment (id=204503) [edit] > firefox download ethereal capture > > The relevant two packets from a firefox download. > HTTP/1.1 200 OK\r\n > Response Code: 200 > Date: Wed, 30 Nov 2005 02:21:55 GMT\r\n > Content-type: application/octet-stream\r\n > Last-Modified: Mon, 28 Nov 2005 22:40:17 GMT\r\n > Content-Length: 9898515\r\n > Server: BestHop 2.4.4\r\n Yep, your trace shows the application/octet-stream type as well. So Safari is ignoring the mime type or something??
http://capricorn.woot.net/~jdrew/dmg/ These are the two dmg files. I've configured both to serve up as application/octet-stream. Firefox displays inline, and Quicksilver downloads. Further, Joe-Drews-Computer:~/Desktop jdrew$ file Firefox\ 1.5.dmg Firefox 1.5.dmg: data Joe-Drews-Computer:~/Desktop jdrew$ file QS-1.3348.dmg QS-1.3348.dmg: bzip2 compressed data, block size = 100k It looks like the Firefox dmg doesn't have the right magic number.
DiskImageMounter has no problem opening it. This has been filed as a Safari bug: http://bugzilla.opendarwin.org/show_bug.cgi?id=5883
Assignee: cshields → nobody
The one thing I've forgotten to mention is that Safari downloads it correctly if Apache 2 is left in its default configuration (at least, its default on my server), which means that it's serving as application/x-apple-diskimage. And yes, regardless of the magic number, it mounts & works correctly.
There is no spec anywhere (outside of someone's blog saying "hey, we should do this") suggesting that application/x-apple-diskimage is the appropriate mime type. The man page for hdid (Apple's command-line utility for dealing with dmg files) says: While it is not directly related to mounting via hdid(1), informing your web server that '.dmg' (and others) are extensions associated with the MIME type application/octet-stream will allow web browsers to down- load the files rather than try to display them. For apache, you add the extensions to the appropriate line in /etc/httpd/mime.types.
Sure, but in a purely pragmatic sense, unless it breaks earlier versions of Safari, it'd be a good idea to get mirrors to set the MIME type to application/x-apple-diskimage (or, I suppose, fix the disk image itself so Safari works properly on it).
If you go read the opendarwin bug that's linked, you'll notice that Safari doesn't really care what the MIME type is; it's content-sniffing, and seems to think our DMG file is an HTML document.
I did, and that's true; but the fact remains that Safari works (see comment 11) if the MIME type is set to application/x-apple-diskimage. Maybe the content sniffing is turned off if it's that mime type (which makes sense).
(In reply to comment #15) > I did, and that's true; but the fact remains that Safari works (see comment 11) > if the MIME type is set to application/x-apple-diskimage. Maybe the content > sniffing is turned off if it's that mime type (which makes sense). It appears the content-sniffing only runs on application/octet-stream. application/* seems to cause a download, whether it's x-apple-diskimage or not, as long as it's not octet-stream (or another internally-recognized type). Neat. I've updated the .htaccess to push x-apple-diskimage and will mail the mirror admins that don't honor it.
http://developer.apple.com/documentation/Cocoa/Reference/Foundation/ObjC_classic/Classes/NSURLResponse.html#//apple_ref/occ/instm/NSURLResponse/MIMEType Apple freely admits that they might do sniffing. Their sniffer is apparently buggy. There's nothing special about application/x-apple-diskimage other than that it's _not_ application/octet-stream, which is the type that seems to trigger NSURL* into doing sniffing. I've verified that a collection of other bogus made-up MIME types also bypass content sniffing. It's a shame that we get the shaft for having done the right thing per comment 12, but at least we've got a workaround.
*** Bug 318333 has been marked as a duplicate of this bug. ***
Since this has been worked around on the mirrors' ends for nearly three months now without incident, I'm resolving this as WFM.
Status: NEW → RESOLVED
Closed: 19 years ago
Resolution: --- → WORKSFORME
I'd rather call it fixed, since we did actually have to do something to work around it. :)
Status: RESOLVED → REOPENED
Resolution: WORKSFORME → ---
Status: REOPENED → RESOLVED
Closed: 19 years ago19 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: