[Lispweb] IMHO + mod_lisp

Marco Antoniotti marcoxa at cs.nyu.edu
Tue May 7 12:36:48 CDT 2002


> From: Ng Pheng Siong <ngps at netmemetic.com>
> Cc: ngps at netmemetic.com, lispweb at red-bean.com
> Content-Disposition: inline
> Sender: lispweb-admin at red-bean.com
> Date: Wed, 8 May 2002 00:13:00 +0800
> X-Filter-Version: 1.8 (cat)
> 
> 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)))

Well, it may be that CMUCL infers the return type of
`request-response-body' in an unexpected way.

>       (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.

Could you try to insert the following calls before the WRITE-SEQUENCE?

      (format *some-appropriate-debugging-stream*
              ";;; Just before WRITE-SEQUENCE~@
               ;;;      type of body is ~S~@
               ;;;      stream element type is ~S~%"
              (type-of body)
              (stream-element-type stream))

Cheers

PS. Maybe we should move this to the cmucl-imp mailing list.


-- 
Marco Antoniotti ========================================================
NYU Courant Bioinformatics Group        tel. +1 - 212 - 998 3488
719 Broadway 12th Floor                 fax  +1 - 212 - 995 4122
New York, NY 10003, USA                 http://bioinformatics.cat.nyu.edu
                    "Hello New York! We'll do what we can!"
                           Bill Murray in `Ghostbusters'.



More information about the lispweb mailing list