From 33988f9b5876e4b44cabe1997a91eb604931c1ca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= Date: Mon, 22 Jan 2018 10:46:34 +0100 Subject: publish: Restore gzip compression in cache-less mode. Fixes . Regression introduced in 297e04d66010ada31a40f40143d81bf6b62affcc. Reported by Christopher Baines . * guix/scripts/publish.scm (nar-response-port): Add 'compression' parameter and honor it. (http-write): Get 'x-nar-compression' from the initial RESPONSE. --- tests/publish.scm | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'tests/publish.scm') diff --git a/tests/publish.scm b/tests/publish.scm index bd1a75cf00..8c88a8c93d 100644 --- a/tests/publish.scm +++ b/tests/publish.scm @@ -111,6 +111,10 @@ (sleep 1) (loop (- i 1)))))) +(define %gzip-magic-bytes + ;; Magic bytes of gzip file. + #vu8(#x1f #x8b)) + ;; Wait until the two servers are ready. (wait-until-ready 6789) @@ -213,6 +217,18 @@ FileSize: ~a~%" (cut restore-file <> temp))) (call-with-input-file temp read-string)))) +(unless (zlib-available?) + (test-skip 1)) +(test-equal "/nar/gzip/* is really gzip" + %gzip-magic-bytes + ;; Since 'gzdopen' (aka. 'call-with-gzip-input-port') transparently reads + ;; uncompressed gzip, the test above doesn't check whether it's actually + ;; gzip. This is what this test does. See . + (let ((nar (http-get-port + (publish-uri + (string-append "/nar/gzip/" (basename %item)))))) + (get-bytevector-n nar (bytevector-length %gzip-magic-bytes)))) + (unless (zlib-available?) (test-skip 1)) (test-equal "/*.narinfo with compression" -- cgit v1.2.3