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

CGI: debug mode

 [1/5] 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 :-)

 [2/5] from: tim:johnsons-web at: 31-Aug-2000 8:31


Hi Alex: I'm a rebol newbie, but have done a lot of CGI programming, and have had to resolve a lot of headaches myself. One of the things that I do is build in switches to send my content to a physical file if necessary. Often times that is helpful, other times, one may actually want to build static pages with the same code. see http://www.rebolforces.com/cgi-util.html also http://www.rebolforces.com/cgi-basics.html and http://www.rebolforces.com/ good stuff there You will find redundant and sloppy code in cgi-util because I am very new to rebol, but some useful stuff, I hope. Look for functionality around re-direction of output. Your comments, questions, and criticisms will be appreciated. They will make me a better rebol programmer. You may email me directly if you wish. regards Tim [alex--pini--mclink--it] wrote:

 [3/5] 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:

 [4/5] from: alex:pini:mclink:it at: 1-Sep-2000 15:02


>- Open Your Mind -<
Quoting from [mailinglists--post--com's] message (01-Sep-00 09:55:57). m> I've seen it in a lot of CGI Rebol scripts: place the 'print m> "Content-type: text/html"' first. m> m> I don't like it myself, but I use it sometimes when I run into trouble, m> until the script is fully tested, then I put it in place again. I do, too (during the debug phase, then I comment it away), but you may have missed the point: the script never issued that first print because of an early error, one that went off *before* the script started. That's what kept me in the dark for so long. Apache logs didn't help me much either, because they just reported incomplete headers, which I thought the script was printing well... :-? Alessandro Pini ([alex--pini--mclink--it]) FBI. F... B... I!! (Mulder (van Blundht))

 [5/5] from: mailinglists:post at: 2-Sep-2000 3:44


From: <[alex--pini--mclink--it]>
> I do, too (during the debug phase, then I comment it away), but you
may have missed the point: Yes, that went one went over my head completely! Sorry! ;o) Regards, Rachid