[plt-scheme] Teeny little net/url bug [and 1 more messages]

From: Eli Barzilay (eli at barzilay.org)
Date: Thu Oct 1 00:57:05 EDT 2009

On Sep 30, Synx wrote:
> (url->string (string->url "?")) => ""
> 
> I can't seem to make a url structure where url->string produces the
> valid URL "?" (meaning the same spot, with no query arguments). ""
> by itself means the same spot with the same query arguments.
> 
> I would recommend adding something in the url structure contract
> that allows the query portion of make-url be either (listof (cons/c
> symbol?  (or/c false/c string?))) or 'clear to produce a ? without
> any name/value pairs.

Allowing #f (which is a different contract) seems like the right thing
(given that the fragment part is done this way), but I'm not sure if
there's code that relies on it.  Is there anyone who uses this and
relies on the query part to always be a list of bindings?


On Sep 30, Synx wrote:
> [...]
> So it handles space/%25 just fine, but colon gets encoded, decoded,
> but never encoded again when it ought to be. That makes it
> impossible to make a relative url whose path contains colons, as
> (url->string) returns unescaped colons, which are treated as
> delimiters for the schema.

The problem with making colons be decoded too is shown in this test
that fails:

  (url->string (path->url (bytes->path #"c:\\a\\b" 'windows)))

does not return

  "file:///c:/a/b"

I'm not sure that it's a good idea to change this, although it looks
like the encoded uris do get to the right place on Windows.  (I tried
FF, IE, and Opera).  Anyone?

-- 
          ((lambda (x) (x x)) (lambda (x) (x x)))          Eli Barzilay:
                    http://barzilay.org/                   Maze is Life!


Posted on the users mailing list.