You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by dAniel hAhler <ap...@thequod.de> on 2005/07/13 00:33:45 UTC

[users@httpd] Handler added with AddHandler gets invoked when is not really an extension

Hello everybody,

I've just discovered that adding
 AddHandler php-fastcgi .xxx
will also parse files like test.xxx.txt and test.xxx.foobar.

I think it should just use the handler if the extension is the last part of 
the URI. Speaking regexp it should build a pattern like "<extension>$".

I've set this handler in a VirtualHost directive.

Is this a bug or am I missing something?

I'm using the Apache2 package from Ubuntu:
# /usr/sbin/apache2 -v
Server version: Apache/2.0.53
Server built:   May  6 2005 08:15:16

# dpkg -l | grep -i apache
ii  apache-common  1.3.33-4       support files for all Apache webservers
ii  apache2-common 2.0.53-5ubuntu next generation, scalable, extendable web se
ii  apache2-mpm-wo 2.0.53-5ubuntu high speed threaded model for Apache2
ii  apache2-thread 2.0.53-5ubuntu development headers for apache2
ii  apache2-utils  2.0.53-5ubuntu utility programs for webservers
ii  libapache-mod- 4.3.10-10ubunt server-side, HTML-embedded scripting languag
ii  libapache2-mod 2.4.2-5        FastCGI module for Apache2
ii  libapache2-mod 2.0.4-3        Apache 2.0 connector for the Tomcat Java ser
ii  libapr0        2.0.53-5ubuntu the Apache Portable Runtime

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Handler added with AddHandler gets invoked when is not really an extension

Posted by Joshua Slive <js...@gmail.com>.
On 7/13/05, dAniel hAhler <ap...@thequod.de> wrote:
> Thank you, Joshua. After reading it, it makes sense.
> 
> I've now used FilesMatch to force vi backups to not been shown unparsed with:
> <IfModule mod_fastcgi.c>
>         <FilesMatch "\.php~$">
>                 SetHandler php-fastcgi
>         </FilesMatch>
> </IfModule>
> 
> As a side note, it would make sense IMHO to add a note to the AddHandler
> directive documentation about this.

Well, then a note would need to be added to all the Add* directives,
since they all behave the same way.  Instead, we usually document
these issues in common sections like the "Files With Multiple
Extensions" section that I pointed you to.

On an unrelated topic, why do you have the <IfModule> block?  If the
point is to protect against security violations by preventing unparsed
php~ files being shown, then surely you would prefer the SetHandler to
be present whether or not mod_fastcgi is loaded.  Then if you
accidentally forget to load mod_fastcgi, apache would generate an
error rather than sending unparsed php.

Joshua.

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Handler added with AddHandler gets invoked when is not really an extension

Posted by dAniel hAhler <ap...@thequod.de>.
On Wednesday 13 July 2005 04:00, Joshua Slive wrote:

> > I've just discovered that adding
> >  AddHandler php-fastcgi .xxx
> > will also parse files like test.xxx.txt and test.xxx.foobar.
> > [...]
> > Is this a bug or am I missing something?

> See
> http://httpd.apache.org/docs-2.0/mod/mod_mime.html#multipleext
> http://httpd.apache.org/docs-2.0/mod/directive-dict.html#Syntax
>
> If you really want only a trailing extension, you can use a
> <FilesMatch> with a SetHandler.

Thank you, Joshua. After reading it, it makes sense.

I've now used FilesMatch to force vi backups to not been shown unparsed with:
<IfModule mod_fastcgi.c>
        <FilesMatch "\.php~$">
                SetHandler php-fastcgi
        </FilesMatch>
</IfModule>

As a side note, it would make sense IMHO to add a note to the AddHandler 
directive documentation about this.

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Handler added with AddHandler gets invoked when is not really an extension

Posted by Joshua Slive <js...@gmail.com>.
On 7/12/05, dAniel hAhler <ap...@thequod.de> wrote:
> Hello everybody,
> 
> I've just discovered that adding
>  AddHandler php-fastcgi .xxx
> will also parse files like test.xxx.txt and test.xxx.foobar.
> 
> I think it should just use the handler if the extension is the last part of
> the URI. Speaking regexp it should build a pattern like "<extension>$".
> 
> I've set this handler in a VirtualHost directive.
> 
> Is this a bug or am I missing something?

See
http://httpd.apache.org/docs-2.0/mod/mod_mime.html#multipleext
http://httpd.apache.org/docs-2.0/mod/directive-dict.html#Syntax

If you really want only a trailing extension, you can use a
<FilesMatch> with a SetHandler.

Joshua.

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Handler added with AddHandler gets invoked when is not really an extension

Posted by Nick Kew <ni...@webthing.com>.
On Tuesday 12 July 2005 23:33, dAniel hAhler wrote:
> Hello everybody,
>
> I've just discovered that adding
>  AddHandler php-fastcgi .xxx
> will also parse files like test.xxx.txt and test.xxx.foobar.

Sounds like multiviews.  Look it up in the docs.

-- 
Nick Kew

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org