From: Eric Covener Date: Wed, 10 Jan 2018 00:57:22 +0000 (+0000) Subject: PR 61980: AH01215 CGI stderr forwarding msg improvement X-Git-Tag: 2.5.0-alpha2-ci-test-only~2987 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=938a1ff0ecc82f3994824b900872dcca6e41fa78;p=thirdparty%2Fapache%2Fhttpd.git 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 ] Submitted By: Hank Ibell Commited By: covener git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1820716 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/CHANGES b/CHANGES index ddc1178f11f..70496956377 100644 --- a/CHANGES +++ b/CHANGES @@ -1,6 +1,9 @@ -*- coding: utf-8 -*- Changes with Apache 2.5.1 + *) mod_cgi: Improve AH01215 messages to make it more clear that the message is + the CGI scripts stderr output. PR 61980. [Hank Ibell ] + *) mod_headers: Allow 'Header unset Content-Type' to remove the Content-Type header. PR 61983. [Hank Ibell ] diff --git a/modules/generators/mod_cgi.c b/modules/generators/mod_cgi.c index 8c4a2c63600..51bc719f018 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);