diff options
author | Michael Hutchinson <mhutchinson@novell.com> | 2008-10-01 03:43:33 +0400 |
---|---|---|
committer | Michael Hutchinson <mhutchinson@novell.com> | 2008-10-01 03:43:33 +0400 |
commit | 95d855ebdd15281566aafc65ddfb26dcd270db74 (patch) | |
tree | 596c7d486dc44347b3d19a73a6941956ae7f8024 | |
parent | 362fb88f2747053cec0ff29208dc14deee1fdbd8 (diff) |
2008-09-30 Michael Hutchinson <mhutchinson@novell.com>
* HttpServerChannel.cs: make sure the channel data object is set
when the port is auto-assigned.
* HttpClientTransportSink.cs: Use the __RequestUri header for the
request's URI. Includes workaround for bad __RequestUri values.
Fixes Bug 378713 - [regression] Remoting - HttpChannel.
svn path=/branches/mono-2-0/mcs/; revision=114529
3 files changed, 32 insertions, 8 deletions
diff --git a/mcs/class/System.Runtime.Remoting/System.Runtime.Remoting.Channels.Http/ChangeLog b/mcs/class/System.Runtime.Remoting/System.Runtime.Remoting.Channels.Http/ChangeLog index cfb537ef580..84f774390f8 100644 --- a/mcs/class/System.Runtime.Remoting/System.Runtime.Remoting.Channels.Http/ChangeLog +++ b/mcs/class/System.Runtime.Remoting/System.Runtime.Remoting.Channels.Http/ChangeLog @@ -1,3 +1,12 @@ +2008-09-30 Michael Hutchinson <mhutchinson@novell.com> + + * HttpServerChannel.cs: make sure the channel data object is set + when the port is auto-assigned. + * HttpClientTransportSink.cs: Use the __RequestUri header for the + request's URI. Includes workaround for bad __RequestUri values. + + Fixes Bug 378713 - [regression] Remoting - HttpChannel. + 2008-09-24 Michael Hutchinson <mhutchinson@novell.com> * HttpServerTransportSink.cs: Disable chunking on the server, as diff --git a/mcs/class/System.Runtime.Remoting/System.Runtime.Remoting.Channels.Http/HttpClientTransportSink.cs b/mcs/class/System.Runtime.Remoting/System.Runtime.Remoting.Channels.Http/HttpClientTransportSink.cs index 760b73764f4..bf525c863b9 100644 --- a/mcs/class/System.Runtime.Remoting/System.Runtime.Remoting.Channels.Http/HttpClientTransportSink.cs +++ b/mcs/class/System.Runtime.Remoting/System.Runtime.Remoting.Channels.Http/HttpClientTransportSink.cs @@ -106,8 +106,21 @@ namespace System.Runtime.Remoting.Channels.Http HttpWebRequest CreateRequest (ITransportHeaders requestHeaders) { - //NOTE: on mono this seems to be set, but on .NET it's null. - //Hence we shouldn't use it: requestHeaders[CommonTransportKeys.RequestUri]) + string url = this.url; + + + //FIXME: requestUri should contain the URL-less URI only when it's a CAO call; + // at all other times it should be null. On Mono, whenever it should be null, it contains the full + // URL+URI, so we have a broken mixure of path types and we need to hack around it + string requestUri = requestHeaders[CommonTransportKeys.RequestUri] as string; + string objectURI; + if (requestUri != null && HttpChannel.ParseInternal (requestUri, out objectURI) == null) { + url = HttpChannel.ParseInternal (url, out objectURI); + if (!url.EndsWith ("/")) + url = url + "/"; + url = url + requestUri; + } + HttpWebRequest request = (HttpWebRequest)WebRequest.Create (url); request.UserAgent = string.Format ("Mozilla/4.0+(compatible; Mono Remoting; Mono {0})", System.Environment.Version); @@ -159,7 +172,7 @@ namespace System.Runtime.Remoting.Channels.Http foreach (DictionaryEntry entry in requestHeaders) { string key = entry.Key.ToString (); - if (key != "__RequestVerb" && key != "Content-Type") { + if (key != "__RequestVerb" && key != "Content-Type" && key != CommonTransportKeys.RequestUri) { request.Headers.Add (key, entry.Value.ToString ()); } } diff --git a/mcs/class/System.Runtime.Remoting/System.Runtime.Remoting.Channels.Http/HttpServerChannel.cs b/mcs/class/System.Runtime.Remoting/System.Runtime.Remoting.Channels.Http/HttpServerChannel.cs index 434a79567c2..d6a00cbc323 100644 --- a/mcs/class/System.Runtime.Remoting/System.Runtime.Remoting.Channels.Http/HttpServerChannel.cs +++ b/mcs/class/System.Runtime.Remoting/System.Runtime.Remoting.Channels.Http/HttpServerChannel.cs @@ -154,17 +154,17 @@ namespace System.Runtime.Remoting.Channels.Http sinkProvider.Next = new SoapServerFormatterSinkProvider (); sinkProvider.Next.Next = new BinaryServerFormatterSinkProvider (); } - - if (port > 0) { - channelData = new ChannelDataStore (new string [] { this.GetChannelUri () } ); + + //MS compat: channelData is null when port < 0 + if (port >= 0) { + channelData = new ChannelDataStore (null); IServerChannelSinkProvider provider = sinkProvider; while (provider != null) { provider.GetChannelData (channelData); provider = provider.Next; } - wantsToListen = false; } - + //create the sink chain and add an HTTP sink IServerChannelSink nextSink = ChannelServices.CreateServerChannelSinkChain (sinkProvider, this); sink = new HttpServerTransportSink (nextSink); @@ -251,6 +251,8 @@ namespace System.Runtime.Remoting.Channels.Http if (port == 0) port = listener.AssignedPort; + + channelData.ChannelUris = new string [] { GetChannelUri () }; } public void StopListening (object data) |