You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Sebastian Pipping <se...@pipping.org> on 2015/04/05 01:21:14 UTC

[users@httpd] Effect of AddType / Differences of AddType and AddHandler

Hello!


I recently learned that both the AddType and AddHandler directives run a
multiple extension approach [1].  So a line like

  AddHandler application/x-httpd-php .php
     ^^^^^^^
could get you into situations where image uploads of files named
"code.php.png" despite ".php" not being the end of the string.  Okay.


I have seen lines like

  AddType application/x-httpd-php .php
     ^^^^
using AddType rather than AddHandler (e.g. at a rather popular German
website called Selfhtml [2]), too.  That's why I'm contacting you.


>From the official AddType docs [3] I was assuming that AddType would
only set the string sent in "Content-type: ..." server response headers,
previously.


To put it into questions:

 * What are the effects of a "AddType ..." line really?

 * What are the differences of AddType and AddHandler?

 * What is the relation of MIME types and handlers in Apache?

 * Are there differences from what Apache 2.2 did compared to 2.4
   in this area of working?


Many thanks in advance for your help!

Best,



Sebastian


[1] https://httpd.apache.org/docs/current/mod/mod_mime.html#multipleext
[2] http://aktuell.de.selfhtml.org/artikel/server/apacheconf/apconf15.htm
[3] https://httpd.apache.org/docs/current/mod/mod_mime.html#addtype

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Effect of AddType / Differences of AddType and AddHandler

Posted by Sebastian Pipping <se...@pipping.org>.
Hello Daniel,


On 06.04.2015 11:47, Daniel wrote:
> You can review that in the documentation too:
> http://httpd.apache.org/docs/current/mod/mod_mime.html

I'm aware of that page, but I don't see answers to my questions on that
page.

Best,



Sebastian


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Effect of AddType / Differences of AddType and AddHandler

Posted by Daniel <df...@gmail.com>.
Sebastian,

You can review that in the documentation too:
http://httpd.apache.org/docs/current/mod/mod_mime.html

Regards

2015-04-05 16:20 GMT+02:00 Sebastian Pipping <se...@pipping.org>:

> Hello Nick,
>
>
> On 05.04.2015 13:36, Nick Kew wrote:
> > Apache 1.0 had no AddHandler, so people used AddType as a hacked
> > workaround.  Apache 1.1 introduced AddHandler, but the AddType
> > hack lived on as a zombie.
>
> Has it lived on until Apache 2.2?  Until 2.4?
>
> How does the hacked workaround work?
>
> Thanks,
>
>
>
> Sebastian
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org
>
>


-- 
*Daniel Ferradal*
IT Specialist

email         dferradal@gmail.com
linkedin     es.linkedin.com/in/danielferradal

Re: [users@httpd] Effect of AddType / Differences of AddType and AddHandler

Posted by Sebastian Pipping <se...@pipping.org>.
On 06.04.2015 14:36, Eric Covener wrote:
> On Sun, Apr 5, 2015 at 10:20 AM, Sebastian Pipping
> <se...@pipping.org> wrote:
>> Has it lived on until Apache 2.2?  Until 2.4?
>>
>> How does the hacked workaround work?
> 
> It's still present.  If no handler is explicitly set, the content-type
> is copied over as the handler.
> 
> A module can either check for a real or "magic" type as either the
> handler or content-type of the current request to figure out whether
> or not to activate itself.

I see.  Thanks!

Best,



Sebastian


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Effect of AddType / Differences of AddType and AddHandler

Posted by Eric Covener <co...@gmail.com>.
On Sun, Apr 5, 2015 at 10:20 AM, Sebastian Pipping
<se...@pipping.org> wrote:
> Has it lived on until Apache 2.2?  Until 2.4?
>
> How does the hacked workaround work?

It's still present.  If no handler is explicitly set, the content-type
is copied over as the handler.

A module can either check for a real or "magic" type as either the
handler or content-type of the current request to figure out whether
or not to activate itself.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Effect of AddType / Differences of AddType and AddHandler

Posted by Sebastian Pipping <se...@pipping.org>.
Hello Nick,


On 05.04.2015 13:36, Nick Kew wrote:
> Apache 1.0 had no AddHandler, so people used AddType as a hacked
> workaround.  Apache 1.1 introduced AddHandler, but the AddType
> hack lived on as a zombie.

Has it lived on until Apache 2.2?  Until 2.4?

How does the hacked workaround work?

Thanks,



Sebastian


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Effect of AddType / Differences of AddType and AddHandler

Posted by Nick Kew <ni...@webthing.com>.
On Sun, 2015-04-05 at 01:21 +0200, Sebastian Pipping wrote:

> [chop]

It's historic.

Apache 1.0 had no AddHandler, so people used AddType as a hacked
workaround.  Apache 1.1 introduced AddHandler, but the AddType
hack lived on as a zombie.  There are a lot of such zombies around:
for example, almost all mod_rewrite examples you'll ever see are
obsolete but live on because "everyone knows" that mod_rewrite is
the universal configuration tool.

Multiple "extensions" are a different matter.  They are required
for some situations such as content negotiation, but in other cases
they can present a gotcha.  There may well be a case for changing
the current default behaviour.

-- 
Nick Kew


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org