[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
01/07: download: 'tls-wrap' treats premature TLS termination as EOF.
From: |
guix-commits |
Subject: |
01/07: download: 'tls-wrap' treats premature TLS termination as EOF. |
Date: |
Fri, 19 Mar 2021 18:04:01 -0400 (EDT) |
civodul pushed a commit to branch master
in repository guix.
commit 43937666ba6975b6c847be8e67cecd781ce27049
Author: Ludovic Courtès <ludo@gnu.org>
AuthorDate: Fri Mar 19 14:23:57 2021 +0100
download: 'tls-wrap' treats premature TLS termination as EOF.
This is a backport of Guile commit
076276c4f580368b4106316a77752d69c8f1494a.
* guix/build/download.scm (tls-wrap)[read!]: Wrap 'get-bytevector-n!'
call in 'catch' and handle 'error/premature-termination' GnuTLS errors.
---
guix/build/download.scm | 20 ++++++++++++++++----
1 file changed, 16 insertions(+), 4 deletions(-)
diff --git a/guix/build/download.scm b/guix/build/download.scm
index f24a1e2..a22d406 100644
--- a/guix/build/download.scm
+++ b/guix/build/download.scm
@@ -305,10 +305,22 @@ host name without trailing dot."
(let ((record (session-record-port session)))
(define (read! bv start count)
- (let ((read (get-bytevector-n! record bv start count)))
- (if (eof-object? read)
- 0
- read)))
+ (define read
+ (catch 'gnutls-error
+ (lambda ()
+ (get-bytevector-n! record bv start count))
+ (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)
+ 0
+ read))
(define (write! bv start count)
(put-bytevector record bv start count)
(force-output record)
- branch master updated (1ab03fb -> 6457985), guix-commits, 2021/03/19
- 01/07: download: 'tls-wrap' treats premature TLS termination as EOF.,
guix-commits <=
- 02/07: doc: Add 'shepherd-service' example., guix-commits, 2021/03/19
- 03/07: build-self: Silent Guile warnings while computing the derivation., guix-commits, 2021/03/19
- 04/07: gnu: Add git2cl., guix-commits, 2021/03/19
- 05/07: gnu: Add fzf., guix-commits, 2021/03/19
- 06/07: gnu: abseil-cpp: Update to 20200923.3., guix-commits, 2021/03/19
- 07/07: gnu: abseil-cpp: Patch sterror_test., guix-commits, 2021/03/19