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. eb03e44b3f


From: Giuseppe Scrivano
Subject: [myserver-commit] [SCM] GNU MyServer branch, master, updated. eb03e44b3f6b73bca1aa91e713a5112a907c8fe0
Date: Sun, 04 Oct 2009 17:02:30 +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  eb03e44b3f6b73bca1aa91e713a5112a907c8fe0 (commit)
       via  c9871081b72b5ec924640b22b7b9b8bf9761bbc7 (commit)
      from  53d2b4a6b2d676565f5a9d1ebcade5cc0bb2fedf (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 eb03e44b3f6b73bca1aa91e713a5112a907c8fe0
Author: Giuseppe Scrivano <address@hidden>
Date:   Sun Oct 4 19:00:35 2009 +0200

    Configuration files location is not exposed by the Server.

diff --git a/myserver/include/conf/mime/mime_manager.h 
b/myserver/include/conf/mime/mime_manager.h
index d7fef85..8881ab6 100644
--- a/myserver/include/conf/mime/mime_manager.h
+++ b/myserver/include/conf/mime/mime_manager.h
@@ -92,6 +92,7 @@ public:
   ~MimeManager ();
   u_long getNumMIMELoaded ();
 
+  u_long reload ();
   u_long loadXML (XmlParser* parser);
   u_long loadXML (const char *filename);
   u_long loadXML (string &filename) {return loadXML (filename.c_str ());}
diff --git a/myserver/include/server/server.h b/myserver/include/server/server.h
index 18ce38d..90cb792 100644
--- a/myserver/include/server/server.h
+++ b/myserver/include/server/server.h
@@ -105,10 +105,6 @@ public:
   bool isAutorebootEnabled ();
   bool isRebooting (){return rebooting;}
   void rebootOnNextLoop ();
-  const char* getMainConfFile ();
-  const char* getVhostConfFile ();
-  const char* getMIMEConfFile ();
-  const char* getExternalPath ();
   ~Server ();
   Protocol* getProtocol (const char *protocolName);
   int addConnection (Socket,MYSERVER_SOCKADDRIN*);
@@ -241,7 +237,6 @@ private:
   int freeHashedData ();
   u_long connectionTimeout;
   u_long maxLogFileSize;
-  void logWriteNTimes (string, unsigned);
   bool resetConfigurationPaths (string &, string &, string &, string &);
   Mutex* connectionsMutex;
   u_long nStaticThreads;
diff --git a/myserver/src/conf/mime/mime_manager.cpp 
b/myserver/src/conf/mime/mime_manager.cpp
index 365844f..e81b244 100644
--- a/myserver/src/conf/mime/mime_manager.cpp
+++ b/myserver/src/conf/mime/mime_manager.cpp
@@ -254,6 +254,17 @@ MimeRecord *MimeManager::readRecord (xmlNodePtr node)
 }
 
 /*!
+ * Reload using the same configuration file.
+ */
+u_long MimeManager::reload ()
+{
+  if (!filename.length ())
+    return -1;
+
+  return loadXML (getFilename ());
+}
+
+/*!
  * Load the MIME types from a XML file. Returns the number of
  * MIME types loaded successfully.
  */
@@ -263,9 +274,7 @@ u_long MimeManager::loadXML (const char *fn)
   u_long ret = 0;
 
   if (parser.open (fn))
-  {
     return -1;
-  }
 
   filename.assign (fn);
 
diff --git a/myserver/src/protocol/control/control_protocol.cpp 
b/myserver/src/protocol/control/control_protocol.cpp
index b4e2e2a..2b35e8d 100644
--- a/myserver/src/protocol/control/control_protocol.cpp
+++ b/myserver/src/protocol/control/control_protocol.cpp
@@ -731,16 +731,7 @@ int ControlProtocol::getFile (ConnectionPtr a, char* fn, 
File* in, File* out,
   /* # of bytes written.  */
   u_long nbw = 0;
 
-  if (!strcmpi (fn, "myserver.xml"))
-    filename = Server::getInstance ()->getMainConfFile ();
-  else if (!strcmpi (fn, "MIMEtypes.xml"))
-    filename = Server::getInstance ()->getMIMEConfFile ();
-  else if (!strcmpi (fn, "virtualhosts.xml"))
-    filename = Server::getInstance ()->getVhostConfFile ();
-  else if (!FilesUtility::fileExists (fn))
-    return CONTROL_FILE_NOT_FOUND;
-  else
-    filename = fn;
+  filename = fn;
 
   ret = localfile.openFile (filename, File::READ | File::OPEN_IF_EXISTS);
 
@@ -793,14 +784,7 @@ int ControlProtocol::putFile (ConnectionPtr a, char* fn, 
File* in,
   u_long nbw = 0;
   Server::getInstance ()->disableAutoReboot ();
 
-  if (!strcmpi (fn, "myserver.xml"))
-    filename = Server::getInstance ()->getMainConfFile ();
-  else if (!strcmpi (fn, "MIMEtypes.xml"))
-    filename = Server::getInstance ()->getMIMEConfFile ();
-  else if (!strcmpi (fn, "virtualhosts.xml"))
-    filename = Server::getInstance ()->getVhostConfFile ();
-  else
-    filename = fn;
+  filename = fn;
 
   /* Remove the file before create it.  */
   ret = FilesUtility::deleteFile (filename);
diff --git a/myserver/src/protocol/http/http.cpp 
b/myserver/src/protocol/http/http.cpp
index 91c9ede..019cb6b 100644
--- a/myserver/src/protocol/http/http.cpp
+++ b/myserver/src/protocol/http/http.cpp
@@ -1781,12 +1781,7 @@ int Http::sendAuth ()
 int Http::loadProtocolStatic ()
 {
   const char *data = NULL;
-  string pluginsResource (Server::getInstance ()->getExternalPath ());
 
-  /*
-   * Store defaults value.
-   * By default use GZIP with files bigger than a MB.
-   */
   staticHttp.timeout = MYSERVER_SEC (15);
 
   Server::getInstance ()->setGlobalData ("http-static", getStaticData ());
@@ -1810,11 +1805,10 @@ int Http::loadProtocolStatic ()
       else
         staticHttp.allowVhostMime = 0;
     }
+
   data = Server::getInstance ()->getData ("cgi.timeout");
   if (data)
-    {
-      staticHttp.timeout = MYSERVER_SEC (atoi (data));
-    }
+    staticHttp.timeout = MYSERVER_SEC (atoi (data));
 
   return 1;
 }
diff --git a/myserver/src/server/server.cpp b/myserver/src/server/server.cpp
index b619a6c..6cd4b83 100644
--- a/myserver/src/server/server.cpp
+++ b/myserver/src/server/server.cpp
@@ -422,7 +422,7 @@ void Server::mainLoop ()
                     }
                   log (MYSERVER_LOG_MSG_INFO, _("Reloading MIME types"));
 
-                  getMimeManager ()->loadXML (getMIMEConfFile ());
+                  getMimeManager ()->reload ();
 
                   log (MYSERVER_LOG_MSG_INFO, _("Reloaded"));
 
@@ -481,15 +481,6 @@ void Server::mainLoop ()
     }
 }
 
-void Server::logWriteNTimes (string str, unsigned n)
-{
-  while (n--)
-    logManager->log (this, "MAINLOG", logLocation, str);
-
-  string msg ("");
-  logManager->log (this, "MAINLOG", logLocation, msg, true);
-}
-
 /*!
  * Display the MyServer boot.
  */
@@ -519,15 +510,14 @@ void Server::displayBoot ()
       try
         {
           size_t length;
-          string softwareSignature;
-          softwareSignature.assign ("************ GNU MyServer ");
-          softwareSignature.append (MYSERVER_VERSION);
-          softwareSignature.append (" ************");
-          length = softwareSignature.length ();
+          string softwareSignature = "************ GNU MyServer "
+            MYSERVER_VERSION " ************";
 
-          logWriteNTimes ("*", length);
+          string tmp (softwareSignature.length (), '*');
+
+          logManager->log (this, "MAINLOG", logLocation, tmp, true);
           logManager->log (this, "MAINLOG", logLocation, softwareSignature, 
true);
-          logWriteNTimes ("*", length);
+          logManager->log (this, "MAINLOG", logLocation, tmp, true);
         }
       catch (exception& e)
         {
@@ -1371,15 +1361,6 @@ Protocol* Server::getProtocol (const char *protocolName)
 }
 
 /*!
- * Get where external protocols are.
- */
-const char* Server::getExternalPath ()
-{
-  return externalPath.c_str ();
-}
-
-
-/*!
  * If specified set the uid/gid for the process.
  */
 void Server::setProcessPermissions ()
@@ -1497,7 +1478,6 @@ void Server::rebootOnNextLoop ()
   toReboot = true;
 }
 
-
 /*!
  * Return the factory object to create cached files.
  */
@@ -1507,30 +1487,6 @@ CachedFileFactory* Server::getCachedFiles ()
 }
 
 /*!
- * Return the path to the mail configuration file.
- */
-const char *Server::getMainConfFile ()
-{
-  return mainConfigurationFile.c_str ();
-}
-
-/*!
- * Return the path to the mail configuration file.
- */
-const char *Server::getVhostConfFile ()
-{
-  return vhostConfigurationFile.c_str ();
-}
-
-/*!
- * Return the path to the mail configuration file.
- */
-const char *Server::getMIMEConfFile ()
-{
-  return mimeConfigurationFile.c_str ();
-}
-
-/*!
  * Get a list with all the alive connections.
  */
 void Server::getConnections (list<ConnectionPtr>& out)
@@ -1607,9 +1563,6 @@ int Server::addThread (bool staticThread)
 
   newThread = new ClientsThread (this);
 
-  if (newThread == 0)
-    return -1;
-
   handlers = getHandlers (msg);
 
   if (handlers)



commit c9871081b72b5ec924640b22b7b9b8bf9761bbc7
Author: Giuseppe Scrivano <address@hidden>
Date:   Sun Oct 4 18:31:05 2009 +0200

    Simplify the configure.ac script.

