From ea3d91cd0db03031aef1234c77756e976b7f9283 Mon Sep 17 00:00:00 2001 From: Michael Burns Date: Thu, 26 Aug 2004 19:08:18 +0000 Subject: [PATCH] Query pairs should be separated by ; original commit: c452a741ac6a15ea125cd44c75949a0db38bf16d --- collects/net/uri-codec-unit.ss | 20 +++++--------------- 1 file changed, 5 insertions(+), 15 deletions(-) diff --git a/collects/net/uri-codec-unit.ss b/collects/net/uri-codec-unit.ss index f848ec3..e7d77bc 100644 --- a/collects/net/uri-codec-unit.ss +++ b/collects/net/uri-codec-unit.ss @@ -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 "[^=]*"))