You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cli-dev@httpd.apache.org by Yussef Alkhamrichi <ya...@hotmail.com> on 2004/11/15 15:18:24 UTC

httpmodule bug

I've been searching for the cause of bug occuring when adding a custom 
httpModule using the web.config for a while now (I've already posted this on 
this list).

I've gone into the code and the only thing I can image that occurs is that 
the web.config of one virtual directory is configured twice for the same 
AppDomain.

The section in the web.config that causes this problem looks like this:

<httpModules>
	<add name="TrustedAuthenticationModule" 
type="TrustedSecurity.TrustedAuthenticationModule, TrustedSecurity" />
</httpModules>

I found some strange code in 2 lines that are indirectly related to the 
configuration, in host.h the function void Configure(String *VirtualPath, 
String *PhysicalPath, HostFactory *Factory, int HostKey) contains these 
lines:

physicalPath = physicalPath->Substring(0, VirtualPath->get_Length() - 1);
virtualPath = virtualPath->Substring(0, VirtualPath->get_Length() - 1);

shouldn't these be:

physicalPath = physicalPath->Substring(0, physicalPath->get_Length() - 1);
virtualPath = virtualPath->Substring(0, virtualPath->get_Length() - 1);

(the last line ofcourse has no effect, but maybe it's better to get the code 
as clean as possible).

Back to my problem, I can create a workaround for it, but I'm really curious 
wether or not the web.config file is handled twice, this would be a serious 
bug I think. Anybody else?

_________________________________________________________________
MSN Search, for accurate results! http://search.msn.nl


Fixed: httpmodule bug

Posted by "William A. Rowe, Jr." <wr...@rowe-clan.net>.
At 08:18 AM 11/15/2004, Yussef Alkhamrichi wrote:

>I found some strange code in 2 lines that are indirectly related to the configuration, in host.h the function void Configure(String *VirtualPath, String *PhysicalPath, HostFactory *Factory, int HostKey) contains these lines:
>
>physicalPath = physicalPath->Substring(0, VirtualPath->get_Length() - 1);
>virtualPath = virtualPath->Substring(0, VirtualPath->get_Length() - 1);
>
>shouldn't these be:
>
>physicalPath = physicalPath->Substring(0, physicalPath->get_Length() - 1);
>virtualPath = virtualPath->Substring(0, virtualPath->get_Length() - 1);

Patched for 2.0.1, thanks!

Bill



Re: httpmodule bug

Posted by "William A. Rowe, Jr." <wr...@rowe-clan.net>.
At 04:52 PM 11/18/2004, Yussef Alkhamrichi wrote:
>I've one other question: I have manually installed the Apache.Web.dll in the GAC. If I remove it from GAC and remove all instances of Apache.Web.dll from my server and start Apache the Apache.Web.dll somehow appaers in the GAC again. Anyone?

If you built from the tree, it's registered by-reference.  That's
probably sub-optimal, but it compensates for the fact that it's
nearly impossible to inject the debugger unless the module is
based in it's build tree (to thoroughly inspect the sources.)

Bill 


Re: httpmodule bug

Posted by Yussef Alkhamrichi <ya...@hotmail.com>.
> >>>I've gone into the code and the only thing I can image that occurs is 
>that the web.config of one virtual directory is configured twice for the 
>same AppDomain.
> >>
> >>Again, I'm curious, is one a child directory of another mount?
> >>Either physical or virtual path (or both?)
> >
> >I'm mounting the directory D:\Web\IssueTracker
> >
> >D:\Web isn't mounted, and both D:\Web and D:\ doesn't contain a 
>web.config (no files at all actualy)
>
>Hmmm - so do you mean you have only one AspNetMount directive?
>If not I'm wondering - is one nested inside another?

I was using 3 aspnetmount directives, all subdirectories of D:\Web (so 
D:\Web\....), I've even removed two of the to test wether this makes any 
difference, but it doesn't.

Somehow the web.config file of the site is configured multiple times.

_________________________________________________________________
MSN Search, for accurate results! http://search.msn.nl


Re: httpmodule bug

Posted by "William A. Rowe, Jr." <wr...@rowe-clan.net>.
At 04:52 PM 11/18/2004, Yussef Alkhamrichi wrote:
>>>I've gone into the code and the only thing I can image that occurs is that the web.config of one virtual directory is configured twice for the same AppDomain.
>>
>>Again, I'm curious, is one a child directory of another mount?
>>Either physical or virtual path (or both?)
>
>I'm mounting the directory D:\Web\IssueTracker
>
>D:\Web isn't mounted, and both D:\Web and D:\ doesn't contain a web.config (no files at all actualy)

