[Top][All Lists]

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

[Guile-commits] GNU Guile branch, stable-2.0, updated. v2.0.3-87-g61fe8e

From: Andy Wingo
Subject: [Guile-commits] GNU Guile branch, stable-2.0, updated. v2.0.3-87-g61fe8ea
Date: Thu, 22 Dec 2011 13:20:21 +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, stable-2.0 has been updated
       via  61fe8eafc236e2f76259e987d66f43e97fc1eed4 (commit)
       via  321770b2a3d7b43a7f24e5a1b3ed8bb36c411ffe (commit)
      from  cc8afa2b361635953dfba7f10e4193b1f243a50f (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 61fe8eafc236e2f76259e987d66f43e97fc1eed4
Author: Andy Wingo <address@hidden>
Date:   Thu Dec 22 08:18:05 2011 -0500

    HTTP: Fix qstring writing of cache-extension values
    * module/web/http.scm ("Cache-Control"): Write string values using the
      default val writer, to get quoting correct.
    * test-suite/tests/web-http.test (pass-if-round-trip): New helper.
      ("general headers"): Check that cache-extensions round trip properly.

commit 321770b2a3d7b43a7f24e5a1b3ed8bb36c411ffe
Author: Daniel Hartwig <address@hidden>
Date:   Sun Nov 27 22:37:24 2011 +0800

    Extend handling of "Cache-Control" header.
    * module/web/http.scm ("Cache-Control"): Value for `max-stale' is
      optional.  Strict validation for value-less directives (`no-store',
      etc.).  String values optional for "cache-extension" directives.
    * test-suite/tests/web-http.test: Value for `max-stale' is optional.


Summary of changes:
 module/web/http.scm            |   14 ++++++++++----
 test-suite/tests/web-http.test |   18 ++++++++++++++++++
 2 files changed, 28 insertions(+), 4 deletions(-)

diff --git a/module/web/http.scm b/module/web/http.scm
index dc742a1..afe70a7 100644
--- a/module/web/http.scm
+++ b/module/web/http.scm
@@ -1240,22 +1240,28 @@ phrase\"."
 (declare-key-value-list-header! "Cache-Control"
   (lambda (k v-str)
     (case k
-      ((max-age max-stale min-fresh s-maxage)
+      ((max-age min-fresh s-maxage)
        (parse-non-negative-integer v-str))
+      ((max-stale)
+       (and v-str (parse-non-negative-integer v-str)))
       ((private no-cache)
        (and v-str (split-header-names v-str)))
       (else v-str)))
   (lambda (k v)
     (case k
-      ((max-age max-stale min-fresh s-maxage)
+      ((max-age min-fresh s-maxage)
        (non-negative-integer? v))
+      ((max-stale)
+       (or (not v) (non-negative-integer? v)))
       ((private no-cache)
        (or (not v) (list-of-header-names? v)))
+      ((no-store no-transform only-if-cache must-revalidate proxy-revalidate)
+       (not v))
-       (not v))))
+       (or (not v) (string? v)))))
   (lambda (k v port)
-     ((string? v) (display v port))
+     ((string? v) (default-val-writer k v port))
      ((pair? v)
       (display #\" port)
       (write-header-list v port)
diff --git a/test-suite/tests/web-http.test b/test-suite/tests/web-http.test
index b6abbf3..7984565 100644
--- a/test-suite/tests/web-http.test
+++ b/test-suite/tests/web-http.test
@@ -45,6 +45,18 @@
             (valid-header? 'sym val))))))
+(define-syntax pass-if-round-trip
+  (syntax-rules ()
+    ((_ str)
+     (pass-if (format #f "~s round trip" str)
+       (equal? (call-with-output-string
+                (lambda (port)
+                  (call-with-values
+                      (lambda () (read-header (open-input-string str)))
+                    (lambda (sym val)
+                      (write-header sym val port)))))
+               str)))))
 (define-syntax pass-if-any-error
   (syntax-rules ()
     ((_ sym str)
@@ -83,6 +95,12 @@
                  '((private . (foo))))
   (pass-if-parse cache-control "no-cache,max-age=10"
                  '(no-cache (max-age . 10)))
+  (pass-if-parse cache-control "max-stale" '(max-stale))
+  (pass-if-parse cache-control "max-stale=10" '((max-stale . 10)))
+  (pass-if-round-trip "Cache-Control: acme-cache-extension\r\n")
+  (pass-if-round-trip "Cache-Control: acme-cache-extension=20\r\n")
+  (pass-if-round-trip "Cache-Control: acme-cache-extension=100 quux\r\n")
+  (pass-if-round-trip "Cache-Control: acme-cache-extension=\"100, quux\"\r\n")
   (pass-if-parse connection "close" '(close))
   (pass-if-parse connection "Content-Encoding" '(content-encoding))

GNU Guile

reply via email to

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