You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by "William A. Rowe, Jr." <wr...@rowe-clan.net> on 2000/12/13 17:50:47 UTC

[Patch] 1.3 - Equivilant functionallity unix <> win32

Attached is a patch I expect to apply at noon CST unless someone objects.
Explanation for why I trust it entirely...

We already have this identical code at line 213 of mod_cgi.c - win32
needs to sponge the script output to the error log itself, since fork
doesn't help us on our platform.

Two other places in mod_cgi.c sponge the stderr output from the script,
we aren't catching the script errors in those two code blocks, although
the unix behavior in all three places is -identical-.

This patch makes the Win32/Netware behavior in all three places 
-identical- as well.  If one user would confirm my testing results,
please ack me ... TIA

Bill


Index: mod_cgi.c
===================================================================
RCS file: /home/cvs/apache-1.3/src/modules/standard/mod_cgi.c,v
retrieving revision 1.95
diff -u -r1.95 mod_cgi.c
--- mod_cgi.c	2000/11/14 09:57:20	1.95
+++ mod_cgi.c	2000/12/13 16:33:53
@@ -529,9 +529,19 @@
 	    while (ap_bgets(argsbuffer, HUGE_STRING_LEN, script_in) > 0) {
 		continue;
 	    }
-	    while (ap_bgets(argsbuffer, HUGE_STRING_LEN, script_err) > 0) {
-		continue;
-	    }
+#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
 	    ap_kill_timeout(r);
 
 
@@ -564,9 +574,18 @@
 	ap_bclose(script_in);
 
 	ap_soft_timeout("soaking script stderr", r);
-	while (ap_bgets(argsbuffer, HUGE_STRING_LEN, script_err) > 0) {
+#if defined(WIN32) || defined(NETWARE)
+        /* 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
 	ap_kill_timeout(r);
 	ap_bclose(script_err);
     }