>Number: 5306
>Category: general
>Synopsis: C++ CGI hangs on system call (but worked correctly under
>OmniHTTPd 1.01)
>Confidential: no
>Severity: non-critical
>Priority: medium
>Responsible: apache
>State: open
>Class: sw-bug
>Submitter-Id: apache
>Arrival-Date: Sun Nov 14 04:10:00 PST 1999
>Last-Modified:
>Originator: [EMAIL PROTECTED]
>Organization:
apache
>Release: 1.3.6
>Environment:
Windows 98, SR-1
>Description:
I'm have problems running one particular CGI script that ran fine on the
OmniHTTPd 1.01 web server (http://www.omnicron.ab.ca/).
The script is a 32-bit command line exe compiled by Microsoft Visual C++
version 6.0, and the problem occurs only when the script calls the "system"
function (to run "dir /b > tmpfile", for instance). The problems are:
1. System call pops up a separate "COMMAND.COM" window, and also grinds
the floppy drive (which wastes a whole lot of time), which the script
didn't do when run by OmniHTTPd.
2. After about four separate system calls in a single run of the script
(which run successfully and generate the expected HTML code), the script
hangs at an additional system call (another directory listing, just run
on a separate directory), leaving the web browser hanging with the HTML
generated up to that point. The web server does not log any errors.
>How-To-Repeat:
The following sample demonstrates some of these errors. With the system call,
the script hangs without returning any output. Comment out that line, and
it works as expected.
#include <stdio.h>
#include <process.h>
int main(void) {
printf("Content-type: text/html\n\n");
printf("<html><body><h1>Testing ...</h1></body></html>\n");
fflush(stdout);
system("dir /b > tmpfile.tmp");
return 0;
}
>Fix:
>Audit-Trail:
>Unformatted:
[In order for any reply to be added to the PR database, you need]
[to include <[EMAIL PROTECTED]> 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! ]