RE: AddHandler scope

2003-06-30 Thread Marc M. Adkins
> > I've been working on a module and quite unexpectedly I found that my
> > AddHandler directive was taking affect at a global level even
> though it was
> > defined within a virtual host block.  So it was affecting Apache manual
> > pages that weren't in the virtual host for which I had created the
> > AddHandler directive.  Am I misunderstanding the scope of AddHandler?
> >
> > I am using named virtual host.  For testing I have all of the
> named hosts
> > defined in my HOSTS file to point to 127.0.0.1.  So in a sense
> it all goes
> > to the same place.  I wouldn't have thought that would have made a
> > difference.
>
> Hmm, considering AddHandler is implemented by mod_mime, I would
> find it very
> suspicious that this is behaving this way.  Can you please post a
> configuration snippet that demonstrates this behavior?  -- justin

OK, I think I got it down to the bare minimum.  The attached files live in
C:\Apache2\foobar on my Windows 2000 system.  I run Apache 2.0.46.

The attached httpd.conf is intended to be Included at the end of the normal
httpd.conf.  I keep my httpd.conf (mostly) 'stock' so there shouldn't be any
real issues there.

My HOSTS file defines:

127.0.0.1   localhost
127.0.0.1   Scope.Doorways.home

which may be some or all of the issue.  This is how I do testing (obviously,
since I'm using a non-standard domain name).

The mod_foobar.c file is a trivial module that just prints the handler name
and filename and DECLINEs.  I've included a Makefile that works with my
version of Microsoft's C compiler, which is whatever comes with Visual
Studio 6.

When I run Apache and hit it with:

http://localhost/manual

my error log contains:

[Mon Jun 30 13:23:35 2003] [info] [client 127.0.0.1]
  foobar_handler(foobar, localhost, C:/Apache2/manual/index.html.en)
[Mon Jun 30 13:23:35 2003] [info] [client 127.0.0.1]
  foobar_handler(text/css, localhost,
 C:/Apache2/manual/style/css/manual.css),
referer: http://localhost/manual/
[Mon Jun 30 13:23:35 2003] [info] [client 127.0.0.1]
  foobar_handler(text/css, localhost,
 C:/Apache2/manual/style/css/manual-print.css),
referer: http://localhost/manual/
[Mon Jun 30 13:23:35 2003] [info] [client 127.0.0.1]
  foobar_handler(image/gif, localhost,
 C:/Apache2/manual/images/left.gif),
referer: http://localhost/manual/
[Mon Jun 30 13:23:35 2003] [info] [client 127.0.0.1]
  foobar_handler(image/gif, localhost,
 C:/Apache2/manual/images/feather.gif),
referer: http://localhost/manual/
[Mon Jun 30 13:23:35 2003] [info] [client 127.0.0.1]
  foobar_handler(text/css, localhost,
 C:/Apache2/manual/style/css/manual-loose-100pc.css),
referer: http://localhost/manual/

Hitting it with:

http://Scope.Doorways.home

gives me the appropriate index file (also supplied but irrelevant) and my
error log contains:

[Mon Jun 30 13:24:00 2003] [info] [client 127.0.0.1]
  foobar_handler(foobar, scope.doorways.home,
 C:/Apache2/foobar/index.html)

So the module is being invoked for the Apache manual pages even though they
are not defined in the virtual server block in which I added the handler.
This is what confuses me.  I wouldn't think that this would happen.

I keep thinking that perhaps the fact that both domain names resolve to
127.0.0.1 via my HOSTS file could be confusing Apache.  But they're named
virtual servers, so I feel like that _shouldn't_ be an issue since I'm
asking for different hosts via the browser.  And the request record is
showing different hostnames in the log.

Anyway, I'm probably missing something simple in the configuration file.

mma


httpd.conf
Description: Binary data


mod_foobar.c
Description: Binary data


Makefile
Description: Binary data
Title: Some Title




Some stuff




Re: AddHandler scope

2003-06-30 Thread Justin Erenkrantz
--On Sunday, June 29, 2003 2:05 PM -0700 "Marc M. Adkins" 
<[EMAIL PROTECTED]> wrote:

I've been working on a module and quite unexpectedly I found that my
AddHandler directive was taking affect at a global level even though it was
defined within a virtual host block.  So it was affecting Apache manual
pages that weren't in the virtual host for which I had created the
AddHandler directive.  Am I misunderstanding the scope of AddHandler?
I am using named virtual host.  For testing I have all of the named hosts
defined in my HOSTS file to point to 127.0.0.1.  So in a sense it all goes
to the same place.  I wouldn't have thought that would have made a
difference.
Hmm, considering AddHandler is implemented by mod_mime, I would find it very 
suspicious that this is behaving this way.  Can you please post a 
configuration snippet that demonstrates this behavior?  -- justin