Re: url-encoding for http addresses



Hi,

Am Dienstag, den 07.12.2004, 22:48 -0500 schrieb Walter Landry: 
> Peter Harvey <pah06 uow edu au> wrote:
> > On Tue, 2004-12-07 at 21:47 -0500, Walter Landry wrote:
> > > But then you have to have special code in your application to escape
> > > only http uri's.  You might as well let gnome-vfs do it for itself.

err... Since gnome_vfs_uri_new takes a text_uri (according to the
parameter name), one should pass an URI in. Otherwise the parameter
should be called text_method_and_filesystem_path,
text_something_that_is_not_an_uri, text_new_not_quite_the_usual or so :)

>  
> > Hate to jump in here, but where are you getting unescaped http uris from
> > in the first place?
> 
> 1) From the user.

I'd like to hear where he got that invalid http uri from. Its not like
it would have worked anywhere.

And even if you want the user to be able to enter unescaped stuff
[normal stuff from the user's point of view], then escape it before
storing it in program memory, and store the result into a separate
variable to be able to show the user the original string without having
to unescape it again all the time. 

Although uris are an implementation detail, the user got used to them.

I know that that is annoying. Uris are by design annoying. 
But I guess they are supposed to be faster than just passing a struct
around with all the parts unescaped and in utf-8 as struct members, with
the uri method as a globally registered number. 

And one can use a simple "Entry" instead of a complex list editor stuff
with uris in the UI.

Guess its the same for normal filesystem paths, they could be passed as
a normal array of filenames instead of mashed together in one string
too, but nobody does it since it's slower and since C sucks in passing
arrays around (by value, with copy-on-write, that is, copy-on-change). 

> 
> 2) I have a certain structure in the filesystem, and that structure is
>    the same whether it is local or remote.  So for local stuff I
>    prepend file://(path to stuff) and for remote stuff I prepend
>    http://www.example.org/(path to stuff).

Yeah. And that works only if 'path to stuff' has already been escaped.

example
  user visible path to stuff = files for stuff/some file.png
  path to stuff = files%20for%20stuff/some%20file.png
  file uri = file://yourhostname/home/blah/files%20for%20stuff/some%
20file.png
  http uri = http://www.example.org/files%20for%20stuff/some%20file.png

> 
> Not having to give much thought to whether a file is local or remote
> is one of the great advantages of something like gnome-vfs.

Yeah. Its the sole reason of existence for gnome-vfs, is it not?

cheers,
   Danny

-- 
www.keyserver.net key id A334AEA6

Attachment: signature.asc
Description: Dies ist ein digital signierter Nachrichtenteil



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]