2009-12-10 Atsushi Enomoto <atsushi@ximian.com>
authorAtsushi Eno <atsushieno@gmail.com>
Thu, 10 Dec 2009 07:57:11 +0000 (07:57 -0000)
committerAtsushi Eno <atsushieno@gmail.com>
Thu, 10 Dec 2009 07:57:11 +0000 (07:57 -0000)
* HttpRequestChannel.cs : when HTTP response was error, do not try
  to read message but just raise an error.

svn path=/trunk/mcs/; revision=148011

mcs/class/System.ServiceModel/System.ServiceModel.Channels/ChangeLog
mcs/class/System.ServiceModel/System.ServiceModel.Channels/HttpRequestChannel.cs

index 5a7738c9817a42937b30893d46ac9670bbc4158d..a1e86227596c5e1eaf43eb38932e937c32058bb0 100755 (executable)
@@ -1,3 +1,8 @@
+2009-12-10  Atsushi Enomoto  <atsushi@ximian.com>
+
+       * HttpRequestChannel.cs : when HTTP response was error, do not try
+         to read message but just raise an error.
+
 2009-12-10  Atsushi Enomoto  <atsushi@ximian.com>
 
        * MessageHeaders.cs : null can be set as a WS-Addressing header item.
index 983b57d517b184b7df40e3516425bc1504ed4dd1..cd1af9faa39b9221f20924fa379a732a81a90d0c 100644 (file)
@@ -196,7 +196,12 @@ namespace System.ServiceModel.Channels
                                        return;
                                }
                        }
-                       
+
+                       var hrr = (HttpWebResponse) res;
+                       if ((int) hrr.StatusCode >= 400) {
+                               channelResult.Complete (new WebException (String.Format ("There was an error on processing web request: Status code {0}({1}): {2}", (int) hrr.StatusCode, hrr.StatusCode, hrr.StatusDescription)));
+                       }
+
                        try {
                                using (var responseStream = resstr) {
                                        MemoryStream ms = new MemoryStream ();