Hmmm - so do you mean you have only one AspNetMount directive?
If not I'm wondering - is one nested inside another?

Bill



Re: httpmodule bug

Posted by Jeff White <jl...@earthlink.net>.
By the way using old RC1 MSI

Will look at HttpApplication state settings
between turkey cooking and eating - seems
something "touchs" them? (?????)

Go relax Bill....

Jeff

----- Original Message ----- 
Sent: Wednesday, November 24, 2004 5:05 PM
Subject: Re: httpmodule bug


>
> From: "Yussef Alkhamrichi"
>
>>
>> Hope someone out there puts together a custom HttpModule and tries 
>> this out, I will continue to search if I can find this bug (sadly 
>> there isn't a way to hack into the config file loading of .NET).
>>
>
> I tried a simple Hello HttpModule and on
> first try:
>
> Server Error in '/TestHttpModules' Application.
> The module 'HelloWorldModule' is already in the
> application and cannot be added again
>
> Tried remove in web.config
>
> Line 2:      <system.web>
> Line 3:          <httpModules>
> Line 4:            <remove name="HelloWorldModule" />
> Line 5:              <add name="HelloWorldModule"
> Line 6:                type="HelloWorldModule, HelloWorldModule" />
>
> Parser Error Message: There is no 'HelloWorldModule' module in the 
> application to remove.
>
> Tried blocking out the "whole name" this time...
>
> <httpModules>
>         <!-- <remove name="HelloWorldModule" />
>            <add name="HelloWorldModule"
>              type="HelloWorldModule, HelloWorldModule" /> -->
>        </httpModules>
>
> System.Threading.ThreadAbortException: Thread was being aborted.
>
> Adding a clear works
>
> <configuration>
>    <system.web>
>        <httpModules>
>         <!-- <remove name="HelloWorldModule" /> -->
>            <clear />
>            <add name="HelloWorldModule"
>              type="HelloWorldModule, HelloWorldModule" />
>        </httpModules>
>    </system.web>
> </configuration>
>
> Moving clear to bottom
>
> <httpModules>
>         <!-- <remove name="HelloWorldModule" />
>         <clear /> -->
>            <add name="HelloWorldModule"
>              type="HelloWorldModule, HelloWorldModule" />
>         <clear />
>        </httpModules>
>
> runs with no error but not httpmodules output either!
>
> Seems mod_aspdotnet needs a clear first
> as you said!
>
> Jeff
>
> 


Re: httpmodule bug

Posted by Jeff White <jl...@earthlink.net>.
From: "Yussef Alkhamrichi"

>
> Hope someone out there puts together a custom HttpModule and tries 
> this out, I will continue to search if I can find this bug (sadly 
> there isn't a way to hack into the config file loading of .NET).
>

I tried a simple Hello HttpModule and on
first try:

Server Error in '/TestHttpModules' Application.
The module 'HelloWorldModule' is already in the
application and cannot be added again

Tried remove in web.config

Line 2:      <system.web>
Line 3:          <httpModules>
Line 4:            <remove name="HelloWorldModule" />
Line 5:              <add name="HelloWorldModule"
Line 6:                type="HelloWorldModule, HelloWorldModule" />

Parser Error Message: There is no 'HelloWorldModule' module in the 
application to remove.

Tried blocking out the "whole name" this time...

<httpModules>
         <!-- <remove name="HelloWorldModule" />
            <add name="HelloWorldModule"
              type="HelloWorldModule, HelloWorldModule" /> -->
        </httpModules>

System.Threading.ThreadAbortException: Thread was being aborted.

Adding a clear works

<configuration>
    <system.web>
        <httpModules>
         <!-- <remove name="HelloWorldModule" /> -->
            <clear />
            <add name="HelloWorldModule"
              type="HelloWorldModule, HelloWorldModule" />
        </httpModules>
    </system.web>
</configuration>

Moving clear to bottom

<httpModules>
         <!-- <remove name="HelloWorldModule" />
         <clear /> -->
            <add name="HelloWorldModule"
              type="HelloWorldModule, HelloWorldModule" />
         <clear />
        </httpModules>

runs with no error but not httpmodules output either!

Seems mod_aspdotnet needs a clear first
as you said!

Jeff



Re: httpmodule bug

Posted by Yussef Alkhamrichi <ya...@hotmail.com>.
> >I've gone into the code and the only thing I can image that occurs is 
>that the web.config of one virtual directory is configured twice for the 
>same AppDomain.
>
>Again, I'm curious, is one a child directory of another mount?
>Either physical or virtual path (or both?)

I'm mounting the directory D:\Web\IssueTracker

D:\Web isn't mounted, and both D:\Web and D:\ doesn't contain a web.config 
(no files at all actualy)

>This looks sane; did you test w/ this patch?  99% certain you
>caught a live one.

I've compiled Apache.Web.Dll (and Apache.Web.Helpers.netmodule) with this 
fix, no change in behaviour noticed.

So the problem with configuring HttpModules continues to exist (I've even 
tried Cassini to check that it isn't a problem with hosting ASP.NET itself, 
but Cassini works fine).

Hope someone out there puts together a custom HttpModule and tries this out, 
I will continue to search if I can find this bug (sadly there isn't a way to 
hack into the config file loading of .NET).

I've one other question: I have manually installed the Apache.Web.dll in the 
GAC. If I remove it from GAC and remove all instances of Apache.Web.dll from 
my server and start Apache the Apache.Web.dll somehow appaers in the GAC 
again. Anyone?

Thnkx

_________________________________________________________________
Talk with your online friends with MSN Messenger http://messenger.msn.nl/


Re: httpmodule bug

Posted by "William A. Rowe, Jr." <wr...@rowe-clan.net>.
At 08:18 AM 11/15/2004, Yussef Alkhamrichi wrote:
>I've gone into the code and the only thing I can image that occurs is that the web.config of one virtual directory is configured twice for the same AppDomain.

Again, I'm curious, is one a child directory of another mount?
Either physical or virtual path (or both?)

>I found some strange code in 2 lines that are indirectly related to the configuration, in host.h the function void Configure(String *VirtualPath, String *PhysicalPath, HostFactory *Factory, int HostKey) contains these lines:
>
>physicalPath = physicalPath->Substring(0, VirtualPath->get_Length() - 1);
>virtualPath = virtualPath->Substring(0, VirtualPath->get_Length() - 1);
>
>shouldn't these be:
>
>physicalPath = physicalPath->Substring(0, physicalPath->get_Length() - 1);
>virtualPath = virtualPath->Substring(0, virtualPath->get_Length() - 1);
>
>(the last line ofcourse has no effect, but maybe it's better to get the code as clean as possible).

This looks sane; did you test w/ this patch?  99% certain you
caught a live one.

Bill 


Re: httpmodule bug

Posted by "William A. Rowe, Jr." <wr...@rowe-clan.net>.
Yussef,

just a theory, try adding the deeper AspNetMounts to get them
mounted correctly before those closer to the drive root.

If ASP.NET 1.1 is traversing the tree for web.config files, it
might be automounting them.  Lets see if this makes any difference.
If the finer grained matching sections come first, maybe this will
help you.

Bill

At 08:18 AM 11/15/2004, Yussef Alkhamrichi wrote:
>I've been searching for the cause of bug occuring when adding a custom httpModule using the web.config for a while now (I've already posted this on this list).
>
>I've gone into the code and the only thing I can image that occurs is that the web.config of one virtual directory is configured twice for the same AppDomain.
>
>The section in the web.config that causes this problem looks like this:
>
><httpModules>
>        <add name="TrustedAuthenticationModule" type="TrustedSecurity.TrustedAuthenticationModule, TrustedSecurity" />
></httpModules>
>
>I found some strange code in 2 lines that are indirectly related to the configuration, in host.h the function void Configure(String *VirtualPath, String *PhysicalPath, HostFactory *Factory, int HostKey) contains these lines:
>
>physicalPath = physicalPath->Substring(0, VirtualPath->get_Length() - 1);
>virtualPath = virtualPath->Substring(0, VirtualPath->get_Length() - 1);
>
>shouldn't these be:
>
>physicalPath = physicalPath->Substring(0, physicalPath->get_Length() - 1);
>virtualPath = virtualPath->Substring(0, virtualPath->get_Length() - 1);
>
>(the last line ofcourse has no effect, but maybe it's better to get the code as clean as possible).
>
>Back to my problem, I can create a workaround for it, but I'm really curious wether or not the web.config file is handled twice, this would be a serious bug I think. Anybody else?
>
>_________________________________________________________________
>MSN Search, for accurate results! http://search.msn.nl
>