[Ecls-list] Building a CGI program

Matthew Mondor mm_lists at pulsar-zone.net
Tue Jun 18 22:33:25 UTC 2013


On Tue, 18 Jun 2013 17:16:47 +0100
William Hounslow <hounslow at users.sourceforge.net> wrote:

> malformed header from script. Bad header=No restarts available.: testpage

It seems that the executable signals a condition for which there exists
no handler or restart, but it's difficult to find out why without more
details.

Verify that the unprivileged user Apache runs under has read access to
the ECL libraries.

If that still doesn't help, I suggest tracing the Apache processes
using a tool such as strace (or ktrace on BSD), in attempt to find out
if more error details can be discovered...  It should show events such
as fork(), the establishment of communication file descriptors (i.e.
including possibly dup2()), followed by execve() or equivalent, and the
output of the script should be fully seen being sent to Apache from the
CGI.

Perhaps another idea would be to wrap your CL code into a condition
handler which prints on one line the condition such that Apache logs
might show it as a bad header:

(handler-case
    (progn
      (princ "Content-type: text/html")
      (terpri)
      (terpri)
      (princ "Hello, World.")
      (values))
  (t (e)
    (princ
     (substitute #\_ #\Newline
                 (format nil "~S: ~A" (type-of e) e)))
    (terpri)
    (values)))

Or perhaps even:

(defun test ()
  (let ((*debugger-hook* #'(lambda (e hook)
                             (declare (ignore hook))
                             (princ
                              (substitute #\_ #\Newline
                                          (format nil "~S: ~A" (type-of e) e)))
                             (terpri)
                             (ext:exit -1))))
    (princ "Content-type: text/html")
    (terpri)
    (terpri)
    (princ "Hello, World.")
    (values)))
(test)


http://www.jlk.net/apache/debugging_cgi.shtml might also be helpful.
-- 
Matt




More information about the ecl-devel mailing list