From: Graham Leggett Date: Tue, 2 Oct 2012 17:41:00 +0000 (+0000) Subject: mod_include: When an include file or virtual path fails, include the result X-Git-Tag: 2.5.0-alpha~6246 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=dcdc124c705560fd3426aaa9de05582aabed2214;p=thirdparty%2Fapache%2Fhttpd.git mod_include: When an include file or virtual path fails, include the result code that tells us why. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1393058 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/modules/filters/mod_include.c b/modules/filters/mod_include.c index 19bcae25408..8b9c4c774b9 100644 --- a/modules/filters/mod_include.c +++ b/modules/filters/mod_include.c @@ -1797,6 +1797,8 @@ static apr_status_t handle_include(include_ctx_t *ctx, ap_filter_t *f, request_rec *rr = NULL; char *error_fmt = NULL; char *parsed_string; + apr_status_t rv = APR_SUCCESS; + int status = 0; ap_ssi_get_tag_and_value(ctx, &tag, &tag_val, SSI_VALUE_DECODED); if (!tag || !tag_val) { @@ -1815,7 +1817,6 @@ static apr_status_t handle_include(include_ctx_t *ctx, ap_filter_t *f, SSI_EXPAND_DROP_NAME); if (tag[0] == 'f') { char *newpath; - apr_status_t rv; /* be safe; only files in this directory or below allowed */ rv = apr_filepath_merge(&newpath, NULL, parsed_string, @@ -1843,14 +1844,14 @@ static apr_status_t handle_include(include_ctx_t *ctx, ap_filter_t *f, } if (!error_fmt && rr->status != HTTP_OK) { - error_fmt = "unable to include \"%s\" in parsed file %s"; + error_fmt = "unable to include \"%s\" in parsed file %s, subrequest setup returned %d"; } if (!error_fmt && (ctx->flags & SSI_FLAG_NO_EXEC) && rr->content_type && strncmp(rr->content_type, "text/", 5)) { error_fmt = "unable to include potential exec \"%s\" in parsed " - "file %s"; + "file %s, content type not text/*"; } /* See the Kludge in includes_filter for why. @@ -1861,13 +1862,13 @@ static apr_status_t handle_include(include_ctx_t *ctx, ap_filter_t *f, ap_set_module_config(rr->request_config, &include_module, r); } - if (!error_fmt && ap_run_sub_req(rr)) { - error_fmt = "unable to include \"%s\" in parsed file %s"; + if (!error_fmt && ((status = ap_run_sub_req(rr)))) { + error_fmt = "unable to include \"%s\" in parsed file %s, subrequest returned %d"; } if (error_fmt) { - ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, error_fmt, tag_val, - r->filename); + ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r, error_fmt, tag_val, + r->filename, status ? status : rr ? rr->status : 0); if (last_error) { /* onerror threw an error, give up completely */ break;