+2006-01-10 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * HttpResponse.cs: typo in comment.
+
+ * HttpApplicationFactory.cs:
+ * HttpApplication.cs: don't discard the application used for running the
+ Application_Start event to allow for Redirect/Transfer to be used. Fail
+ to get the request/response from the application object as MS does (it
+ can still be retrieved through HttpContext.Current.blah). Fixes
+ bug #77162.
+
2006-01-09 Vladimir Krasnov <vladimirk@mainsoft.com>
* CapabilitiesLoader.cs: Merged TARGET_JVM parts in LoadFile
get {
if (context == null)
throw new HttpException (Locale.GetText ("No context is available."));
+
+ if (false == HttpApplicationFactory.ContextAvailable)
+ throw new HttpException (Locale.GetText ("Request is not available in this context."));
+
return context.Request;
}
}
get {
if (context == null)
throw new HttpException (Locale.GetText ("No context is available."));
+
+ if (false == HttpApplicationFactory.ContextAvailable)
+ throw new HttpException (Locale.GetText ("Response is not available in this context."));
+
return context.Response;
}
}
stop_processing = true;
}
+ internal bool RequestCompleted {
+ set { stop_processing = value; }
+ }
+
public virtual void Dispose ()
{
if (modcoll != null) {
//
IEnumerator Pipeline ()
{
+ if (stop_processing)
+ yield return true;
+
if (BeginRequest != null)
foreach (bool stop in RunHooks (BeginRequest))
yield return stop;
{
InitOnce (true);
PreStart ();
- stop_processing = false;
pipeline = Pipeline ();
Tick ();
}
return true;
}
- void FireOnAppStart (HttpContext context)
+ HttpApplication FireOnAppStart (HttpContext context)
{
HttpApplication app = (HttpApplication) Activator.CreateInstance (app_type, true);
+ context.ApplicationInstance = app;
app.SetContext (context);
object [] args = new object [] {app, EventArgs.Empty};
FireEvent ("Application_Start", app, args);
- Recycle (app);
+ return app;
}
void FireOnAppEnd ()
internal static HttpApplication GetApplication (HttpContext context)
{
HttpApplicationFactory factory = theFactory;
+ HttpApplication app = null;
if (factory.needs_init){
if (context == null)
return null;
// We watch bin or bin/*.dll if the directory exists
factory.bin_watcher = CreateWatcher (bin, new FileSystemEventHandler (factory.OnAppFileChanged));
#endif
- factory.FireOnAppStart (context);
+ app = factory.FireOnAppStart (context);
factory.app_start_needed = false;
+ return app;
}
}
}
lock (factory.available) {
- if (factory.available.Count > 0)
- return (HttpApplication) factory.available.Pop ();
+ if (factory.available.Count > 0) {
+ app = (HttpApplication) factory.available.Pop ();
+ app.RequestCompleted = false;
+ return app;
+ }
}
- HttpApplication app = (HttpApplication) Activator.CreateInstance (factory.app_type, true);
-
- return app;
+ return (HttpApplication) Activator.CreateInstance (factory.app_type, true);
}
// The lock is in InvokeSessionEnd
app.Dispose ();
}
}
+
+ internal static bool ContextAvailable {
+ get { return theFactory != null && theFactory.app_start_needed && theFactory.needs_init; }
+ }
}
}