[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Guile-commits] branch master updated: web: Client treats TLS "premature
[Guile-commits] branch master updated: web: Client treats TLS "premature termination" error as EOF.
Fri, 06 Mar 2020 17:46:12 -0500
This is an automated email from the git hooks/post-receive script.
civodul pushed a commit to branch master
in repository guile.
The following commit(s) were added to refs/heads/master by this push:
new 076276c web: Client treats TLS "premature termination" error as EOF.
076276c is described below
Author: Ludovic CourtÃ¨s <address@hidden>
AuthorDate: Fri Mar 6 23:04:12 2020 +0100
web: Client treats TLS "premature termination" error as EOF.
Reported by <address@hidden>.
* module/web/client.scm (tls-wrap)[read!]: Catch 'gnutls-error around
module/web/client.scm | 13 ++++++++++++-
1 file changed, 12 insertions(+), 1 deletion(-)
diff --git a/module/web/client.scm b/module/web/client.scm
index 67d926f..769f3ec 100644
@@ -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)
+ (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)))
|[Prev in Thread]
||[Next in Thread]|
- [Guile-commits] branch master updated: web: Client treats TLS "premature termination" error as EOF.,
Ludovic Courtès <=