Răsfoiți Sursa

2010-07-09 Atsushi Enomoto <[email protected]>

	* SecureMessageGenerator.cs : MessageBuffer was missing copy of
	  Body wsu:Id attribute.
	* HttpRequestChannel.cs : remove comment for resolved issue.


svn path=/trunk/mcs/; revision=160102
Atsushi Eno 15 ani în urmă
părinte
comite
8d3ff9480e

+ 6 - 0
mcs/class/System.ServiceModel/System.ServiceModel.Channels/ChangeLog

@@ -1,3 +1,9 @@
+2010-07-09  Atsushi Enomoto  <[email protected]>
+
+	* SecureMessageGenerator.cs : MessageBuffer was missing copy of
+	  Body wsu:Id attribute.
+	* HttpRequestChannel.cs : remove comment for resolved issue.
+
 2010-07-09  Atsushi Enomoto  <[email protected]>
 
 	* HttpListenerManager.cs : move another old code.

+ 0 - 7
mcs/class/System.ServiceModel/System.ServiceModel.Channels/HttpRequestChannel.cs

@@ -146,13 +146,6 @@ namespace System.ServiceModel.Channels
 			}
 #endif
 
-/*
-// FIXME: this causes invalid message security.
-var mb = message.CreateBufferedCopy (0x10000);
-message = mb.CreateMessage ();
-Console.WriteLine (mb.CreateMessage ());
-*/
-
 			if (!suppressEntityBody && String.Compare (web_request.Method, "GET", StringComparison.OrdinalIgnoreCase) != 0) {
 				MemoryStream buffer = new MemoryStream ();
 				Encoder.WriteMessage (message, buffer);

+ 31 - 0
mcs/class/System.ServiceModel/System.ServiceModel.Channels/SecureMessageGenerator.cs

@@ -731,6 +731,11 @@ else
 			get { return msg.Properties; }
 		}
 
+		protected override MessageBuffer OnCreateBufferedCopy (int maxBufferSize)
+		{
+			return new WSSecurityMessageBuffer (msg.CreateBufferedCopy (maxBufferSize), body_id);
+		}
+
 		protected override string OnGetBodyAttribute (string localName, string ns)
 		{
 			if (localName == "Id" && ns == Constants.WsuNamespace)
@@ -752,4 +757,30 @@ else
 			msg.WriteBodyContents (w);
 		}
 	}
+	
+	internal class WSSecurityMessageBuffer : MessageBuffer
+	{
+		public WSSecurityMessageBuffer (MessageBuffer mb, string bodyId)
+		{
+			buffer = mb;
+			body_id = bodyId;
+		}
+		
+		MessageBuffer buffer;
+		string body_id;
+		
+		public override int BufferSize {
+			get { return buffer.BufferSize; }
+		}
+		
+		public override void Close ()
+		{
+			buffer.Close ();
+		}
+		
+		public override Message CreateMessage ()
+		{
+			return new WSSecurityMessage (buffer.CreateMessage (), body_id);
+		}
+	}
 }