2009-10-06 Atsushi Enomoto <atsushi@ximian.com>
authorAtsushi Eno <atsushieno@gmail.com>
Tue, 6 Oct 2009 18:18:54 +0000 (18:18 -0000)
committerAtsushi Eno <atsushieno@gmail.com>
Tue, 6 Oct 2009 18:18:54 +0000 (18:18 -0000)
* WebScriptEnablingBehavior.cs : fix listen uri which used to result
  in unexpected relative recalculation against the base uri.

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

mcs/class/System.ServiceModel.Web/System.ServiceModel.Description/ChangeLog
mcs/class/System.ServiceModel.Web/System.ServiceModel.Description/WebScriptEnablingBehavior.cs

index 51bff804149e0cdac2d701ac390fe8cc8d19637e..78dbaee6d2360ba60099d261023c58da887702d4 100644 (file)
@@ -1,3 +1,8 @@
+2009-10-06  Atsushi Enomoto  <atsushi@ximian.com>
+
+       * WebScriptEnablingBehavior.cs : fix listen uri which used to result
+         in unexpected relative recalculation against the base uri.
+
 2009-09-18  Atsushi Enomoto  <atsushi@ximian.com>
 
        * WebHttpBehavior.cs : parameter Wrapped check in Validate() should
index c35283c75bf92097ddb43b3bf3584ff54874e746..44b3990fb5202ab820bfc3d4af3c0718b1a6bed0 100644 (file)
@@ -94,8 +94,8 @@ namespace System.ServiceModel.Description
                        base.ApplyDispatchBehavior (endpoint, endpointDispatcher);
 
                        // doing similar to ServiceMetadataExtension
-                       BuildScriptDispatcher (endpoint, endpointDispatcher, "/js", false);
-                       BuildScriptDispatcher (endpoint, endpointDispatcher, "/jsdebug", true);
+                       BuildScriptDispatcher (endpoint, endpointDispatcher, "js", false);
+                       BuildScriptDispatcher (endpoint, endpointDispatcher, "jsdebug", true);
                }
 
                void BuildScriptDispatcher (ServiceEndpoint endpoint, EndpointDispatcher ed, string subPath, bool debug)
@@ -103,11 +103,14 @@ namespace System.ServiceModel.Description
                        var instance = new InteropScriptService (endpoint.Contract.ContractType, endpoint.Address.Uri.ToString (), debug);
 
                        var cdOrg = ed.ChannelDispatcher;
-                       var uri = new Uri (cdOrg.Listener.Uri, subPath);
-                       var cd = new ChannelDispatcher (endpoint.Binding.BuildChannelListener<IReplyChannel> (uri), String.Empty);
+                       var baseUriString = endpoint.ListenUri.ToString ();
+                       var uri = new Uri (String.Concat (baseUriString, baseUriString [baseUriString.Length - 1] == '/' ? String.Empty : "/", subPath));
+                       var listener = endpoint.Binding.BuildChannelListener<IReplyChannel> (uri);
+                       var cd = new ChannelDispatcher (listener, String.Empty);
                        cd.MessageVersion = MessageVersion.None;
 
-                       cd.Endpoints.Add (new EndpointDispatcher (new EndpointAddress (uri), "InteropScriptService", String.Empty));
+                       cd.Endpoints.Add (new EndpointDispatcher (new EndpointAddress (uri), "InteropScriptService", String.Empty)
+                               { ContractFilter = new MatchAllMessageFilter () });
 
                        var dr = cd.Endpoints [0].DispatchRuntime;
                        var dop = new DispatchOperation (dr, "Get", "*", "*");