[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
02/02: substitute: Avoid infinite loop when updating the substitute list
02/02: substitute: Avoid infinite loop when updating the substitute list.
Mon, 06 Jul 2015 23:08:45 +0000
civodul pushed a commit to branch master
in repository guix.
Author: Andy Patterson <address@hidden>
Date: Tue Jul 7 00:52:16 2015 +0200
substitute: Avoid infinite loop when updating the substitute list.
* guix/scripts/substitute.scm (http-multiple-get): When RESP has
close", consume HEAD anyway; always call PROC to read from BODY.
Co-authored-by: Ludovic CourtÃ¨s <address@hidden>
guix/scripts/substitute.scm | 11 ++++++-----
1 files changed, 6 insertions(+), 5 deletions(-)
diff --git a/guix/scripts/substitute.scm b/guix/scripts/substitute.scm
index 8b4fa36..0baba91 100755
@@ -462,17 +462,18 @@ to read the response body. Return the list of results."
((head tail ...)
- (let* ((resp (read-response p))
- (body (response-body-port resp)))
+ (let* ((resp (read-response p))
+ (body (response-body-port resp))
+ (result (cons (proc head resp body) result)))
;; The server can choose to stop responding at any time, in which
;; case we have to try again. Check whether that is the case.
+ ;; Note that even upon "Connection: close", we can read from BODY.
(match (assq 'connection (response-headers resp))
- (connect requests result)) ;try again
+ (connect tail result)) ;try again
- (loop tail ;keep going
- (cons (proc head resp body) result)))))))))))
+ (loop tail result)))))))))) ;keep going
(define (read-to-eof port)
"Read from PORT until EOF is reached. The data are discarded."