Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search

[REBOL] CGI: debug mode Re:

From: mailinglists:post at: 1-Sep-2000 9:55

Hello, I've seen it in a lot of CGI Rebol scripts: place the 'print Content-type: text/html ' first. I don't like it myself, but I use it sometimes when I run into trouble, until the script is fully tested, then I put it in place again. Regards, Rachid ----- Original Message ----- From: <[alex--pini--mclink--it]> To: <[list--rebol--com]> Sent: Thursday, August 31, 2000 15:22 Subject: [REBOL] CGI: debug mode
> >- 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: