[#1340][WCF]: Fix null reference when using invalid HTTP methods.
authorMartin Baulig <martin.baulig@xamarin.com>
Wed, 19 Sep 2012 04:28:47 +0000 (06:28 +0200)
committerMartin Baulig <martin.baulig@xamarin.com>
Wed, 19 Sep 2012 04:28:47 +0000 (06:28 +0200)
mcs/class/System.ServiceModel/System.ServiceModel.Channels.Http/HttpReplyChannel.cs

index 5bc1c4dc3b38c8fedb1b2eefe43514b9f840572e..16c38c77932c39409c4349ee2ea501d67051c820 100644 (file)
@@ -168,13 +168,14 @@ namespace System.ServiceModel.Channels.Http
 
                        Message msg = null;
 
-                       if (ctxi.Request.HttpMethod == "POST") {
+                       if (ctxi.Request.HttpMethod == "POST")
                                msg = CreatePostMessage (ctxi);
-                               if (msg == null)
-                                       return false;
-                       } else if (ctxi.Request.HttpMethod == "GET")
+                       else if (ctxi.Request.HttpMethod == "GET")
                                msg = Message.CreateMessage (MessageVersion.None, null); // HTTP GET-based request
 
+                       if (msg == null)
+                               return false;
+
                        if (msg.Headers.To == null)
                                msg.Headers.To = ctxi.Request.Url;
                        msg.Properties.Add ("Via", LocalAddress.Uri);