mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-05-20 11:40:18 +02:00
web: Client treats TLS "premature termination" error as EOF.
Fixes <https://bugs.gnu.org/39800>. Reported by <franco.rcr@gmail.com>. * module/web/client.scm (tls-wrap)[read!]: Catch 'gnutls-error around 'get-bytevector-some' call.
This commit is contained in:
parent
8a25546a94
commit
076276c4f5
1 changed files with 12 additions and 1 deletions
|
@ -243,7 +243,18 @@ host name without trailing dot."
|
|||
;; underlying socket.
|
||||
(let ((record (session-record-port session)))
|
||||
(define (read! bv start count)
|
||||
(define read-bv (get-bytevector-some record))
|
||||
(define read-bv
|
||||
(catch 'gnutls-error
|
||||
(lambda ()
|
||||
(get-bytevector-some record))
|
||||
(lambda (key err proc . rest)
|
||||
;; When responding to "Connection: close" requests, some
|
||||
;; servers close the connection abruptly after sending the
|
||||
;; response body, without doing a proper TLS connection
|
||||
;; termination. Treat it as EOF.
|
||||
(if (eq? err error/premature-termination)
|
||||
the-eof-object
|
||||
(apply throw key err proc rest)))))
|
||||
(if (eof-object? read-bv)
|
||||
0 ; read! returns 0 on eof-object
|
||||
(let ((read-bv-len (bytevector-length read-bv)))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue