1
0
mirror of https://git.savannah.gnu.org/git/guix.git synced 2026-05-24 18:11:51 +02:00

publish: Restore gzip compression in cache-less mode.

Fixes <https://bugs.gnu.org/30184>.
Regression introduced in 297e04d660.
Reported by Christopher Baines <mail@cbaines.net>.

* guix/scripts/publish.scm (nar-response-port): Add 'compression'
parameter and honor it.
(http-write): Get 'x-nar-compression' from the initial RESPONSE.
This commit is contained in:
Ludovic Courtès
2018-01-22 10:46:34 +01:00
parent 3b6502e25d
commit 33988f9b58
2 changed files with 25 additions and 7 deletions
+16
View File
@@ -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 <https://bugs.gnu.org/30184>.
(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"