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.
This commit is contained in:
Ludovic Courtès 2017-11-15 09:59:29 +01:00
parent c114c9c5d8
commit 866f37fb7e
No known key found for this signature in database
GPG Key ID: 090B11993D9AEBB5
1 changed files with 7 additions and 0 deletions

View File

@ -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)