On 01/04/2009 09:52 PM, [email protected] wrote:
> Author: niq
> Date: Sun Jan 4 12:52:41 2009
> New Revision: 731358
>
> URL: http://svn.apache.org/viewvc?rev=731358&view=rev
> Log:
> Fix mod_ext_filter to detect failure to start the external program,
> and add configuration option to abort or continue.
> PR 41120
>
> Modified:
> httpd/httpd/trunk/CHANGES
> httpd/httpd/trunk/docs/manual/mod/mod_ext_filter.xml
> httpd/httpd/trunk/modules/filters/mod_ext_filter.c
>
> @@ -855,7 +869,19 @@
>
> if (!ctx) {
> if ((rv = init_filter_instance(f)) != APR_SUCCESS) {
> - return rv;
> + ctx = f->ctx;
> + ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r,
> + "can't initialise output filter %s: %s",
> + f->frec->name,
> + ctx->dc->onfail ? "removing" : "aborting");
> + ap_remove_output_filter(f);
> + if (ctx->dc->onfail) {
Hm. I am slightly confused here. The documentation states that "abort" should be
the default behaviour (that is the else branch), but if nothing is set in the
config
onfail defaults to -1 which would cause to get us here (the remove case).
So either the documentation or the code is wrong.
> + return ap_pass_brigade(f->next, bb);
> + }
> + else {
> + f->r->status = HTTP_INTERNAL_SERVER_ERROR;
> + return HTTP_INTERNAL_SERVER_ERROR;
> + }
> }
> ctx = f->ctx;
> }
> @@ -886,7 +912,19 @@
>
> if (!ctx) {
> if ((rv = init_filter_instance(f)) != APR_SUCCESS) {
> - return rv;
> + ctx = f->ctx;
> + ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, f->r,
> + "can't initialise input filter %s: %s",
> + f->frec->name,
> + ctx->dc->onfail ? "removing" : "aborting");
> + ap_remove_input_filter(f);
> + if (ctx->dc->onfail) {
Same as above.
> + return ap_get_brigade(f->next, bb, mode, block, readbytes);
> + }
> + else {
> + f->r->status = HTTP_INTERNAL_SERVER_ERROR;
> + return HTTP_INTERNAL_SERVER_ERROR;
> + }
> }
> ctx = f->ctx;
> }
>
Regards
RĂ¼diger