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-364-g8


From: Giuseppe Scrivano
Subject: [myserver-commit] [SCM] GNU MyServer branch, master, updated. 0_9-364-g8b2808f
Date: Fri, 06 Nov 2009 09:33:42 +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  8b2808f4556d1bf86af3708332d0f4e4ad599cf8 (commit)
       via  5ab8a057a885421230d65f9d4159233a6e8b0468 (commit)
       via  d7b86d91d7d7198a55def013b010b12a989442ab (commit)
      from  5454284e8ee015351d807f5ee10f5b985af4b56b (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 8b2808f4556d1bf86af3708332d0f4e4ad599cf8
Author: Giuseppe Scrivano <address@hidden>
Date:   Fri Nov 6 10:33:34 2009 +0100

    Move protocol modes from globals #define's to an enum inside the Protocol 
class itself.

diff --git a/myserver/include/protocol/ftp/ftp.h 
b/myserver/include/protocol/ftp/ftp.h
index 7bf286f..df4ea16 100644
--- a/myserver/include/protocol/ftp/ftp.h
+++ b/myserver/include/protocol/ftp/ftp.h
@@ -1,20 +1,20 @@
 /* -*- mode: c++ -*- */
 /*
-MyServer
-Copyright (C) 2008, 2009 Free Software Foundation, Inc.
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+  MyServer
+  Copyright (C) 2008, 2009 Free Software Foundation, Inc.
+  This program is free software; you can redistribute it and/or modify
+  it under the terms of the GNU General Public License as published by
+  the Free Software Foundation; either version 2 of the License, or
+  (at your option) any later version.
+
+  This program is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+  GNU General Public License for more details.
+
+  You should have received a copy of the GNU General Public License
+  along with this program; if not, write to the Free Software
+  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  
USA
 */
 
 #ifndef FTP_H
@@ -214,7 +214,7 @@ class FtpProtocol:public Protocol
 public:
   FtpProtocol ()
   {
-    protocolOptions = PROTOCOL_FAST_CHECK;
+    protocolOptions = Protocol::FAST_CHECK;
   }
 
   virtual ~ FtpProtocol ()
diff --git a/myserver/include/protocol/http/dyn_http_command.h 
b/myserver/include/protocol/http/dyn_http_command.h
index 76e119d..0024500 100644
--- a/myserver/include/protocol/http/dyn_http_command.h
+++ b/myserver/include/protocol/http/dyn_http_command.h
@@ -1,19 +1,19 @@
 /* -*- mode: c++ -*- */
 /*
-MyServer
-Copyright (C) 2005, 2007, 2009 Free Software Foundation, Inc.
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 3 of the License, or
-(at your option) any later version.
+  MyServer
+  Copyright (C) 2005, 2007, 2009 Free Software Foundation, Inc.
+  This program is free software; you can redistribute it and/or modify
+  it under the terms of the GNU General Public License as published by
+  the Free Software Foundation; either version 3 of the License, or
+  (at your option) any later version.
 
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-GNU General Public License for more details.
+  This program is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+  GNU General Public License for more details.
 
-You should have received a copy of the GNU General Public License
-along with this program.  If not, see <http://www.gnu.org/licenses/>.
+  You should have received a copy of the GNU General Public License
+  along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
 
 #ifndef DYN_HTTP_COMMAND_H
@@ -37,8 +37,8 @@ public:
   string getName ();
   virtual int acceptData () = 0;
   virtual int send (HttpThreadContext* context, ConnectionPtr lpconnection,
-                                                                        
string& Uri, int systemrequest = 0,
-                                                                        int 
OnlyHeader = 0, int yetmapped = 0) = 0;
+                    string& Uri, int systemrequest = 0,
+                    int OnlyHeader = 0, int yetmapped = 0) = 0;
 private:
   string name;
 };
diff --git a/myserver/include/protocol/http/dyn_http_command_manager.h 
b/myserver/include/protocol/http/dyn_http_command_manager.h
index c62ef80..954c735 100644
--- a/myserver/include/protocol/http/dyn_http_command_manager.h
+++ b/myserver/include/protocol/http/dyn_http_command_manager.h
@@ -1,19 +1,19 @@
 /* -*- mode: c++ -*- */
 /*
-MyServer
-Copyright (C) 2005, 2007, 2009 Free Software Foundation, Inc.
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 3 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program.  If not, see <http://www.gnu.org/licenses/>.
+  MyServer
+  Copyright (C) 2005, 2007, 2009 Free Software Foundation, Inc.
+  This program is free software; you can redistribute it and/or modify
+  it under the terms of the GNU General Public License as published by
+  the Free Software Foundation; either version 3 of the License, or
+  (at your option) any later version.
+
+  This program is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+  GNU General Public License for more details.
+
+  You should have received a copy of the GNU General Public License
+  along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
 
 #ifndef DYN_HTTP_COMMAND_MANAGER_H
@@ -53,7 +53,7 @@ public:
     addHttpCommand (strName, httpCommand);
   }
 private:
-       HashMap<string, DynamicHttpCommand*> dynamicHttpCommands;
+  HashMap<string, DynamicHttpCommand*> dynamicHttpCommands;
 };
 
 #endif
diff --git a/myserver/include/protocol/http/dyn_http_manager.h 
b/myserver/include/protocol/http/dyn_http_manager.h
index 7488d31..5e6734b 100644
--- a/myserver/include/protocol/http/dyn_http_manager.h
+++ b/myserver/include/protocol/http/dyn_http_manager.h
@@ -1,19 +1,19 @@
 /* -*- mode: c++ -*- */
 /*
-MyServer
-Copyright (C) 2005, 2009 Free Software Foundation, Inc.
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 3 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program.  If not, see <http://www.gnu.org/licenses/>.
+  MyServer
+  Copyright (C) 2005, 2009 Free Software Foundation, Inc.
+  This program is free software; you can redistribute it and/or modify
+  it under the terms of the GNU General Public License as published by
+  the Free Software Foundation; either version 3 of the License, or
+  (at your option) any later version.
+
+  This program is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+  GNU General Public License for more details.
+
+  You should have received a copy of the GNU General Public License
+  along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
 
 #ifndef DYN_HTTP_MANAGER_H
@@ -33,10 +33,10 @@ using namespace std;
 class DynamicHttpManager
 {
 public:
-       DynamicHttpManager ();
-       virtual ~DynamicHttpManager ();
-       virtual int send (HttpThreadContext*, ConnectionPtr s, const char 
*filenamePath,
-                   const char* cgi, int selfExecuted, int onlyHeader = 0) = 0;
+  DynamicHttpManager ();
+  virtual ~DynamicHttpManager ();
+  virtual int send (HttpThreadContext*, ConnectionPtr s, const char 
*filenamePath,
+                    const char* cgi, int selfExecuted, int onlyHeader = 0) = 0;
 
 };
 
diff --git a/myserver/include/protocol/http/dyn_http_manager_list.h 
b/myserver/include/protocol/http/dyn_http_manager_list.h
index c77af1c..3621031 100644
--- a/myserver/include/protocol/http/dyn_http_manager_list.h
+++ b/myserver/include/protocol/http/dyn_http_manager_list.h
@@ -1,19 +1,19 @@
 /* -*- mode: c++ -*- */
 /*
-MyServer
-Copyright (C) 2005, 2007, 2008, 2009 Free Software Foundation, Inc.
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 3 of the License, or
-(at your option) any later version.
+  MyServer
+  Copyright (C) 2005, 2007, 2008, 2009 Free Software Foundation, Inc.
+  This program is free software; you can redistribute it and/or modify
+  it under the terms of the GNU General Public License as published by
+  the Free Software Foundation; either version 3 of the License, or
+  (at your option) any later version.
 
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-GNU General Public License for more details.
+  This program is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+  GNU General Public License for more details.
 
-You should have received a copy of the GNU General Public License
-along with this program.  If not, see <http://www.gnu.org/licenses/>.
+  You should have received a copy of the GNU General Public License
+  along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
 
 #ifndef DYN_HTTP_MANAGER_LIST_H
@@ -38,8 +38,8 @@ public:
 
   HttpDataHandler *getHttpManager (const char *name)
   {
-       string strName (name);
-       return getHttpManager (strName);
+    string strName (name);
+    return getHttpManager (strName);
   }
 
   HashMap<string, HttpDataHandler*>::Iterator begin (){return 
dynamicHttpManagers.begin ();}
@@ -49,8 +49,8 @@ public:
 
   void addHttpManager (const char* name, HttpDataHandler* httpManager)
   {
-       string strName (name);
-       addHttpManager (strName, httpManager);
+    string strName (name);
+    addHttpManager (strName, httpManager);
   }
 
   void clear ();
@@ -58,7 +58,7 @@ public:
   DynHttpManagerList ();
   ~DynHttpManagerList ();
 private:
-       HashMap<string, HttpDataHandler*> dynamicHttpManagers;
+  HashMap<string, HttpDataHandler*> dynamicHttpManagers;
 };
 
 #endif
diff --git a/myserver/include/protocol/http/http_data_handler.h 
b/myserver/include/protocol/http/http_data_handler.h
index 8866ba2..9de3caa 100644
--- a/myserver/include/protocol/http/http_data_handler.h
+++ b/myserver/include/protocol/http/http_data_handler.h
@@ -1,19 +1,19 @@
 /* -*- mode: c++ -*- */
 /*
-MyServer
-Copyright (C) 2005, 2007, 2008, 2009 Free Software Foundation, Inc.
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 3 of the License, or
-(at your option) any later version.
+  MyServer
+  Copyright (C) 2005, 2007, 2008, 2009 Free Software Foundation, Inc.
+  This program is free software; you can redistribute it and/or modify
+  it under the terms of the GNU General Public License as published by
+  the Free Software Foundation; either version 3 of the License, or
+  (at your option) any later version.
 
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-GNU General Public License for more details.
+  This program is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+  GNU General Public License for more details.
 
-You should have received a copy of the GNU General Public License
-along with this program.  If not, see <http://www.gnu.org/licenses/>.
+  You should have received a copy of the GNU General Public License
+  along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
 
 #ifndef HTTP_DATA_HANDLER_H
@@ -35,14 +35,14 @@ public:
   virtual int load ();
   virtual int unLoad ();
 
-       virtual int send (HttpThreadContext*, const char* exec,
-                   const char* cmdLine = 0, bool execute = false,
-                   bool onlyHeader = false);
+  virtual int send (HttpThreadContext*, const char* exec,
+                    const char* cmdLine = 0, bool execute = false,
+                    bool onlyHeader = false);
 
   HttpDataHandler ();
   virtual ~HttpDataHandler ();
 
-       static void checkDataChunks (HttpThreadContext*, bool*, bool*);
+  static void checkDataChunks (HttpThreadContext*, bool*, bool*);
 
   static int appendDataToHTTPChannel (HttpThreadContext* td,
                                       char* buffer,
@@ -54,13 +54,13 @@ public:
                                       u_long realBufferSize,
                                       MemoryStream *tmpStream);
 
-       static int appendDataToHTTPChannel (HttpThreadContext* td,
-                                     char* buffer,
-                                     u_long size,
-                                     File* appendFile,
-                                     FiltersChain* chain,
-                                     bool append,
-                                     bool useChunks);
+  static int appendDataToHTTPChannel (HttpThreadContext* td,
+                                      char* buffer,
+                                      u_long size,
+                                      File* appendFile,
+                                      FiltersChain* chain,
+                                      bool append,
+                                      bool useChunks);
 
 };
 
diff --git a/myserver/include/protocol/https/https.h 
b/myserver/include/protocol/https/https.h
index a777252..3f2a896 100644
--- a/myserver/include/protocol/https/https.h
+++ b/myserver/include/protocol/https/https.h
@@ -49,7 +49,7 @@ class HttpsProtocol : public Protocol
 public:
   HttpsProtocol ()
   {
-    protocolOptions = PROTOCOL_USES_SSL;
+    protocolOptions = Protocol::SSL;
   }
 
   virtual ~HttpsProtocol ()
diff --git a/myserver/include/protocol/protocol.h 
b/myserver/include/protocol/protocol.h
index 75720a4..6be5ce0 100644
--- a/myserver/include/protocol/protocol.h
+++ b/myserver/include/protocol/protocol.h
@@ -21,10 +21,6 @@
 # include "stdafx.h"
 # include <include/base/xml/xml_parser.h>
 # include <include/connection/connection.h>
-/*! Various options that can be use for the protocol.  */
-# define PROTOCOL_USES_SSL 1
-# define PROTOCOL_FAST_CHECK 2
-# define PROTOCOL_DENY_DELETE 4
 
 /*!
  *This is the base class to derive other protocols implementations for the 
server.
@@ -32,6 +28,14 @@
 class Protocol
 {
 public:
+  /*! Various options that can be use for the protocol.  */
+  enum
+    {
+      SSL = 1,
+      FAST_CHECK = 2,
+      DENY_DELETE = 4
+    };
+
   Protocol ();
   virtual ~Protocol ();
   virtual const char* getName ();
diff --git a/myserver/include/protocol/protocol_buffer.h 
b/myserver/include/protocol/protocol_buffer.h
index 1e9e592..74c48ed 100644
--- a/myserver/include/protocol/protocol_buffer.h
+++ b/myserver/include/protocol/protocol_buffer.h
@@ -1,20 +1,20 @@
 /* -*- mode: c++ -*- */
 /*
-MyServer
-Copyright (C) 2002, 2003, 2004, 2007, 2008, 2009 Free Software
-Foundation, Inc.
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 3 of the License, or
-(at your option) any later version.
+  MyServer
+  Copyright (C) 2002, 2003, 2004, 2007, 2008, 2009 Free Software
+  Foundation, Inc.
+  This program is free software; you can redistribute it and/or modify
+  it under the terms of the GNU General Public License as published by
+  the Free Software Foundation; either version 3 of the License, or
+  (at your option) any later version.
 
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-GNU General Public License for more details.
+  This program is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+  GNU General Public License for more details.
 
-You should have received a copy of the GNU General Public License
-along with this program.  If not, see <http://www.gnu.org/licenses/>.
+  You should have received a copy of the GNU General Public License
+  along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
 
 #ifndef PROTOCOL_BUFFER_H
@@ -23,11 +23,11 @@ along with this program.  If not, see 
<http://www.gnu.org/licenses/>.
 /*!
  *Base class to handle a buffer in the connection.
  */
-class  ProtocolBuffer
+class ProtocolBuffer
 {
 public:
   ProtocolBuffer ();
-       virtual ~ProtocolBuffer ();
+  virtual ~ProtocolBuffer ();
   virtual bool allowDelete (bool wait);
 };
 
diff --git a/myserver/include/protocol/protocols_manager.h 
b/myserver/include/protocol/protocols_manager.h
index 44f0f46..dbb4095 100644
--- a/myserver/include/protocol/protocols_manager.h
+++ b/myserver/include/protocol/protocols_manager.h
@@ -36,11 +36,9 @@ class ProtocolsManager
 public:
   ProtocolsManager ();
   ~ProtocolsManager ();
-
   Protocol* getProtocol (string &name);
 
   void addProtocol (string &name, Protocol *protocol);
-
   void addProtocol (const char *name, Protocol *protocol)
   {
     string strName (name);
diff --git a/myserver/include/protocol/url.h b/myserver/include/protocol/url.h
index 836304d..08f1327 100644
--- a/myserver/include/protocol/url.h
+++ b/myserver/include/protocol/url.h
@@ -1,19 +1,19 @@
 /* -*- mode: c++ -*- */
 /*
-MyServer
-Copyright (C) 2009 Free Software Foundation, Inc.
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 3 of the License, or
-(at your option) any later version.
+  MyServer
+  Copyright (C) 2009 Free Software Foundation, Inc.
+  This program is free software; you can redistribute it and/or modify
+  it under the terms of the GNU General Public License as published by
+  the Free Software Foundation; either version 3 of the License, or
+  (at your option) any later version.
 
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-GNU General Public License for more details.
+  This program is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+  GNU General Public License for more details.
 
-You should have received a copy of the GNU General Public License
-along with this program.  If not, see <http://www.gnu.org/licenses/>.
+  You should have received a copy of the GNU General Public License
+  along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
 
 #ifndef URL_H
diff --git a/myserver/src/conf/vhost/vhost.cpp 
b/myserver/src/conf/vhost/vhost.cpp
index 0249ba5..5fa3804 100644
--- a/myserver/src/conf/vhost/vhost.cpp
+++ b/myserver/src/conf/vhost/vhost.cpp
@@ -476,7 +476,7 @@ int Vhost::initializeSSL ()
   if (!protocol)
     return 0;
 
-  if (!(protocol->getProtocolOptions () & PROTOCOL_USES_SSL))
+  if (!(protocol->getProtocolOptions () & Protocol::SSL))
     return 0;
 
   return sslContext.initialize ();
diff --git a/myserver/src/http_handler/http_file/http_file.cpp 
b/myserver/src/http_handler/http_file/http_file.cpp
index d22c223..407fdec 100644
--- a/myserver/src/http_handler/http_file/http_file.cpp
+++ b/myserver/src/http_handler/http_file/http_file.cpp
@@ -446,7 +446,7 @@ int HttpFile::send (HttpThreadContext* td, const char 
*filenamePath,
      * file to the socket.
      */
     if (!useChunks && chain.isEmpty () && !td->appendOutputs
-        && !(td->http->getProtocolOptions () & PROTOCOL_USES_SSL))
+        && !(td->http->getProtocolOptions () & Protocol::SSL))
       {
         u_long nbw = 0;
         int ret = file->fastCopyToSocket (td->connection->socket, firstByte,
diff --git a/myserver/src/protocol/control/control_protocol.cpp 
b/myserver/src/protocol/control/control_protocol.cpp
index 4e61967..aea6af7 100644
--- a/myserver/src/protocol/control/control_protocol.cpp
+++ b/myserver/src/protocol/control/control_protocol.cpp
@@ -75,7 +75,7 @@ const char* ControlProtocol::getName ()
  */
 ControlProtocol::ControlProtocol ()
 {
-  protocolOptions = PROTOCOL_USES_SSL;
+  protocolOptions = Protocol::SSL;
   protocolPrefix.assign ("control://");
 }
 
diff --git a/myserver/src/protocol/ftp/ftp.cpp 
b/myserver/src/protocol/ftp/ftp.cpp
index 96b8ee9..99ac809 100644
--- a/myserver/src/protocol/ftp/ftp.cpp
+++ b/myserver/src/protocol/ftp/ftp.cpp
@@ -295,7 +295,7 @@ int Ftp::LAST_PASV_PORT = 65000;
 Ftp::Ftp ()
 {
   m_nPassiveport = Ftp::FIRST_PASV_PORT;
-  protocolOptions = PROTOCOL_FAST_CHECK | PROTOCOL_DENY_DELETE;
+  protocolOptions = Protocol::FAST_CHECK | Protocol::DENY_DELETE;
   protocolPrefix.assign ("ftp://";);
 }
 
diff --git a/myserver/src/protocol/http/env/env.cpp 
b/myserver/src/protocol/http/env/env.cpp
index 469925c..dc15dc1 100644
--- a/myserver/src/protocol/http/env/env.cpp
+++ b/myserver/src/protocol/http/env/env.cpp
@@ -146,7 +146,7 @@ void Env::buildEnvironmentString (HttpThreadContext* td, 
char *cgiEnv,
   memCgi << end_str << "REMOTE_USER=";
   memCgi << td->connection->getLogin ();
 
-  if (td->http->getProtocolOptions () & PROTOCOL_USES_SSL)
+  if (td->http->getProtocolOptions () & Protocol::SSL)
     memCgi << end_str << "SSL=ON";
   else
     memCgi << end_str << "SSL=OFF";
diff --git a/myserver/src/protocol/http/http.cpp 
b/myserver/src/protocol/http/http.cpp
index 161cce0..c4ac163 100644
--- a/myserver/src/protocol/http/http.cpp
+++ b/myserver/src/protocol/http/http.cpp
@@ -1117,7 +1117,6 @@ int Http::controlConnection (ConnectionPtr a, char*, 
char*, u_long, u_long,
                         ret = 1;
                         retvalue = ClientsThread::KEEP_CONNECTION;
                         break;
-
                       }
 
                   }
diff --git a/myserver/src/protocol/https/https.cpp 
b/myserver/src/protocol/https/https.cpp
index ddf0bb2..fe97141 100644
--- a/myserver/src/protocol/https/https.cpp
+++ b/myserver/src/protocol/https/https.cpp
@@ -51,7 +51,7 @@ const char* Https::getName ()
 Https::Https ()
 {
   protocolPrefix.assign ("https://";);
-  protocolOptions = PROTOCOL_USES_SSL;
+  protocolOptions = Protocol::SSL;
 }
 
 /*!
diff --git a/myserver/src/server/server.cpp b/myserver/src/server/server.cpp
index 577b296..d7edcb7 100644
--- a/myserver/src/server/server.cpp
+++ b/myserver/src/server/server.cpp
@@ -1155,14 +1155,13 @@ ConnectionPtr Server::addConnectionToList (Socket* s,
   if (protocol)
     opts = protocol->getProtocolOptions ();
 
-  if (opts & PROTOCOL_USES_SSL)
+  if (opts & Protocol::SSL)
     doSSLhandshake = 1;
 
-  if (opts & PROTOCOL_FAST_CHECK)
+  if (opts & Protocol::FAST_CHECK)
     doFastCheck = 1;
 
   string msg ("new-connection");
-
   handlers = getHandlers (msg);
   if (handlers)
     {



commit 5ab8a057a885421230d65f9d4159233a6e8b0468
Author: Giuseppe Scrivano <address@hidden>
Date:   Fri Nov 6 10:16:39 2009 +0100

    Code refactoring: rename a function and remove some unused macro's.

diff --git a/myserver/include/server/server.h b/myserver/include/server/server.h
index 60fd436..9a9b3e4 100644
--- a/myserver/include/server/server.h
+++ b/myserver/include/server/server.h
@@ -108,7 +108,7 @@ public:
   void enableAutoReboot ();
   bool isAutorebootEnabled ();
   bool isRebooting (){return rebooting;}
-  void rebootOnNextLoop ();
+  void delayedReboot ();
   ~Server ();
   Protocol* getProtocol (const char *protocolName);
   int addConnection (Socket*, MYSERVER_SOCKADDRIN*);
diff --git a/myserver/src/myserver.cpp b/myserver/src/myserver.cpp
index df82918..d044359 100644
--- a/myserver/src/myserver.cpp
+++ b/myserver/src/myserver.cpp
@@ -80,7 +80,7 @@ void Sig_Hup (int signal)
   /*
    *On the SIGHUP signal reboot the server.
    */
-  Server::getInstance ()->rebootOnNextLoop ();
+  Server::getInstance ()->delayedReboot ();
   registerSignals ();
 }
 #else
diff --git a/myserver/src/protocol/control/control_protocol.cpp 
b/myserver/src/protocol/control/control_protocol.cpp
index 0ff8f60..4e61967 100644
--- a/myserver/src/protocol/control/control_protocol.cpp
+++ b/myserver/src/protocol/control/control_protocol.cpp
@@ -53,19 +53,17 @@ struct ControlProtocolVisitorArg
   static const int SHOW_CONNECTIONS = 1;
   static const int KILL_CONNECTION = 2;
   int command;
-
   ConnectionPtr connection;
-  File* out;
+  File *out;
   char *buffer;
   int bufferSize;
-  ControlHeader* header;
-
+  ControlHeader *header;
   u_long id;
 };
 
 /*!
- *Returns the name of the protocol. If an out buffer is defined
- *fullfill it with the name too.
+ * Returns the name of the protocol. If an out buffer is defined
+ * fullfill it with the name too.
  */
 const char* ControlProtocol::getName ()
 {
@@ -367,7 +365,7 @@ int ControlProtocol::controlConnection (ConnectionPtr a, 
char *request,
   authorized = checkAuth (header);
 
   /*
-   *If the client is not authorized remove the connection.
+   * If the client is not authorized remove the connection.
    */
   if (authorized == 0)
     {
@@ -382,8 +380,8 @@ int ControlProtocol::controlConnection (ConnectionPtr a, 
char *request,
       return 0;
     }
   /*
-   *If the specified length is different from the length that the
-   *server can read, remove the connection.
+   * If the specified length is different from the length that the
+   * server can read, remove the connection.
    */
   if (dataWritten != specifiedLength)
     {
@@ -403,11 +401,8 @@ int ControlProtocol::controlConnection (ConnectionPtr a, 
char *request,
 
   knownCommand = 0;
 
-  /*
-   *Create an out file. This can be used by commands that
-   *needs it.
-   */
-  outFile = new File ();
+  /* Create an out file. This can be used by commands needing it. */
+    outFile = new File ();
   outFilePath << getdefaultwd (0, 0) << "/ControlOutput_" << (u_int) id;
 
   ret = outFile->createTemporaryFile (outFilePath.str ().c_str ());
@@ -444,7 +439,7 @@ int ControlProtocol::controlConnection (ConnectionPtr a, 
char *request,
   else if (!strcmp (command, "REBOOT"))
     {
       knownCommand = 1;
-      Server::getInstance ()->rebootOnNextLoop ();
+      Server::getInstance ()->delayedReboot ();
       ret = 0;
     }
   else if (!strcmp (command, "GETFILE"))
@@ -482,34 +477,36 @@ int ControlProtocol::controlConnection (ConnectionPtr a, 
char *request,
       char *connection;
       outFile->seek (0);
       if (ret)
-        {
-          sendResponse (auxBuffer, bufferSize, a, CONTROL_INTERNAL, header, 0);
-        }
+        sendResponse (auxBuffer, bufferSize, a, CONTROL_INTERNAL, header, 0);
       else
         sendResponse (auxBuffer, bufferSize, a, CONTROL_OK, header, outFile);
+
       if (inFile)
         {
           inFile->close ();
           delete inFile;
-          inFile=0;
+          inFile = NULL;
         }
+
       if (outFile)
         {
           outFile->close ();
           delete outFile;
-          outFile=0;
+          outFile = NULL;
         }
+
       FilesUtility::deleteFile (inFilePath.str ().c_str ());
       FilesUtility::deleteFile (outFilePath.str ().c_str ());
       connection = header.getConnection ();
+
       /*
-       *If the Keep-Alive was specified keep the connection in the
-       *active connections list.
+       * If the Keep-Alive was specified keep the connection in the
+       * active connections list.
        */
-      if (!strcmpi (connection,"keep-alive"))
-        return 1;
+      if (!strcmpi (connection, "keep-alive"))
+        return ClientsThread::KEEP_CONNECTION;
       else
-        return 0;
+        return ClientsThread::DELETE_CONNECTION;
     }
   else
     {
@@ -521,6 +518,7 @@ int ControlProtocol::controlConnection (ConnectionPtr a, 
char *request,
           delete inFile;
           inFile = NULL;
         }
+
       if (outFile)
         {
           outFile->close ();
@@ -529,15 +527,16 @@ int ControlProtocol::controlConnection (ConnectionPtr a, 
char *request,
         }
       FilesUtility::deleteFile (inFilePath.str ().c_str ());
       FilesUtility::deleteFile (outFilePath.str ().c_str ());
-      return 0;
+
+      return ClientsThread::DELETE_CONNECTION;
     }
 }
 
 /*!
- *Add the entry to the log file.
+ * Add the entry to the log file.
  */
 int ControlProtocol::addToLog (int retCode, ConnectionPtr con, char *buffer,
-                               int bufferSize, ControlHeader& header)
+                               int bufferSize, ControlHeader &header)
 {
   string time;
   getRFC822GMTTime (time, 32);
@@ -549,92 +548,79 @@ int ControlProtocol::addToLog (int retCode, ConnectionPtr 
con, char *buffer,
 }
 
 /*!
- *Send the response with status=errID and the data contained in the outFile.
- *Return nonzero on errors.
+ * Send the response with status=errID and the data contained in the outFile.
+ * Return nonzero on errors.
  */
 int ControlProtocol::sendResponse (char *buffer, int buffersize,
                                    ConnectionPtr a, int errID,
-                                   ControlHeader& header, File* outFile)
+                                   ControlHeader &header, File *outFile)
 {
   u_long dataLength = 0;
-  int err;
-  err = addToLog (errID, a, buffer, buffersize, header);
-  if (err)
-    return err;
+
+  if (addToLog (errID, a, buffer, buffersize, header))
+    return -1;
 
   if (outFile)
     dataLength = outFile->getFileSize ();
-  /* Build and send the first line.  */
-#ifdef HAVE_SNPRINTF
-  snprintf (buffer, buffersize,
-#else
-  sprintf (buffer,
-#endif
-          "/%i\r\n", errID);
 
-  err = a->socket->send (buffer, strlen (buffer), 0);
-  if (err == -1)
-  {
-    a->host->warningsLogWrite (_("Control: socket error"));
-    return -1;
-  }
-
-  /* Build and send the Length line.  */
-#ifdef HAVE_SNPRINTF
-  snprintf (buffer, buffersize,
-#else
-  sprintf (buffer,
-#endif
-          "/LEN %u\r\n", (u_int)dataLength);
+  /* Build and send the first line.  */
+  snprintf (buffer, buffersize, "/%i\r\n", errID);
+  if (a->socket->send (buffer, strlen (buffer), 0) < 0)
+    {
+      a->host->warningsLogWrite (_("Control: socket error"));
+      return -1;
+    }
 
-  err = a->socket->send (buffer, strlen (buffer), 0);
-           if (err == -1)
-  {
-    a->host->warningsLogWrite (_("Control: socket error"));
-    return -1;
-  }
+  snprintf (buffer, buffersize, "/LEN %u\r\n", (u_int)dataLength);
+  if (a->socket->send (buffer, strlen (buffer), 0) < 0)
+    {
+      a->host->warningsLogWrite (_("Control: socket error"));
+      return -1;
+    }
 
   /* Send the end of the header.  */
-  err = a->socket->send ("\r\n", 2, 0);
-  if (err == -1)
-  {
-    a->host->warningsLogWrite (_("Control: socket error"));
-    return -1;
-  }
+  if (a->socket->send ("\r\n", 2, 0) < 0)
+    {
+      a->host->warningsLogWrite (_("Control: socket error"));
+      return -1;
+    }
 
   /* Flush the content of the file if any.  */
   if (dataLength)
-  {
-    int dataToSend = dataLength;
-    u_long nbr;
-    for ( ; ; )
     {
-      err = outFile->read (buffer, min (dataToSend, buffersize), &nbr);
-      if (err)
-      {
-        a->host->warningsLogWrite (_("Control: internal error"));
-        return -1;
-      }
-      dataToSend -= nbr;
-      err = a->socket->send (buffer, nbr, 0);
-      if (dataToSend == 0)
-        break;
-      if (err == -1)
-      {
-        a->host->warningsLogWrite (_("Control: socket error"));
-        return -1;
-      }
+      int dataToSend = dataLength;
+      u_long nbr;
+      for ( ; ; )
+        {
+          int err;
+          if (outFile->read (buffer, min (dataToSend, buffersize), &nbr))
+            {
+              a->host->warningsLogWrite (_("Control: internal error"));
+              return -1;
+            }
+
+          dataToSend -= nbr;
+          err = a->socket->send (buffer, nbr, 0);
+
+          if (dataToSend == 0)
+            break;
+
+          if (err == -1)
+            {
+              a->host->warningsLogWrite (_("Control: socket error"));
+              return -1;
+            }
+        }
     }
-  }
 
   return 0;
 }
 
 /*!
- *Show the currect active connections.
+ * Show the currect active connections.
  */
-int  ControlProtocol::showConnections (ConnectionPtr a,File* out, char *buffer,
-                                      int bufferSize, ControlHeader& header)
+int  ControlProtocol::showConnections (ConnectionPtr a,File *out, char *buffer,
+                                      int bufferSize, ControlHeader &header)
 {
   ControlProtocolVisitorArg args;
   args.command = ControlProtocolVisitorArg::SHOW_CONNECTIONS;
@@ -648,7 +634,7 @@ int  ControlProtocol::showConnections (ConnectionPtr 
a,File* out, char *buffer,
 }
 
 /*!
- *Kill a connection by its ID.
+ * Kill a connection by its ID.
  */
 int ControlProtocol::killConnection (ConnectionPtr a, u_long id, File *out,
                                     char *buffer, int bufferSize,
@@ -672,9 +658,9 @@ int ControlProtocol::killConnection (ConnectionPtr a, 
u_long id, File *out,
 }
 
 /*!
- *Visitor.
+ * Visitor.
  */
-int ControlProtocol::visitConnection (ConnectionPtr con, void* argP)
+int ControlProtocol::visitConnection (ConnectionPtr con, void *argP)
 {
   int ret = 0;
   u_long nbw;
@@ -682,19 +668,11 @@ int ControlProtocol::visitConnection (ConnectionPtr con, 
void* argP)
 
   if (arg->command == ControlProtocolVisitorArg::SHOW_CONNECTIONS)
   {
-#ifdef HAVE_SNPRINTF
     snprintf (arg->buffer, arg->bufferSize, "%i - %s - %i - %s - %i - %s - 
%s\r\n",
              static_cast<int>(con->getID ()),  con->getIpAddr (),
              static_cast<int>(con->getPort ()),
              con->getLocalIpAddr (),  static_cast<int>(con->getLocalPort ()),
              con->getLogin (), con->getPassword ());
-#else
-    sprintf (arg->buffer, "%i - %s - %i - %s - %i - %s - %s\r\n",
-            static_cast<int>(con->getID ()),  con->getIpAddr (),
-            static_cast<int>(con->getPort ()),
-            con->getLocalIpAddr (),  static_cast<int>(con->getLocalPort ()),
-            con->getLogin (), con->getPassword ());
-#endif
 
     ret = arg->out->writeToFile (arg->buffer, strlen (arg->buffer), &nbw);
 
@@ -776,9 +754,9 @@ int ControlProtocol::getFile (ConnectionPtr a, char *fn, 
File *in, File *out,
 /*!
  * Save the file on the local FS.
  */
-int ControlProtocol::putFile (ConnectionPtr a, char* fn, File* in,
-                              File* out, char *buffer,int bufferSize,
-                              ControlHeader& header)
+int ControlProtocol::putFile (ConnectionPtr a, char *fn, File *in,
+                              File *out, char *buffer, int bufferSize,
+                              ControlHeader &header)
 {
   const char *filename = 0;
   File localfile;
@@ -847,8 +825,8 @@ int ControlProtocol::putFile (ConnectionPtr a, char* fn, 
File* in,
 /*!
  *Return the current MyServer version.
  */
-int ControlProtocol::getVersion (ConnectionPtr a, File* out, char *buffer,
-                                 int bufferSize, ControlHeader& header)
+int ControlProtocol::getVersion (ConnectionPtr a, File *out, char *buffer,
+                                 int bufferSize, ControlHeader &header)
 {
   u_long nbw;
   myserver_strlcpy (buffer, MYSERVER_VERSION, bufferSize);
diff --git a/myserver/src/server/server.cpp b/myserver/src/server/server.cpp
index 7615166..577b296 100644
--- a/myserver/src/server/server.cpp
+++ b/myserver/src/server/server.cpp
@@ -1507,7 +1507,7 @@ bool Server::isServerReady ()
 /*!
  * Reboot the server on the next loop.
  */
-void Server::rebootOnNextLoop ()
+void Server::delayedReboot ()
 {
   serverReady = false;
   toReboot = true;



commit d7b86d91d7d7198a55def013b010b12a989442ab
Author: Giuseppe Scrivano <address@hidden>
Date:   Fri Nov 6 09:55:25 2009 +0100

    Remove the globals `argc' and `argv'.  use an enum instead of #define's for 
run modes.

diff --git a/myserver/src/myserver.cpp b/myserver/src/myserver.cpp
index 25a2e73..df82918 100644
--- a/myserver/src/myserver.cpp
+++ b/myserver/src/myserver.cpp
@@ -44,8 +44,11 @@ extern "C"
 #endif
 
 
-#define MYSERVER_RUNAS_CONSOLE 1
-#define MYSERVER_RUNAS_SERVICE 2
+enum
+{
+  MYSERVER_RUNAS_CONSOLE = 1,
+  MYSERVER_RUNAS_SERVICE
+};
 
 void consoleService (string &, string &, string &, string &,
            MainConfiguration* (*genMainConf) (Server *server, const char 
*arg));
@@ -61,9 +64,6 @@ void runService ();
 void registerService ();
 void removeService ();
 void runAsService ();
-
-int argn;
-char **argv;
 void registerSignals ();
 
 #ifndef WIN32
@@ -108,10 +108,10 @@ void registerSignals ()
   sig1.sa_handler = SIG_IGN;
   sig2.sa_handler = Sig_Quit;
   sig3.sa_handler = Sig_Hup;
-  sigaction (SIGPIPE,&sig1,NULL); // catch broken pipes
-  sigaction (SIGINT, &sig2,NULL); // catch ctrl-c
-  sigaction (SIGTERM,&sig2,NULL); // catch the kill signal
-  sigaction (SIGHUP,&sig3,NULL); // catch the HUP signal
+  sigaction (SIGPIPE, &sig1, NULL);
+  sigaction (SIGINT, &sig2, NULL);
+  sigaction (SIGTERM, &sig2, NULL);
+  sigaction (SIGHUP, &sig3, NULL);
 
   /* Avoid zombie processes.  */
   sigaction (SIGCHLD, &sa, (struct sigaction *)NULL);
@@ -348,15 +348,13 @@ int main  (int argn, char **argv)
 #ifdef ARGP
   struct argp_input input;
 #endif
+
 #ifndef WIN32
   pid_t pid;
   pid_t sid;
 #endif
   string mainConf, mimeConf, vhostConf, externPath;
 
-  ::argn = argn;
-  ::argv = argv;
-
   registerSignals ();
 
 #if HAVE_GETTEXT

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

Summary of changes:
 myserver/include/protocol/ftp/ftp.h                |   32 ++--
 myserver/include/protocol/http/dyn_http_command.h  |   28 ++--
 .../protocol/http/dyn_http_command_manager.h       |   30 ++--
 myserver/include/protocol/http/dyn_http_manager.h  |   36 ++--
 .../include/protocol/http/dyn_http_manager_list.h  |   34 ++--
 myserver/include/protocol/http/http_data_handler.h |   46 +++---
 myserver/include/protocol/https/https.h            |    2 +-
 myserver/include/protocol/protocol.h               |   12 +-
 myserver/include/protocol/protocol_buffer.h        |   30 ++--
 myserver/include/protocol/protocols_manager.h      |    2 -
 myserver/include/protocol/url.h                    |   24 ++--
 myserver/include/server/server.h                   |    2 +-
 myserver/src/conf/vhost/vhost.cpp                  |    2 +-
 myserver/src/http_handler/http_file/http_file.cpp  |    2 +-
 myserver/src/myserver.cpp                          |   24 +--
 myserver/src/protocol/control/control_protocol.cpp |  194 +++++++++-----------
 myserver/src/protocol/ftp/ftp.cpp                  |    2 +-
 myserver/src/protocol/http/env/env.cpp             |    2 +-
 myserver/src/protocol/http/http.cpp                |    1 -
 myserver/src/protocol/https/https.cpp              |    2 +-
 myserver/src/server/server.cpp                     |    7 +-
 21 files changed, 245 insertions(+), 269 deletions(-)


hooks/post-receive
-- 
GNU MyServer




reply via email to

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