How to make handlers work for PS & PDF files

John Chambers <[email protected]> Mon, 18 Apr 2005 15:45:18 -0400
Newsgroups gmane.comp.mozilla.devel.macosx
Organization Another Netscape Collabra Server User
Message-ID <[email protected]>
On my Powerbook (10.3.8), with both mozilla and firefox, when I try to get
a PS or PDF file that comes from a CGI program, I almost always get that
popup window saying:

You have chosen to open
[icon] scriptname
with is a: application/ps
from: [URL]
What should Firefox do with this file?

I always have to click the "Choose" button, although  "Do this automatically
for files like this from now on" is checked.

The firefox popup that's visible now does say (in bold) "Settings can be changed
in the Downloads section of Firefox, Preferences."  But this isn't true.  When I
open the Preferences window in FF, there's the "File Types" list that shows the
handlers.  It has "Change Action...", "Remove" and "Plug-Ins..." buttons.  There's
nothing at all that lets me add a handler.

The list contains a PDF entry, but no PS entry.  I tried editing the PDF entry,
and it does show the "Open them in this application" item checked, and its
value is "/Applications/Acrobat Reader 5.0".  But FF still asks me to chose
the app.  For PS files, there's no PS entry in the list, though there is an EPS
entry.  I can edit that, and it shows that EPS files are to be handled by
"/Applications/Preview.app".  But this doesn't work either.  And even if I
chose Preview by hand for a PS file, no Preview window ever opens.

One thing that I suspect is a problem is that line in the popup window:

[icon] scriptname

This shows the script name, although the script has sent lines like

Content-Disposition: filename.ps
Content-Type: application/ps

The Content-Type field is recognized by mozilla and firefox, but the
Content-Disposition field is apparently ignored.  If I tell it to save the
file to disk, they don't ask me for the file name; they save it with the
CGI script's name as the filename.  There's no indication anywhere
that mozilla or firefox sees the Content-Disposition line.

Funny thing is that when I do the same download from mozilla or
firefox on a nearby  linux box, all of this acts like I'd expect.  If I say
to save the file to disk, it ends up with the Content-Disposition name.
I can also use the linux version of the Preferences window to set up
a handler for PS and PDF files, the handlers' names appear in the
popup window, the handler starts ok and displays the file's contents.

But no amount of frobbing the Preferences on OSX seems to have any
effect at all on either browser's behavior.  The only way I've found to
make it work is to let the browser save the file under the CGI name,
find it, change its name to what it should be, and click on that file.

Has anyone successfully done what I'm trying to do here?

BTW, clicking on a plain hyperlink to a PS or PDF file seems to work
fine.  The  problem is only when the file comes from a CGI program on
the server.  The OSX browsers seem to always  use the last field of the
URL as the file name, even when it's a CGI, and when it has no suffix.
Of course, I could be misdiagnosing the problem here.