httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sam Robb <sr...@wisewire.com>
Subject Patch for Win32 CGI bugs
Date Mon, 02 Feb 1998 16:46:17 GMT
All,

Patch for some Win32 CGI-related bugs, based off the Friday snapshot of
the source
from dev.apache.org/from-cvs/.  This is my first contribution, so please
let me know if
anything's incorrect or inappropriate.

Also, a while back, someone had some information on using cvs from NT to
access
the repositories for updates.  Whoever it was, can you repeat the info
and/or make it
available at dev.apache.org?  Thanks.

[1129] os-windows Hang on concurrent CGI invocations
[1607] os-windows apache 1.3b3 hangs on concurrent CGI (still) ref bug
1129
[1712] os-windows CGI-executables other than .exe won't execute

Definitely fixes 1712; possibly fixes the other two. Before the patch,
27 consecutive
cgi invocations would cause apache to hang; after the patch, I was
unable to reproduce
the effects (with either repeated or concurrent CGI requests).

- Samrobb (srobb@wisewire.com)
- WiseWire Corporation - The Content Agent Company
- http://www.wisewire.com
- http://www.lycos.com/webguides/webguides.html

The box said 'Requires Windows 95, or better.' So I bought a Macintosh.


diff -u f:\apache.org\src\os\win32\util_win32.c
f:\apache.src\src\os\win32\util_win32.c > f:\apache.dif\util_win32.txt

--- f:\apache.org\src\os\win32\util_win32.c	Fri Dec 26 15:00:12 1997
+++ f:\apache.src\src\os\win32\util_win32.c	Mon Feb 02 08:52:42 1998
@@ -89,6 +89,14 @@
  *
  *  1. Win32 doesn't deal with spaces in argv.
  *  2. Win95 doesn't like / in cmdname.
+ *
+ *  More:
+ *  3.  Win32 wants a '.' appended to bare filename (ex,
+ *      "script.") to indicate that yes, you really mean
+ *      that the file doesn't have an extension
+ *  4.  Win32 requires _flushall before spawn* (keeps
+ *      repeated CGI calls from hanging)
+ *  
  */
 
 #undef _spawnv
@@ -99,13 +107,22 @@
     const char *szArg;
     char *szCmd;
     char *s;
+    char *ext;
+    int cmdlen;
     
-    szCmd = _alloca(strlen(cmdname)+1);
+    cmdlen = strlen(cmdname);
+    szCmd = _alloca(cmdlen+2);
     strcpy(szCmd, cmdname);
     for (s = szCmd; *s; ++s)
         if (*s == '/')
             *s = '\\';
     
+    ext = strrchr(szCmd, '.');
+    if (!ext || ext < strrchr(szCmd, '\\')) {
+        szCmd[cmdlen] = '.';
+        szCmd[cmdlen+1] = '\0';
+    }
+
     for (n=0; argv[n]; ++n)
         ;
 
@@ -127,6 +144,7 @@
 
     aszArgs[n] = NULL;
 
+    _flushall();
     return _spawnv(mode, szCmd, aszArgs);
 }
 
@@ -138,13 +156,22 @@
     const char *szArg;
     char *szCmd;
     char *s;
+    char *ext;
+    int cmdlen;
     
-    szCmd = _alloca(strlen(cmdname)+1);
+    cmdlen = strlen(cmdname);
+    szCmd = _alloca(cmdlen+2);
     strcpy(szCmd, cmdname);
     for (s = szCmd; *s; ++s)
         if (*s == '/')
             *s = '\\';
     
+    ext = strrchr(szCmd, '.');
+    if (!ext || ext < strrchr(szCmd, '\\')) {
+        szCmd[cmdlen] = '.';
+        szCmd[cmdlen+1] = '\0';
+    }
+
     for (n = 0; argv[n] ; ++n)
         ;
 
@@ -166,6 +193,7 @@
 
     aszArgs[n] = NULL;
 
+    _flushall();
     return _spawnve(mode, szCmd, aszArgs, envp);
 }
 
@@ -178,13 +206,22 @@
     const char *const *aszEnv;
     char *szCmd;
     char *s;
-    
-    szCmd = _alloca(strlen(cmdname)+1);
+    char *ext;
+    int cmdlen;
+
+    cmdlen = strlen(cmdname);
+    szCmd = _alloca(cmdlen+2);
     strcpy(szCmd, cmdname);
     for (s = szCmd; *s; ++s)
         if(*s == '/')
             *s = '\\';
 
+    ext = strrchr(szCmd, '.');
+    if (!ext || ext < strrchr(szCmd, '\\')) {
+        szCmd[cmdlen] = '.';
+        szCmd[cmdlen+1] = '\0';
+    }
+
     va_start(vlist, cmdname);
     for (n = 0; va_arg(vlist, const char *); ++n)
         ;
@@ -212,5 +249,6 @@
     aszEnv = va_arg(vlist, const char *const *);
     va_end(vlist);
     
+    _flushall();
     return _spawnve(mode, szCmd, aszArgs, aszEnv);
 }


Mime
View raw message