2009-10-15 Atsushi Enomoto <atsushi@ximian.com>
authorAtsushi Eno <atsushieno@gmail.com>
Thu, 15 Oct 2009 07:49:55 +0000 (07:49 -0000)
committerAtsushi Eno <atsushieno@gmail.com>
Thu, 15 Oct 2009 07:49:55 +0000 (07:49 -0000)
* ServiceHostBase.cs : fix relative URI construction for
  ServiceMetadataExtension. It should create URI like
  http://localhost/test.svc/wsdl, not http://localhost/wsdl .

svn path=/trunk/mcs/; revision=144184

mcs/class/System.ServiceModel/System.ServiceModel/ChangeLog
mcs/class/System.ServiceModel/System.ServiceModel/ServiceHostBase.cs

index 731ea42f7503ed6c4a564288e13938ba844c20ca..2091592007e95317bf34f0cad33b7a02ebfb0ed1 100755 (executable)
@@ -1,3 +1,9 @@
+2009-10-15  Atsushi Enomoto  <atsushi@ximian.com>
+
+       * ServiceHostBase.cs : fix relative URI construction for
+         ServiceMetadataExtension. It should create URI like
+         http://localhost/test.svc/wsdl, not http://localhost/wsdl .
+
 2009-10-15  Atsushi Enomoto  <atsushi@ximian.com>
 
        * ServiceHostBase.cs : on opening the host, check service endpoints
index b58174b9aaf5240be980a20ece75f814a3bcf427..26bec839d5a0a76600b99727fdf906f8befa628b 100644 (file)
@@ -85,7 +85,8 @@ namespace System.ServiceModel
                        }
                }
 
-               internal Uri CreateUri (string scheme, Uri relativeUri) {
+               internal Uri CreateUri (string scheme, Uri relativeUri)
+               {
                        Uri baseUri = base_addresses.Contains (scheme) ? base_addresses [scheme] : null;
 
                        if (relativeUri == null)
@@ -95,7 +96,13 @@ namespace System.ServiceModel
                        if (baseUri == null)
                                return null;
                        var s = relativeUri.ToString ();
-                       return new Uri (baseUri, s.Length > 0 && s [0] == '/' ? '.' + s : s);
+                       if (s.Length == 0)
+                               return baseUri;
+                       var l = baseUri.LocalPath;
+                       if (l.Length > 0 && l [l.Length - 1] != '/')
+                               return new Uri (String.Concat (baseUri.ToString (), "/", relativeUri.ToString ()));
+                       else
+                               return new Uri (baseUri, relativeUri);
                }
 
                public ChannelDispatcherCollection ChannelDispatchers {