diff --git a/myserver/configure.ac b/myserver/configure.ac
index a3c7f6b..cb58eb1 100644
--- a/myserver/configure.ac
+++ b/myserver/configure.ac
@@ -71,39 +71,14 @@ AC_ARG_ENABLE([tests], [--disable-tests Disable the tests 
suite],
 
 AC_ARG_ENABLE([gui], [--enable-gui Build and install GUI application], 
enable_gui="yes", enable_gui="")
 
-dnl Looking for argp.h
-AC_CHECK_HEADER([argp.h], AC_DEFINE(ARGP, 1, [Define if GNU argp tools are 
available]))
 
-dnl Looking for error.h
+AC_CHECK_HEADER([argp.h], AC_DEFINE(ARGP, 1, [Define if GNU argp tools are 
available]))
 AC_CHECK_HEADER([error.h], AC_DEFINE(ERRORH, 1, [Define if the error.h file is 
present]))
-
 AC_CHECK_HEADER([grp.h], AC_DEFINE(GRP, 1, [Define if grp.h is available]))
-
 AC_CHECK_HEADER([tre/regex.h], AC_DEFINE(TRE, 1, [Define if the tre library is 
present]))
-
 AC_CHECK_HEADER([sys/sendfile.h], AC_DEFINE(SENDFILE, 1, [Define if the 
sendfile syscall is present]))
 
-AC_CHECK_FUNCS(regcomp, AC_DEFINE(REGEX, 1, [Define if the regex library is 
present]) )
-
-AC_CHECK_FUNCS(gettimeofday, AC_DEFINE(GETTIMEOFDAY, 1, [Define if the 
gettimeofday function is present]) )
-
-AC_CHECK_FUNCS(setgroups, AC_DEFINE(SETGROUPS, 1, [Define if the setgroups 
function is present]) )
-
-AC_CHECK_FUNCS(localtime_r, AC_DEFINE(LOCALTIME_R, 1, [Define if the 
localtime_r function is present]) )
-
-AC_CHECK_FUNCS(pipe, AC_DEFINE(PIPE, 1, [Define if the pipe function is 
present]) )
-
-AC_CHECK_FUNCS(posix_fallocate, AC_DEFINE(POSIX_FALLOCATE, 1, [Define if the 
posix_fallocate function is present]) )
-
-AC_CHECK_FUNCS(snprintf, AC_DEFINE(SNPRINTF, 1, [Define if the snprintf 
function is present]) )
-
-AC_CHECK_FUNCS(openat, AC_DEFINE(OPENAT, 1, [Define if the openat function is 
present]) )
-
-AC_CHECK_FUNCS(fstatat, AC_DEFINE(FSTATAT, 1, [Define if the fstatat function 
is present]) )
-
-AC_CHECK_FUNCS(getpwnam, AC_DEFINE(GETPWNAM, 1, [Define if the getpwnam 
function is present]) )
-
-AC_CHECK_FUNCS(ffsl, AC_DEFINE(FFSL, 1, [Define if the ffsl function is 
present]) )
+AC_CHECK_FUNCS(regcomp gettimeofday setgroups localtime_r pipe posix_fallocate 
snprintf openat fstatat getpwnam ffsl)
 
 AC_CHECK_LIB(gcrypt, gcry_control, AC_DEFINE(GCRY_CONTROL, 1, [Define if the 
gcry_control function is present]))
 
@@ -299,8 +274,6 @@ else
     AC_DEFINE(HAVE_IPV6, 0, [Disable IPv6 support])
 fi
 
-
-
 if test x$enable_tests == xyes; then
   dnl Looking for cppunit
   AM_PATH_CPPUNIT(1.12.0, have_cppunit=yes)
diff --git a/myserver/include/base/regex/myserver_regex.h 
b/myserver/include/base/regex/myserver_regex.h
index 035c6a4..0d1d599 100644
--- a/myserver/include/base/regex/myserver_regex.h
+++ b/myserver/include/base/regex/myserver_regex.h
@@ -28,7 +28,7 @@ extern "C"
 
 # ifdef TRE
 #  include <tre/regex.h>
-# elif REGEX
+# elif HAVE_REGCOMP
 #  include <regex.h>
 # else
   typedef void* regmatch_t;
diff --git a/myserver/src/base/regex/myserver_regex.cpp 
b/myserver/src/base/regex/myserver_regex.cpp
index c7a45d1..c4f9797 100644
--- a/myserver/src/base/regex/myserver_regex.cpp
+++ b/myserver/src/base/regex/myserver_regex.cpp
@@ -17,7 +17,7 @@ along with this program.  If not, see 
<http://www.gnu.org/licenses/>.
 
 #include <include/base/regex/myserver_regex.h>
 
-#ifdef REGEX
+#ifdef HAVE_REGCOMP
 # define REGLIB 1
 #elif TRE
 # define REGLIB 1

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

Summary of changes:
 myserver/configure.ac                              |   31 +---------
 myserver/include/base/regex/myserver_regex.h       |    2 +-
 myserver/include/conf/mime/mime_manager.h          |    1 +
 myserver/include/server/server.h                   |    5 --
 myserver/src/base/regex/myserver_regex.cpp         |    2 +-
 myserver/src/conf/mime/mime_manager.cpp            |   13 ++++-
 myserver/src/protocol/control/control_protocol.cpp |   20 +------
 myserver/src/protocol/http/http.cpp                |   10 +---
 myserver/src/server/server.cpp                     |   61 ++-----------------
 9 files changed, 27 insertions(+), 118 deletions(-)


hooks/post-receive
-- 
GNU MyServer




reply via email to

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