summaryrefslogtreecommitdiff
path: root/guix
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2016-03-10 13:53:23 +0100
committerLudovic Courtès <ludo@gnu.org>2016-03-10 13:55:30 +0100
commitec278439f3ff5dcd3d02c05099ba1724cc2459f1 (patch)
tree94073bd7dfff433142aa452f1a46132ebece8063 /guix
parent9b7bd1b160be7c740a798c09e3b8986368b92036 (diff)
substitute: Optimize HTTP pipelining over TLS.
* guix/scripts/substitute.scm (http-multiple-get): Write the requests to a bytevector output port before sending them.
Diffstat (limited to 'guix')
-rwxr-xr-xguix/scripts/substitute.scm13
1 files changed, 11 insertions, 2 deletions
diff --git a/guix/scripts/substitute.scm b/guix/scripts/substitute.scm
index cc637c8d13..b057e9b12a 100755
--- a/guix/scripts/substitute.scm
+++ b/guix/scripts/substitute.scm
@@ -495,8 +495,17 @@ read the response body, and the previous result, starting with SEED, à la
(setvbuf p _IOFBF (expt 2 16)))
;; Send all of REQUESTS in a row.
- (for-each (cut write-request <> p) requests)
- (force-output p)
+ ;; XXX: Do our own caching to work around inefficiencies when
+ ;; communicating over TLS: <http://bugs.gnu.org/22966>.
+ (let-values (((buffer get) (open-bytevector-output-port)))
+ ;; On Guile > 2.0.9, inherit the HTTP proxying property from P.
+ (when (module-variable (resolve-interface '(web http))
+ 'http-proxy-port?)
+ (set-http-proxy-port?! buffer (http-proxy-port? p)))
+
+ (for-each (cut write-request <> buffer) requests)
+ (put-bytevector p (get))
+ (force-output p))
;; Now start processing responses.
(let loop ((requests requests)