From de4cf24b0b4867d50a2044786bb5e12f25dbf42b Mon Sep 17 00:00:00 2001 From: Daniel Kochmanski Date: Tue, 12 Jun 2018 12:53:04 +0200 Subject: [PATCH] hunchentoot: lift up handler-case in acceptor-dispatch-request Method binds hunchentoot:*catch-errors-p* to NIL, so hunchentoot tries to invoke a debugger if a condition comes to it. Error condition wasn't handled by clack if it happened in handle-response, because handler-case was wrapped around funcall, not the whole expression. HANDLE-RESPONSE might have raisen an exception from SSL library (and other communication methods) for instance when peer has closed the connection - that lead to uncought closed stream error condition. Fixes #127. --- src/handler/hunchentoot.lisp | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/handler/hunchentoot.lisp b/src/handler/hunchentoot.lisp index aac78b82..67d81113 100644 --- a/src/handler/hunchentoot.lisp +++ b/src/handler/hunchentoot.lisp @@ -62,13 +62,12 @@ (let ((app (acceptor-app acceptor)) (env (acceptor-handle-request acceptor req)) (hunchentoot:*catch-errors-p* nil)) - (handle-response - (if (acceptor-debug acceptor) - (funcall app env) - (handler-case (funcall app env) - (error (error) - (princ error *error-output*) - '(500 () ("Internal Server Error")))))))) + (if (acceptor-debug acceptor) + (handle-response (funcall app env)) + (handler-case (handle-response (funcall app env)) + (error (error) + (princ error *error-output*) + '(500 () ("Internal Server Error"))))))) (defmethod hunchentoot:process-connection :around ((acceptor clack-acceptor) socket) (let ((flex:*substitution-char* #-(or abcl lispworks) #\Replacement_Character