[plt-scheme] URLs with passwords

From: Robby Findler (robby at eecs.northwestern.edu)
Date: Sun Jan 25 13:11:16 EST 2009

On Sun, Jan 25, 2009 at 11:57 AM, David Van Horn <dvanhorn at ccs.neu.edu> wrote:
> The delicious API (http://delicious.com/help/api) requires URLs like the
> following:
>
>   https://user:password@api.del.icio.us/v1/posts/get?tag=foo
>
> But I can't seem to construct such a URL with the net/url library.  The
> colon between user and password always gets encoded. So for example,
>
> (url->string
>  (string->url
>   "https://user:password@api.del.icio.us/v1/posts/get?tag=foo"))
>
> ==>
>
> "https://user%3Apassword@api.del.icio.us/v1/posts/get?tag=foo"
>
> Is this a bug, or is there some other way to construct the appropriate URL?
>  (This is in 4.1.3.3-svn3dec2008).
>

By my read, this is legal, according to section 2.4.2 of RFC 2396:

  http://www.ietf.org/rfc/rfc2396.txt

It would also be legal to leave it unescaped, but the way the RFC is
written, the colon is not reserved there, but just a general character
as part of the userinfo field (and the colon can change the meaning
elsewhere, of course).

So, I think it would be safe to put actual colons into the userinfo
field without escaping them, but I'll have to make the actual change
later on (feel free to submit a patch, if you have time to add test
cases, etc).

Robby


Posted on the users mailing list.