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>
This commit is contained in:
parent
399f9acee3
commit
075d99f195
|
@ -462,17 +462,18 @@ to read the response body. Return the list of results."
|
||||||
(()
|
(()
|
||||||
(reverse result))
|
(reverse result))
|
||||||
((head tail ...)
|
((head tail ...)
|
||||||
(let* ((resp (read-response p))
|
(let* ((resp (read-response p))
|
||||||
(body (response-body-port resp)))
|
(body (response-body-port resp))
|
||||||
|
(result (cons (proc head resp body) result)))
|
||||||
;; The server can choose to stop responding at any time, in which
|
;; The server can choose to stop responding at any time, in which
|
||||||
;; case we have to try again. Check whether that is the case.
|
;; 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))
|
(match (assq 'connection (response-headers resp))
|
||||||
(('connection 'close)
|
(('connection 'close)
|
||||||
(close-port p)
|
(close-port p)
|
||||||
(connect requests result)) ;try again
|
(connect tail result)) ;try again
|
||||||
(_
|
(_
|
||||||
(loop tail ;keep going
|
(loop tail result)))))))))) ;keep going
|
||||||
(cons (proc head resp body) result)))))))))))
|
|
||||||
|
|
||||||
(define (read-to-eof port)
|
(define (read-to-eof port)
|
||||||
"Read from PORT until EOF is reached. The data are discarded."
|
"Read from PORT until EOF is reached. The data are discarded."
|
||||||
|
|
Loading…
Reference in New Issue