Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiguel de Icaza <miguel@gnome.org>2011-10-16 19:41:36 +0400
committerMiguel de Icaza <miguel@gnome.org>2011-10-16 19:46:00 +0400
commit8c810e02a34055b7d448810d42ca30d78fdfc00b (patch)
tree2bcc8c311aba9a48a945301be92904ae325669f4 /mcs/class/System.ServiceModel.Web
parentabbb1550d39077a7ceb40d7aeb01273b17e01c02 (diff)
Apply patch from Mario Kosmiskaso fix bug 1209: Patch to correctly expose WebOperationContext.IncomingResponse
There was apparently no point in the call flow when the reponse message was set in the context, resulting in WebOperationContext.IncomingResponse always being null. After patching WebMessageFormatter to set the response in the context (if available) the value of WebOperationContext.IncomingResponse was still null. A bit more investigation showed that IncomingWebResponseContext would construct a HttpResponseMessageProperty encapsulating the OperationContext at the time the request was made but before the response was received and cache that object. That caused the HttpResponseMessageProperty to always have a null value for the response. The second part of the patch changes this behavior and always creates a new HttpResponseMessageProperty on GET.
Diffstat (limited to 'mcs/class/System.ServiceModel.Web')
-rw-r--r--mcs/class/System.ServiceModel.Web/System.ServiceModel.Dispatcher/WebMessageFormatter.cs5
-rw-r--r--mcs/class/System.ServiceModel.Web/System.ServiceModel.Web/IncomingWebResponseContext.cs16
2 files changed, 16 insertions, 5 deletions
diff --git a/mcs/class/System.ServiceModel.Web/System.ServiceModel.Dispatcher/WebMessageFormatter.cs b/mcs/class/System.ServiceModel.Web/System.ServiceModel.Dispatcher/WebMessageFormatter.cs
index 34d4040392b..1cb5eef442b 100644
--- a/mcs/class/System.ServiceModel.Web/System.ServiceModel.Dispatcher/WebMessageFormatter.cs
+++ b/mcs/class/System.ServiceModel.Web/System.ServiceModel.Dispatcher/WebMessageFormatter.cs
@@ -386,6 +386,11 @@ namespace System.ServiceModel.Dispatcher
throw new ArgumentNullException ("parameters");
CheckMessageVersion (message.Version);
+ if (OperationContext.Current != null) {
+ // Set response in the context
+ OperationContext.Current.IncomingMessage = message;
+ }
+
if (message.IsEmpty)
return null; // empty message, could be returned by HttpReplyChannel.
diff --git a/mcs/class/System.ServiceModel.Web/System.ServiceModel.Web/IncomingWebResponseContext.cs b/mcs/class/System.ServiceModel.Web/System.ServiceModel.Web/IncomingWebResponseContext.cs
index af254f9767f..dde1575987c 100644
--- a/mcs/class/System.ServiceModel.Web/System.ServiceModel.Web/IncomingWebResponseContext.cs
+++ b/mcs/class/System.ServiceModel.Web/System.ServiceModel.Web/IncomingWebResponseContext.cs
@@ -34,14 +34,20 @@ namespace System.ServiceModel.Web
{
public class IncomingWebResponseContext
{
- HttpResponseMessageProperty hp;
+ OperationContext ctx;
+
+ HttpResponseMessageProperty hp {
+ get {
+ if (ctx.IncomingMessageProperties != null)
+ return (HttpResponseMessageProperty) ctx.IncomingMessageProperties [HttpResponseMessageProperty.Name];
+ else
+ return new HttpResponseMessageProperty ();
+ }
+ }
internal IncomingWebResponseContext (OperationContext context)
{
- if (context.IncomingMessageProperties != null)
- hp = (HttpResponseMessageProperty) context.IncomingMessageProperties [HttpResponseMessageProperty.Name];
- else
- hp = new HttpResponseMessageProperty ();
+ ctx = context;
}
public long ContentLength {