myserver-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[myserver-commit] [SCM] GNU MyServer branch, master, updated. v0.9.2-461


From: Giuseppe Scrivano
Subject: [myserver-commit] [SCM] GNU MyServer branch, master, updated. v0.9.2-461-g4610bc1
Date: Thu, 21 Apr 2011 11:56:25 +0000

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU MyServer".

The branch, master has been updated
       via  4610bc1c88c48d4a096060685876ef7ae3f60035 (commit)
      from  61d1323797634e78122daeb2535f05a432468aaf (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------


commit 4610bc1c88c48d4a096060685876ef7ae3f60035
Author: Giuseppe Scrivano <address@hidden>
Date:   Thu Apr 21 13:45:12 2011 +0200

    Http: drop support to output to a temporary file
    
    Now HTTP handlers don't have to care if data should be written to a
    temporary file.

diff --git a/myserver/include/protocol/http/http_data_handler.h 
b/myserver/include/protocol/http/http_data_handler.h
index c60821a..b0b6e89 100644
--- a/myserver/include/protocol/http/http_data_handler.h
+++ b/myserver/include/protocol/http/http_data_handler.h
@@ -55,9 +55,7 @@ public:
   static size_t appendDataToHTTPChannel (HttpThreadContext* td,
                                          char *buffer,
                                          size_t size,
-                                         File *appendFile,
                                          FiltersChain *chain,
-                                         bool append,
                                          bool useChunks,
                                          size_t realBufferSize,
                                          MemoryStream *tmpStream);
@@ -65,9 +63,7 @@ public:
   static size_t appendDataToHTTPChannel (HttpThreadContext* td,
                                          char *buffer,
                                          size_t size,
-                                         File *appendFile,
                                          FiltersChain* chain,
-                                         bool append,
                                          bool useChunks);
 
 };
