X-Git-Url: http://wien.tomnetworks.com/gitweb/?a=blobdiff_plain;f=mcs%2Fclass%2FSystem.Runtime.Remoting%2FSystem.Runtime.Remoting.Channels%2FSoapServerFormatterSink.cs;h=d818bca48c7d190ac2309ed9459ba150728e93dc;hb=c0a8ef12af1f473bfc837325581fe738f1b3178c;hp=8219869f8d95125c2dfef717e6efc07622b251ef;hpb=234225d112c4b018b8d1796f4c06a15812137500;p=mono.git diff --git a/mcs/class/System.Runtime.Remoting/System.Runtime.Remoting.Channels/SoapServerFormatterSink.cs b/mcs/class/System.Runtime.Remoting/System.Runtime.Remoting.Channels/SoapServerFormatterSink.cs index 8219869f8d9..d818bca48c7 100644 --- a/mcs/class/System.Runtime.Remoting/System.Runtime.Remoting.Channels/SoapServerFormatterSink.cs +++ b/mcs/class/System.Runtime.Remoting/System.Runtime.Remoting.Channels/SoapServerFormatterSink.cs @@ -6,27 +6,27 @@ // // 2002 (C) Copyright, Ximian, Inc. // - -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// + +// +// Permission is hereby granted, free of charge, to any person obtaining +// a copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to +// permit persons to whom the Software is furnished to do so, subject to +// the following conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// using System.Collections; using System.IO; @@ -86,7 +86,6 @@ namespace System.Runtime.Remoting.Channels { } } -#if NET_1_1 [ComVisible(false)] public TypeFilterLevel TypeFilterLevel { @@ -98,7 +97,6 @@ namespace System.Runtime.Remoting.Channels { _soapCore = new SoapCore (this, props, SoapServerFormatterSinkProvider.AllowedProperties); } } -#endif public void AsyncProcessResponse (IServerResponseChannelSinkStack sinkStack, object state, IMessage msg, ITransportHeaders headers, Stream stream) @@ -130,6 +128,32 @@ namespace System.Runtime.Remoting.Channels { IMessage requestMsg, ITransportHeaders requestHeaders, Stream requestStream, out IMessage responseMsg, out ITransportHeaders responseHeaders, out Stream responseStream) { + // Check whether the request was already processed by another + // formatter sink and pass the request to the next sink if so. + if (requestMsg != null) + return next_sink.ProcessMessage (sinkStack, + requestMsg, + requestHeaders, + requestStream, + out responseMsg, + out responseHeaders, + out responseStream); + + // Check whether the request is suitable for this formatter + // and pass the request to the next sink if not. + // Note that a null content-type is handled as suitable, + // otherwise no other sink will be able to handle the request. + string contentType = requestHeaders["Content-Type"] as string; + if (contentType == null || !contentType.StartsWith ("text/xml") || requestHeaders["SOAPAction"] == null) { + return next_sink.ProcessMessage (sinkStack, + requestMsg, + requestHeaders, + requestStream, + out responseMsg, + out responseHeaders, + out responseStream); + } + responseMsg = null; responseHeaders = null; responseStream = null; @@ -149,7 +173,6 @@ namespace System.Runtime.Remoting.Channels { SoapFormatter fm = _soapCore.GetSafeDeserializer (); SoapMessage soapMessage = soapMsgFormatter.CreateSoapMessage (true); fm.TopObject = soapMessage; - requestStream.Position = 0; fm.Deserialize(requestStream); requestMsg = soapMsgFormatter.BuildMethodCallFromSoapMessage(soapMessage, uri); @@ -162,6 +185,7 @@ namespace System.Runtime.Remoting.Channels { object rtnMessageObject = soapMsgFormatter.BuildSoapMessageFromMethodResponse((IMethodReturnMessage) responseMsg, out responseHeaders); responseStream = new MemoryStream(); _soapCore.Serializer.Serialize(responseStream, rtnMessageObject); + responseStream.Position = 0; } } } @@ -171,6 +195,7 @@ namespace System.Runtime.Remoting.Channels { object rtnMessageObject = soapMsgFormatter.BuildSoapMessageFromMethodResponse((IMethodReturnMessage) responseMsg, out responseHeaders); responseStream = new MemoryStream(); _soapCore.Serializer.Serialize(responseStream, rtnMessageObject); + responseStream.Position = 0; sp = ServerProcessing.Complete; }