guile-commits
[Top][All Lists]
Advanced

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

[Guile-commits] GNU Guile branch, master, updated. release_1-9-13-133-g9


From: Andy Wingo
Subject: [Guile-commits] GNU Guile branch, master, updated. release_1-9-13-133-g9eed101
Date: Mon, 06 Dec 2010 12:48:55 +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".

http://git.savannah.gnu.org/cgit/guile.git/commit/?id=9eed1010e7cdc39c7c0ac18a34414f3653da7a5a

The branch, master has been updated
       via  9eed1010e7cdc39c7c0ac18a34414f3653da7a5a (commit)
      from  adcd58543c110f58d681e80c8e4e76d1f7f34577 (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 9eed1010e7cdc39c7c0ac18a34414f3653da7a5a
Author: Andy Wingo <address@hidden>
Date:   Mon Dec 6 13:52:56 2010 +0100

    leniency regarding quality values in http.scm
    
    * module/web/http.scm: Add commentary.
      (parse-quality): Allow .NNN to be interpreted as 0.NNN.
    
    * test-suite/tests/web-http.test ("request headers"): Add a test.

-----------------------------------------------------------------------

Summary of changes:
 module/web/http.scm            |   20 ++++++++++++++++++++
 test-suite/tests/web-http.test |    2 ++
 2 files changed, 22 insertions(+), 0 deletions(-)

diff --git a/module/web/http.scm b/module/web/http.scm
index bf54b23..6416b1b 100644
--- a/module/web/http.scm
+++ b/module/web/http.scm
@@ -17,6 +17,16 @@
 ;; Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
 ;; 02110-1301 USA
 
+;;; Commentary:
+;;;
+;;; This module has a number of routines to parse textual
+;;; representations of HTTP data into native Scheme data structures.
+;;;
+;;; It tries to follow RFCs fairly strictly---the road to perdition
+;;; being paved with compatibility hacks---though some allowances are
+;;; made for not-too-divergent texts (like a quality of .2 which should
+;;; be 0.2, etc).
+;;;
 ;;; Code:
 
 (define-module (web http)
@@ -316,6 +326,16 @@
                           (+ q (* place (char->decimal (string-ref str i))))
                           q))))
             (bad-header-component 'quality str))))
+   ;; Allow the nonstandard .2 instead of 0.2.
+   ((and (eqv? (string-ref str start) #\.)
+         (< 1 (- end start) 5))
+    (let lp ((place 1) (i (+ start 3)) (q 0))
+      (if (= i start)
+          q
+          (lp (* 10 place) (1- i)
+              (if (< i end)
+                  (+ q (* place (char->decimal (string-ref str i))))
+                  q)))))
    (else
     (bad-header-component 'quality str))))
 
diff --git a/test-suite/tests/web-http.test b/test-suite/tests/web-http.test
index 5085668..4d1fe6c 100644
--- a/test-suite/tests/web-http.test
+++ b/test-suite/tests/web-http.test
@@ -143,6 +143,8 @@
                    (0 . "*")))
   (pass-if-parse accept-language "da, en-gb;q=0.8, en;q=0.7"
                  '((1000 . "da") (800 . "en-gb") (700 . "en")))
+  ;; Allow nonstandard .2 to mean 0.2
+  (pass-if-parse accept-language "en-gb;q=.2" '((200 . "en-gb")))
   (pass-if-parse authorization "foo" "foo")
   (pass-if-parse expect "100-continue, foo" '((100-continue) ("foo")))
   (pass-if-parse from "address@hidden" "address@hidden")


hooks/post-receive
-- 
GNU Guile



reply via email to

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