tests: Use unbuffered input ports when decompressing from 'guix publish'.

Fixes <http://bugs.gnu.org/24060>.
Reported by Chris Marusich <cmmarusich@gmail.com>.

* tests/publish.scm (http-get-port): Explicitly call
'open-socket-for-uri' and add calls to 'setvbuf'.
This commit is contained in:
Ludovic Courtès 2016-07-27 12:43:12 +02:00
parent 688ec13c45
commit 37402ecb43
No known key found for this signature in database
GPG Key ID: 090B11993D9AEBB5
1 changed files with 10 additions and 2 deletions

View File

@ -58,8 +58,16 @@
(lambda (response body) body))) (lambda (response body) body)))
(define (http-get-port uri) (define (http-get-port uri)
(call-with-values (lambda () (http-get uri #:streaming? #t)) (let ((socket (open-socket-for-uri uri)))
(lambda (response port) port))) ;; Make sure to use an unbuffered port so that we can then peek at the
;; underlying file descriptor via 'call-with-gzip-input-port'.
(setvbuf socket _IONBF)
(call-with-values
(lambda ()
(http-get uri #:port socket #:streaming? #t))
(lambda (response port)
(setvbuf port _IONBF)
port))))
(define (publish-uri route) (define (publish-uri route)
(string-append "http://localhost:6789" route)) (string-append "http://localhost:6789" route))