chicken-users
[Top][All Lists]
Advanced

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

[Chicken-users] uri.egg uri-encode-query patch


From: Hans Bulfone
Subject: [Chicken-users] uri.egg uri-encode-query patch
Date: Sun, 28 Oct 2007 19:28:27 +0100
User-agent: Mutt/1.5.16 (2007-06-09)

hi,

imho the uri-encode-query function escapes too few characters, e.g.
in the following example + and & should have been escaped to not
be misinterpreted when decoding:

#;4> (uri-encode-query '(("foo" . "test & co") ("bar" . "quux+bla")))
"foo=test+&+co&bar=quux+bla"
#;5> (uri-decode-query "foo=test+&+co&bar=quux+bla")
(("bar" . "quux bla") (" co" . #t) ("foo" . "test "))

as far as i see rfc3986 treats the whole query string as a unit,
so i looked in the html 4 spec[1] that says that all reserved characters
in query keys and values should be escaped.

i've attached a patch that changes uri-encode-query accordingly, and
also changes RFC3986-unreserved-char? to not treat ! as an unreserved char,
as it imho shouldn't be according to rfc3986.

#;10> (uri-encode-query '(("foo" . "test & co") ("bar" . "quux+bla")))
"foo=test+%26+co&bar=quux%2Bbla"
#;11> (uri-decode-query "foo=test+%26+co&bar=quux%2Bbla")
(("bar" . "quux+bla") ("foo" . "test & co"))

bye,
hans.


[1] http://www.w3.org/TR/html401/interact/forms.html#h-17.13

Attachment: uri.scm.patch
Description: Text document


reply via email to

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