Browse Source

[System]: Properly propage exceptions in HttpWebRequest.BeginGetResponse().

(cherry picked from commit acf6c4bd3718265bc62aafc6338d024db1a4e950)
Martin Baulig 10 years ago
parent
commit
f8f7de7356
1 changed files with 7 additions and 1 deletions
  1. 7 1
      mcs/class/System/System.Net/HttpWebRequest.cs

+ 7 - 1
mcs/class/System/System.Net/HttpWebRequest.cs

@@ -969,11 +969,17 @@ namespace System.Net
 					}
 				}
 
-				if (!requestSent) {
+				if (requestSent)
+					return;
+
+				try {
 					requestSent = true;
 					redirects = 0;
 					servicePoint = GetServicePoint ();
 					abortHandler = servicePoint.SendRequest (this, connectionGroup);
+				} catch (Exception ex) {
+					aread.SetCompleted (synch, ex);
+					aread.DoCallback ();
 				}
 			});