diff options
author | Christopher Baines <mail@cbaines.net> | 2021-01-07 20:18:57 +0000 |
---|---|---|
committer | Christopher Baines <mail@cbaines.net> | 2021-02-22 19:53:45 +0000 |
commit | 43ed93a6ef84be2699edd5987142e6f7c71e96cb (patch) | |
tree | 9bf552b94ca9c45fb7a0cea1e054a7971bf5afe8 | |
parent | e35603affbc6d46c48281ba2576380290c46ef76 (diff) | |
download | guix-43ed93a6ef84be2699edd5987142e6f7c71e96cb.tar guix-43ed93a6ef84be2699edd5987142e6f7c71e96cb.tar.gz |
http-client: Accept #:open-connection in http-fetch.
So that an alternative procedure can be passed in, perhaps to perform
connection caching.
* guix/http-client.scm (http-fetch): Add an #:open-connection keyword
argument.
-rw-r--r-- | guix/http-client.scm | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/guix/http-client.scm b/guix/http-client.scm index 3aba3b28c1..2d7458a56e 100644 --- a/guix/http-client.scm +++ b/guix/http-client.scm @@ -75,6 +75,7 @@ (define* (http-fetch uri #:key port (text? #f) (buffered? #t) + (open-connection guix:open-connection-for-uri) (keep-alive? #f) (verify-certificate? #t) (headers '((user-agent . "GNU Guile"))) @@ -97,10 +98,10 @@ Raise an '&http-get-error' condition if downloading fails." (let loop ((uri (if (string? uri) (string->uri uri) uri))) - (let ((port (or port (guix:open-connection-for-uri uri - #:verify-certificate? - verify-certificate? - #:timeout timeout))) + (let ((port (or port (open-connection uri + #:verify-certificate? + verify-certificate? + #:timeout timeout))) (headers (match (uri-userinfo uri) ((? string? str) (cons (cons 'Authorization |