Fix exception handling for the web server exception handler
Don't crash if it returns a response with invalid headers.
This commit is contained in:
parent
e3bc3c12b0
commit
710972691b
1 changed files with 52 additions and 30 deletions
|
@ -345,36 +345,58 @@ on the procedure being called at any particular time."
|
|||
(lambda (return)
|
||||
(with-exception-handler
|
||||
(lambda (exn)
|
||||
(call-with-values
|
||||
(lambda ()
|
||||
(exception-handler exn request))
|
||||
(match-lambda*
|
||||
((response body)
|
||||
(call-with-values
|
||||
(lambda ()
|
||||
(sanitize-response request response body))
|
||||
return))
|
||||
(other
|
||||
(call-with-values
|
||||
(lambda ()
|
||||
(default-exception-handler
|
||||
(make-exception-with-irritants
|
||||
(list (make-exception-with-message
|
||||
(simple-format
|
||||
#f
|
||||
"wrong number of values returned from exception handler, expecting 2, got ~A"
|
||||
(length other)))
|
||||
exception-handler))
|
||||
request))
|
||||
(match-lambda*
|
||||
((response body)
|
||||
(call-with-values
|
||||
(lambda ()
|
||||
(sanitize-response
|
||||
request
|
||||
response
|
||||
body))
|
||||
return))))))))
|
||||
(with-exception-handler
|
||||
(lambda (exn)
|
||||
(call-with-values
|
||||
(lambda ()
|
||||
(default-exception-handler
|
||||
(make-exception
|
||||
exn
|
||||
(make-exception-with-message
|
||||
"exception in exception handler")
|
||||
(make-exception-with-irritants
|
||||
exception-handler))
|
||||
request))
|
||||
(match-lambda*
|
||||
((response body)
|
||||
(call-with-values
|
||||
(lambda ()
|
||||
(sanitize-response
|
||||
request
|
||||
response
|
||||
body))
|
||||
return)))))
|
||||
(lambda ()
|
||||
(call-with-values
|
||||
(lambda ()
|
||||
(exception-handler exn request))
|
||||
(match-lambda*
|
||||
((response body)
|
||||
(call-with-values
|
||||
(lambda ()
|
||||
(sanitize-response request response body))
|
||||
return))
|
||||
(other
|
||||
(call-with-values
|
||||
(lambda ()
|
||||
(default-exception-handler
|
||||
(make-exception-with-irritants
|
||||
(list (make-exception-with-message
|
||||
(simple-format
|
||||
#f
|
||||
"wrong number of values returned from exception handler, expecting 2, got ~A"
|
||||
(length other)))
|
||||
exception-handler))
|
||||
request))
|
||||
(match-lambda*
|
||||
((response body)
|
||||
(call-with-values
|
||||
(lambda ()
|
||||
(sanitize-response
|
||||
request
|
||||
response
|
||||
body))
|
||||
return))))))))))
|
||||
(lambda ()
|
||||
(start-stack
|
||||
#t
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue