summaryrefslogtreecommitdiffstats
path: root/modules/generators/mod_cgi.c
diff options
context:
space:
mode:
authorEric Covener <covener@apache.org>2018-01-10 01:57:22 +0100
committerEric Covener <covener@apache.org>2018-01-10 01:57:22 +0100
commit938a1ff0ecc82f3994824b900872dcca6e41fa78 (patch)
tree578e23df6745f1db9946d7be30a1b4defb5681d6 /modules/generators/mod_cgi.c
parentPR 61983: "Header unset Content-Type" doesn't work (diff)
downloadapache2-938a1ff0ecc82f3994824b900872dcca6e41fa78.tar.xz
apache2-938a1ff0ecc82f3994824b900872dcca6e41fa78.zip
PR 61980: AH01215 CGI stderr forwarding msg improvement
*) mod_cgi: Improve AH01215 messages to make it more clear that the message is the CGI scripts stderr output. PR 61980. [Hank Ibell <hwibell gmail.com>] Submitted By: Hank Ibell <hwibell gmail.com> Commited By: covener git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1820716 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'modules/generators/mod_cgi.c')
-rw-r--r--modules/generators/mod_cgi.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/modules/generators/mod_cgi.c b/modules/generators/mod_cgi.c
index 8c4a2c6360..51bc719f01 100644
--- a/modules/generators/mod_cgi.c
+++ b/modules/generators/mod_cgi.c
@@ -167,12 +167,11 @@ static int log_scripterror(request_rec *r, cgi_server_conf * conf, int ret,
apr_file_t *f = NULL;
apr_finfo_t finfo;
char time_str[APR_CTIME_LEN];
- int log_flags = rv ? APLOG_ERR : APLOG_ERR;
/* Intentional no APLOGNO */
/* Callee provides APLOGNO in error text */
- ap_log_rerror(APLOG_MARK, log_flags, rv, r,
- "%s%s: %s", logno ? logno : "", error, r->filename);
+ ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r,
+ "%sstderr from %s: %s", logno ? logno : "", r->filename, error);
/* XXX Very expensive mainline case! Open, then getfileinfo! */
if (!conf->logname ||
@@ -209,8 +208,14 @@ static apr_status_t log_script_err(request_rec *r, apr_file_t *script_err)
while ((rv = apr_file_gets(argsbuffer, HUGE_STRING_LEN,
script_err)) == APR_SUCCESS) {
+
newline = strchr(argsbuffer, '\n');
if (newline) {
+ char *prev = newline - 1;
+ if (prev >= argsbuffer && *prev == '\r') {
+ newline = prev;
+ }
+
*newline = '\0';
}
log_scripterror(r, conf, r->status, 0, APLOGNO(01215), argsbuffer);