unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
* [PATCH] read-response-body should return received data when error occcurs (V2)
@ 2012-03-16  5:45 Nala Ginrut
  2012-03-16  5:54 ` Nala Ginrut
  2012-03-16 16:57 ` Ian Price
  0 siblings, 2 replies; 10+ messages in thread
From: Nala Ginrut @ 2012-03-16  5:45 UTC (permalink / raw)
  To: guile-devel

[-- Attachment #1: Type: text/plain, Size: 1320 bytes --]

From 183abb7e7d649fe4a1d1799b97e6da96f51b683c Mon Sep 17 00:00:00 2001
From: NalaGinrut <NalaGinrut@gmail.com>
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

[-- Attachment #2: Type: text/html, Size: 1662 bytes --]

^ permalink raw reply related	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2012-03-17  2:26 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-03-16  5:45 [PATCH] read-response-body should return received data when error occcurs (V2) Nala Ginrut
2012-03-16  5:54 ` Nala Ginrut
2012-03-16  5:56   ` Nala Ginrut
2012-03-16  7:32   ` Daniel Hartwig
2012-03-16  8:47     ` Nala Ginrut
2012-03-16 16:27       ` Tristan Colgate
2012-03-17  2:26         ` Nala Ginrut
2012-03-16 16:57 ` Ian Price
2012-03-16 17:25   ` Daniel Hartwig
2012-03-17  1:46     ` Nala Ginrut

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).