summary refs log tree commit diff
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2017-11-15 09:59:29 +0100
committerLudovic Courtès <ludo@gnu.org>2017-11-16 08:45:14 +0100
commit866f37fb7e4f3e0bd695a951071383cdff3da8cd (patch)
tree4537a2159fee0f1774ac39a17cec060cba484b16
parentc114c9c5d813b61f47f092489ca7ee7893936abc (diff)
downloadguix-866f37fb7e4f3e0bd695a951071383cdff3da8cd.tar.gz
download: Improve efficiency of 'write-request' over TLS.
This is another instance of <https://bugs.gnu.org/22966>.
The Microsoft-IIS/7.5 server at static.nvd.nist.gov would sometimes hang
when receiving our requests byte by byte.

* guix/build/download.scm (tls-wrap) [!guile-2.0]: Add 'setvbuf' call.
-rw-r--r--guix/build/download.scm7
1 files changed, 7 insertions, 0 deletions
diff --git a/guix/build/download.scm b/guix/build/download.scm
index 90de269f9b..4490d225e6 100644
--- a/guix/build/download.scm
+++ b/guix/build/download.scm
@@ -306,6 +306,13 @@ host name without trailing dot."
       ;; never be closed.  So we use `fileno', but keep a weak reference to
       ;; PORT, so the file descriptor gets closed when RECORD is GC'd.
       (register-tls-record-port record port)
+
+      ;; Write HTTP requests line by line rather than byte by byte:
+      ;; <https://bugs.gnu.org/22966>.  This is not possible on Guile 2.0.
+      (cond-expand
+        (guile-2.0 #f)
+        (else (setvbuf record 'line)))
+
       record)))
 
 (define (ensure-uri uri-or-string)                ;XXX: copied from (web http)