mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-05-20 11:40:18 +02:00
Fix uri-encoding for octets 0-15
* module/web/uri.scm (uri-encode): All encoded octets should be of the form % HEXDIGIT HEXDIGIT. * test-suite/tests/web-uri.test ("encode"): Add test.
This commit is contained in:
parent
dc7a9cefbf
commit
b401fe7169
2 changed files with 4 additions and 1 deletions
|
@ -377,6 +377,8 @@ the byte."
|
|||
(if (< i len)
|
||||
(let ((byte (bytevector-u8-ref bv i)))
|
||||
(display #\% port)
|
||||
(when (< byte 16)
|
||||
(display #\0 port))
|
||||
(display (number->string byte 16) port)
|
||||
(lp (1+ i))))))))
|
||||
str)))
|
||||
|
|
|
@ -258,4 +258,5 @@
|
|||
(equal? "foo bar" (uri-decode "foo+bar"))))
|
||||
|
||||
(with-test-prefix "encode"
|
||||
(pass-if (equal? "foo%20bar" (uri-encode "foo bar"))))
|
||||
(pass-if (equal? "foo%20bar" (uri-encode "foo bar")))
|
||||
(pass-if (equal? "foo%0a%00bar" (uri-encode "foo\n\x00bar"))))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue