You are viewing a plain text version of this content. The canonical link for it is here.
Posted to apache-bugdb@apache.org by Hardy Braunsdorf <ha...@metechnology.com> on 2000/06/08 10:11:37 UTC
mod_cgi/6161: Ouputs to stderr from a cgi-program was not written in error.log.
>Number: 6161
>Category: mod_cgi
>Synopsis: Ouputs to stderr from a cgi-program was not written in error.log.
>Confidential: no
>Severity: non-critical
>Priority: medium
>Responsible: apache
>State: open
>Class: sw-bug
>Submitter-Id: apache
>Arrival-Date: Thu Jun 08 01:20:01 PDT 2000
>Closed-Date:
>Last-Modified:
>Originator: hardy.braunsdorf@metechnology.com
>Release: 1.3.12
>Organization:
apache
>Environment:
Windows NT 4.0 Server SP 4
Visual C++ 5.0 SP3
>Description:
I use a cgi-program, that report errors to the stderr. Under unix-systems i see
this output in the apache-errorlog.
>How-To-Repeat:
#include <stdio.h>
int main()
{
fprintf(stderr,"Test stderr under Windows NT\n");
printf("Content-Type: text/html\n\n");
printf("Testpage\n");
return 0;
}
>Fix:
*** mod_cgi.c Thu Jun 8 10:06:56 2000
--- mod_cgi.c.own Thu Jun 8 10:06:48 2000
***************
*** 520,525 ****
--- 520,538 ----
ap_checkconv(r);
#endif /*CHARSET_EBCDIC*/
+ #if defined(WIN32) || defined(NETWARE)
+ /* Soak up stderr and redirect it to the error log.
+ * Script output to stderr is already directed to the error log
+ * on Unix, thanks to the magic of fork().
+ */
+ while (ap_bgets(argsbuffer, HUGE_STRING_LEN, script_err) > 0) {
+ ap_log_rerror(APLOG_MARK, APLOG_ERR | APLOG_NOERRNO, r,
+ "%s", argsbuffer);
+ }
+ #else
+ while (ap_bgets(argsbuffer, HUGE_STRING_LEN, script_err) > 0)
+ continue;
+ #endif
location = ap_table_get(r->headers_out, "Location");
if (location && location[0] == '/' && r->status == 200) {
>Release-Note:
>Audit-Trail:
>Unformatted:
[In order for any reply to be added to the PR database, you need]
[to include <ap...@Apache.Org> in the Cc line and make sure the]
[subject line starts with the report component and number, with ]
[or without any 'Re:' prefixes (such as "general/1098:" or ]
["Re: general/1098:"). If the subject doesn't match this ]
[pattern, your message will be misfiled and ignored. The ]
["apbugs" address is not added to the Cc line of messages from ]
[the database automatically because of the potential for mail ]
[loops. If you do not include this Cc, your reply may be ig- ]
[nored unless you are responding to an explicit request from a ]
[developer. Reply only with text; DO NOT SEND ATTACHMENTS! ]