]> granicus.if.org Git - apache/commitdiff
mod_include: When an include file or virtual path fails, include the result
authorGraham Leggett <minfrin@apache.org>
Tue, 2 Oct 2012 17:41:00 +0000 (17:41 +0000)
committerGraham Leggett <minfrin@apache.org>
Tue, 2 Oct 2012 17:41:00 +0000 (17:41 +0000)
code that tells us why.

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1393058 13f79535-47bb-0310-9956-ffa450edef68

modules/filters/mod_include.c

index 19bcae25408e95179af507a9fd716fd7bf35281c..8b9c4c774b975624533636ecd392841a1c3c54b5 100644 (file)
@@ -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;