[REBOL] CGI: debug mode
From: alex::pini::mclink::it at: 31-Aug-2000 15:22
>- Open Your Mind -<
[[[ MY-MESSAGES-TO-FEEDBACK-KEEP-BOUNCING-BACK MODE ON ]]]
I've been going mad due to a malfunctioning CGI script. It wouldn't even tell me what
the error was, I just got a generic error page.
I've spent many hours trying to understand what the problem was, then I used a dirty
trick (I simulated its execution *by hand*) and found out that the Content-Type wasn't
being issued because there was a loading-time error, so even the very first instruction
( print "Content-Type: text/plain^/" ) wasn't executed. This happened online only, the
offline execution was OK. Argh.
Now the problem's solved, but it would be nice'n'useful to have a command line option
to make sure that, in case *anything* gets written to standard output, the very first
thing printed is "Content-Type: text/plain^/" or some other Content-Type.
Now, if the script issues "Content-Type: text/plain^/" itself, that's OK, if the script
issues "Content-Type: text/html^/" that's OK, if the script issues "Content-Type: movie/sci-fi^/",
that's OK... but if the script issues anything else or if there's an early error, the
REBOL interpreter issues "Content-Type: text/plain^/" *first*. So we can see what the
hell's going on. :-)
I realize this would bring performance down a bit, so it should be a separate, non-default
choice. I was thinking something like --cgidebug or -d, like this:
REBOL --cgidebug --secure none cgi-script.r
REBOL -ds cgi-script.r
Or at least have "Content-Type: text/plain^/" printed before any early error message
when using the standard --cgi ((-:
[[[ MY-MESSAGES-TO-FEEDBACK-KEEP-BOUNCING-BACK MODE OFF ]]]
Alessandro Pini ([alex--pini--mclink--it])
Dave, about that monolith...
"Yes, HAL?" "Have you tried the switch?" (-O HAL 9000 & Bowman :-)