[hunchentoot-devel] beginners output problem

Andy Chambers achambers.home at googlemail.com
Sat Jun 2 20:40:16 UTC 2007


The send-reply function below is part of some code that transforms
sexp's according to specified rules a-la-sxml from the scheme world.

My problem is that when I evaluate the let form on its own, it returns
"<HTML></HTML>" as expected.  However, when I request the page served
by the easy-handler, I get the following condition.

I/O timeout reading #<SB-SYS:FD-STREAM for "a constant string" {B84B211}>

I'm using sbcl on debian with hunchentoot just asdf-intalled as a
local package.  Can anyone suggest why the let form would evaluate ok
on its own but not inside the easy-handler?

Cheers,
Andy



(defun send-reply (&optional s &rest fragments)
  "Output the fragments to the specified stream"
  (labels ((descend (fragments
 &optional result)
             (cond
               ((null fragments) result)
               ((not (car fragments)) (descend (cdr fragments)
result))
               ((null (car fragments)) (descend (cdr fragments)
result))
               ((eq t (car fragments)) (descend (cdr fragments) t))
               ((consp (car fragments))
                (descend (cdr fragments) (descend (car fragments)
result)))
               ((functionp (car fragments))
                (funcall (car fragments))
                (descend (cdr fragments) t))
               (t (format s "~a" (car fragments))
                  (descend (cdr fragments) t)))))
    (descend fragments)))

(define-easy-handler (test :uri "/test"
                           :default-request-type :get)
    ()
  (let ((out (with-output-to-string (s)
               (send-reply s '(#\< HTML (#\> "</" HTML #\>))))))
    out))



More information about the Tbnl-devel mailing list