a

>>Bugs>> [Fixed in trunk.417, not present in NeatUpload-1.2] UploadHttpModule on non configured path
Pages: 1   reply
Author [Fixed in trunk.417, not present in NeatUpload-1.2] UploadHttpModule on non configured path
guest
Total Posts:
UploadHttpModule on non configured path
11/16/2006 9:42:29 AM
The UploadHttpModule seems to be handling requests even on non configured URL.
On each registered event, there should be a:
if (!Config.Current.UseHttpModule)
{
    return;
}
as there is in Application_BeginRequest.

Otherwise, using Server.Transfer(url, true) on a non configured url cleans the Form collection.

Alberto Bolchini (albertob at engitel.com)

Here's a patch:

--- NeatUpload-trunk.412.orig/UploadHttpModule.cs    2006-09-26 01:25:26.000000000 +0200
+++ NeatUpload-trunk.412/UploadHttpModule.cs    2006-11-15 10:15:26.328125000 +0100
@@ -330,6 +330,10 @@
 
         private void Application_ResolveRequestCache(object sender, EventArgs e)
         {
+            if (!Config.Current.UseHttpModule)
+            {
+                return;
+            }
             if (log.IsDebugEnabled) log.Debug("In Application_ResolveRequestCache");
             // Wait for the upload to complete before AcquireRequestState fires.  If we don't then the session
             // will be locked while the upload completes
@@ -361,6 +365,10 @@
 
         private void Application_PreSendRequestHeaders(object sender, EventArgs e)
         {
+            if (!Config.Current.UseHttpModule)
+            {
+                return;
+            }
             if (log.IsDebugEnabled) log.Debug("In Application_PreSendRequestHeaders");
             if (requestHandledBySubRequest)
             {
@@ -389,6 +397,10 @@
 
         private void Application_Error(object sender, EventArgs e)
         {
+            if (!Config.Current.UseHttpModule)
+            {
+                return;
+            }
             if (log.IsDebugEnabled) log.Debug("In Application_Error");
             HttpApplication app = sender as HttpApplication;
             if (log.IsDebugEnabled) log.DebugFormat("Error is: {0}", app.Server.GetLastError());
@@ -403,6 +415,10 @@
         private EventHandler RememberErrorHandler;
         private void RememberError(object sender, EventArgs e)
         {
+            if (!Config.Current.UseHttpModule)
+            {
+                return;
+            }
             DecoratedWorkerRequest decoratedWorker = GetCurrentWorkerRequest() as DecoratedWorkerRequest;
             HttpApplication app = sender as HttpApplication;
            
@@ -428,8 +444,11 @@
 
         private void Application_EndRequest(object sender, EventArgs e)
         {
+            if (!Config.Current.UseHttpModule)
+            {
+                return;
+            }
             if (log.IsDebugEnabled) log.Debug("In Application_EndRequest");
-
             HttpApplication app = sender as HttpApplication;
             if (RememberErrorHandler != null)
             {

 
Dean Brettle
Total Posts: 2015
Re: UploadHttpModule on non configured path
11/16/2006 10:10:27 AM
Hmmm...

I wouldn't think that adding that check would be necessary.  I don't see anything in the other handlers that would cause the form collection to be cleared.  Are you sure that your patch fixed the problem and not something else?  If so, I'll try to reproduce the problem here so I can verify the fix.

BTW, what version of NeatUpload and .NET are you using?

Thanks,
--Dean

 
guest
Total Posts:
Re: UploadHttpModule on non configured path
11/16/2006 10:38:37 AM
Yes, the check on all methods actually fixed the behaviour.

I have an httphandler which transfers /aaa/bbb/ccc.html to /xxx/yyy/zzz.aspx?id=123 with a Server.Transfer(url, true). zzz.aspx gets the server variable "QUERY_STRING" correct (id=123) but the Request parameters collection gets cleaned.

I'm using .NET 1.1.4322 on Windows XP with NeatUpload-trunk.412

Thank you,

Alberto.

 
Dean Brettle
Total Posts: 2015
Re: UploadHttpModule on non configured path
11/20/2006 2:07:26 PM
This is fixed as of NeatUpload-trunk.415.  The bug does not exist in NeatUpload-1.2.

The bug was caused by one of the UploadHttpModule's event handlers accessing Request.Params.  Apparently, that array is constructed on demand and not replaced when Server.Transfer() is called.  To same thing would occur if your HttpHandler accessed Request.Params before calling Server.Transfer(), so be careful not to do that.

FYI, the patch I applied is a little more complicated than what you provided because I want to prevent the problem even when the UploadHttpModule is being used.  To do that I changed the handler to manually extract the param from the query string, instead of using Request.Params.

Thanks again for the feedback and patch, and thanks for emailing me the test case.

--Dean

 
Dean Brettle
Total Posts: 2015
Re: [Fixed in trunk.417, not present in NeatUpload-1.2] UploadHttpModule on non configured path
12/3/2006 9:41:26 PM
The fix in NeatUpload-trunk.415 introduced another bug that occurs when the URL that the form is posted to does not contain a query string.  That is fixed as of NeatUpload-trunk.417.

--Dean

 
Pages: 1   reply
a