Author: spouliot
Date: 2005-04-10 14:26:53 -0400 (Sun, 10 Apr 2005)
New Revision: 42763

Modified:
   trunk/mcs/class/System/System.Net/ChangeLog
   trunk/mcs/class/System/System.Net/WebConnection.cs
Log:
2005-04-10  Sebastien Pouliot  <[EMAIL PROTECTED]>

        * WebConnection.cs: Added support for TrustFailure when throwing a
        WebException. Fix bug #74286.



Modified: trunk/mcs/class/System/System.Net/ChangeLog
===================================================================
--- trunk/mcs/class/System/System.Net/ChangeLog 2005-04-10 18:25:27 UTC (rev 
42762)
+++ trunk/mcs/class/System/System.Net/ChangeLog 2005-04-10 18:26:53 UTC (rev 
42763)
@@ -1,3 +1,8 @@
+2005-04-10  Sebastien Pouliot  <[EMAIL PROTECTED]>
+
+       * WebConnection.cs: Added support for TrustFailure when throwing a
+       WebException. Fix bug #74286.
+
 2005-04-10 Gonzalo Paniagua Javier <[EMAIL PROTECTED]>
 
        * HttpWebRequest.cs: 

Modified: trunk/mcs/class/System/System.Net/WebConnection.cs
===================================================================
--- trunk/mcs/class/System/System.Net/WebConnection.cs  2005-04-10 18:25:27 UTC 
(rev 42762)
+++ trunk/mcs/class/System/System.Net/WebConnection.cs  2005-04-10 18:26:53 UTC 
(rev 42763)
@@ -74,6 +74,7 @@
                static Type sslStream;
                static PropertyInfo piClient;
                static PropertyInfo piServer;
+               static PropertyInfo piTrustFailure;
 
                public WebConnection (WebConnectionGroup group, ServicePoint 
sPoint)
                {
@@ -154,6 +155,7 @@
                                }
                                piClient = sslStream.GetProperty 
("SelectedClientCertificate");
                                piServer = sslStream.GetProperty 
("ServerCertificate");
+                               piTrustFailure = sslStream.GetProperty 
("TrustFailure");
                        }
                }
 
@@ -813,8 +815,15 @@
                                if (e is WebException)
                                        throw e;
 
-                               HandleError (WebExceptionStatus.SendFailure, e, 
"Write");
-                               throw new WebException ("Not connected", e, 
WebExceptionStatus.SendFailure, null);
+                               WebExceptionStatus wes = 
WebExceptionStatus.SendFailure;
+
+                               // if SSL is in use then check for TrustFailure
+                               if (ssl && (bool) piTrustFailure.GetValue 
(nstream, null)) {
+                                       wes = WebExceptionStatus.TrustFailure;
+                               }
+
+                               HandleError (wes, e, "Write");
+                               throw new WebException ("Not connected", e, 
wes, null);
                        }
                }
 

_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to