You are viewing a plain text version of this content. The canonical link for it is here.
Posted to mod_python-dev@quetz.apache.org by Graham Dumpleton <gr...@dscpl.com.au> on 2005/12/20 10:53:40 UTC

input/output filters and .htaccess

Anyone know if there are any technical reasons why input/output filters
as they exist at the moment, applying only to body content and not
headers, can not be specified in a .htaccess files?

Specifically, the SetInputFilter, SetOutputFilter, AddInputFilter and
AddOutputFilter directives of Apache can be specified in either main
server configuration or .htaccess files, yet the PythonInputFilter and
PythonOutputFilter directives are only allowed to be specified in the
main server configuration.

This is because mod_python.c contains:

     AP_INIT_TAKE12(
         "PythonInputFilter", directive_PythonInputFilter, NULL, 
RSRC_CONF|ACCESS_CONF,
         "Python input filter."),
     AP_INIT_TAKE12(
         "PythonOutputFilter", directive_PythonOutputFilter, NULL, 
RSRC_CONF|ACCESS_CONF,
         "Python output filter."),

If however I change it to:

     AP_INIT_TAKE12(
         "PythonInputFilter", directive_PythonInputFilter, NULL, OR_ALL,
         "Python input filter."),
     AP_INIT_TAKE12(
         "PythonOutputFilter", directive_PythonOutputFilter, NULL, 
OR_ALL,
         "Python output filter."),

it is then possible to use the mod_python directives in a .htaccess 
file.

Running the code this way appears to work for both input and output 
filters
when specified in the .htaccess file without problems.

So, does anyone know why this might be a bad idea? I can't really think 
of
any reasons why it shouldn't be okay. If there is some confirmation that
it all sounds reasonable, I'll create a JIRA issue for it to be a future
enhancement.

Graham


Re: input/output filters and .htaccess

Posted by "Gregory (Grisha) Trubetskoy" <gr...@apache.org>.
This sounds like a good idea, but it's probably better to push this off to 
3.3 just to veer on the side of caution.

My $0.02

Grisha

On Tue, 20 Dec 2005, Graham Dumpleton wrote:

> Anyone know if there are any technical reasons why input/output filters
> as they exist at the moment, applying only to body content and not
> headers, can not be specified in a .htaccess files?
>
> Specifically, the SetInputFilter, SetOutputFilter, AddInputFilter and
> AddOutputFilter directives of Apache can be specified in either main
> server configuration or .htaccess files, yet the PythonInputFilter and
> PythonOutputFilter directives are only allowed to be specified in the
> main server configuration.
>
> This is because mod_python.c contains:
>
>    AP_INIT_TAKE12(
>        "PythonInputFilter", directive_PythonInputFilter, NULL, 
> RSRC_CONF|ACCESS_CONF,
>        "Python input filter."),
>    AP_INIT_TAKE12(
>        "PythonOutputFilter", directive_PythonOutputFilter, NULL, 
> RSRC_CONF|ACCESS_CONF,
>        "Python output filter."),
>
> If however I change it to:
>
>    AP_INIT_TAKE12(
>        "PythonInputFilter", directive_PythonInputFilter, NULL, OR_ALL,
>        "Python input filter."),
>    AP_INIT_TAKE12(
>        "PythonOutputFilter", directive_PythonOutputFilter, NULL, OR_ALL,
>        "Python output filter."),
>
> it is then possible to use the mod_python directives in a .htaccess file.
>
> Running the code this way appears to work for both input and output filters
> when specified in the .htaccess file without problems.
>
> So, does anyone know why this might be a bad idea? I can't really think of
> any reasons why it shouldn't be okay. If there is some confirmation that
> it all sounds reasonable, I'll create a JIRA issue for it to be a future
> enhancement.
>
> Graham
>

Re: input/output filters and .htaccess

Posted by Jorey Bump <li...@joreybump.com>.
Graham Dumpleton wrote:
> Anyone know if there are any technical reasons why input/output filters
> as they exist at the moment, applying only to body content and not
> headers, can not be specified in a .htaccess files?
> 
> Specifically, the SetInputFilter, SetOutputFilter, AddInputFilter and
> AddOutputFilter directives of Apache can be specified in either main
> server configuration or .htaccess files, yet the PythonInputFilter and
> PythonOutputFilter directives are only allowed to be specified in the
> main server configuration.
> 
> This is because mod_python.c contains:
> 
>     AP_INIT_TAKE12(
>         "PythonInputFilter", directive_PythonInputFilter, NULL, 
> RSRC_CONF|ACCESS_CONF,
>         "Python input filter."),
>     AP_INIT_TAKE12(
>         "PythonOutputFilter", directive_PythonOutputFilter, NULL, 
> RSRC_CONF|ACCESS_CONF,
>         "Python output filter."),
> 
> If however I change it to:
> 
>     AP_INIT_TAKE12(
>         "PythonInputFilter", directive_PythonInputFilter, NULL, OR_ALL,
>         "Python input filter."),
>     AP_INIT_TAKE12(
>         "PythonOutputFilter", directive_PythonOutputFilter, NULL, OR_ALL,
>         "Python output filter."),
> 
> it is then possible to use the mod_python directives in a .htaccess file.
> 
> Running the code this way appears to work for both input and output filters
> when specified in the .htaccess file without problems.
> 
> So, does anyone know why this might be a bad idea? I can't really think of
> any reasons why it shouldn't be okay. If there is some confirmation that
> it all sounds reasonable, I'll create a JIRA issue for it to be a future
> enhancement.

Are there any conflicts when a directive appears in both places? If not, 
how do they cascade (does the .htaccess trump the one in the conf file, 
is it additive, does it respect virtual host or directory boundaries, 
etc...)?