diff --git a/myserver/include/protocol/http/http_thread_context.h 
b/myserver/include/protocol/http/http_thread_context.h
index 0b2202c..a72fccf 100644
--- a/myserver/include/protocol/http/http_thread_context.h
+++ b/myserver/include/protocol/http/http_thread_context.h
@@ -50,9 +50,7 @@ class MimeRecord;
  */
 struct HttpThreadContext
 {
-  bool appendOutputs;
-
-  /*! Set by raiseHTTPError.  */
+  /*! Http::raiseHTTPError sets this.  */
   int lastError;
 
   /*! Is the client asking only for the header?  */
@@ -83,7 +81,6 @@ struct HttpThreadContext
   HashMap<string,string*> other;
   char identity[32];
   File inputData;
-  File outputData;
   int authScheme;
   Http *http;
   MimeRecord *mime;
diff --git a/myserver/src/http_handler/cgi/cgi.cpp 
b/myserver/src/http_handler/cgi/cgi.cpp
index 58e6f43..d244283 100644
--- a/myserver/src/http_handler/cgi/cgi.cpp
+++ b/myserver/src/http_handler/cgi/cgi.cpp
@@ -346,9 +346,7 @@ int Cgi::sendData (HttpThreadContext* td, Pipe &stdOutFile, 
FiltersChain& chain,
       td->sentData += HttpDataHandler::appendDataToHTTPChannel (td,
                                                   
td->auxiliaryBuffer->getBuffer (),
                                                   nBytesRead,
-                                                  &(td->outputData),
                                                   &chain,
-                                                  td->appendOutputs,
                                                   useChunks);
     }
 
@@ -453,11 +451,6 @@ int Cgi::sendHeader (HttpThreadContext *td, Pipe 
&stdOutFile, FiltersChain &chai
         HttpHeaders::buildHTTPResponseHeaderStruct 
(td->auxiliaryBuffer->getBuffer (),
                                                     &td->response,
                                                     &(td->nBytesToRead));
-      /*
-       *If we have not to append the output send data
-       *directly to the client.
-       */
-      if (!td->appendOutputs)
         {
           string* location = td->response.getValue ("Location", NULL);
 
@@ -480,9 +473,7 @@ int Cgi::sendHeader (HttpThreadContext *td, Pipe 
&stdOutFile, FiltersChain &chai
       td->sentData += HttpDataHandler::appendDataToHTTPChannel (td,
                                td->auxiliaryBuffer->getBuffer () + headerSize,
                                                     headerOffset - headerSize,
-                                                    &(td->outputData),
                                                     &chain,
-                                                    td->appendOutputs,
                                                     useChunks);
     }
 
diff --git a/myserver/src/http_handler/fastcgi/fastcgi.cpp 
b/myserver/src/http_handler/fastcgi/fastcgi.cpp
index 9b012b7..196b777 100644
--- a/myserver/src/http_handler/fastcgi/fastcgi.cpp
+++ b/myserver/src/http_handler/fastcgi/fastcgi.cpp
@@ -623,10 +623,7 @@ int FastCgi::sendData (FcgiContext* con, u_long dim, 
u_long timeout,
   size_t nbw = HttpDataHandler::appendDataToHTTPChannel (con->td,
                                             con->td->buffer->getBuffer (),
                                             con->td->buffer->getLength (),
-                                            &(con->td->outputData),
-                                            chain,
-                                            con->td->appendOutputs,
-                                            con->useChunks);
+                                            chain, con->useChunks);
 
   con->td->sentData += nbw;
   return 0;
@@ -689,7 +686,6 @@ int FastCgi::handleHeader (FcgiContext* con, FiltersChain* 
chain, bool* response
         }
     }
 
-  if (!con->td->appendOutputs)
     {
       string *location = con->td->response.getValue ("Location", NULL);
       if (location)
@@ -714,9 +710,7 @@ int FastCgi::handleHeader (FcgiContext* con, FiltersChain* 
chain, bool* response
       size_t nbw = HttpDataHandler::appendDataToHTTPChannel (con->td,
                                                 con->td->buffer->getBuffer () 
+ headerSize,
                                                 size - headerSize,
-                                                &(con->td->outputData),
                                                 chain,
-                                                con->td->appendOutputs,
                                                 con->useChunks);
       con->td->sentData += nbw;
     }
diff --git a/myserver/src/http_handler/http_dir/http_dir.cpp 
b/myserver/src/http_handler/http_dir/http_dir.cpp
index c16bc10..fd666d0 100644
--- a/myserver/src/http_handler/http_dir/http_dir.cpp
+++ b/myserver/src/http_handler/http_dir/http_dir.cpp
@@ -379,7 +379,6 @@ int HttpDir::send (HttpThreadContext* td,
                                                         "is not valid"), 
ignPattern);
 
               fd.findclose ();
-              td->outputData.close ();
               chain.clearAllFilters ();
               return td->http->raiseHTTPError (500);
             }
@@ -439,8 +438,7 @@ int HttpDir::send (HttpThreadContext* td,
 
       td->sentData += appendDataToHTTPChannel (td, 
td->auxiliaryBuffer->getBuffer (),
                                            td->auxiliaryBuffer->getLength (),
-                                           &(td->outputData), &chain,
-                                           td->appendOutputs, useChunks);
+                                           &chain, useChunks);
 
       filename = directory;
       td->auxiliaryBuffer->setLength (0);
@@ -455,8 +453,7 @@ int HttpDir::send (HttpThreadContext* td,
 
       td->sentData += appendDataToHTTPChannel (td, 
td->auxiliaryBuffer->getBuffer (),
                                            td->auxiliaryBuffer->getLength (),
-                                           &(td->outputData), &chain,
-                                           td->appendOutputs, useChunks);
+                                           &chain, useChunks);
 
       fd.findfirst (filename.c_str ());
 
@@ -471,8 +468,7 @@ int HttpDir::send (HttpThreadContext* td,
 
       td->sentData += appendDataToHTTPChannel (td, 
td->auxiliaryBuffer->getBuffer (),
                                                td->auxiliaryBuffer->getLength 
(),
-                                               &(td->outputData), &chain,
-                                               td->appendOutputs, useChunks);
+                                               &chain, useChunks);
       td->auxiliaryBuffer->setLength (0);
 
       if (FilesUtility::getPathRecursionLevel (td->request.uri) >= 1)
@@ -508,8 +504,7 @@ int HttpDir::send (HttpThreadContext* td,
 
           td->sentData += appendDataToHTTPChannel (td, 
td->auxiliaryBuffer->getBuffer (),
                                                    
td->auxiliaryBuffer->getLength (),
-                                                   &(td->outputData), &chain,
-                                                   td->appendOutputs, 
useChunks);
+                                                   &chain, useChunks);
         }
 
       /* Put all files in a vector.  */
