<br><font size=2 face="sans-serif">Hi Stefan</font>
<br>
<br><font size=2 face="sans-serif">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:</font>
<br>
<br><font size=2 face="Courier">Uri absURI = new Uri("http://localhost:9000/abc");</font>
<br><font size=2 face="Courier">Uri relURI = new Uri("abc", UriKind.Relative);</font>
<br><font size=2 face="Courier">Uri simURI = new Uri("http://localhost:9000/abc);</font>
<br>
<br><font size=2 face="sans-serif">then </font><font size=2 face="Courier New">Console.WriteLine(xxxURI)
</font><font size=2 face="sans-serif">and </font><font size=2 face="Courier New">Console.WriteLine(xxxURI.ToString())</font><font size=2 face="sans-serif">
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.</font>
<br>
<br><font size=2 face="sans-serif">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.</font>
<br>
<br><font size=2 face="sans-serif">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.</font>
<br>
<br><font size=2 face="sans-serif">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.</font>
<br>
<br><font size=2 face="sans-serif">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?</font>
<br><font size=2 face="sans-serif"><br>
Best regards<br>
Alan<br>
-------------------<br>
T.J. Watson Research Center, Hawthorne, NY<br>
1-914-784-7286<br>
alan_webb@us.ibm.com</font>