diff options
author | Andy Patterson <ajpatter@uwaterloo.ca> | 2015-07-07 00:52:16 +0200 |
---|---|---|
committer | Ludovic Courtès <ludo@gnu.org> | 2015-07-07 01:04:02 +0200 |
commit | 075d99f19599b2903490942d8c3717cdd5b5d31e (patch) | |
tree | 2d65b981e7576ea861047c0e7cf65555f3045a0a | |
parent | 399f9acee3be2825e93cdb0832f5b9e3e43fa283 (diff) | |
download | guix-075d99f19599b2903490942d8c3717cdd5b5d31e.tar guix-075d99f19599b2903490942d8c3717cdd5b5d31e.tar.gz |
substitute: Avoid infinite loop when updating the substitute list.
Reported
at <http://lists.gnu.org/archive/html/guix-devel/2015-07/msg00119.html>.
* guix/scripts/substitute.scm (http-multiple-get): When RESP has "Connection:
close", consume HEAD anyway; always call PROC to read from BODY.
Co-authored-by: Ludovic Courtès <ludo@gnu.org>
-rwxr-xr-x | 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 8b4fa36d2a..0baba91981 100755 --- a/guix/scripts/substitute.scm +++ b/guix/scripts/substitute.scm @@ -462,17 +462,18 @@ to read the response body. Return the list of results." (() (reverse result)) ((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)) (('connection 'close) (close-port p) - (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." |