[Opensim-dev] Uris: Errors/Inconsistencies/TBD

Stefan Andersson stefan at tribalmedia.se
Wed Sep 10 13:32:44 UTC 2008


Alan, I believe the Uri behaviour I'm talking about just concerns the host node. What happens if you change that toUri absURI = new Uri(http://localhost:9000/); vsUri 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 AnderssonTribal Media AB Join the 3d web revolution : http://tribalnet.se/ 

To: opensim-dev at lists.berlios.deFrom: alan_webb at us.ibm.comDate: Wed, 10 Sep 2008 08:07:47 -0400Subject: Re: [Opensim-dev] Uris: Errors/Inconsistencies/TBDHi 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 regardsAlan-------------------T.J. Watson Research Center, Hawthorne, NY1-914-784-7286alan_webb at us.ibm.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://opensimulator.org/pipermail/opensim-dev/attachments/20080910/ae1e7b06/attachment-0001.html>


More information about the Opensim-dev mailing list