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 (JIRA)" <ji...@apache.org> on 2005/12/30 01:12:01 UTC

[jira] Commented: (MODPYTHON-103) Implement req.add_output_filter().

    [ http://issues.apache.org/jira/browse/MODPYTHON-103?page=comments#action_12361401 ] 

Graham Dumpleton commented on MODPYTHON-103:
--------------------------------------------

Correspondingly, it should be possible to add a req.add_input_filter() function as well. This is because mod_python input filters only get triggered for the body of the request. This will only occur though when a call is made to req.read(). As a consequence, a request handler should probably be able to register input filters as well, provided it does it before the first req.read() of any request body content.

Worth noting though is that if the request doesn't specify a content length, calling req.read() will not cause the input filter to be triggered at that point. The input filter will however be triggered at some point later on (not sure where), by Apache so that the input filter will detect end of input and close off the bucket brigade properly.


> Implement req.add_output_filter().
> ----------------------------------
>
>          Key: MODPYTHON-103
>          URL: http://issues.apache.org/jira/browse/MODPYTHON-103
>      Project: mod_python
>         Type: New Feature
>   Components: core
>     Reporter: Graham Dumpleton
>      Fix For: 3.3

>
> Add new member function to request object called "add_output_filter()". This would be a wrapper around the function "ap_add_output_filter()" and allow previously defined filters to be attached to the current request such that output can be filtered through them. For example:
>   req.add_output_filter("INCLUDES")
> It would probably be necessary for any such call to be done prior to the first output being generated from the request handler.
> In addition to this member function, it may be necessary to also provide another member function called something like "req.add_python_output_filter()". This would be called something like:
>   req.add_python_output_filter("module_name::filter_name",path)
> Ie., like "req.add_handler()" but no first argument for phase.
> This method would allow a specific Python filter handler function to be specified. This would be equivalent to using the PythonOutputFilter directive to first name a mod_python based filter handler function and then adding it as an output filter.
>   # Main Apache config.
>   PythonOutputFilter module_name::filter_name MYFILTER
>   # Handler code.
>   req.add_output_filter("MYFILTER")
> Note that the PythonOutputFilter directive can only be used in the main Apache configuration file, it cannot be used in a .htaccess file. Whether it could be made to work in a .htaccess file in some way needs to be investigated. In mod_perl their equivlent seems to allow it.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira