[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Bug-apl] debugging a cgi script

From: Juergen Sauermann
Subject: Re: [Bug-apl] debugging a cgi script
Date: Sun, 14 Aug 2016 12:16:43 +0200
User-agent: Mozilla/5.0 (X11; Linux i686; rv:31.0) Gecko/20100101 Thunderbird/31.4.0

Hi Alex,

you could use ⎕FIO to write information about how far you came in the script into a separate
file for debugging purposes.

I haven't seen your code, but from the error text I would assume that either you haven't provided, the CGI header, or the DOMAIN ERROR occurred before the CGI header was printed.

Have a look at the HTML workspace (provided with GNU APL) which does it like this:

**⍝ emit a CGI header (if started from a web server)**
** xZ←'' ◊ →(0=⍴,⎕ENV "GATEWAY_INTERFACE")⍴0 ⍝ nothing if not run as CGI script**
** ⍝**
** ⍝ The 'Content-type: ...' string ends with LF (and no CR)**
** ⍝ ⎕UCS 13 10 13 emits CR LF CR.**
** ⍝ Together this gives two lines, each ending with CR/LF**
** ⍝ Most tolerate LF without CR, but the CGI standard wants CR/LF**
** ⍝**
** xZ←'Content-type: text/html; charset=UTF-8', ⎕UCS 13 10 13**
As soon as the CGI header is correct every output shows up in the web page and therefore there is no need for extra debugging capabilities. Make sure thak nothing else is printed before the CGI header!

/// Jürgen

On 08/14/2016 03:27 AM, Alex Weiner wrote:
Hi Bug APL,
I am having difficulty pinning down this error that occurs when executing my script from a webserver (as a CGI script). The error does not occur when I mock up data to bypass values filled in by ⎕env, and run the script locally. I'm using apache, and the error logs are terribly opaque:
(removing personal info)

    malformed header from script 'runflake': Bad header: DOMAIN ERROR

Would it be possible to have the function and line number included in this? I'm also fairly new at CGI scripting, so if anyone can direct me to alternate debugging methods, that would work too.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]