[kpax-devel] Dropping into the debugger

Sven Van Caekenberghe scaekenberghe at common-lisp.net
Sat Oct 14 19:56:25 UTC 2006


On 14 Oct 2006, at 19:13, Joel Reymont wrote:

> Notice how nothing is done above, basically, when there's no  
> content stream.

There was even more wrong in commit in paserve.lisp (custom response  
headers were not passed to paserve).
The following version (also available in the darcs repository) makes  
the redirect work in the reddit example:

(defmethod commit ((request-response paserve-request-response))
   (with-slots (paserve-request paserve-entity content-stream  
response-status response-mime-type response-headers)
       request-response
     (net.aserve:with-http-response
         (paserve-request paserve-entity
                          :content-type response-mime-type
                          :response (response-status-to-paserve- 
status response-status))
       (net.aserve:with-http-body
           (paserve-request paserve-entity :headers response-headers)
         (let* ((output (when content-stream (get-output-stream- 
string content-stream)))
                (size (if output (length output) 0)))
           (setf (net.aserve:request-reply-content-length paserve- 
request) size)
           (when (plusp size) (write-string output net.aserve::*html- 
stream*))
           (log-info request-response "replied ~d bytes with status  
~a" size response-status))))))

There might be more bitrot in the paserve.lisp file - I haven't  
actually ran or used paserve in a very long while.
Anyway, thanks for pointing this out and spotting the actual problem!
I guess you did get multithreaded debugging working under slime ;-)
Anyway, the following might also help:
	(net.aserve::debug-on :notrap)
	(net.aserve::note-debug-set)
The first form causes paserve to enter the debugger on errors  
(itself, apart from kpax),
the second form reports the current debug settings.

Sven




More information about the kpax-devel mailing list