[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Myserver-commit] [2739] Fixed bug with broken pipes
From: |
Giuseppe Scrivano |
Subject: |
[Myserver-commit] [2739] Fixed bug with broken pipes |
Date: |
Wed, 06 Aug 2008 17:31:39 +0000 |
Revision: 2739
http://svn.sv.gnu.org/viewvc/?view=rev&root=myserver&revision=2739
Author: gscrivano
Date: 2008-08-06 17:31:38 +0000 (Wed, 06 Aug 2008)
Log Message:
-----------
Fixed bug with broken pipes
Modified Paths:
--------------
trunk/myserver/src/cgi.cpp
trunk/myserver/src/env.cpp
Modified: trunk/myserver/src/cgi.cpp
===================================================================
--- trunk/myserver/src/cgi.cpp 2008-08-06 15:55:22 UTC (rev 2738)
+++ trunk/myserver/src/cgi.cpp 2008-08-06 17:31:38 UTC (rev 2739)
@@ -546,7 +546,7 @@
}
/* Send the rest of the data until we can read from the pipe. */
- do
+ for(;;)
{
/* Process timeout. */
if((int)(getTicks() - procStartTime) > cgiTimeout)
@@ -559,27 +559,23 @@
return 0;
}
- if(stdOutFile.pipeTerminated() ||
- (!nBytesRead && !cgiProc.isProcessAlive()))
+ int aliveProcess = cgiProc.isProcessAlive();
+
+ /* Read data from the process standard output file. */
+ if(stdOutFile.read(td->buffer2->getBuffer(),
+ td->buffer2->getRealLength(),
+ &nBytesRead))
{
- nBytesRead = 0;
+ stdOutFile.close();
+ stdInFile.closeFile();
+ chain.clearAllFilters();
+ /* Remove the connection on sockets error. */
+ cgiProc.terminateProcess();
+ return 0;
}
- else
- {
- /* Read data from the process standard output file. */
- if(stdOutFile.read(td->buffer2->getBuffer(),
- td->buffer2->getRealLength(),
- &nBytesRead))
- {
- stdOutFile.close();
- stdInFile.closeFile();
- chain.clearAllFilters();
- /* Remove the connection on sockets error. */
- cgiProc.terminateProcess();
- return 0;
- }
-
- }
+
+ if(!aliveProcess && !nBytesRead)
+ break;
if(nBytesRead)
{
@@ -640,9 +636,8 @@
}
}
}
- while(!stdOutFile.pipeTerminated() &&
- ( nBytesRead || cgiProc.isProcessAlive()));
+
/* Send the last null chunk if needed. */
if(useChunks && chain.write("0\r\n\r\n", 5, &nbw2))
{
Modified: trunk/myserver/src/env.cpp
===================================================================
--- trunk/myserver/src/env.cpp 2008-08-06 15:55:22 UTC (rev 2738)
+++ trunk/myserver/src/env.cpp 2008-08-06 17:31:38 UTC (rev 2739)
@@ -65,7 +65,7 @@
memCgi << end_str << "REDIRECT_STATUS=TRUE";
memCgi << end_str << "SERVER_NAME=";
- memCgi << Server::getInstance()->getServerName();
+ memCgi << Server::getInstance()->getServerName();
memCgi << end_str << "SERVER_SIGNATURE=";
memCgi << "<address>GNU MyServer ";
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Myserver-commit] [2739] Fixed bug with broken pipes,
Giuseppe Scrivano <=