@@ -570,8 +565,7 @@ int HttpDir::send (HttpThreadContext* td,
           generateElement (*td->auxiliaryBuffer, file, linkPrefix, 
formatString);
           td->sentData += appendDataToHTTPChannel (td, 
td->auxiliaryBuffer->getBuffer (),
                                                    
td->auxiliaryBuffer->getLength (),
-                                                   &(td->outputData), &chain,
-                                                   td->appendOutputs, 
useChunks);
+                                                   &chain, useChunks);
         }
 
       td->auxiliaryBuffer->setLength (0);
@@ -595,8 +589,7 @@ int HttpDir::send (HttpThreadContext* td,
       *td->auxiliaryBuffer << "</address>\r\n</body>\r\n</html>\r\n";
       td->sentData += appendDataToHTTPChannel (td, 
td->auxiliaryBuffer->getBuffer (),
                                                td->auxiliaryBuffer->getLength 
(),
-                                               &(td->outputData), &chain,
-                                               td->appendOutputs, useChunks);
+                                               &chain, useChunks);
 
       *td->auxiliaryBuffer << end_str;
       /* Changes the \ character in the / character.  */
@@ -605,7 +598,7 @@ int HttpDir::send (HttpThreadContext* td,
         if (*bufferloop == '\\')
           *bufferloop = '/';
 
-      if (!td->appendOutputs && useChunks)
+      if (useChunks)
         chain.getStream ()->write ("0\r\n\r\n", 5, &nbw);
     }
   catch (exception & e)
