From 183abb7e7d649fe4a1d1799b97e6da96f51b683c Mon Sep 17 00:00:00 2001 From: NalaGinrut Date: Fri, 16 Mar 2012 13:41:34 +0800 Subject: [PATCH] read-response-body returns received data when error occurs --- module/web/response.scm | 10 +++++----- 1 files changed, 5 insertions(+), 5 deletions(-) diff --git a/module/web/response.scm b/module/web/response.scm index 07e1245..5c6861a 100644 --- a/module/web/response.scm +++ b/module/web/response.scm @@ -228,12 +228,12 @@ This is true for some response types, like those with code 304." "Reads the response body from @var{r}, as a bytevector. Returns @code{#f} if there was no response body." (let ((nbytes (response-content-length r))) - (and nbytes - (let ((bv (get-bytevector-n (response-port r) nbytes))) - (if (= (bytevector-length bv) nbytes) - bv + (and nbytes + (let* ((bv (get-bytevector-n (response-port r) nbytes))) + (if (eof-object? bv) (bad-response "EOF while reading response body: ~a bytes of ~a" - (bytevector-length bv) nbytes)))))) + 0 nbytes) + bv))))) (define (write-response-body r bv) "Write @var{bv}, a bytevector, to the port corresponding to the HTTP -- 1.7.0.4