1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-04-29 19:30:36 +02:00

(web http): keys are always symbols

* module/web/http.scm (parse-media-type): Parse media types as symbols.
  (parse-key-value-list, parse-param-component, parse-param-list):
  Change kons to val-parser. Always parse keys as symbols, and always
  either cons, if there is a val, or just have the key, if there is no
  val.  Easier to explain and just as correct.
  (declare-param-list-header!, declare-key-value-list-header!): Adapt to
  key-list and param-list kons change.
  ("Cache-Control", "Pragma", "Transfer-Encoding", "Accept", "Expect")
  ("TE"): Likewise, adapt.
  ("Content-Type"): Param keys are symbols.
This commit is contained in:
Andy Wingo 2011-01-08 20:50:46 -08:00
parent 32de1aa783
commit 0acc595b94
7 changed files with 83 additions and 100 deletions

View file

@ -30,8 +30,8 @@
(status 200)
(title default-title)
(doctype html5-doctype)
(content-type-params '(("charset" . "utf-8")))
(content-type "text/html")
(content-type-params '((charset . "utf-8")))
(content-type 'text/html)
(extra-headers '())
(sxml (and body (templatize #:title title #:body body))))
(values (build-response

View file

@ -23,7 +23,7 @@
;; for us with a 200 OK status.
;;
(define (handler request body)
(values '((content-type . ("text/plain")))
(values '((content-type . (text/plain)))
"Hello, World!"))
(run-server handler)