comp.lang.ada
 help / color / mirror / Atom feed
From: David Thompson <dave.thompson2@verizon.net>
Subject: Re: Open URLs
Date: Thu, 14 Jan 2010 03:32:43 -0500
Date: 2010-01-14T03:32:43-05:00	[thread overview]
Message-ID: <s4ltk5dr6n1s0bqacon52vuq6jmm234276@4ax.com> (raw)
In-Reply-To: 1exooomj74fsx.1k5y7r1avujek$.dlg@40tude.net

On Sun, 3 Jan 2010 21:05:46 +0100, "Dmitry A. Kazakov"
<mailbox@dmitry-kazakov.de> wrote:

> On Sun, 3 Jan 2010 10:17:58 -0800 (PST), vlc wrote:
> 
> > I am looking for a way to open URLs (like "file:///home/vlc/file") as
> > files - as you would do with "Open (Handle, In_File, "/home/vlc/
> > file")".
> > 
> > I could surely just remove the heading "file://", but this would still
> > leave me with the problem of special characters like "file:///home/vlc/
> > name%20with%20spaces".
> 
> The third / is a delimiter, theoretically there could be something between
> file:// and /. The path might be followed by queries and fragments, see
> here:
> 
>    http://en.wikipedia.org/wiki/URI_scheme#Generic_syntax
>  
Although one can just say queries aren't supported for resources that
are actually files, since they don't make sense. (Although they might
for something like a cryptographic FS where you must supply a password
-- but then whether you should allow a password to be supplied by a
potentially untrusted path is another issue.)

Fragments are supposed to be implemented by the user agent (for the
web, normally a browser); it's not clear to me whether the OP does or
anyone else would want this below or above the proposed API.

> > Does anybody know of a way to translate URLs to paths?
> 
> You just parse it. What is the problem, except that the number of URI
> schemes is huge.
> 
Nontrivial but I wouldn't say huge -- and the number that make sense
for files is pretty small. And the OP apparently only needs one.

> Regarding replacing %20 with SP, I am not sure if this has to be done. You
> have to dig the documents (RFC) to verify if %<number> is indeed a defined
> escape sequence, if there are any in the URI, I do not remember. Otherwise
> it is a part of the file name to be passed further as is.
> 
Yes % two-hex is in STD66=RFC3986 2, and %20=SP is even the example.

Of course if there are codepoints not allowed in a pathname, like NUL
on Unix, you can't support the corresponding escape %00 in a URI. 
And you need to decide some things like whether %2F is treated as a
branch-character / which is similarly unsupportable, or as a branch
delimiter in violation of the nominal URI semantics.

<snip code>




      reply	other threads:[~2010-01-14  8:32 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-01-03 18:17 Open URLs vlc
2010-01-03 18:36 ` Gautier write-only
2010-01-03 18:36 ` Pascal Obry
2010-01-03 18:53   ` vlc
2010-01-03 20:05 ` Dmitry A. Kazakov
2010-01-14  8:32   ` David Thompson [this message]
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox