allows colons in the userinfo field of a url (ie, does not encode them)

svn: r13282

original commit: 134138916f
This commit is contained in:
Robby Findler 2009-01-25 20:12:08 +00:00
commit bf3aa92f31
2 changed files with 24 additions and 0 deletions

View File

@ -78,6 +78,19 @@ Encode a string using the URI encoding rules.}
Decode a string using the URI decoding rules.}
@defproc[(uri-path-segment-encode [str string?]) string?]{
Encodes a string according to the rules in @cite["RFC3986"] for path segments.
}
@defproc[(uri-path-segment-decode [str string?]) string?]{
Decodes a string according to the rules in @cite["RFC3986"] for path segments.
}
@defproc[(uri-userinfo-encode [str string?]) string?]{
Encodes a string according to the rules in @cite["RFC3986"] for the userinfo field.
}
@defproc[(uri-userinfo-decode [str string?]) string?]{
Decodes a string according to the rules in @cite["RFC3986"] for the userinfo field.
}
@defproc[(form-urlencoded-encode [str string?]) string?]{

View File

@ -148,6 +148,14 @@
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(test "hello" uri-userinfo-encode "hello")
(test "hello%20there" uri-userinfo-encode "hello there")
(test "hello:there" uri-userinfo-encode "hello:there")
(test "hello" uri-userinfo-decode "hello")
(test "hello there" uri-userinfo-decode "hello%20there")
(test "hello:there" uri-userinfo-decode "hello:there")
(let ()
(define (test-s->u vec str)
(test vec string->url/vec str)
@ -239,6 +247,9 @@
"http://robb%20y@www.drscheme.org/")
(test-s->u #("http" #f "www.drscheme.org" #f #t (#("%a") #("b/") #("c")) () #f)
"http://www.drscheme.org/%25a/b%2F/c")
(test-s->u #("http" "robby:password" "www.drscheme.org" #f #t (#("")) () #f)
"http://robby:password@www.drscheme.org/")
(test "robby:password" (lambda (x) (url-user (string->url x))) "http://robby%3apassword@www.drscheme.org/")
;; test the characters that need to be encoded in paths vs those that do not need to
;; be encoded in paths