1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-06-16 16:50:21 +02:00

more symbols in (web http)

* module/web/http.scm (declare-symbol-list-header!): New helper.
  ("Connection"): Redefine as a header list.
  ("Allow", "Content-Encoding", "Accept-Ranges"): Redefine as symbol
  lists.

* test-suite/tests/web-http.test:
* test-suite/tests/web-response.test: Adapt tests.
This commit is contained in:
Andy Wingo 2011-01-08 21:32:14 -08:00
parent 0acc595b94
commit 94f16a5b8f
3 changed files with 22 additions and 12 deletions

View file

@ -860,6 +860,16 @@ phrase\"."
(declare-header! name
split-and-trim list-of-strings? write-list-of-strings))
;; emacs: (put 'declare-symbol-list-header! 'scheme-indent-function 1)
(define (declare-symbol-list-header! name)
(declare-header! name
(lambda (str)
(map string->symbol (split-and-trim str)))
(lambda (v)
(list-of? symbol? v))
(lambda (v port)
(write-list v port display ", "))))
;; emacs: (put 'declare-header-list-header! 'scheme-indent-function 1)
(define (declare-header-list-header! name)
(declare-header! name
@ -969,7 +979,7 @@ phrase\"."
;; e.g.
;; Connection: close, foo-header
;;
(declare-string-list-header! "Connection")
(declare-header-list-header! "Connection")
;; Date = "Date" ":" HTTP-date
;; e.g.
@ -1090,11 +1100,11 @@ phrase\"."
;; Allow = #Method
;;
(declare-string-list-header! "Allow")
(declare-symbol-list-header! "Allow")
;; Content-Encoding = 1#content-coding
;;
(declare-string-list-header! "Content-Encoding")
(declare-symbol-list-header! "Content-Encoding")
;; Content-Language = 1#language-tag
;;
@ -1407,7 +1417,7 @@ phrase\"."
;; Accept-Ranges = acceptable-ranges
;; acceptable-ranges = 1#range-unit | "none"
;;
(declare-string-list-header! "Accept-Ranges")
(declare-symbol-list-header! "Accept-Ranges")
;; Age = age-value
;; age-value = delta-seconds