(apologies to ES for email.)

ES wrote:
> Le 21/5/2005, "greyfade / gmail.com" <greyfade / gmail.com> a ˝─rit:
> >this is a problem that's been driving me nuts ever since i first
tried
> >it.
> >
> >i can create simple, minimal scripts in Python, Perl, and PHP that
run
> >flawlessly on the first try with minimal effort, both on my local
> >testing system (Apache 2.0.52 and Ruby 1.8.2) and on the server my
> >personal site is hosted on (Apache 1.3.33 and unknown version of
Ruby -
> >i'm trying to find out).  but no matter what i try, i simply can not
> >get even the most minimal ruby script to function:
> >
> >#!/usr/bin/env ruby
> >
> >print "Content-type: text/html\n\n"
> >print "<html><body>Hello World!</body></html>\n"
> >
> >it runs perfectly fine at the console, no warnings, no errors, no
> >problems.  but as a CGI script, it's another story:  i get an error
500
> >and the cryptic (and seemingly common) "Premature end of script
> >headers".  no other warnings or errors.  if i simply change "ruby"
to
> >"python" on the shebang line, the above script magically works with
no
> >other effort on my part.
>
> This, actually, goes to the HTTP spec. Try this:
>
> #!/bin/env/ ruby
> print "HTTP/1.0 200 OK\r\n"
> print "Content-type: text/html\r\n\r\n"
> print "<html><body>Hello World!</body></html>\n"
>
not the case, apparently.  it works happily with "\n" instead of "\r\n"
and doesn't seem to require the 200 header.

> >i'm going insane because nothing, AFAICT, is wrong.  the server is
> >correctly set-up, permissions are correct, ownership is correct,
ruby
> >is installed and working, yet NOTHING seems to coax it into working.
> >it repeatedly reports this incredibly uninformative "Premature end
of
> >script headers" error.
> >
> >is there something i could have missed?  a possible
misconfiguration?
> >or does ruby just hate me?
>

on one of my test servers, it turns out there is no ruby installed and
on another, it seems to be a major misconfiguration.  so it seems
there's a lot i've missed as my original script runs unmodified on yet
another server.

> E
> 
> --
> template<typename duck>
> void quack(duck& d) { d.quack(); }