Log inRegister an accountBrowse CSDbHelp & documentationFacts & StatisticsThe forumsAvailable RSS-feeds on CSDbSupport CSDb Commodore 64 Scene Database
You are not logged in - nap
CSDb User Forums


Forums > CSDb Feedback > Content types and Firefox
2010-03-25 22:01
MagerValp

Registered: Dec 2001
Posts: 1065
Content types and Firefox

Firefox recently got stricter about Content-Type:s, so it's no longer to automatically launch x64 or The Unarchiver from downloads on CSDB. Everything is sent out as application/octet-stream, and saving is the only option. Is there any chance we could get proper Content-Type:s for zip files, d64s, etc?
2010-03-25 22:34
Perff
Administrator

Posts: 1673
Hm. Might be something to spend some time on.
But it must be done right, and tested in several browsers as there have been some issues with this before.
Anyone with some experience on this field? Also how to detect the correct content-type in php. (I bet there is a better way than checking the filename? :) )
2010-03-25 22:59
chatGPZ

Registered: Dec 2001
Posts: 11293
i can view/open files directly fine, in firefox and in opera... what am i doing wrong? =P
2010-03-26 07:57
Jetboy

Registered: Jul 2006
Posts: 269
Works for me too.
MagerValp maybe you have something messed up with file associations on your system?

------
http://colors.collectingsmiles.com
2010-03-26 11:08
Skate

Registered: Jul 2003
Posts: 494
@perff: as of php v5.3.0, Fileinfo function comes built-in. Try the code below.

$filename = "path/filename.extension";
$finfo = finfo_open(FILEINFO_MIME_TYPE);
echo finfo_file($finfo, $filename);
finfo_close($finfo);
2010-03-26 12:09
chatGPZ

Registered: Dec 2001
Posts: 11293
and btw, the proper content type for d64 _is_ "application/octet-stream" =)
2010-03-26 12:58
Burglar

Registered: Dec 2004
Posts: 1069
Quoting Groepaz
and btw, the proper content type for d64 _is_ "application/octet-stream" =)

"application/octet-stream" is just the default type of everything binary. as it doesn't define anything, newer browsers will not auto-open it (like firefox).

application/x-d64 will work perfectly fine instead, and application/x-prg too.

and for zip, use application/zip
2010-03-26 13:06
chatGPZ

Registered: Dec 2001
Posts: 11293
defining content types that the OS (or the browser) doesnt know about is really pointless though.
2010-03-26 13:15
Burglar

Registered: Dec 2004
Posts: 1069
which is why you tell your browser to use x64 to open those types.

really, using application/octet-stream is telling the browser "you can not render this, just save the thing on disk"
2010-03-26 13:18
Burglar

Registered: Dec 2004
Posts: 1069
http://filext.com/file-extension/D64
2010-03-26 13:23
chatGPZ

Registered: Dec 2001
Posts: 11293
Quote:
which is why you tell your browser to use x64 to open those types.

thats pretty much what i did ... unless people start using whatever fucked up file extension, where is the problem? :)
2010-03-26 13:27
Burglar

Registered: Dec 2004
Posts: 1069
Quoting Groepaz
Quote:
which is why you tell your browser to use x64 to open those types.

thats pretty much what i did ... unless people start using whatever fucked up file extension, where is the problem? :)

cause the "new" (its far from new) type application/x-d64 will work for everybody and application/octet-stream does not.
2010-03-26 13:46
chatGPZ

Registered: Dec 2001
Posts: 11293
whatever.... now go and fix that damned file listing =D
2010-03-26 14:06
Burglar

Registered: Dec 2004
Posts: 1069
only if you get Perff to fix the mimetypes on here ;)

hah!
2010-03-26 14:33
chatGPZ

Registered: Dec 2001
Posts: 11293
PEEEEEEEEEERFFFFFF HELP!!!!!!!!!!!!! THIS IS URGENT !!!!!!!!!!!!!

=D
2010-03-26 17:57
MagerValp

Registered: Dec 2001
Posts: 1065
Quote: i can view/open files directly fine, in firefox and in opera... what am i doing wrong? =P

