guile-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Guile-commits] branch master updated: web: Client treats TLS "premature


From: Ludovic Courtès
Subject: [Guile-commits] branch master updated: web: Client treats TLS "premature termination" error as EOF.
Date: 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

commit 076276c4f580368b4106316a77752d69c8f1494a
Author: Ludovic Courtès <address@hidden>
AuthorDate: Fri Mar 6 23:04:12 2020 +0100

    web: Client treats TLS "premature termination" error as EOF.
    
    Fixes <https://bugs.gnu.org/39800>.
    Reported by <address@hidden>.
    
    * module/web/client.scm (tls-wrap)[read!]: Catch 'gnutls-error around
    'get-bytevector-some' call.
---
 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
--- a/module/web/client.scm
+++ b/module/web/client.scm
@@ -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)))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]