[kpax-devel] Dropping into the debugger
Joel Reymont
joel at whylisp.com
Sat Oct 14 17:13:39 UTC 2006
On Oct 13, 2006, at 9:34 PM, Sven Van Caekenberghe wrote:
> Unless the API and packages are identical, you might have to make
> another front-end (server-class):
The problem is that commit is called internally after redirect-to.
The function is implemented differently for paserve and s-http-
server, though.
s-http-server:
(defmethod commit ((request-response s-http-server-request-response))
(with-slots (response-state content-stream socket-stream request-
state)
request-response
(unless (eql request-state :body-read)
(get-request-body request-response))
(unless (eql response-state :response-written)
(let* ((output (when content-stream (get-output-stream-string
content-stream)))
(size (if output (length output) 0)))
(commit-headers request-response size)
(when (plusp size) (write-string output socket-stream))))
(finish-output socket-stream)
(setf response-state :response-flushed)))
Notice how nothing is done above, basically, when there's no content
stream.
(defmethod commit ((request-response paserve-request-response))
(with-slots (paserve-request paserve-entity content-stream
response-status response-mime-type)
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)
(let ((output (get-output-stream-string content-stream)))
(setf (net.aserve:request-reply-content-length paserve-
request) (length output))
(write-string output net.aserve::*html-stream*)
(log-info request-response "replied ~d bytes with status
~a" (length output) response-status))))))
Thanks, Joel
--
http://whylisp.com
More information about the kpax-devel
mailing list