[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Guile-commits] GNU Guile branch, master, updated. release_1-9-13-96-ga4

From: Andy Wingo
Subject: [Guile-commits] GNU Guile branch, master, updated. release_1-9-13-96-ga4342ba
Date: Mon, 22 Nov 2010 22:55:07 +0000

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU Guile".

The branch, master has been updated
       via  a4342ba82655deecc8c001d7f457ebe8db01354e (commit)
      from  015a4aaedb9e8dd839b481bc83ac5b9f88e63a81 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit a4342ba82655deecc8c001d7f457ebe8db01354e
Author: Andy Wingo <address@hidden>
Date:   Mon Nov 22 23:58:24 2010 +0100

    fix up a couple content-length issues in web/server.scm:sanitize-response
    * module/web/server.scm (sanitize-response): Allow body to be #f. Don't
      require or insert a content-length if there is no body.


Summary of changes:
 module/web/server.scm |   17 ++++++++++-------
 1 files changed, 10 insertions(+), 7 deletions(-)

diff --git a/module/web/server.scm b/module/web/server.scm
index 83997d7..0d5bd40 100644
--- a/module/web/server.scm
+++ b/module/web/server.scm
@@ -166,6 +166,8 @@
    ((list? response)
     (sanitize-response request (build-response #:headers response) body))
+   ((not body)
+    (values response #vu8()))
    ((string? body)
     (let* ((type (response-content-type response
@@ -185,13 +187,14 @@
     (sanitize-response request response (call-with-output-string body)))
    ((bytevector? body)
     ;; check length; assert type; add other required fields?
-    (values (let ((len (response-content-length response)))
-              (if len
-                  (if (= len (bytevector-length body))
-                      response
-                      (error "bad content-length" len (bytevector-length 
-                  (extend-response response 'content-length
-                                   (bytevector-length body))))
+    (values (let ((rlen (response-content-length response))
+                  (blen (bytevector-length body)))
+              (cond
+               ((rlen) (if (= rlen blen)
+                           response
+                           (error "bad content-length" rlen blen)))
+               ((zero? blen) response)
+               (else (extend-response response 'content-length blen))))
     (error "unexpected body type"))))

GNU Guile

reply via email to

[Prev in Thread] Current Thread [Next in Thread]