* HttpApplication.cs: ThreadAbortException is ok on Redirect.
* HttpContext.cs: added TimeoutPossible property.
* HttpResponse.cs: throw ThreadAbortException if End () is called within
a step in which is possible to timeout.
Fixes bug #51703.
svn path=/trunk/mcs/; revision=20791
+2003-12-04 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * HttpApplication.cs: ThreadAbortException is ok on Redirect.
+ * HttpContext.cs: added TimeoutPossible property.
+ * HttpResponse.cs: throw ThreadAbortException if End () is called within
+ a step in which is possible to timeout.
+
+ Fixes bug #51703.
+
2003-12-04 Jackson Harper <jackson@ximian.com>
* HttpRequest.cs: Cleanup method.
readysync = state.CompletedSynchronously;
} catch (ThreadAbortException obj) {
- StepTimeout timeout = obj.ExceptionState as StepTimeout;
- if (timeout != null) {
+ object o = obj.ExceptionState;
+ Type type = (o != null) ? o.GetType () : null;
+ if (type == typeof (StepTimeout)) {
Thread.ResetAbort ();
lasterror = new HttpException ("The request timed out.");
_app.CompleteRequest ();
+ } else if (type == typeof (StepCompleteRequest)) {
+ Thread.ResetAbort ();
+ _app.CompleteRequest ();
}
} catch (Exception obj) {
lasterror = obj;
}
#endregion Properties
}
+
+ // Used in HttpResponse.End ()
+ class StepCompleteRequest
+ {
+ }
}
}
}
+ internal bool TimeoutPossible {
+ get { return (Interlocked.CompareExchange (ref timeoutPossible, 1, 1) == 1); }
+ }
+
internal void BeginTimeoutPossible ()
{
timeoutPossible = 1;
if (_bEnded)
return;
+ if (_Context.TimeoutPossible)
+ Thread.CurrentThread.Abort (new StepCompleteRequest ());
+
Flush ();
_bEnded = true;
_Context.ApplicationInstance.CompleteRequest ();