Puzzling

Ruby Tuesday wrote:

I’d love to run mod_ruby which is running in my Linux Redhat 9 but now I
have to use the windows server, I’m stuck — can’t find mod_ruby/eruby
binaries for mswin32 version. Anyone compiled that already? Please share.

Check out this link:
http://www.moriq.com/ruby/win32-apache2-ruby1.8.1-mod_ruby/

it worked for me in the past.

/kent

Ruby Tuesday wrote:

Hi Osuka, unfortunately I have no say in what browser to use - I’m stuck
with IE and MS-Windoze.

Reading from the reply, it seems that IE6 has a little bug with header
text/plain. Have anyone encounter that issues? Try to use text/plain and put
some reqular text afterward. It works fine with Mozilla but not with IE.
Thanks

Hi!
Others have pointed out that changing the extension would work, so…

added to apache conf

AddType application/x-httpd-ruby .cgi
Action application/x-httpd-ruby “e:/usr/local/bin/ruby.exe”
AddType application/x-httpd-cgi .cgi

changing extensions to “cgi” or anything windows doesn’t know about
should do the trick.

···

---
Other possibility, is by using an .htaccess(but depends on what a
.htaccess can override and where), based on Tdiary install instructions,
which uses *.rb and works flawlesly in IE.

#Added this to Apache conf since windows doesn’t really
#want to create files with no “filename”
AccessFileName dot.htaccess

#create a dot.access file in the dir where your’re using cgi
#and add the lines:

Options +ExecCGI
#notice that Indexes, You might not want that.
Options ExecCGI Indexes
AddHandler cgi-script .ruby
#and renamed the files to *.ruby, I used a ruby ext. but whatever goes
#as long as windows doesn’t knows about it(it can’t use .rb, IE does the
dialogs.)

I’m still don’t know why Tdiary can use the *.rb files without IE goin’
dialog mmh, btw all the files keep the shebang.

Sorry to take a time replying, but… is(was) weekend.

“John W. Long” wrote:

---- Jon A. Lambert wrote: ----

mod_ruby works only on Apache 1.x

I’m running it right now on Apache 2.

Oops sorry, you are correct sir.

I was having trouble under Windows XP. But r.e. my last post, I have that licked.
Hopefully that is, at least I haven’t encountered any show stoppers since
yesterday. :slight_smile:

···


J. Lambert

Robert Klemme wrote:

“Charles Comstock” cc1@cec.wustl.edu schrieb im Newsbeitrag
news:c18g6f$maq$2@newsreader.wustl.edu…

Charles Comstock wrote:

Robert wrote:

Jon A. Lambert wrote:

“Ruby Tuesday” wrote:

BTW this is incorrect.
print “Content-type: text/html \n\n\n”

It should be
print “Content-type: text/html \r\n\r\n”

Is that a Ruby thing? That certainly isn’t how Perl does it. Perl does
the following:

print “Content-type: text/html\n\n”;

Which I believe is the standard header.

I’m pretty sure under the rfs your supposed to do \r\n\r\n, but I think
most servers are setup to just look for a single blank line before
actual content, and so they generally just look for a \n and thus the
\n\n works. But technically it’s supposed to be \r\n\r\n I think.

Charles Comstock

Oops dunno what I was typing, I meant RFC, not rfs,

Charles Comstock

Nevertheless you are right. The RFC requires \r\n sequences as line
termination in an HTTP header. Never mind what “Perl does”, it’s better to
just comply to the standard - “Better safe than sorry.” :slight_smile:

See
HTTP/1.1: HTTP Message

Regards

robert

I would agree except every tutorial I have ever seen on it uses \n\n and
not the other.

“Kent S.” wrote:

Ruby Tuesday wrote:

I’d love to run mod_ruby which is running in my Linux Redhat 9 but now I
have to use the windows server, I’m stuck — can’t find mod_ruby/eruby
binaries for mswin32 version. Anyone compiled that already? Please share.

Check out this link:
Index of /ruby/win32-apache2-ruby1.8.1-mod_ruby

it worked for me in the past.

Thanks for the link Kent. It wouldn’t work at all for me. Both ruby-run
and eruby-run crashes the Apache2 child process and causes one to have
to stop and restart Apache. This is under Windows XP.

So I decided to become an Apache module developer (of sorts) and
downloaded the Apace2.0.48 source, compiled it in VC++, then
downloaded mod_ruby 1.1.2 source, hand applied the changes from the
above link, compiled that and ended up crashing and burning just as above.
sniff

On a whim, well not exactly a whim as I found some related clues in how
mod_php is compiled and linked, I changed the -MD flag passed to the
compiler to -MT which links in the multi-threaded runtime library staticly
LIBCMT.LIB vs. MSVCRT.DLL, and…

Bingo! I’m now happily writing Ruby and Eruby code type stuffs. Whee!

Thanks for the clue. :slight_smile:

···


J. Lambert

Hi Kents, I tried the site you suggested and still give me the error:

Internal Server Error
The server encountered an internal error or misconfiguration and was unable
to complete your request.

Please contact the server administrator, usenets@earthlink.net and inform
them of the time the error occurred, and anything you might have done that
may have caused the error.

More information about this error may be available in the server error log.

···

Apache/2.0.48 (Win32) DAV/2 mod_ssl/2.0.47 OpenSSL/0.9.7b mod_fastcgi/2.4.2
PHP/4.3.4 mod_ruby/1.1.1 Server at windev Port 80

And this is the error log from the apache:

[Mon Feb 23 18:55:31 2004] [error] mod_ruby: error in ruby
(eval): (eval)uninitialized constant Apache::RubyRun (NameError)
from (eval):0:in `value’

Below are portion of my httpd.conf for ruby:
LoadModule ruby_module modules/mod_ruby.so

ClearModuleList

AddModule mod_ruby.c

RubyRequire apache/ruby-run SetHandler ruby-object RubyHandler Apache::RubyRun.instance

Handle *.rhtml files as eRuby files

RubyRequire apache/eruby-run
<Files *.rhtml>
SetHandler ruby-object
RubyHandler Apache::ERubyRun.instance

RubySafeLevel 0

CGI for ruby

AddType application/x-httpd-ruby .rb
Action application/x-httpd-ruby /cgi-bin/ruby.exe

“Kent S.” happy@user.com wrote in message
news:F2d_b.42829$kR3.25049@bignews4.bellsouth.net

Ruby Tuesday wrote:

I’d love to run mod_ruby which is running in my Linux Redhat 9 but now I
have to use the windows server, I’m stuck — can’t find mod_ruby/eruby
binaries for mswin32 version. Anyone compiled that already? Please
share.

Check out this link:
Index of /ruby/win32-apache2-ruby1.8.1-mod_ruby

it worked for me in the past.

/kent

“Osuka Adartse” wrote:

I’m still don’t know why Tdiary can use the *.rb files without IE goin’
dialog mmh, btw all the files keep the shebang.

Doing a scan of the TDiary code, it’s because it sets the the content-type to text/html
for it’s webpages. The only exceptions to setting the content to text/html appear to be
some pages it would produce for severe errors in exception processing (i.e. traceback
output)

The problem is simple but annoying. When Internet Explorer encounters a document
with the content-type of text/plain, it searchs for a helper application based on the
documents extension.

The solution is to change the extension or change the content-type to text/html.

The problem with changing the extension is that if one of the users browsing your
web site has a helper application configured for that extension then IE is going
to use it. For example changing it *.rbx isn’t going to help if the user (say me)
decided to associate *.rbx with their favorite text editor (I have). So the only
way to be sure the user sees a document with the content-type of text/plain within
the IE browser is to use no extension at all. That is ‘helloworld.rb’ becomes
‘helloworld’. This solution is annoying for the developer as maybe their favorite
editor’s syntax highlighting is keyed of the extension. It’s also annoying when trying
to configure your webserver to properly handle files based on their extensions
or having to move these files into special directories or using the location directive.

I’ve encountered the exact same problems with perl. I understand how convenient
it is to generate the normal EOL sequence in most languages and use text/plain as
opposed to using html-style EOL sequences and use text/html. Unfortunately as
most users are using IE, you are left with these choices.

···


J. Lambert

I’ve tried both using \n\n and \r\n\r\n on Perl and Ruby as well. Both
resulted the same.

When I tried it with Mozilla, the “Content-type: text/plain” works. Do you
guys think it is the IE things? Thanks

“Robert” bobx@linuxmail.org wrote in message
news:KtidnX_WrYgkkqXd4p2dnA@adelphia.com

Robert Klemme wrote:

“Charles Comstock” cc1@cec.wustl.edu schrieb im Newsbeitrag
news:c18g6f$maq$2@newsreader.wustl.edu…

Charles Comstock wrote:

Robert wrote:

Jon A. Lambert wrote:

“Ruby Tuesday” wrote:

BTW this is incorrect.
print “Content-type: text/html \n\n\n”

It should be
print “Content-type: text/html \r\n\r\n”

Is that a Ruby thing? That certainly isn’t how Perl does it. Perl does
the following:

print “Content-type: text/html\n\n”;

Which I believe is the standard header.

I’m pretty sure under the rfs your supposed to do \r\n\r\n, but I think
most servers are setup to just look for a single blank line before
actual content, and so they generally just look for a \n and thus the
\n\n works. But technically it’s supposed to be \r\n\r\n I think.

Charles Comstock

Oops dunno what I was typing, I meant RFC, not rfs,

Charles Comstock

Nevertheless you are right. The RFC requires \r\n sequences as line
termination in an HTTP header. Never mind what “Perl does”, it’s better
to

···

just comply to the standard - “Better safe than sorry.” :slight_smile:

See
HTTP/1.1: HTTP Message

Regards

robert

I would agree except every tutorial I have ever seen on it uses \n\n and
not the other.

John, would you mind sharing what you did. And if possible, perhaps the
binaries for mod_ruby/eruby and its related static library(if needed). I’d
love to see it working on Apache2/Mod_ruby/Eruby/Ruby-1.8.1

Thanks

“Jon A. Lambert” jlsysinc@alltel.net wrote in message
news:002801c3fa6d$e9b246e0$0200000a@agamemnon…

“Kent S.” wrote:

Ruby Tuesday wrote:

I’d love to run mod_ruby which is running in my Linux Redhat 9 but now
I
have to use the windows server, I’m stuck — can’t find
mod_ruby/eruby
binaries for mswin32 version. Anyone compiled that already? Please
share.

···

Check out this link:
Index of /ruby/win32-apache2-ruby1.8.1-mod_ruby

it worked for me in the past.

Thanks for the link Kent. It wouldn’t work at all for me. Both ruby-run
and eruby-run crashes the Apache2 child process and causes one to have
to stop and restart Apache. This is under Windows XP.

So I decided to become an Apache module developer (of sorts) and
downloaded the Apace2.0.48 source, compiled it in VC++, then
downloaded mod_ruby 1.1.2 source, hand applied the changes from the
above link, compiled that and ended up crashing and burning just as above.
sniff

On a whim, well not exactly a whim as I found some related clues in how
mod_php is compiled and linked, I changed the -MD flag passed to the
compiler to -MT which links in the multi-threaded runtime library staticly
LIBCMT.LIB vs. MSVCRT.DLL, and…

Bingo! I’m now happily writing Ruby and Eruby code type stuffs. Whee!

Thanks for the clue. :slight_smile:


J. Lambert

John, would you mind sharing what you did. And if possible, perhaps the
binaries for mod_ruby/eruby and its related static library(if needed). I’d
love to see it working on Apache2/Mod_ruby/Eruby/Ruby-1.8.1

Thanks

“Jon A. Lambert” jlsysinc@alltel.net wrote in message
news:002801c3fa6d$e9b246e0$0200000a@agamemnon…

“Kent S.” wrote:

Ruby Tuesday wrote:

I’d love to run mod_ruby which is running in my Linux Redhat 9 but now
I
have to use the windows server, I’m stuck — can’t find
mod_ruby/eruby
binaries for mswin32 version. Anyone compiled that already? Please
share.

···

Check out this link:
Index of /ruby/win32-apache2-ruby1.8.1-mod_ruby

it worked for me in the past.

Thanks for the link Kent. It wouldn’t work at all for me. Both ruby-run
and eruby-run crashes the Apache2 child process and causes one to have
to stop and restart Apache. This is under Windows XP.

So I decided to become an Apache module developer (of sorts) and
downloaded the Apace2.0.48 source, compiled it in VC++, then
downloaded mod_ruby 1.1.2 source, hand applied the changes from the
above link, compiled that and ended up crashing and burning just as above.
sniff

On a whim, well not exactly a whim as I found some related clues in how
mod_php is compiled and linked, I changed the -MD flag passed to the
compiler to -MT which links in the multi-threaded runtime library staticly
LIBCMT.LIB vs. MSVCRT.DLL, and…

Bingo! I’m now happily writing Ruby and Eruby code type stuffs. Whee!

Thanks for the clue. :slight_smile:


J. Lambert

Ruby beginner here. Heard of it before and on a whim decided to check
it out a couple of days ago and I love it. I friggin love it.
I’m doing stuff that would take me a while to figure out with other
languages’ syntax. I’ve never seen a language that looks so “clean.”

Anyway, I have some questions I couldn’t find in the FAQ

sample code:

x = 2
puts x

Now, is “puts” a class or instance method of Object? What about “x”?
Is that a class or instance variable of an Object?
When you run a Ruby program, is the program an instance of Object?

Ruby Tuesday wrote:

I’ve tried both using \n\n and \r\n\r\n on Perl and Ruby as well. Both
resulted the same.

When I tried it with Mozilla, the “Content-type: text/plain” works. Do you
guys think it is the IE things? Thanks

I doubt that it’s an IE vs. Mozilla. This is just basic HTTP stuff. The
RFC specifies that each message header end with a CRLF, with a “line”
containing only a CRLF separating the headers from the message body. So
your Content-type header, ending with two (or more) such sequences
should work; the first to terminate the header the second to separate
the header and body, and any subsequent ones are treated as part of the
body.

print “Content-type: text/html\r\n\r\n”
print “Your body goes here…”

Should and, at least in my experience, does work.

The RFC also admonishes applications to be tolerant and accept slightly
incorrectly formed documents:

“The line terminator for message-header fields is the sequence CRLF.
However, we recommend that applications, when parsing such headers,
recognize a single LF as a line terminator and ignore the leading CR.”

(from HTTP/1.1: Appendices)

The following works for me:

#!C:/ruby/bin/ruby.exe
print “Content-type: text/html\n\n”
print "1st line "
print "2nd line "
print "3rd line "

I can replace the first line with one ending in \r\n\r\n (what I had
originally because it’s correct, not just tolerated by well-behaved
applications). I can also replace with \n\n\n (or \r\n\r\n\r\n) which
generates an extra blank line in the document.

BTW, I’m running on WinXP SP1 with Apache 2.0.47 and Ruby 1.8.0. I
tested with IE 6.0 and FireFox 0.8. The directory that contains the
scripts is set up as follows in httpd.conf:

<Directory “C:/Apache2/htdocs/ruby”>
Options Indexes FollowSymLinks ExecCGI
Order allow,deny
Allow from all

Bottom line, what you posted should work. It seems like something else
must be going on (that is, the problem’s not in your Ruby script itself).

Cheers,
Trey

John, would you mind sharing what you did. And if possible, perhaps the
binaries for mod_ruby/eruby and its related static library(if needed). I’d
love to see it working on Apache2/Mod_ruby/Eruby/Ruby-1.8.1

Thanks

I’ve zipped up my build directory both binaries and the source and put it here:
ftp://wizards.kicks-ass.net

You have to manually copy the mod_ruby.so to your apache modules directory
and everything in libs/apache to somewhere in your ruby search list.
It was compiled under Windows XP SP1 with VC++ 6.0 using Apache 2.0.48
for ruby-mswin32-1.8.1-11

···

----- Original Message -----
From: “Ruby Tuesday” rubytuezdayz@yahoo.com
Newsgroups: comp.lang.ruby
To: “ruby-talk ML” ruby-talk@ruby-lang.org
Sent: Monday, February 23, 2004 10:49 PM
Subject: Re: Puzzling… no longer


J. Lambert

Your simple code is being executed in the context of some private Object
instance.

$ irb
irb(main):001:0> self.class
=> Object
irb(main):002:0>

Object class includes Kernel module which in turn defines all these
puts, print, etc. methods. Your x variable is the local variable. All
methods defined at the top level context become private methods of this
private Object.

/kent

Sang Kim wrote:

···

Ruby beginner here. Heard of it before and on a whim decided to check
it out a couple of days ago and I love it. I friggin love it.
I’m doing stuff that would take me a while to figure out with other
languages’ syntax. I’ve never seen a language that looks so “clean.”

Anyway, I have some questions I couldn’t find in the FAQ

sample code:

x = 2
puts x

Now, is “puts” a class or instance method of Object? What about “x”?
Is that a class or instance variable of an Object?
When you run a Ruby program, is the program an instance of Object?

Welcome.

x is a local variable, as opposed to @x, @@x (instance and class), X
(constant), $x (global).

puts is a method of the Kernel module, which is included in the Object
class, and therefore available anywhere.

The context of your program is the “top-level”, which is an instance
of Object, and probably has some special features surrouding it.

Take a look at the standard textbook “Programming Ruby” for more juicy
goodness, although it seems you’ll be able to pick up a fair bit on
your own :slight_smile:

Programming Ruby

Cheers,
Gavin

···

On Sunday, February 22, 2004, 5:30:42 PM, Sang wrote:

Ruby beginner here. Heard of it before and on a whim decided to check
it out a couple of days ago and I love it. I friggin love it.
I’m doing stuff that would take me a while to figure out with other
languages’ syntax. I’ve never seen a language that looks so “clean.”

Anyway, I have some questions I couldn’t find in the FAQ

sample code:

x = 2
puts x

Now, is “puts” a class or instance method of Object? What about “x”?
Is that a class or instance variable of an Object?
When you run a Ruby program, is the program an instance of Object?

The following works for me:

#!C:/ruby/bin/ruby.exe
print “Content-type: text/html\n\n” <<<<<
print "1st line "
print "2nd line "
print "3rd line "

The above works for me as well on both IE6 and Mozilla. But try to change
the header to the following:

#!C:/ruby/bin/ruby.exe
print “Content-type: text/plain\n\n” <<<<<<<
print "1st line "
print "2nd line "
print "3rd line "

Again, both method works with Mozilla. So, I am begining to think that IE is
mis-behaving! Unfortunately, this is the basic RFC for header.
Please confirm.

Thanks

“Trey Campbell” drtrey@midsouth.rr.com wrote in message
news:4038C68E.8010805@midsouth.rr.com

Ruby Tuesday wrote:

I’ve tried both using \n\n and \r\n\r\n on Perl and Ruby as well. Both
resulted the same.

When I tried it with Mozilla, the “Content-type: text/plain” works. Do
you

···

guys think it is the IE things? Thanks

I doubt that it’s an IE vs. Mozilla. This is just basic HTTP stuff. The
RFC specifies that each message header end with a CRLF, with a “line”
containing only a CRLF separating the headers from the message body. So
your Content-type header, ending with two (or more) such sequences
should work; the first to terminate the header the second to separate
the header and body, and any subsequent ones are treated as part of the
body.

print “Content-type: text/html\r\n\r\n”
print “Your body goes here…”

Should and, at least in my experience, does work.

The RFC also admonishes applications to be tolerant and accept slightly
incorrectly formed documents:

“The line terminator for message-header fields is the sequence CRLF.
However, we recommend that applications, when parsing such headers,
recognize a single LF as a line terminator and ignore the leading CR.”

(from HTTP/1.1: Appendices)

The following works for me:

#!C:/ruby/bin/ruby.exe
print “Content-type: text/html\n\n”
print "1st line "
print "2nd line "
print "3rd line "

I can replace the first line with one ending in \r\n\r\n (what I had
originally because it’s correct, not just tolerated by well-behaved
applications). I can also replace with \n\n\n (or \r\n\r\n\r\n) which
generates an extra blank line in the document.

BTW, I’m running on WinXP SP1 with Apache 2.0.47 and Ruby 1.8.0. I
tested with IE 6.0 and FireFox 0.8. The directory that contains the
scripts is set up as follows in httpd.conf:

<Directory “C:/Apache2/htdocs/ruby”>
Options Indexes FollowSymLinks ExecCGI
Order allow,deny
Allow from all

Bottom line, what you posted should work. It seems like something else
must be going on (that is, the problem’s not in your Ruby script itself).

Cheers,
Trey

Jon, at last! I’ve been looking for this day and thank you. It works!

Now, I can start learning Ruby web programming. Thanks again

“Jon A. Lambert” jlsysinc@alltel.net wrote in message
news:019201c3fa91$f86f46f0$0200000a@agamemnon…

From: “Ruby Tuesday” rubytuezdayz@yahoo.com
Newsgroups: comp.lang.ruby
To: “ruby-talk ML” ruby-talk@ruby-lang.org
Sent: Monday, February 23, 2004 10:49 PM
Subject: Re: Puzzling… no longer

John, would you mind sharing what you did. And if possible, perhaps the
binaries for mod_ruby/eruby and its related static library(if needed).
I’d
love to see it working on Apache2/Mod_ruby/Eruby/Ruby-1.8.1

Thanks

I’ve zipped up my build directory both binaries and the source and put it
here:

···

----- Original Message -----
ftp://wizards.kicks-ass.net

You have to manually copy the mod_ruby.so to your apache modules directory
and everything in libs/apache to somewhere in your ruby search list.
It was compiled under Windows XP SP1 with VC++ 6.0 using Apache 2.0.48
for ruby-mswin32-1.8.1-11


J. Lambert

Ruby Tuesday wrote:

The following works for me:

#!C:/ruby/bin/ruby.exe
print “Content-type: text/html\n\n” <<<<<
print "1st line "
print "2nd line "
print "3rd line "

The above works for me as well on both IE6 and Mozilla. But try to change
the header to the following:

#!C:/ruby/bin/ruby.exe
print “Content-type: text/plain\n\n” <<<<<<<
print "1st line "
print "2nd line "
print "3rd line "

Again, both method works with Mozilla. So, I am begining to think that IE is
mis-behaving! Unfortunately, this is the basic RFC for header.
Please confirm.

Thanks

Trying it with the following:

#!C:/ruby/bin/ruby.exe
print “Content-type: text/plain\n\n”
print "1st line "
print "2nd line "
print "3rd line "

Mozilla renders the page (as if it encountered a

 tag). IE shows a
dialog offering to run the associated application (but warning that it
might not be a good idea to do so). I wouldn’t characterize that as
misbehaving since that’s what I’d expect it to do, or at least offer to
do; it’s just doing a better job of recognizing potential helper
applications than Mozilla is.

Just change the extension to something that’s not associated with a
program (like .rbx) and it works the same as Mozilla. I used the name
puzzle.rbx and got the same results in both browsers. Shouldn’t be a
problem if you’re using the shebang line to run it as a CGI, not via the
extension.

Cheers,
Trey

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

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.

um… okay. I’ll stop my “standards rant” now.

-Mark

···

On Feb 22, 2004, at 7:25 PM, Trey Campbell wrote:

Trying it with the following:

#!C:/ruby/bin/ruby.exe
print “Content-type: text/plain\n\n”
print "1st line "
print "2nd line "
print "3rd line "

Mozilla renders the page (as if it encountered a

 tag). IE shows
a dialog offering to run the associated application (but warning that
it might not be a good idea to do so). I wouldn’t characterize that as
misbehaving since that’s what I’d expect it to do, or at least offer
to do; it’s just doing a better job of recognizing potential helper
applications than Mozilla is.

“Mark Hubbart” discord@mac.com schrieb im Newsbeitrag
news:FE8E6434-65C0-11D8-9977-000502FDD5CC@mac.com

Trying it with the following:

#!C:/ruby/bin/ruby.exe
print “Content-type: text/plain\n\n”
print "1st line "
print "2nd line "
print "3rd line "

Mozilla renders the page (as if it encountered a

 tag). IE shows
a dialog offering to run the associated application (but warning that
it might not be a good idea to do so). I wouldn’t characterize that as
misbehaving since that’s what I’d expect it to do, or at least offer
to do; it’s just doing a better job of recognizing potential helper
applications than Mozilla is.

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).

Correct so far.

A mime type of “text/plain” indicates a
simple plaintext file, which should be rendered on the screen.

I don’t subscibe to your relative clause: the fact that data is tagged as
plaintext does not mean it has to be rendered on the screen, especially does
it not mean that the browser should do it. What happens to a file is
totally client (i.e. browser) dependent, so it might or might not decide to
display it itself or delegate handling to some other entity. How this
entity is found (via a browser internal mapping or via some OS mechanism) is
again browser and system dependent.

Pragmatically one would expect a text/plain file to appear on the screen,
probably in a browser window or in some text editor. But it might as well
be saved to disk or whatever, depending on the user’s configuration.

The
browser should NOT try to execute it. If it should be executed, it
should have a mime type of, I don’t know, “executable/ruby” or
something.

Well, it need not be named “executable”, because there is no inherent
semantics in mime type. The configuration determines what to do with it.
You could as well configure emacs as handler for a Ruby script.

If the browser can’t recognize the mime type, then it
should feel free to try to figure it out.

Agreed, the mime type should definitely take precedence.

A windows pc determines filetypes based on the extension,

AFAIK this is not fully correct: I believe that current Windows version are
also capable to identify a file’s type via other mechanisms; I believe you
can write handlers and register them with the system that look into files
and determines type etc. Maybe someone with a bit more Windows insight than
me can comment / correct me.

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.

Yep.

um… okay. I’ll stop my “standards rant” now.
:slight_smile:

The crucial point with MIME is, that the standard defines a format for
naming file types and a mechanism to register well known types. But it does
not fix what to do with these files.

Kind regards

robert
···

On Feb 22, 2004, at 7:25 PM, Trey Campbell wrote: