diff options
author | Mark H Weaver <mhw@netris.org> | 2016-03-15 12:40:53 -0400 |
---|---|---|
committer | Mark H Weaver <mhw@netris.org> | 2016-03-15 12:40:53 -0400 |
commit | a3b84f70d8bc992a0fc38cabdf12d48ff5e10e15 (patch) | |
tree | ba2c4880e3f4ce6509ff219d0fd646493d085e1d /guix/http-client.scm | |
parent | 2c9f0b077018d2cac599bd2f466769cd5ffd3adc (diff) | |
parent | 20095cc5139666fe67b3ae76b3f46ff85e4956bb (diff) |
Merge branch 'master' into security-updates
Diffstat (limited to 'guix/http-client.scm')
-rw-r--r-- | guix/http-client.scm | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/guix/http-client.scm b/guix/http-client.scm index 2161856c63..25693824ed 100644 --- a/guix/http-client.scm +++ b/guix/http-client.scm @@ -222,11 +222,14 @@ or if EOF is reached." (module-define! (resolve-module '(web client)) 'shutdown (const #f)) -(define* (http-fetch uri #:key port (text? #f) (buffered? #t)) +(define* (http-fetch uri #:key port (text? #f) (buffered? #t) + keep-alive?) "Return an input port containing the data at URI, and the expected number of bytes available or #f. If TEXT? is true, the data at URI is considered to be textual. Follow any HTTP redirection. When BUFFERED? is #f, return an -unbuffered port, suitable for use in `filtered-port'. +unbuffered port, suitable for use in `filtered-port'. When KEEP-ALIVE? is +true, send a 'Connection: keep-alive' HTTP header, in which case PORT may be +reused for future HTTP requests. Raise an '&http-get-error' condition if downloading fails." (let loop ((uri (if (string? uri) @@ -246,8 +249,10 @@ Raise an '&http-get-error' condition if downloading fails." ;; Try hard to use the API du jour to get an input port. (if (guile-version>? "2.0.7") (http-get uri #:streaming? #t #:port port + #:keep-alive? #t #:headers auth-header) ; 2.0.9+ (http-get* uri #:decode-body? text? ; 2.0.7 + #:keep-alive? #t #:port port #:headers auth-header))) ((code) (response-code resp))) |