robustness in mod-lisp-read
* tekuti/mod-lisp.scm (mod-lisp-read): Close the port if there is an error reading the request.
This commit is contained in:
parent
fc386dcb71
commit
15f024a12d
1 changed files with 11 additions and 6 deletions
|
@ -242,12 +242,17 @@
|
||||||
;; Otherwise, try to read a request from this port.
|
;; Otherwise, try to read a request from this port.
|
||||||
;; Record the next index.
|
;; Record the next index.
|
||||||
(set-mod-lisp-poll-idx! server (1- idx))
|
(set-mod-lisp-poll-idx! server (1- idx))
|
||||||
(let ((req (read-request/mod-lisp port)))
|
(with-throw-handler
|
||||||
;; Block buffering for reading body and writing response.
|
#t
|
||||||
(setvbuf port _IOFBF)
|
(lambda ()
|
||||||
(values port
|
(let ((req (read-request/mod-lisp port)))
|
||||||
req
|
;; Block buffering for reading body and writing response.
|
||||||
(read-request-body/latin-1 req))))))))))))
|
(setvbuf port _IOFBF)
|
||||||
|
(values port
|
||||||
|
req
|
||||||
|
(read-request-body/latin-1 req))))
|
||||||
|
(lambda (k . args)
|
||||||
|
(false-if-exception (close-port port)))))))))))))
|
||||||
|
|
||||||
;; -> unspecified values
|
;; -> unspecified values
|
||||||
(define (mod-lisp-write server client response body)
|
(define (mod-lisp-write server client response body)
|
||||||
|
|
Loading…
Reference in a new issue