[Lispweb] IMHO + mod_lisp

Ng Pheng Siong ngps at netmemetic.com
Tue May 7 11:13:00 CDT 2002


On Tue, May 07, 2002 at 11:08:38AM -0400, Marco Antoniotti wrote:
> > Looks like write-sequence croaked when attempting to write testapp1's HTML
> > output... 
> 
> Yes. There seem to be two errors here.  Is there a declaration for the
> variable `body' above?

Doesn't look like it. Since the code is short, I hope the list doesn't mind
my posting it (this is from the file mod-lisp.lisp):

;; a callback function which writes the output of IMHO to mod_lisp
;; with the necessary headers
(defun mod-lisp-response (request)
  (let ((stream (request-stream request)))
    (write-header-line stream "Status" "200 OK")
    (write-header-line stream "Content-Type" (request-response-type request))
    
    (let ((body (request-response-body request)))
      (when (and (consp body) (equal (car body) :data))
        (setq body (cdr body)))
      
      (if (request-response-length request)
          (write-header-line stream "Content-Length"
                             (princ-to-string (request-response-length request)))
          (write-header-line stream "Content-Length"
                             (princ-to-string (length body))))

      (when *keep-mod-lisp-socket*
        (write-header-line stream "Keep-Socket" "1"))
      
      (write-string "end" stream)
      (write-char #\NewLine stream)
      (write-sequence body stream))))

The last line above is the one that croaks; my http client sees the "end"
and the #\NewLine after it.
         
Cheers.
-- 
Ng Pheng Siong <ngps at netmemetic.com> * http://www.netmemetic.com




More information about the lispweb mailing list