substitute: Remove connection handling from fetch.

http-fetch does this, so just use that code instead.

* guix/scripts/substitute.scm (fetch): Remove connection handling when the
port is closed.
This commit is contained in:
Christopher Baines 2021-01-07 19:37:20 +00:00
parent fbd61b5d3d
commit 08acee2f98
No known key found for this signature in database
GPG key ID: 5E28A33B0B84F577

View file

@ -200,14 +200,10 @@ (define* (fetch uri #:key (buffered? #t) (timeout? #t)
(warning (G_ "while fetching ~a: server is somewhat slow~%")
(uri->string uri))
(warning (G_ "try `--no-substitutes' if the problem persists~%")))
(begin
(when (or (not port) (port-closed? port))
(set! port (guix:open-connection-for-uri
uri #:verify-certificate? #f)))
(http-fetch uri #:text? #f #:port port
#:keep-alive? keep-alive?
#:buffered? buffered?
#:verify-certificate? #f))))))
(http-fetch uri #:text? #f #:port port
#:keep-alive? keep-alive?
#:buffered? buffered?
#:verify-certificate? #f)))))
(else
(leave (G_ "unsupported substitute URI scheme: ~a~%")
(uri->string uri)))))