Author: gonzalo
Date: 2005-04-08 16:56:45 -0400 (Fri, 08 Apr 2005)
New Revision: 42707
Modified:
branches/mono-1-0/mcs/class/System/System.Net/ChangeLog
branches/mono-1-0/mcs/class/System/System.Net/HttpWebRequest.cs
Log:
2005-04-08 Gonzalo Paniagua Javier <[EMAIL PROTECTED]>
* HttpWebRequest.cs: moved redirection handling to a proper place.
Modified: branches/mono-1-0/mcs/class/System/System.Net/ChangeLog
===================================================================
--- branches/mono-1-0/mcs/class/System/System.Net/ChangeLog 2005-04-08
20:56:04 UTC (rev 42706)
+++ branches/mono-1-0/mcs/class/System/System.Net/ChangeLog 2005-04-08
20:56:45 UTC (rev 42707)
@@ -1,3 +1,7 @@
+2005-04-08 Gonzalo Paniagua Javier <[EMAIL PROTECTED]>
+
+ * HttpWebRequest.cs: moved redirection handling to a proper place.
+
2005-04-04 Gonzalo Paniagua Javier <[EMAIL PROTECTED]>
* NtlmClient.cs: fix typo in assembly name.
Modified: branches/mono-1-0/mcs/class/System/System.Net/HttpWebRequest.cs
===================================================================
--- branches/mono-1-0/mcs/class/System/System.Net/HttpWebRequest.cs
2005-04-08 20:56:04 UTC (rev 42706)
+++ branches/mono-1-0/mcs/class/System/System.Net/HttpWebRequest.cs
2005-04-08 20:56:45 UTC (rev 42707)
@@ -594,6 +594,7 @@
WebAsyncResult result = asyncWrite;
if (!requestSent) {
requestSent = true;
+ redirects = 0;
servicePoint = GetServicePoint ();
abortHandler = servicePoint.SendRequest
(this, connectionGroup);
}
@@ -662,6 +663,7 @@
if (!requestSent) {
requestSent = true;
+ redirects = 0;
servicePoint = GetServicePoint ();
abortHandler = servicePoint.SendRequest (this,
connectionGroup);
}
@@ -679,25 +681,10 @@
if (result == null)
throw new ArgumentException ("Invalid
IAsyncResult", "asyncResult");
- redirects = 0;
- bool redirected = false;
- asyncRead = result;
- do {
- if (redirected) {
- haveResponse = false;
- webResponse = null;
- result.Reset ();
- servicePoint = GetServicePoint ();
- abortHandler = servicePoint.SendRequest
(this, connectionGroup);
- }
-
- if (!result.WaitUntilComplete (timeout, false))
{
- Abort ();
- throw new WebException("The request
timed out", WebExceptionStatus.Timeout);
- }
-
- redirected = CheckFinalStatus (result);
- } while (redirected);
+ if (!result.WaitUntilComplete (timeout, false)) {
+ Abort ();
+ throw new WebException("The request timed out",
WebExceptionStatus.Timeout);
+ }
return result.Response;
}
@@ -1035,10 +1022,33 @@
if (r != null) {
if (wexc != null) {
r.SetCompleted (false, wexc);
- } else {
- r.SetCompleted (false, webResponse);
+ r.DoCallback ();
+ return;
}
- r.DoCallback ();
+
+ bool redirected;
+ try {
+ redirected = CheckFinalStatus (r);
+ if (!redirected) {
+ r.SetCompleted (false,
webResponse);
+ r.DoCallback ();
+ } else {
+ haveResponse = false;
+ webResponse = null;
+ r.Reset ();
+ servicePoint = GetServicePoint
();
+ abortHandler =
servicePoint.SendRequest (this, connectionGroup);
+ }
+ } catch (WebException wexc2) {
+ r.SetCompleted (false, wexc2);
+ r.DoCallback ();
+ return;
+ } catch (Exception ex) {
+ wexc = new WebException (ex.Message,
ex, WebExceptionStatus.ProtocolError, null);
+ r.SetCompleted (false, wexc);
+ r.DoCallback ();
+ return;
+ }
}
}
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches