H
HAL 9000
Hi, all. Posting from work via Google.
I have an Apache server that I don't administer or configure. It
doesn't have mod_ruby, and at this point I don't want to ask for
it to be installed.
I had the idea of using erb via a shebang line in a .cgi file.
It didn't quite work, somehow related to the fact that erb is
a script. (This is on a Sun.) I'm not entirely sure why that is,
but I wrapped it in a simple C program that calls system(), and
it works fine.
So my shebang line looks like: #!/home/prod/bin/erbc
and the rest of the .cgi is just HTML and emnedded Ruby. (If this
is dumb, tell me a better way.)
In most cases, this works fine. I start out each .cgi with a
line like this: <%= "Content-type: text/html\r\n\r\n" %>
and all is well.
However, *one* of them has a problem. It gives me a "premature
end of header" error, although the header is the same as the
others. (I've noticed it seems to give this error, slightly
misleadingly, when some piece of non-header text is output
before/instead of a header.)
I'm guessing that somehow the generated erb program is writing
a warning or error or something that Apache is seeing *before*
the header. If it is, I'm not seeing that information anywhere.
I have run the script directly from the command line, and the
output is fully correct. So it only fails when the web server
runs it. Sounds like some kind of user or permission issue.
The embedded code does read some files, but they all seem to
be world-readable.
Any ideas how to debug this one?
For example, can I "see what the web server sees" (but doesn't
write to the log)?
Thanks,
Hal
I have an Apache server that I don't administer or configure. It
doesn't have mod_ruby, and at this point I don't want to ask for
it to be installed.
I had the idea of using erb via a shebang line in a .cgi file.
It didn't quite work, somehow related to the fact that erb is
a script. (This is on a Sun.) I'm not entirely sure why that is,
but I wrapped it in a simple C program that calls system(), and
it works fine.
So my shebang line looks like: #!/home/prod/bin/erbc
and the rest of the .cgi is just HTML and emnedded Ruby. (If this
is dumb, tell me a better way.)
In most cases, this works fine. I start out each .cgi with a
line like this: <%= "Content-type: text/html\r\n\r\n" %>
and all is well.
However, *one* of them has a problem. It gives me a "premature
end of header" error, although the header is the same as the
others. (I've noticed it seems to give this error, slightly
misleadingly, when some piece of non-header text is output
before/instead of a header.)
I'm guessing that somehow the generated erb program is writing
a warning or error or something that Apache is seeing *before*
the header. If it is, I'm not seeing that information anywhere.
I have run the script directly from the command line, and the
output is fully correct. So it only fails when the web server
runs it. Sounds like some kind of user or permission issue.
The embedded code does read some files, but they all seem to
be world-readable.
Any ideas how to debug this one?
For example, can I "see what the web server sees" (but doesn't
write to the log)?
Thanks,
Hal