summary refs log tree commit diff
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2016-07-27 12:43:12 +0200
committerLudovic Courtès <ludo@gnu.org>2016-07-27 12:45:01 +0200
commit37402ecb4379d7199dd4b3386488261938edc780 (patch)
treec94f30b7bac52fabc8c2ddc25f2b51c9afea07aa
parent688ec13c459602d475bccd3638a6802dc0a6ce23 (diff)
downloadguix-37402ecb4379d7199dd4b3386488261938edc780.tar.gz
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'.
-rw-r--r--tests/publish.scm12
1 files changed, 10 insertions, 2 deletions
diff --git a/tests/publish.scm b/tests/publish.scm
index 0ba33487bd..4dc807505c 100644
--- a/tests/publish.scm
+++ b/tests/publish.scm
@@ -58,8 +58,16 @@
     (lambda (response body) body)))
 
 (define (http-get-port uri)
-  (call-with-values (lambda () (http-get uri #:streaming? #t))
-    (lambda (response port) port)))
+  (let ((socket (open-socket-for-uri uri)))
+    ;; 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)
   (string-append "http://localhost:6789" route))