[Opensim-dev] Uris: Errors/Inconsistencies/TBD
Alan M Webb
alan_webb at us.ibm.com
Thu Sep 11 13:55:00 UTC 2008
Stefan
OK. I didn't pick up on the transition from your original note which
referred to URI's in general that end with a "/" and a URI with an empty
path, which is a special case I think, in being considered to be
equivalent to an absolute empty path. But is this case really the one you
were concerned about? A relative path is not required to start with a "/"
so inserting one would certainly not be desirable. If this is the only
case then I'm not sure I have understood your concerns properly.
If your issue is solely with the empty-path case then I have no problem
with a "/" being required, or being introduced if omitted. However, I do
still think that we would be best served by an unconditional decomposition
of all inbound URI's into the elements that are described in the RFC, with
the "path" (sic) being decomposed into a sequence of segments. Even in
this canonical form the 1st "/" is clearly special and the fact of its
presence needs to be preserved.
Also, are you concerned with incoming URI's or outoing (OpenSim composed)
URI's. I thought all inbound URI's were coming through the HttpListener
interface which I would have (naiively) expected to have always used the
underlying Uri mechanism.
Sorry if I'm being dense here.
Best regards
Alan
-------------------
T.J. Watson Research Center, Hawthorne, NY
1-914-784-7286
alan_webb at us.ibm.com
Stefan Andersson <stefan at tribalmedia.se>
Sent by: opensim-dev-bounces at lists.berlios.de
09/10/2008 09:32 AM
Please respond to
opensim-dev at lists.berlios.de
To
<opensim-dev at lists.berlios.de>
cc
Subject
Re: [Opensim-dev] Uris: Errors/Inconsistencies/TBD
Alan,
I believe the Uri behaviour I'm talking about just concerns the host node.
What happens if you change that to
Uri absURI = new Uri(http://localhost:9000/);
vs
Uri simURI = new Uri(http://localhost:9000);
? I believe you should get the same result on mono.
of course, if you specify segments, the uri should be reported back as it
was specified. Otherwise, Uri would change the semantics of the last node.
Which would be bad, indeed.
I concur with your suggestion to use a uniform Uri strategy thru OpenSim.
I do believe that it should be built upon Uri and UriBuilder over
home-grown code. Given that I haven't found segment building support in
neither, we might want to combine Uri, UriBuilder and the uri building
parts of RestClient into our own OSUri class that encapsulates building
and handling uris.
The goal is, as I guess you state, to make the system as resilient as
possible. And, to some extent, to introduce a bit more fine-grained a
typeset than 'string' for passing Uris.
Best regards,
Stefan Andersson
Tribal Media AB
Join the 3d web revolution : http://tribalnet.se/
To: opensim-dev at lists.berlios.de
From: alan_webb at us.ibm.com
Date: Wed, 10 Sep 2008 08:07:47 -0400
Subject: Re: [Opensim-dev] Uris: Errors/Inconsistencies/TBD
Hi Stefan
The .NET behavior is bemusing. Running mono on Linux, the behavior is NOT
the same - which may be cause for even bigger concern. On Linux, given:
Uri absURI = new Uri("http://localhost:9000/abc");
Uri relURI = new Uri("abc", UriKind.Relative);
Uri simURI = new Uri("http://localhost:9000/abc);
then Console.WriteLine(xxxURI) and Console.WriteLine(xxxURI.ToString())
both produce exactly what went into the constuctor. If I change the
initial string to have a trailing slash, only then do I see a trailing
slash on output. On the face of it I agree with your assertion that using
the existing behavior of Uri should be preferred, and yet if our goal is
to obtain consistent behaviour for OpenSim on multiple platforms, the
tests above would suggest that Uri is not going to do that for us, and
that the RestClient code, in doing things explicitly, is more likely to
succeed. It would be nice to get the same behavior from mono and .net, but
that's probably much harder to achieve.
I probably take issue with your criticism of the RestClient's (who wrote
this code - they should be defending this!) removal of a single trailing
slash. A single trailing slash is an accepted, if not entirely proper,
redundancy. Two trailing slashes would be an invalid URI in my opinion and
should always be rejected. As an externally supplied value we can not
adopt a pre-condition stance as to its validity, so testing and rejection
should be preferred I think. In the subsequent code that you used in your
example, given the preceding, then this IS based upon a slashless URL
representation.
If I were writing the RestClient I think I would prefer to see the
decomposition of the URI into its component pieces, and reconstruction
from that abstract form immediately prior to use.
So my vote would be for a single class in OpenSim that provides a
guaranteed URI behaviour for everybody who deals in this area. No URI
would be admitted into OpenSim except via this class, and none generated
from any other source. All modifications to the URI would also be made
using the class.
By the way, just so the original issue doesn't get lost, our objective
here is for OpenSim to have an HTTP interface (REST, XMLRPC, whatever)
that does not behave differently when a supplied URI has, or does not
have, a trailing "/", right?
Best regards
Alan
-------------------
T.J. Watson Research Center, Hawthorne, NY
1-914-784-7286
alan_webb at us.ibm.com_______________________________________________
Opensim-dev mailing list
Opensim-dev at lists.berlios.de
https://lists.berlios.de/mailman/listinfo/opensim-dev
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://opensimulator.org/pipermail/opensim-dev/attachments/20080911/484bd2aa/attachment-0001.html>
More information about the Opensim-dev
mailing list