diff --git a/myserver/src/http_handler/http_file/http_file.cpp 
b/myserver/src/http_handler/http_file/http_file.cpp
index 5f5249c..69bd63a 100644
--- a/myserver/src/http_handler/http_file/http_file.cpp
+++ b/myserver/src/http_handler/http_file/http_file.cpp
@@ -406,7 +406,7 @@ int HttpFile::send (HttpThreadContext* td, const char 
*filenamePath,
       Check if there are all the conditions to use a direct copy from the
       file to the socket.
     */
-    if (!useChunks && chain.isEmpty () && !td->appendOutputs
+    if (!useChunks && chain.isEmpty ()
         && !(td->http->getProtocolOptions () & Protocol::SSL))
       {
         size_t nbw = 0;
@@ -425,10 +425,7 @@ int HttpFile::send (HttpThreadContext* td, const char 
*filenamePath,
 
     file->seek (firstByte);
 
-    if (td->appendOutputs)
-      chain.setStream (&(td->outputData));
-    else
-      chain.setStream (td->connection->socket);
+    chain.setStream (td->connection->socket);
 
     /*
       Flush initial data.  This is data that filters could have added
@@ -444,9 +441,7 @@ int HttpFile::send (HttpThreadContext* td, const char 
*filenamePath,
         if (nbr)
           dataSent += HttpDataHandler::appendDataToHTTPChannel (td,
                                                     td->buffer->getBuffer (),
-                                                    nbr, &(td->outputData),
-                                                    &chain, td->appendOutputs,
-                                                    useChunks);
+                                                    nbr, &chain, useChunks);
       } /* memStream.availableToRead ().  */
 
     /* Flush the rest of the file.  */
@@ -474,8 +469,7 @@ int HttpFile::send (HttpThreadContext* td, const char 
*filenamePath,
             bytesToSend -= nbr;
 
             dataSent += appendDataToHTTPChannel (td, td->buffer->getBuffer (),
-                                                 nbr, &(td->outputData), 
&chain,
-                                                 td->appendOutputs, useChunks,
+                                                 nbr, &chain, useChunks,
                                                  td->buffer->getRealLength (),
                                                  &memStream);
           }
@@ -506,9 +500,7 @@ int HttpFile::send (HttpThreadContext* td, const char 
*filenamePath,
                                 td->buffer->getRealLength (), &nbr);
 
                 dataSent += appendDataToHTTPChannel (td, td->buffer->getBuffer 
(),
-                                                     nbr, &(td->outputData),
-                                                     &chain, td->appendOutputs,
-                                                     useChunks);
+                                                     nbr, &chain, useChunks);
                 break;
               }
           }
diff --git a/myserver/src/http_handler/isapi/isapi.cpp 
b/myserver/src/http_handler/isapi/isapi.cpp
index b8b5f6f..d14e5ea 100644
--- a/myserver/src/http_handler/isapi/isapi.cpp
+++ b/myserver/src/http_handler/isapi/isapi.cpp
@@ -279,31 +279,28 @@ BOOL WINAPI ISAPI_WriteClientExport (HCONN hConn, LPVOID 
Buffer, LPDWORD lpdwByt
             (ConnInfo->td->buffer->getBuffer (), &ConnInfo->td->response,
              &(ConnInfo->td->nBytesToRead));
 
-          if (!ConnInfo->td->appendOutputs)
+          if (keepalive)
             {
-              if (keepalive)
+              HttpResponseHeader::Entry *e;
+              e = ConnInfo->td->response.other.get ("transfer-encoding");
+              if (e)
+                e->value.assign ("chunked");
+              else
                 {
-                  HttpResponseHeader::Entry *e;
-                  e = ConnInfo->td->response.other.get ("transfer-encoding");
-                  if (e)
-                    e->value.assign ("chunked");
-                  else
-                    {
-                      e = new HttpResponseHeader::Entry ();
-                      e->name.assign ("transfer-encoding");
-                      e->value.assign ("chunked");
-                      ConnInfo->td->response.other.put (e->name, e);
-                    }
+                  e = new HttpResponseHeader::Entry ();
+                  e->name.assign ("transfer-encoding");
+                  e->value.assign ("chunked");
+                  ConnInfo->td->response.other.put (e->name, e);
                 }
-              else
-                ConnInfo->td->response.setValue ("connection", "Close");
-
-              if (HttpHeaders::sendHeader (ConnInfo->td->response,
-                                           *ConnInfo->td->connection->socket,
-                                           *ConnInfo->td->auxiliaryBuffer,
-                                           ConnInfo->td))
-                return HttpDataHandler::RET_FAILURE;
             }
+          else
+            ConnInfo->td->response.setValue ("connection", "Close");
+
+          if (HttpHeaders::sendHeader (ConnInfo->td->response,
+                                       *ConnInfo->td->connection->socket,
+                                       *ConnInfo->td->auxiliaryBuffer,
+                                       ConnInfo->td))
+            return HttpDataHandler::RET_FAILURE;
           /*! Save the headerSent status. */
           ConnInfo->headerSent=1;
 
@@ -317,7 +314,7 @@ BOOL WINAPI ISAPI_WriteClientExport (HCONN hConn, LPVOID 
Buffer, LPDWORD lpdwByt
           if (len)
             {
               /*! With keep-alive connections use chunks.*/
-              if (keepalive && (!ConnInfo->td->appendOutputs))
+              if (keepalive)
                 {
                   sprintf (chunkSize, "%x\r\n", len);
                   if (ConnInfo->chain.getStream ()->write (chunkSize,
@@ -325,23 +322,13 @@ BOOL WINAPI ISAPI_WriteClientExport (HCONN hConn, LPVOID 
Buffer, LPDWORD lpdwByt
                     return HttpDataHandler::RET_FAILURE;
                 }
 
-              if (ConnInfo->td->appendOutputs)
-                {
-                  if (ConnInfo->td->outputData.writeToFile ((char*)(buffer + 
headerSize),
-                                                            len, &nbw))
-                    return HttpDataHandler::RET_FAILURE;
-                  ConnInfo->dataSent += nbw;
-                }
-              else
-                {
-                  if (ConnInfo->chain.write ((char*)(buffer + headerSize),
-                                             len, &nbw))
-                    return HttpDataHandler::RET_FAILURE;
-                  ConnInfo->dataSent += nbw;
-                }
+              if (ConnInfo->chain.write ((char*)(buffer + headerSize),
+                                         len, &nbw))
+                return HttpDataHandler::RET_FAILURE;
+              ConnInfo->dataSent += nbw;
 
               /*! Send the chunk footer.  */
-              if (keepalive && (!ConnInfo->td->appendOutputs))
+              if (keepalive)
                 {
                   if (ConnInfo->chain.getStream ()->write ("\r\n", 2, &nbw))
                     return HttpDataHandler::RET_FAILURE;
@@ -351,7 +338,7 @@ BOOL WINAPI ISAPI_WriteClientExport (HCONN hConn, LPVOID 
Buffer, LPDWORD lpdwByt
     }
   else/*!Continue to send data chunks*/
     {
-      if (keepalive  && (!ConnInfo->td->appendOutputs))
+      if (keepalive)
         {
           sprintf (chunkSize, "%x\r\n", *lpdwBytes);
           nbw = ConnInfo->connection->socket->send (chunkSize,
@@ -360,20 +347,11 @@ BOOL WINAPI ISAPI_WriteClientExport (HCONN hConn, LPVOID 
Buffer, LPDWORD lpdwByt
             return HttpDataHandler::RET_FAILURE;
         }
 
-      if (ConnInfo->td->appendOutputs)
-        {
-          if (ConnInfo->td->outputData.writeToFile ((char*)Buffer,*lpdwBytes, 
&nbw))
-            return HttpDataHandler::RET_FAILURE;
-          ConnInfo->dataSent += nbw;
-        }
-      else
-        {
-          if (ConnInfo->chain.write ((char*)Buffer,*lpdwBytes, &nbw))
-            return HttpDataHandler::RET_FAILURE;
-          ConnInfo->dataSent += nbw;
-        }
+      if (ConnInfo->chain.write ((char*)Buffer,*lpdwBytes, &nbw))
+        return HttpDataHandler::RET_FAILURE;
+      ConnInfo->dataSent += nbw;
 
-      if (keepalive  && (!ConnInfo->td->appendOutputs))
+      if (keepalive)
         {
           nbw = ConnInfo->connection->socket->send ("\r\n", 2, 0);
           if ((nbw == (size_t)-1) || (!nbw))
diff --git a/myserver/src/http_handler/mscgi/mscgi.cpp 
b/myserver/src/http_handler/mscgi/mscgi.cpp
index d721b9a..ee6d22b 100644
--- a/myserver/src/http_handler/mscgi/mscgi.cpp
+++ b/myserver/src/http_handler/mscgi/mscgi.cpp
@@ -135,7 +135,7 @@ int MsCgi::send (HttpThreadContext* td, const char* exec, 
const char* cmdLine,
           return td->http->raiseHTTPError (data.errorPage);
         }
 
-      if (!td->appendOutputs && data.useChunks && !data.error)
+      if (data.useChunks && !data.error)
         chain.getStream ()->write ("0\r\n\r\n", 5, &nbw);
 
       if (!data.error)
@@ -170,9 +170,7 @@ int MsCgi::write (const char* data, size_t len, MsCgiData* 
mcd)
   mcd->td->sentData +=
     HttpDataHandler::appendDataToHTTPChannel (mcd->td,
                                               (char *) data, len,
-                                              &(mcd->td->outputData),
                                               mcd->filtersChain,
-                                              mcd->td->appendOutputs,
                                               mcd->useChunks);
   return 0;
 }
diff --git a/myserver/src/http_handler/proxy/proxy.cpp 
b/myserver/src/http_handler/proxy/proxy.cpp
index 4c908da..b48f306 100644
--- a/myserver/src/http_handler/proxy/proxy.cpp
+++ b/myserver/src/http_handler/proxy/proxy.cpp
@@ -315,9 +315,7 @@ int Proxy::readPayLoad (HttpThreadContext* td,
 
               td->sentData += HttpDataHandler::appendDataToHTTPChannel (td,
                                                        td->buffer->getBuffer 
(),
-                                                       nbr, &(td->outputData),
-                                                       out, td->appendOutputs,
-                                                       useChunks);
+                                                       nbr, out, useChunks);
             }
         }
     }
@@ -347,8 +345,7 @@ int Proxy::readPayLoad (HttpThreadContext* td,
             length -= nbr;
 
           td->sentData += HttpDataHandler::appendDataToHTTPChannel (td, 
td->buffer->getBuffer (),
-                                                    nbr, &(td->outputData), 
out,
-                                                    td->appendOutputs, 
useChunks);
+                                                    nbr, out, useChunks);
           if (timedOut || contentLength && length == 0)
             break;
         }
diff --git a/myserver/src/http_handler/scgi/scgi.cpp 
b/myserver/src/http_handler/scgi/scgi.cpp
index ac31d70..1158582 100644
--- a/myserver/src/http_handler/scgi/scgi.cpp
+++ b/myserver/src/http_handler/scgi/scgi.cpp
@@ -268,8 +268,7 @@ int Scgi::sendResponse (ScgiContext* ctx, bool onlyHeader, 
FiltersChain* chain)
   if (read - headerSize)
     td->sentData +=
       appendDataToHTTPChannel (td, td->auxiliaryBuffer->getBuffer () + 
headerSize,
-                             read - headerSize, &(td->outputData), chain,
-                               td->appendOutputs, useChunks);
+                             read - headerSize, chain, useChunks);
 
   if (td->response.getStatusType () == HttpResponseHeader::SUCCESSFUL)
     {
@@ -284,11 +283,10 @@ int Scgi::sendResponse (ScgiContext* ctx, bool 
onlyHeader, FiltersChain* chain)
 
           td->sentData +=
             appendDataToHTTPChannel (td, td->auxiliaryBuffer->getBuffer (),
-                                     nbr, &(td->outputData), chain,
-                                     td->appendOutputs, useChunks);
+                                     nbr, chain, useChunks);
         }
 
-      if (!td->appendOutputs && useChunks)
+      if (useChunks)
         chain->getStream ()->write ("0\r\n\r\n", 5, &nbw);
     }
 
diff --git a/myserver/src/http_handler/wincgi/wincgi.cpp 
b/myserver/src/http_handler/wincgi/wincgi.cpp
index cb4e990..e96b278 100644
--- a/myserver/src/http_handler/wincgi/wincgi.cpp
+++ b/myserver/src/http_handler/wincgi/wincgi.cpp
@@ -105,11 +105,11 @@ int WinCgi::send (HttpThreadContext* td, const char* 
scriptpath,
       chain.setStream (td->connection->socket);
       if (td->mime)
         {
-          size_t nbw2;
           Server::getInstance ()->getFiltersFactory ()->chain (&chain,
                                                           td->mime->filters,
                                                         td->connection->socket,
-                                                               &nbw2, 1);
+                                                               &nbw, 1);
+          td->sentData += nbw;
         }
 
       /* The WinCGI protocol uses a .ini file to send data to the new process. 
 */
@@ -300,42 +300,23 @@ int WinCgi::send (HttpThreadContext* td, const char* 
scriptpath,
        */
       stream << OutFileHandle.getFileSize () - headerSize;
       td->response.contentLength.assign (stream.str ());
-      if (!td->appendOutputs)
-        {
-          HttpHeaders::sendHeader (td->response, *chain.getStream (),
-                                   *td->buffer, td);
-
-          if (onlyHeader)
-            {
-              OutFileHandle.close ();
-              FilesUtility::deleteFile (outFilePath);
-              FilesUtility::deleteFile (dataFilePath);
-              chain.clearAllFilters ();
-              return HttpDataHandler::RET_OK;
-            }
+      HttpHeaders::sendHeader (td->response, *chain.getStream (),
+                               *td->buffer, td);
 
-          size_t written;
-          chain.write ((char*)(buffer + headerSize), nBytesRead - headerSize,
-                       &written);
-          nbw += written;
-        }
-      else
+      if (onlyHeader)
         {
-          size_t nbw2;
-          HttpHeaders::buildHTTPResponseHeader (td->buffer->getBuffer (),
-                                                &td->response);
-          if (onlyHeader)
-            {
-              chain.clearAllFilters ();
-              return HttpDataHandler::RET_OK;
-            }
-
-          td->outputData.writeToFile ((char*) (buffer + headerSize),
-                                      nBytesRead - headerSize,
-                                      &nbw2);
-          nbw += nbw2;
+          OutFileHandle.close ();
+          FilesUtility::deleteFile (outFilePath);
+          FilesUtility::deleteFile (dataFilePath);
+          chain.clearAllFilters ();
+          return HttpDataHandler::RET_OK;
         }
 
+      size_t written;
+      chain.write ((char*)(buffer + headerSize), nBytesRead - headerSize,
+                   &written);
+      td->dataSent += written;
+
       if (td->response.getStatusType () == HttpResponseHeader::SUCCESSFUL)
         {
           /* Flush the rest of the file.  */
@@ -346,17 +327,11 @@ int WinCgi::send (HttpThreadContext* td, const char* 
scriptpath,
               if (! nBytesRead)
                 break;
 
-              if (td->appendOutputs)
-                td->outputData.writeToFile (buffer, nBytesRead, &nbw);
-              else
-                {
-                  size_t nbw2;
-                  chain.write ((char*) buffer, nBytesRead, &nbw2);
-                }
+              chain.write ((char*) buffer, nBytesRead, &nbw);
+              td->sentData += nbw;
             }
           while (nBytesRead);
         }
-      td->sentData += nbw;
 
       chain.clearAllFilters ();
       OutFileHandle.close ();
diff --git a/myserver/src/protocol/http/http.cpp 
b/myserver/src/protocol/http/http.cpp
index 0e24a2f..8b17b16 100644
--- a/myserver/src/protocol/http/http.cpp
+++ b/myserver/src/protocol/http/http.cpp
@@ -849,7 +849,6 @@ int Http::controlConnection (ConnectionPtr a, char*, char*, 
u_long, u_long,
       td->id = id;
       td->lastError = 0;
       td->http = this;
-      td->appendOutputs = false;
       td->onlyHeader = false;
       td->filenamePath.assign ("");
       td->mime = NULL;
@@ -1159,7 +1158,6 @@ int Http::controlConnection (ConnectionPtr a, char*, 
char*, u_long, u_long,
       try
         {
           td->inputData.close ();
-          td->outputData.close ();
         }
       catch (GenericFileException & e)
         {
@@ -1183,8 +1181,6 @@ int Http::controlConnection (ConnectionPtr a, char*, 
char*, u_long, u_long,
   catch (...)
     {
       td->inputData.close ();
-      td->outputData.close ();
-
       td->connection->host->warningsLogWrite (_("HTTP: internal error"));
       raiseHTTPError (500);
       logHTTPaccess ();
@@ -1475,15 +1471,12 @@ Internal Server Error\n\
   *td->auxiliaryBuffer << time;
   *td->auxiliaryBuffer << "\r\n\r\n";
 
-  if (! td->appendOutputs)
-    {
-      td->connection->socket->send (td->auxiliaryBuffer->getBuffer (),
-                                    td->auxiliaryBuffer->getLength (),
-                                    0);
+  td->connection->socket->send (td->auxiliaryBuffer->getBuffer (),
+                                td->auxiliaryBuffer->getLength (),
+                                0);
 
-      if (! td->onlyHeader)
-        td->connection->socket->send (hardHTML, strlen (hardHTML), 0);
-    }
+  if (! td->onlyHeader)
+    td->connection->socket->send (hardHTML, strlen (hardHTML), 0);
 
   return HttpDataHandler::RET_FAILURE;
 }
diff --git a/myserver/src/protocol/http/http_data_handler.cpp 
b/myserver/src/protocol/http/http_data_handler.cpp
index 04401ea..355ee34 100644
--- a/myserver/src/protocol/http/http_data_handler.cpp
+++ b/myserver/src/protocol/http/http_data_handler.cpp
@@ -66,9 +66,7 @@ int HttpDataHandler::unLoad ()
   \param td The HTTP thread context.
   \param buffer Data to send.
   \param size Size of the buffer.
-  \param appendFile The file where append if in append mode.
   \param chain Where send data if not append.
-  \param append Append to the file?
   \param useChunks Can we use HTTP chunks to send data?
   \param realBufferSize The real dimension of the buffer that can be
   used by this method.
@@ -78,9 +76,7 @@ int HttpDataHandler::unLoad ()
 size_t HttpDataHandler::appendDataToHTTPChannel (HttpThreadContext *td,
                                                  char *buffer,
                                                  size_t size,
-                                                 File *appendFile,
                                                  FiltersChain *chain,
-                                                 bool append,
                                                  bool useChunks,
                                                  size_t realBufferSize,
                                                  MemoryStream *tmpStream)
@@ -89,8 +85,7 @@ size_t HttpDataHandler::appendDataToHTTPChannel 
(HttpThreadContext *td,
   Stream *oldStream = chain->getStream ();
 
   if (!chain->hasModifiersFilters ())
-    return appendDataToHTTPChannel (td, buffer, size, appendFile, chain, 
append,
-                                    useChunks);
+    return appendDataToHTTPChannel (td, buffer, size, chain, useChunks);
 
   /*
     This function can't append directly to the chain because we can't
@@ -107,8 +102,7 @@ size_t HttpDataHandler::appendDataToHTTPChannel 
(HttpThreadContext *td,
 
   chain->setStream (oldStream);
 
-  return appendDataToHTTPChannel (td, buffer, nbr, appendFile, chain, append,
-                                  useChunks);
+  return appendDataToHTTPChannel (td, buffer, nbr, chain, useChunks);
 }
 
 /*!
@@ -117,18 +111,15 @@ size_t HttpDataHandler::appendDataToHTTPChannel 
(HttpThreadContext *td,
   \param td The HTTP thread context.
   \param buffer Data to send.
   \param size Size of the buffer.
-  \param appendFile The file where append if in append mode.
   \param chain Where send data if not append.
-  \param append Append to the file?
   \param useChunks Can we use HTTP chunks to send data?
  */
 size_t
-HttpDataHandler::appendDataToHTTPChannel (HttpThreadContext* td,
+HttpDataHandler::appendDataToHTTPChannel (HttpThreadContext *td,
                                           char *buffer,
                                           size_t size,
-                                          File *appendFile,
                                           FiltersChain *chain,
-                                          bool append, bool useChunks)
+                                          bool useChunks)
 {
   size_t tmp, nbw = 0;
   if (chain->hasModifiersFilters ())
@@ -137,12 +128,6 @@ HttpDataHandler::appendDataToHTTPChannel 
(HttpThreadContext* td,
       return 0;
     }
 
-  if (append)
-    {
-      appendFile->writeToFile (buffer, size, &nbw);
-      return nbw;
-    }
-
   if (useChunks)
     {
       ostringstream chunkHeader;
diff --git a/myserver/src/protocol/http/http_headers.cpp 
b/myserver/src/protocol/http/http_headers.cpp
index 45be2f3..375f74c 100644
--- a/myserver/src/protocol/http/http_headers.cpp
+++ b/myserver/src/protocol/http/http_headers.cpp
@@ -901,7 +901,7 @@ int HttpHeaders::sendHeader (HttpResponseHeader &response, 
Stream &stream,
                              MemBuf &memBuf, HttpThreadContext *ctx)
 {
   int ret = 0;
-  if (ctx == NULL || (!ctx->appendOutputs && !ctx->headerSent))
+  if (ctx == NULL || (!ctx->headerSent))
     {
       size_t nbw;
       u_long len = buildHTTPResponseHeader (memBuf.getBuffer (), &response);
diff --git a/myserver/src/protocol/http/webdav/webdav.cpp 
b/myserver/src/protocol/http/webdav/webdav.cpp
index 41bf189..b15b801 100644
--- a/myserver/src/protocol/http/webdav/webdav.cpp
+++ b/myserver/src/protocol/http/webdav/webdav.cpp
@@ -337,9 +337,7 @@ int WebDAV::propfind (HttpThreadContext* td)
 
           td->sentData +=
             HttpDataHandler::appendDataToHTTPChannel (td, 
td->buffer->getBuffer (),
-                                                      nbr, &(td->outputData),
-                                                      &chain, 
td->appendOutputs,
-                                                      useChunks);
+                                                      nbr, &chain, useChunks);
           if (nbr != td->buffer->getRealLength ())
             break;
         }
@@ -656,9 +654,7 @@ int WebDAV::lock (HttpThreadContext* td)
 
           td->sentData +=
             HttpDataHandler::appendDataToHTTPChannel (td, 
td->buffer->getBuffer (),
-                                                      nbr, &(td->outputData),
-                                                      &chain, 
td->appendOutputs,
-                                                      useChunks);
+                                                      nbr, &chain, useChunks);
         }
 
       if (useChunks && chain.getStream ()->write ("0\r\n\r\n", 5, &nbw2))

-----------------------------------------------------------------------

Summary of changes:
 myserver/include/protocol/http/http_data_handler.h |    4 -
 .../include/protocol/http/http_thread_context.h    |    5 +-
 myserver/src/http_handler/cgi/cgi.cpp              |    9 --
 myserver/src/http_handler/fastcgi/fastcgi.cpp      |    8 +--
 myserver/src/http_handler/http_dir/http_dir.cpp    |   21 ++----
 myserver/src/http_handler/http_file/http_file.cpp  |   18 +---
 myserver/src/http_handler/isapi/isapi.cpp          |   80 +++++++-------------
 myserver/src/http_handler/mscgi/mscgi.cpp          |    4 +-
 myserver/src/http_handler/proxy/proxy.cpp          |    7 +-
 myserver/src/http_handler/scgi/scgi.cpp            |    8 +-
 myserver/src/http_handler/wincgi/wincgi.cpp        |   59 ++++----------
 myserver/src/protocol/http/http.cpp                |   17 +---
 myserver/src/protocol/http/http_data_handler.cpp   |   23 +-----
 myserver/src/protocol/http/http_headers.cpp        |    2 +-
 myserver/src/protocol/http/webdav/webdav.cpp       |    8 +--
 15 files changed, 78 insertions(+), 195 deletions(-)


hooks/post-receive
-- 
GNU MyServer



reply via email to

[Prev in Thread] Current Thread [Next in Thread]