Query pairs should be separated by ;

original commit: c452a741ac6a15ea125cd44c75949a0db38bf16d
This commit is contained in:
Michael Burns 2004-08-26 19:08:18 +00:00
parent 86d03e750a
commit ea3d91cd0d

View File

@ -55,7 +55,7 @@
;; 2. The control names/values are listed in the order they appear
;; in the document. The name is separated from the value by `=' and
;; name/value pairs are separated from each other by `&'.
;; name/value pairs are separated from each other by `&' or by `;'.
;; NB: RFC 2396 supersedes RFC 1738.
@ -200,21 +200,9 @@
(define (form-urlencoded-decode str)
(decode form-urlencoded-decoding-vector str))
;; listof (cons string string) -> string
;; listof (cons symbol string) -> string
;; http://www.w3.org/TR/html401/appendix/notes.html#ampersands-in-uris
(define alist->form-urlencoded
(match-lambda
[() ""]
[((name . value))
(string-append (form-urlencoded-encode name)
"="
(form-urlencoded-encode value))]
[((name . value) . rest)
(string-append (form-urlencoded-encode name)
"="
(form-urlencoded-encode value)
";"
(alist->form-urlencoded rest))]))
(lambda (args)
(let* ([format-one
(lambda (arg)
@ -229,11 +217,13 @@
[(null? args) null]
[(null? (cdr args)) (list (format-one (car args)))]
[else (list* (format-one (car args))
;; As per the defacto CGI standard, and
;; HTML 4.01
";"
(loop (cdr args)))]))])
(apply string-append strs))))
;; string -> listof (cons string string)
;; string -> listof (cons string string)
;; http://www.w3.org/TR/html401/appendix/notes.html#ampersands-in-uris
(define (form-urlencoded->alist str)
(define key-regexp (regexp "[^=]*"))