diff options
author | Ludovic Courtès <ludo@gnu.org> | 2013-04-27 23:00:21 +0200 |
---|---|---|
committer | Ludovic Courtès <ludo@gnu.org> | 2013-04-27 23:00:21 +0200 |
commit | 61ef22f432933a51dfe9e286488689abb84c1b92 (patch) | |
tree | ac7067079af293131e2e12bf12339dae9fd0041c | |
parent | c4ca12c15b27cc13b747c184abde1e9de3c46606 (diff) | |
download | guix-61ef22f432933a51dfe9e286488689abb84c1b92.tar.gz guix-61ef22f432933a51dfe9e286488689abb84c1b92.zip |
web: Add 2.0.5 workaround for responses without content-length.
* guix/web.scm (read-response-body*)[when-guile<=2.0.5]: Support
responses without content-length.
Reported by Andreas Enge <andreas@enge.fr>.
-rw-r--r-- | guix/web.scm | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/guix/web.scm b/guix/web.scm index 3348d42b47..0fa3f8aa0c 100644 --- a/guix/web.scm +++ b/guix/web.scm @@ -121,12 +121,15 @@ closed it will also close PORT, unless the KEEP-ALIVE? is true." #:keep-alive? #t))) (get-bytevector-all chunk-port)) (let ((nbytes (response-content-length r))) - (and nbytes - (let ((bv (get-bytevector-n (response-port r) nbytes))) - (if (= (bytevector-length bv) nbytes) - bv - (bad-response "EOF while reading response body: ~a bytes of ~a" - (bytevector-length bv) nbytes))))))) + ;; Backport of Guile commit 84dfde82ae8f6ec247c1c147c1e2ae50b207bad9 + ;; ("fix response-body-port for responses without content-length"). + (if nbytes + (let ((bv (get-bytevector-n (response-port r) nbytes))) + (if (= (bytevector-length bv) nbytes) + bv + (bad-response "EOF while reading response body: ~a bytes of ~a" + (bytevector-length bv) nbytes))) + (get-bytevector-all (response-port r)))))) ;; Install this patch only on Guile 2.0.5. (when (version>? "2.0.6" (version)) |