Puzzling...

J

Josef 'Jupp' SCHUGT

Hi!

* Mark Hubbart:
The mime type is there for a reason. When a file is downloaded, the
browser is supposed to look at the mime type to figure out what to
do. If the mime-type is "image/jpeg", that means it's jpeg image,
despite the fact that it's filename might be "graph.rb" (if it
happens to be a dynamically created image). A mime type of
"text/plain" indicates a simple plaintext file, which should be
rendered on the screen. The browser should NOT try to execute it.

The result can be very surprising. Suppose it's some text document
about a company's division called 'identification division':

print "Content-type: text/plain\n\n"
puts " *************************"
puts
puts " IDENTIFICATION DIVISION."
puts
puts " *************************"
puts
puts " * identifies new technologies"
puts
puts " * gives estimates for return rates we expect"
puts
puts " * finds the optimal portefeuille for you"


It would be quite surprising to see a window pop up asking if the
browser should run the COBOL program *SCNR*
If it should be executed, it should have a mime type of, I don't
know, "executable/ruby" or something. If the browser can't
recognize the mime type, *then* it should feel free to try to
figure it out.

Or leave it to the user.
A windows pc determines filetypes based on the extension, a mac
primarily uses the creatorcode and typecode metadata, a unix box
uses (mostly, i think) magic numbers. All Things Web are supposed
to use mime types as a bridge. This is to ensure that things like,
say, a plaintext file, don't get interpreted as, say, an executable
ruby script.

The Unix solution isn't optimal, either. 'English text' can be a
script in a verbose programming language, an elaborated sed script
may be identified as a 'data', etc.

Josef 'Jupp' SCHUGT
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,787
Messages
2,569,629
Members
45,332
Latest member
LeesaButts

Latest Threads

Top