mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-05-20 11:40:18 +02:00
more robustness in http-read
* module/web/server/http.scm (http-read): If there was an error reading the request, be sure to close the request port.
This commit is contained in:
parent
4164be30d3
commit
b500ced6b8
1 changed files with 11 additions and 6 deletions
|
@ -113,12 +113,17 @@
|
|||
;; Otherwise, try to read a request from this port.
|
||||
;; Record the next index.
|
||||
(set-http-poll-idx! server (1- idx))
|
||||
(let ((req (read-request port)))
|
||||
;; Block buffering for reading body and writing response.
|
||||
(setvbuf port _IOFBF)
|
||||
(values port
|
||||
req
|
||||
(read-request-body/bytevector req))))))))))))
|
||||
(with-throw-handler
|
||||
#t
|
||||
(lambda ()
|
||||
(let ((req (read-request port)))
|
||||
;; Block buffering for reading body and writing response.
|
||||
(setvbuf port _IOFBF)
|
||||
(values port
|
||||
req
|
||||
(read-request-body/bytevector req))))
|
||||
(lambda (k . args)
|
||||
(false-if-exception (close-port port)))))))))))))
|
||||
|
||||
(define (keep-alive? response)
|
||||
(let ((v (response-version response)))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue