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

From: YC (yinso.chen at gmail.com)
Date: Thu Oct 1 16:22:48 EDT 2009

On Wed, Sep 30, 2009 at 9:57 PM, Eli Barzilay <eli at barzilay.org> wrote:

> 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?

This change will mean mapping the query would take one extra test - or we
will have to have a separate function to help filter it out.

(define (url-query* url)
  (if (not (url-query url)) '() (url-query url)))

Which probably should be supplied within net/url so people who depends on
the binding do not have to write their own.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20091001/1f7f8fca/attachment.html>

Posted on the users mailing list.