Ludovic Courtès <l...@gnu.org> skribis: > As of commit cdc688c5ee106b7ee2547e4abd74ab81d7702d3d, it seems that the > connection reuse code for substitutes breaks if you’re fetching gzip > substitutes.
Here’s a simple reproducer that systematically fails after the first download: --8<---------------cut here---------------start------------->8--- $ ./pre-inst-env guile ~/src/guix-debugging/http-pipelining-gzip.scm ;;; (fetch 164664960) Backtrace: In ice-9/boot-9.scm: 1736:10 11 (with-exception-handler _ _ #:unwind? _ #:unwind-for-type _) In unknown file: 10 (apply-smob/0 #<thunk 7f9bf630c520>) In ice-9/boot-9.scm: 718:2 9 (call-with-prompt _ _ #<procedure default-prompt-handler (k proc)>) In ice-9/eval.scm: 619:8 8 (_ #(#(#<directory (guile-user) 7f9bf630fc80>))) In ice-9/boot-9.scm: 2806:4 7 (save-module-excursion _) 4351:12 6 (_) In /home/ludo/src/guix-debugging/http-pipelining-gzip.scm: 18:4 5 (_) In guix/http-client.scm: 116:21 4 (http-fetch _ #:port _ #:text? _ #:buffered? _ #:open-connection _ #:keep-alive? _ # _ #:headers _ # _) In web/client.scm: 526:24 3 (http-request _ #:body _ #:verify-certificate? _ #:port _ #:method _ #:version _ #:keep-alive? _ # _ # …) In web/response.scm: 198:31 2 (read-response #<input-output: string 7f9bf36c6000>) In web/http.scm: 1194:12 1 (read-response-line _) 252:2 0 (parse-http-version _ _ _) web/http.scm:252:2: In procedure parse-http-version: Bad http-version header component: ì½ --8<---------------cut here---------------end--------------->8--- Ludo’.
(use-modules (guix http-client) ((guix build download) #:select (open-connection-for-uri)) (guix utils) ((guix serialization) #:select (dump-port*)) (web uri) (web request) (web response) (srfi srfi-1)) (define %base-url "https://ci.guix.gnu.org") (define port (open-connection-for-uri (string->uri %base-url))) (let loop () (define-values (input size) (http-fetch (string->uri "https://ci.guix.gnu.org/nar/gzip/0fcjk788gj7k6gsf3zsx8j8lyw6w896b-inkscape-1.0.2") #:port port #:text? #f #:open-connection open-connection-for-uri ;/cached #:keep-alive? #t #:buffered? #f)) (define-values (decompressed pids) (decompressed-port 'gzip input)) (setvbuf decompressed 'none) (call-with-output-file "/tmp/out" (lambda (output) (setvbuf output 'none) (dump-port* decompressed output (pk 'fetch 164664960)))) ;size of compressed nar (unless (every (compose zero? cdr waitpid) pids) (error "decomp error")) (loop))