You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by mi...@apache.org on 2012/10/02 19:41:00 UTC

svn commit: r1393058 - /httpd/httpd/trunk/modules/filters/mod_include.c

Author: minfrin
Date: Tue Oct  2 17:41:00 2012
New Revision: 1393058

URL: http://svn.apache.org/viewvc?rev=1393058&view=rev
Log:
mod_include: When an include file or virtual path fails, include the result
code that tells us why.

Modified:
    httpd/httpd/trunk/modules/filters/mod_include.c

Modified: httpd/httpd/trunk/modules/filters/mod_include.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/filters/mod_include.c?rev=1393058&r1=1393057&r2=1393058&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/filters/mod_include.c (original)
+++ httpd/httpd/trunk/modules/filters/mod_include.c Tue Oct  2 17:41:00 2012
@@ -1797,6 +1797,8 @@ static apr_status_t handle_include(inclu
         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(inclu
                                             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(inclu
         }
 
         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(inclu
             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;