And you're using FF3.6, not 3.5?

URL:s with Content-Type: application/octet-stream and Content-Disposition: attachment are *supposed* to force a save dialog...

As for CSDB, a few application/x-foo based on the file extension for the common C64 file types should suffice, and finfo_file() will mop up the rest.

d64: application/x-d64 (and d71, d81, etc)
prg: application/x-prg
sid: audio/prs.sid (IANA registered! :)
...and what else? Do we have VICE snapshots?

I guess the only tricky bit is how to handle .gz - as Content-encoding: gzip, or as application/x-gzip?
2010-03-26 21:03
Burglar

Registered: Dec 2004
Posts: 1069
yay, another one with a clue ;)

gzip is no question, its application/x-gzip. you use content-encoding: gzip (or deflate) for compression on text/html and such.
so, perff will see dramatic performance increase if he starts using mod_deflate or mod_gzip.

but anyway, hope its clear now
2010-03-27 12:25
Burglar

Registered: Dec 2004
Posts: 1069
PS: groepaz, check SH.
2010-03-27 15:33
MagerValp

Registered: Dec 2001
Posts: 1065
Well a case could be made for .prg.gz to be sent with Content-encoding, but application/x-gzip is probably better.
2010-03-27 17:40
Burglar

Registered: Dec 2004
Posts: 1069
Quoting MagerValp
Well a case could be made for .prg.gz to be sent with Content-encoding, but application/x-gzip is probably better.

to be totally accurate, you could make a ".prg" (and d64,t64,etc) get transferred with Content-encoding: gzip (or deflate). Which means the server and the browser will do the g(un)zipping on the fly. Doing it for ".prg.gz" would mean gzipping it twice...

anyway, I'll write up some simple apache conf for it.
2010-03-27 18:11
Burglar

Registered: Dec 2004
Posts: 1069
erm, first of all, start using an alive apache version, like 2.2.15
compile it with --enable-deflate, or if you use a standard distribution
it's probably already enabled.

### mime.types

application/x-d64 d64
application/x-t64 t64
application/x-prg prg
audio/prs.sid sid
application/zip zip

the last 2 should already be there

### httpd.conf

TypesConfig /path/to/mime.types

AddOutputFilterByType DEFLATE text/html text/plain text/xml application/xml
AddOutputFilterByType DEFLATE application/javascript text/css
AddOutputFilterByType DEFLATE audio/prs.sid application/x-d64 application/x-prg
AddOutputFilterByType DEFLATE application/x-t64

and thats it
RefreshSubscribe to this thread:

You need to be logged in to post in the forum.

Search the forum:
Search   for   in  
All times are CET.
Search CSDb
Advanced
Users Online
t0m3000/HF^BOOM!^IBX
iAN CooG/HVSC
MKCKoner
Guests online: 120
Top Demos
1 Next Level  (9.7)
2 13:37  (9.7)
3 Coma Light 13  (9.7)
4 Edge of Disgrace  (9.6)
5 Mojo  (9.6)
6 Uncensored  (9.6)
7 Wonderland XIV  (9.6)
8 Comaland 100%  (9.6)
9 No Bounds  (9.6)
10 Unboxed  (9.6)
Top onefile Demos
1 Layers  (9.6)
2 Party Elk 2  (9.6)
3 Cubic Dream  (9.6)
4 Copper Booze  (9.6)
5 Rainbow Connection  (9.5)
6 It's More Fun to Com..  (9.5)
7 Morph  (9.5)
8 Dawnfall V1.1  (9.5)
9 Onscreen 5k  (9.5)
10 Daah, Those Acid Pil..  (9.5)
Top Groups
1 Booze Design  (9.3)
2 Oxyron  (9.3)
3 Nostalgia  (9.3)
4 Censor Design  (9.3)
5 Triad  (9.2)
Top Graphicians
1 Mirage  (9.7)
2 Archmage  (9.7)
3 Facet  (9.6)
4 Carrion  (9.6)
5 Pal  (9.6)

Home - Disclaimer
Copyright © No Name 2001-2024
Page generated in: 0.069 sec.