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. 0_9_2-182-


From: Giuseppe Scrivano
Subject: [myserver-commit] [SCM] GNU MyServer branch, master, updated. 0_9_2-182-g6f83a5a
Date: Mon, 19 Apr 2010 14:14: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  6f83a5af73d6a3d9a9abc31db0541983a2c65715 (commit)
       via  c3612bc638e625e0f14705e460a9f2ceb0767281 (commit)
       via  67d4f13e33f8f2f51a3ab5586043b48d807eb8a6 (commit)
       via  0bafdf18183e11b25bd1309711496f7f25e4d82b (commit)
       via  c37c1d260c78dede82cc5641e601cb082a39254b (commit)
       via  ade9708329454506b9310125e543fb12b1157e8a (commit)
       via  c96eceb92e62fa207d32e30d4c5295457b45924a (commit)
       via  47a5deaee3a4d6b07352b047aaed6881630e38bd (commit)
       via  de143fa5c2c5510fe4c707f310163a88d1ee758b (commit)
      from  65ae115899512a5ebde9d66bf7ebbdbcf062a956 (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 6f83a5af73d6a3d9a9abc31db0541983a2c65715
Author: Giuseppe Scrivano <address@hidden>
Date:   Mon Apr 19 16:06:14 2010 +0200

    Pass --keyword=_E to `xgettext'

diff --git a/myserver/po/Makevars b/myserver/po/Makevars
index 60a44cc..48a6525 100644
--- a/myserver/po/Makevars
+++ b/myserver/po/Makevars
@@ -10,7 +10,7 @@ subdir = po
 top_builddir = ..
 
 # These options get passed to xgettext.
-XGETTEXT_OPTIONS = --keyword=_ --keyword=N_ \
+XGETTEXT_OPTIONS = --keyword=_ --keyword=N_ --keyword=_E \
           \
  --flag=_:1:pass-c-format\
  --flag=N_:1:pass-c-format\
diff --git a/myserver/po/Makevars.template b/myserver/po/Makevars.template
index 32692ab..dd1a896 100644
--- a/myserver/po/Makevars.template
+++ b/myserver/po/Makevars.template
@@ -8,7 +8,7 @@ subdir = po
 top_builddir = ..
 
 # These options get passed to xgettext.
-XGETTEXT_OPTIONS = --keyword=_ --keyword=N_
+XGETTEXT_OPTIONS = --keyword=_ --keyword=N_ --keyword=_E
 
 # This is the copyright holder that gets inserted into the header of the
 # $(DOMAIN).pot file.  Set this to the copyright holder of the surrounding



commit c3612bc638e625e0f14705e460a9f2ceb0767281
Author: Giuseppe Scrivano <address@hidden>
Date:   Mon Apr 19 15:06:48 2010 +0200

    Adjust timeout multiplier

diff --git a/myserver/src/connections_scheduler/connections_scheduler.cpp 
b/myserver/src/connections_scheduler/connections_scheduler.cpp
index 0fbb115..5bf6996 100644
--- a/myserver/src/connections_scheduler/connections_scheduler.cpp
+++ b/myserver/src/connections_scheduler/connections_scheduler.cpp
@@ -101,8 +101,7 @@ void ConnectionsScheduler::newData (short event, 
SocketHandle handle)
         return;
 
       server->notifyDeleteConnection (connection);
-
-      removeConnection (connection);
+      server->deleteConnection (connection);
     }
 }
 
@@ -468,7 +467,7 @@ void ConnectionsScheduler::addWaitingConnectionImpl 
(ConnectionPtr c, int lock)
 #endif
 
   if (server)
-    tv.tv_sec = server->getTimeout () / 1000;
+    tv.tv_sec = server->getTimeout () / 1000000;
   else
     tv.tv_sec = 30;
 
diff --git a/myserver/src/server/server.cpp b/myserver/src/server/server.cpp
index 528bf0f..2cb578b 100644
--- a/myserver/src/server/server.cpp
+++ b/myserver/src/server/server.cpp
@@ -870,7 +870,7 @@ int Server::initialize ()
   if (data)
     buffersize = (atol (data) > 81920) ?  atol (data) :  81920 ;
 
-  data = getData ("server.connection_timeout");
+  data = getData ("connection.timeout");
   if (data)
     connectionTimeout = MYSERVER_SEC ((u_long) atol (data));
 



commit 67d4f13e33f8f2f51a3ab5586043b48d807eb8a6
Author: Giuseppe Scrivano <address@hidden>
Date:   Mon Apr 19 14:28:10 2010 +0200

    Use chunked transfer encoding only on HTTP/1.1

diff --git a/myserver/src/protocol/http/http.cpp 
b/myserver/src/protocol/http/http.cpp
index e3600e9..996326b 100644
--- a/myserver/src/protocol/http/http.cpp
+++ b/myserver/src/protocol/http/http.cpp
@@ -398,7 +398,7 @@ int Http::getFilePermissions (string& filename, string& 
directory, string& file,
     }
   catch (FileNotFoundException & e)
     {
-      return raiseHTTPError (404);
+      return 404;
     }
   catch (exception & e)
     {
@@ -915,16 +915,6 @@ int Http::controlConnection (ConnectionPtr a, char*, 
char*, u_long, u_long,
 
       td->response.ver.assign (td->request.ver.c_str ());
 
-      /* Do not use Keep-Alive with HTTP version older than 1.1.  */
-      if (td->request.ver.compare ("HTTP/1.1"))
-        {
-          HttpRequestHeader::Entry *connection =
-                  td->request.other.get ("connection");
-
-          if (connection && connection->value->length ())
-            connection->value->assign ("close");
-        }
-
       /*
        * For methods that accept data after the HTTP header set the correct
        * pointer and create a file containing the informations after the 
header.
@@ -981,7 +971,8 @@ int Http::controlConnection (ConnectionPtr a, char*, char*, 
u_long, u_long,
           HttpRequestHeader::Entry *connection
             = td->request.other.get ("connection");
           if (connection)
-            keepalive = !stringcmpi (connection->value->c_str (), 
"keep-alive");
+            keepalive = !stringcmpi (connection->value->c_str (), "keep-alive")
+              && !td->request.ver.compare ("HTTP/1.1");
 
           if (! td->request.ver.compare ("HTTP/1.1")
               && (host == NULL || host->value->length () == 0))
@@ -1393,41 +1384,37 @@ int Http::raiseHTTPError (int ID)
 
       HttpErrors::getErrorMessage (ID, errorMessage);
 
-      /* Send only the header (and the body if specified).  */
-      {
-        const char* value
-          = td->securityToken.getData ("http.error_body", MYSERVER_VHOST_CONF
-                                       | MYSERVER_SERVER_CONF, NULL);
+      const char* value
+        = td->securityToken.getData ("http.error_body", MYSERVER_VHOST_CONF
+                                     | MYSERVER_SERVER_CONF, NULL);
 
-        if (value && ! strcasecmp (value, "NO"))
-          {
-            errorBodyLength = 0;
-            td->response.contentLength.assign ("0");
-          }
-        else
-          {
-            ostringstream size;
-            errorBodyMessage << ID << " - " << errorMessage << "\r\n";
-            errorBodyLength = errorBodyMessage.str ().length ();
-            size << errorBodyLength;
-            td->response.contentLength.assign (size.str ());
-          }
-      }
+      if (value && ! strcasecmp (value, "NO"))
+        {
+          errorBodyLength = 0;
+          td->response.contentLength.assign ("0");
+        }
+      else
+        {
+          ostringstream size;
+          errorBodyMessage << ID << " - " << errorMessage << "\r\n";
+          errorBodyLength = errorBodyMessage.str ().length ();
+          size << errorBodyLength;
+          td->response.contentLength.assign (size.str ());
+        }
 
-      if (HttpHeaders::sendHeader (td->response, *td->connection->socket,
-                                   *td->buffer, td))
-        return 1;
+      HttpHeaders::sendHeader (td->response, *td->connection->socket,
+                               *td->buffer, td);
 
       if (errorBodyLength)
           td->connection->socket->send (errorBodyMessage.str ().c_str (),
                                         errorBodyLength, 0);
-      return HttpDataHandler::RET_OK;
     }
   catch (exception &e)
     {
       td->connection->host->warningsLogWrite (_E ("HTTP: internal error"), &e);
       return HttpDataHandler::RET_FAILURE;
     }
+  return HttpDataHandler::RET_OK;
 }
 
 /*!
diff --git a/myserver/src/protocol/http/http_data_handler.cpp 
b/myserver/src/protocol/http/http_data_handler.cpp
index 216cb05..b4f8bd5 100644
--- a/myserver/src/protocol/http/http_data_handler.cpp
+++ b/myserver/src/protocol/http/http_data_handler.cpp
@@ -200,7 +200,8 @@ HttpDataHandler::checkDataChunks (HttpThreadContext* td, 
bool* keepalive,
   *keepalive = td->request.isKeepAlive ();
   *useChunks = false;
 
-  /* Do not use chunked transfer with old HTTP/1.0 clients.  */
+  *keepalive &= !td->request.ver.compare ("HTTP/1.1");
+
   if (*keepalive)
     {
       HttpResponseHeader::Entry *e;



commit 0bafdf18183e11b25bd1309711496f7f25e4d82b
Author: Giuseppe Scrivano <address@hidden>
Date:   Mon Apr 19 13:06:55 2010 +0200

    Map Http handlers status codes to protocol handler codes correctly

diff --git a/myserver/src/protocol/http/http.cpp 
b/myserver/src/protocol/http/http.cpp
index 108659a..e3600e9 100644
--- a/myserver/src/protocol/http/http.cpp
+++ b/myserver/src/protocol/http/http.cpp
@@ -829,6 +829,7 @@ int Http::controlConnection (ConnectionPtr a, char*, char*, 
u_long, u_long,
   /* Dimension of the POST data. */
   int contentLength = -1;
   DynamicHttpCommand *dynamicCommand;
+  bool keepalive = false;
 
   try
     {
@@ -891,7 +892,7 @@ int Http::controlConnection (ConnectionPtr a, char*, char*, 
u_long, u_long,
         return ClientsThread::INCOMPLETE_REQUEST;
 
       if (a->protocolBuffer)
-        ((HttpUserData*) a->protocolBuffer)->digestChecked = 0;
+        ((HttpUserData *) a->protocolBuffer)->digestChecked = 0;
 
       /* If the validRequest cointains an error code send it to the user.  */
       if (validRequest != 200)
@@ -947,10 +948,8 @@ int Http::controlConnection (ConnectionPtr a, char*, 
char*, u_long, u_long,
             {
               const char* msg = "HTTP/1.1 100 Continue\r\n\r\n";
               if (a->socket->bytesToRead () == 0)
-                {
-                  if (a->socket->send (msg, (int) strlen (msg), 0) == -1)
-                    return ClientsThread::DELETE_CONNECTION;
-                }
+                a->socket->send (msg, (int) strlen (msg), 0);
+
               return ClientsThread::INCOMPLETE_REQUEST;
             }
 
@@ -979,13 +978,20 @@ int Http::controlConnection (ConnectionPtr a, char*, 
char*, u_long, u_long,
            * request does not include a Host request-header.
            */
           HttpRequestHeader::Entry *host = td->request.other.get ("host");
+          HttpRequestHeader::Entry *connection
+            = td->request.other.get ("connection");
+          if (connection)
+            keepalive = !stringcmpi (connection->value->c_str (), 
"keep-alive");
 
           if (! td->request.ver.compare ("HTTP/1.1")
               && (host == NULL || host->value->length () == 0))
             {
               int ret = raiseHTTPError (400);
               logHTTPaccess ();
-              return ret;
+              if (ret == HttpDataHandler::RET_OK && keepalive)
+                return ClientsThread::KEEP_CONNECTION;
+              else
+                return ClientsThread::DELETE_CONNECTION;
             }
 
           /* Find the virtual host to check both host name and IP value.  */
@@ -1000,7 +1006,10 @@ int Http::controlConnection (ConnectionPtr a, char*, 
char*, u_long, u_long,
             {
               int ret = raiseHTTPError (400);
               logHTTPaccess ();
-              return ret;
+              if (ret == HttpDataHandler::RET_OK && keepalive)
+                return ClientsThread::KEEP_CONNECTION;
+              else
+                return ClientsThread::DELETE_CONNECTION;
             }
 
           if (td->request.uri.length () > 2 && td->request.uri[1] == '~')
@@ -1092,12 +1101,7 @@ int Http::controlConnection (ConnectionPtr a, char*, 
char*, u_long, u_long,
                                                                       msg, td);
                     if (handlerRet == ClientsThread::DELETE_CONNECTION)
                       {
-                        ret = ClientsThread::DELETE_CONNECTION;
-                        break;
-                      }
-                    else if (handlerRet == ClientsThread::KEEP_CONNECTION)
-                      {
-                        ret = ClientsThread::KEEP_CONNECTION;
+                        ret = HttpDataHandler::RET_FAILURE;
                         break;
                       }
                   }
@@ -1161,12 +1165,6 @@ int Http::controlConnection (ConnectionPtr a, char*, 
char*, u_long, u_long,
         {
         }
 
-      bool keepalive = false;
-      HttpRequestHeader::Entry *connection = td->request.other.get
-                                                       ("connection");
-      if (connection)
-        keepalive = !stringcmpi (connection->value->c_str (), "keep-alive");
-
       logHTTPaccess ();
 
       /* Map the HttpDataHandler return value to codes understood by



commit c37c1d260c78dede82cc5641e601cb082a39254b
Author: Giuseppe Scrivano <address@hidden>
Date:   Mon Apr 19 12:53:42 2010 +0200

    Cleanup some errors check code

diff --git a/myserver/src/protocol/http/http.cpp 
b/myserver/src/protocol/http/http.cpp
index 32321ba..108659a 100644
--- a/myserver/src/protocol/http/http.cpp
+++ b/myserver/src/protocol/http/http.cpp
@@ -1308,11 +1308,12 @@ int Http::raiseHTTPError (int ID)
       int errorBodyLength = 0;
       int useMessagesFiles = 1;
       HttpRequestHeader::Entry *host = td->request.other.get ("host");
-      HttpRequestHeader::Entry *connection = td->request.other.get 
("connection");
-      const char *useMessagesVal = td->securityToken.getData 
("http.use_error_file",
-                                                              
MYSERVER_VHOST_CONF
-                                                              | 
MYSERVER_SERVER_CONF,
-                                                              NULL);
+      HttpRequestHeader::Entry *connection
+        = td->request.other.get ("connection");
+      const char *useMessagesVal =
+        td->securityToken.getData ("http.use_error_file", MYSERVER_VHOST_CONF
+                                   | MYSERVER_SERVER_CONF,
+                                   NULL);
       if (useMessagesVal)
         {
           if (! strcasecmp (useMessagesVal, "YES"))
@@ -1396,9 +1397,9 @@ int Http::raiseHTTPError (int ID)
 
       /* Send only the header (and the body if specified).  */
       {
-        const char* value = td->securityToken.getData ("http.error_body",
-                                                             
MYSERVER_VHOST_CONF |
-                                                             
MYSERVER_SERVER_CONF, NULL);
+        const char* value
+          = td->securityToken.getData ("http.error_body", MYSERVER_VHOST_CONF
+                                       | MYSERVER_SERVER_CONF, NULL);
 
         if (value && ! strcasecmp (value, "NO"))
           {
@@ -1419,19 +1420,14 @@ int Http::raiseHTTPError (int ID)
                                    *td->buffer, td))
         return 1;
 
-      if (errorBodyLength
-          && (td->connection->socket->send (errorBodyMessage.str ().c_str (),
-                                            errorBodyLength, 0) < 0))
-        {
-          td->connection->host->warningsLogWrite (_("HTTP: socket error"));
-          return HttpDataHandler::RET_FAILURE;
-        }
-
+      if (errorBodyLength)
+          td->connection->socket->send (errorBodyMessage.str ().c_str (),
+                                        errorBodyLength, 0);
       return HttpDataHandler::RET_OK;
     }
-  catch (...)
+  catch (exception &e)
     {
-      td->connection->host->warningsLogWrite (_("HTTP: internal error"));
+      td->connection->host->warningsLogWrite (_E ("HTTP: internal error"), &e);
       return HttpDataHandler::RET_FAILURE;
     }
 }
@@ -1482,10 +1478,9 @@ Internal Server Error\n\
   *td->auxiliaryBuffer << time;
   *td->auxiliaryBuffer << "\r\n\r\n";
 
-  if (td->connection->socket->send (td->auxiliaryBuffer->getBuffer (),
-                                    (u_long) td->auxiliaryBuffer->getLength (),
-                                    0) < 0)
-    return HttpDataHandler::RET_FAILURE;
+  td->connection->socket->send (td->auxiliaryBuffer->getBuffer (),
+                                (u_long) td->auxiliaryBuffer->getLength (),
+                                0);
 
   if (!td->onlyHeader)
     td->connection->socket->send (hardHTML, (u_long) strlen (hardHTML), 0);
@@ -1666,13 +1661,8 @@ int Http::sendHTTPRedirect (const char *newURL)
   getRFC822GMTTime (time, 32);
   *td->auxiliaryBuffer << time
           << "\r\n\r\n";
-  if (td->connection->socket->send (td->auxiliaryBuffer->getBuffer (),
-                                    (int) td->auxiliaryBuffer->getLength (), 
0) < 0)
-    {
-      td->connection->host->warningsLogWrite (_("HTTP: socket error"));
-      return HttpDataHandler::RET_FAILURE;
-    }
-
+  td->connection->socket->send (td->auxiliaryBuffer->getBuffer (),
+                                (int) td->auxiliaryBuffer->getLength (), 0);
   return HttpDataHandler::RET_OK;
 }
 
@@ -1698,12 +1688,8 @@ int Http::sendHTTPNonModified ()
 
   *td->auxiliaryBuffer << "Date: " << time << "\r\n\r\n";
 
-  if (td->connection->socket->send (td->auxiliaryBuffer->getBuffer (),
-                                    (int) td->auxiliaryBuffer->getLength (), 
0) < 0)
-    {
-      td->connection->host->warningsLogWrite (_("HTTP: socket error"));
-      return HttpDataHandler::RET_FAILURE;
-    }
+  td->connection->socket->send (td->auxiliaryBuffer->getBuffer (),
+                                (int) td->auxiliaryBuffer->getLength (), 0);
 
   return HttpDataHandler::RET_OK;
 }



commit ade9708329454506b9310125e543fb12b1157e8a
Author: Giuseppe Scrivano <address@hidden>
Date:   Mon Apr 19 12:52:40 2010 +0200

    Add the Status header only if it has a value

diff --git a/myserver/src/protocol/http/http_headers.cpp 
b/myserver/src/protocol/http/http_headers.cpp
index 1bb07e2..4145db7 100644
--- a/myserver/src/protocol/http/http_headers.cpp
+++ b/myserver/src/protocol/http/http_headers.cpp
@@ -55,15 +55,15 @@ u_long HttpHeaders::buildHTTPResponseHeader (char *str,
   char *pos = str;
   const int MAX = MYSERVER_KB (8);
   if (response->httpStatus != 200)
-  {
-    if (response->errorType.length () == 0)
     {
-      HttpErrors::getErrorMessage (response->httpStatus, response->errorType);
+      if (response->errorType.length () == 0)
+        HttpErrors::getErrorMessage (response->httpStatus, 
response->errorType);
+
+      pos += sprintf (pos, "%s %i %s\r\n", response->ver.c_str (),
+                      response->httpStatus, response->errorType.c_str ());
+      if (response->errorType.c_str ()[0])
+        pos += sprintf (pos, "Status: %s\r\n", response->errorType.c_str ());
     }
-    pos += sprintf (str, "%s %i %s\r\nStatus: %s\r\n", response->ver.c_str (),
-                    response->httpStatus, response->errorType.c_str (),
-                    response->errorType.c_str () );
-  }
   else
     pos += sprintf (str,"%s 200 OK\r\n",response->ver.c_str ());
 



commit c96eceb92e62fa207d32e30d4c5295457b45924a
Author: Giuseppe Scrivano <address@hidden>
Date:   Mon Apr 19 12:36:10 2010 +0200

    Do not force chunked transfer encoding when a range is specified

diff --git a/myserver/src/http_handler/http_file/http_file.cpp 
b/myserver/src/http_handler/http_file/http_file.cpp
index 5dc253a..310b74d 100644
--- a/myserver/src/http_handler/http_file/http_file.cpp
+++ b/myserver/src/http_handler/http_file/http_file.cpp
@@ -309,28 +309,13 @@ int HttpFile::send (HttpThreadContext* td, const char 
*filenamePath,
           }
       }
 
-    bytesToSend = filesize;
     if (lastByte == 0)
-      lastByte = bytesToSend;
+      lastByte = filesize;
     else
-      {
-        /*
-         * If the client use ranges set the right value
-         * for the last byte number.
-         */
-        lastByte = std::min (lastByte + 1, bytesToSend);
-      }
+      lastByte = std::min (lastByte + 1, filesize);
 
-    /*
-     * bytesToSend is the interval between the first and the last byte.
-     */
     bytesToSend = lastByte - firstByte;
 
-    /*
-     * If fail to set the file pointer returns an internal server error.
-     */
-    file->seek (firstByte);
-
     keepalive = td->request.isKeepAlive ();
 
     td->buffer->setLength (0);
@@ -341,8 +326,8 @@ int HttpFile::send (HttpThreadContext* td, const char 
*filenamePath,
         HttpResponseHeader::Entry *e;
         ostringstream buffer;
         td->response.httpStatus = 206;
-        buffer << "bytes "<< (u_long)firstByte << "-"
-               << (u_long) (lastByte - 1) << "/" << (u_long)filesize;
+        buffer << "bytes "<< (u_long) firstByte << "-"
+               << (u_long) (lastByte - 1) << "/" << (u_long) filesize;
 
         e = td->response.other.get ("content-range");
         if (e)
@@ -354,8 +339,6 @@ int HttpFile::send (HttpThreadContext* td, const char 
*filenamePath,
             e->value->assign (buffer.str ());
             td->response.other.put (*(e->name), e);
           }
-
-        useChunks = true;
       }
     chain.setStream (&memStream);
     if (td->mime)
@@ -372,7 +355,6 @@ int HttpFile::send (HttpThreadContext* td, const char 
*filenamePath,
       }
 
     useModifiers = chain.hasModifiersFilters ();
-
     if (!useModifiers)
       {
         ostringstream buffer;
@@ -463,6 +445,8 @@ int HttpFile::send (HttpThreadContext* td, const char 
*filenamePath,
         return HttpDataHandler::RET_OK;
       }
 
+    file->seek (firstByte);
+
     if (td->appendOutputs)
       chain.setStream (&(td->outputData));
     else
@@ -545,10 +529,6 @@ int HttpFile::send (HttpThreadContext* td, const char 
*filenamePath,
                                                        nbr, &(td->outputData),
                                                        &chain, 
td->appendOutputs,
                                                           useChunks);
-
-                HttpDataHandler::appendDataToHTTPChannel (td, 0, 0,
-                                                     &(td->outputData), &chain,
-                                                 td->appendOutputs, useChunks);
                 break;
               }
           }



commit 47a5deaee3a4d6b07352b047aaed6881630e38bd
Author: Giuseppe Scrivano <address@hidden>
Date:   Mon Apr 19 11:45:36 2010 +0200

    HTTP/1.0 does not require host to be specified

diff --git a/myserver/src/protocol/http/http.cpp 
b/myserver/src/protocol/http/http.cpp
index 3c8776f..32321ba 100644
--- a/myserver/src/protocol/http/http.cpp
+++ b/myserver/src/protocol/http/http.cpp
@@ -980,61 +980,27 @@ int Http::controlConnection (ConnectionPtr a, char*, 
char*, u_long, u_long,
            */
           HttpRequestHeader::Entry *host = td->request.other.get ("host");
 
-          if (host == NULL || (!td->request.ver.compare ("HTTP/1.1")
-                               && host->value->length () == 0))
+          if (! td->request.ver.compare ("HTTP/1.1")
+              && (host == NULL || host->value->length () == 0))
             {
-              raiseHTTPError (400);
-              /* If the inputData file was not closed close it.  */
-              if (td->inputData.getHandle ())
-                {
-                  td->inputData.close ();
-                  FilesUtility::deleteFile (td->inputDataPath);
-                }
-
-              /* If the outputData file was not closed close it.  */
-              if (td->outputData.getHandle ())
-                {
-                  td->outputData.close ();
-                  FilesUtility::deleteFile (td->outputDataPath);
-                }
+              int ret = raiseHTTPError (400);
               logHTTPaccess ();
-              return ClientsThread::DELETE_CONNECTION;
+              return ret;
             }
-          else
-            {
-              /* Find the virtual host to check both host name and IP value.  
*/
-              Vhost* newHost = Server::getInstance ()->getVhosts ()->getVHost 
(host ?
-                                                           host->value->c_str 
() : "",
-                                            a->getLocalIpAddr (), 
a->getLocalPort ());
-              if (a->host)
-                a->host->removeRef ();
-
-              a->host = newHost;
-              if (a->host == NULL)
-                {
-                  Server::getInstance ()->log (MYSERVER_LOG_MSG_ERROR,
-                                    _("Invalid virtual host requested from 
%s"),
-                                               a->getIpAddr ());
 
-                  raiseHTTPError (400);
-                  /*
-                   *If the inputData file was not closed close it.
-                   */
-                  if (td->inputData.getHandle ())
-                    {
-                      td->inputData.close ();
-                      FilesUtility::deleteFile (td->inputDataPath);
-                    }
+          /* Find the virtual host to check both host name and IP value.  */
+          Vhost* newHost = Server::getInstance ()->getVhosts ()->getVHost 
(host ?
+                                                       host->value->c_str () : 
"",
+                                         a->getLocalIpAddr (), a->getLocalPort 
());
+          if (a->host)
+            a->host->removeRef ();
 
-                   /* If the outputData file was not closed close it.  */
-                  if (td->outputData.getHandle ())
-                    {
-                      td->outputData.close ();
-                      FilesUtility::deleteFile (td->outputDataPath);
-                    }
-                  logHTTPaccess ();
-                  return ClientsThread::DELETE_CONNECTION;
-                }
+          a->host = newHost;
+          if (a->host == NULL)
+            {
+              int ret = raiseHTTPError (400);
+              logHTTPaccess ();
+              return ret;
             }
 
           if (td->request.uri.length () > 2 && td->request.uri[1] == '~')



commit de143fa5c2c5510fe4c707f310163a88d1ee758b
Author: Giuseppe Scrivano <address@hidden>
Date:   Mon Apr 19 11:45:03 2010 +0200

    Handle seek errors

diff --git a/myserver/src/base/file/file.cpp b/myserver/src/base/file/file.cpp
index bc67e92..c16cb66 100644
--- a/myserver/src/base/file/file.cpp
+++ b/myserver/src/base/file/file.cpp
@@ -300,7 +300,7 @@ u_long File::getFileSize ()
 int File::seek (u_long initialByte)
 {
   u_long ret;
-  ret = lseek (handle, initialByte, SEEK_SET);
+  ret = checked::checkError (lseek (handle, initialByte, SEEK_SET));
   return (ret != initialByte ) ? 1 : 0;
 }
 

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

Summary of changes:
 myserver/po/Makevars                               |    2 +-
 myserver/po/Makevars.template                      |    2 +-
 myserver/src/base/file/file.cpp                    |    2 +-
 .../connections_scheduler.cpp                      |    5 +-
 myserver/src/http_handler/http_file/http_file.cpp  |   32 +---
 myserver/src/protocol/http/http.cpp                |  203 +++++++-------------
 myserver/src/protocol/http/http_data_handler.cpp   |    3 +-
 myserver/src/protocol/http/http_headers.cpp        |   14 +-
 myserver/src/server/server.cpp                     |    2 +-
 9 files changed, 91 insertions(+), 174 deletions(-)


hooks/post-receive
-- 
GNU MyServer




reply via email to

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