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-360-g1


From: Giuseppe Scrivano
Subject: [myserver-commit] [SCM] GNU MyServer branch, master, updated. 0_9-360-g16ded71
Date: Thu, 05 Nov 2009 21:28:43 +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  16ded713f3e44e1677dd2d7b7d0da234fa9f70d9 (commit)
       via  890d5ec417290ec31483bfb0a9c35faf124713ff (commit)
       via  89eef0881e9f93e534594f2b23d85a9ccc447c8a (commit)
      from  8803a55881b0fecc63e40662a9e2771f1bfe20b0 (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 16ded713f3e44e1677dd2d7b7d0da234fa9f70d9
Author: Giuseppe Scrivano <address@hidden>
Date:   Thu Nov 5 22:08:51 2009 +0100

    Rename "server.{mime,vhost}_manager" to "server.{mime,vhost}_handler".
    
    Server::getData () accepts an additional `defValue' param.  If the
    desired variable is not found then return `defValue'.  By default its
    value is NULL.

diff --git a/myserver/documentation/basic_configuration.texi 
b/myserver/documentation/basic_configuration.texi
index 1ce43a0..8f0b235 100644
--- a/myserver/documentation/basic_configuration.texi
+++ b/myserver/documentation/basic_configuration.texi
@@ -32,7 +32,7 @@ are looked exclusively in this directory.
 @subsection Alternative handlers
 Plugins are allowed to install new handlers to read the configuration
 from other sources.  It is done changing the value of the variables
address@hidden and @code{server.server.mime_manager},
address@hidden and @code{server.server.mime_handler},
 respectively to use a different handler for the virtual hosts and for
 the MIME types.  If no value is specified then the value @value{xml}
 is used.
diff --git a/myserver/include/server/server.h b/myserver/include/server/server.h
index 91af0f3..60fd436 100644
--- a/myserver/include/server/server.h
+++ b/myserver/include/server/server.h
@@ -90,7 +90,7 @@ public:
   int loadLibraries ();
 
   CachedFileFactory* getCachedFiles ();
-  const char* getData (const char* name);
+  const char* getData (const char *name, const char *defValue = NULL);
 
   void setGlobalData (const char* name, void* data);
   void* getGlobalData (const char* name);
diff --git a/myserver/src/server/server.cpp b/myserver/src/server/server.cpp
index 20ab5d7..7615166 100644
--- a/myserver/src/server/server.cpp
+++ b/myserver/src/server/server.cpp
@@ -305,14 +305,17 @@ int Server::postLoad ()
   /* Load the MIME types.  */
   log (MYSERVER_LOG_MSG_INFO, _("Loading MIME types..."));
 
-  const char *mimeManagerCfg = getData ("server.mime_manager");
-  if (!mimeManagerCfg)
-    mimeManagerCfg = "xml";
-
-  string handlerStr (mimeManagerCfg);
+  string handlerStr (getData ("server.mime_handler", "xml"));
   mimeManager.setDefaultHandler (handlerStr);
 
   MimeManagerHandler *mimeHandler = mimeManager.getDefaultHandler ();
+  if (!mimeHandler)
+    {
+      log (MYSERVER_LOG_MSG_ERROR,
+          _("Error creating the MIME types handler: %s"), handlerStr.c_str ());
+      return -1;
+    }
+
   if (int nMIMEtypes = mimeHandler->load (mimeConfigurationFile.c_str ()))
     log (MYSERVER_LOG_MSG_INFO, _("Using %i MIME types"), nMIMEtypes);
   else
@@ -343,13 +346,18 @@ int Server::postLoad ()
  */
 int Server::loadVHostConf ()
 {
-  const char *vhostHandlerN = getData ("server.vhost_manager");
-  if (!vhostHandlerN)
-    vhostHandlerN = "xml";
-
-  string vhostHandlerStr (vhostHandlerN);
+  string vhostHandlerStr (getData ("server.vhost_handler", "xml"));
   vhostHandler = vhostManager.buildHandler (vhostHandlerStr, &listenThreads,
                                             logManager);
+
+  if (!vhostHandler)
+    {
+      log (MYSERVER_LOG_MSG_ERROR,
+           _("Error creating the virtual hosts handler: %s"),
+           vhostHandlerStr.c_str ());
+      return -1;
+    }
+
   vhostManager.setHandler (vhostHandler);
 
   /* Load the virtual hosts configuration.  */
@@ -1365,12 +1373,13 @@ int Server::freeHashedData ()
 
 /*!
  * Get the value for name in the hash dictionary.
+ * If the value is not found then defValue is returned.
  */
-const char* Server::getData (const char* name)
+const char *Server::getData (const char *name, const char *defValue)
 {
   NodeTree<string> *s = hashedData.get (name);
 
-  return s ? s->getValue ()->c_str () : 0;
+  return s ? s->getValue ()->c_str () : defValue;
 }
 
 /*!



commit 890d5ec417290ec31483bfb0a9c35faf124713ff
Author: Giuseppe Scrivano <address@hidden>
Date:   Thu Nov 5 21:58:32 2009 +0100

    Document how use different configuration files handlers.

diff --git a/myserver/documentation/basic_configuration.texi 
b/myserver/documentation/basic_configuration.texi
index d211224..1ce43a0 100644
--- a/myserver/documentation/basic_configuration.texi
+++ b/myserver/documentation/basic_configuration.texi
@@ -29,6 +29,14 @@ configuration files by the @code{--cfgdir} argument to the 
myserver
 process.  In case a path is specified, then the configuration files
 are looked exclusively in this directory.
 
address@hidden Alternative handlers
+Plugins are allowed to install new handlers to read the configuration
+from other sources.  It is done changing the value of the variables
address@hidden and @code{server.server.mime_manager},
+respectively to use a different handler for the virtual hosts and for
+the MIME types.  If no value is specified then the value @value{xml}
+is used.
+
 @section Server administrator
 CGI scripts can get the server administrator e-mail and show them to
 the user (through the SERVER_ADMIN environment variable). 



commit 89eef0881e9f93e534594f2b23d85a9ccc447c8a
Author: Giuseppe Scrivano <address@hidden>
Date:   Thu Nov 5 21:57:38 2009 +0100

    Refactor common code in a single function.

diff --git a/myserver/include/server/server.h b/myserver/include/server/server.h
index 4947ee0..91af0f3 100644
--- a/myserver/include/server/server.h
+++ b/myserver/include/server/server.h
@@ -175,6 +175,7 @@ private:
 
   MainConfiguration *configurationFileManager;
   MainConfiguration* (*genMainConf) (Server *server, const char *arg);
+  int loadVHostConf ();
 
 # ifdef WIN32
   friend int __stdcall control_handler (u_long control_type);
diff --git a/myserver/src/server/server.cpp b/myserver/src/server/server.cpp
index 2c2b803..20ab5d7 100644
--- a/myserver/src/server/server.cpp
+++ b/myserver/src/server/server.cpp
@@ -299,25 +299,8 @@ int Server::postLoad ()
   loadStaticComponents ();
   loadPlugins ();
 
-  /* FIXME: refactor.. the same code is present in the main loop.  */
-  const char *vhostHandlerN = getData ("server.vhost_manager");
-  if (!vhostHandlerN)
-    vhostHandlerN = "xml";
-
-  string vhostHandlerStr (vhostHandlerN);
-  vhostHandler = vhostManager.buildHandler (vhostHandlerStr, &listenThreads,
-                                            logManager);
-  vhostManager.setHandler (vhostHandler);
-
-  /* Load the virtual hosts configuration from the xml file.  */
-  if (vhostHandler->load (vhostConfigurationFile.c_str ()))
-    {
-      log (MYSERVER_LOG_MSG_ERROR,
-           _("Error loading the vhost configuration file %s"),
-           vhostConfigurationFile.c_str ());
-      return -1;
-    }
-
+  if (loadVHostConf ())
+    return -1;
 
   /* Load the MIME types.  */
   log (MYSERVER_LOG_MSG_INFO, _("Loading MIME types..."));
@@ -356,6 +339,32 @@ int Server::postLoad ()
 }
 
 /*!
+ * Reload the virtual hosts configuration.
+ */
+int Server::loadVHostConf ()
+{
+  const char *vhostHandlerN = getData ("server.vhost_manager");
+  if (!vhostHandlerN)
+    vhostHandlerN = "xml";
+
+  string vhostHandlerStr (vhostHandlerN);
+  vhostHandler = vhostManager.buildHandler (vhostHandlerStr, &listenThreads,
+                                            logManager);
+  vhostManager.setHandler (vhostHandler);
+
+  /* Load the virtual hosts configuration.  */
+  if (vhostHandler->load (vhostConfigurationFile.c_str ()))
+    {
+      log (MYSERVER_LOG_MSG_ERROR,
+           _("Error loading the vhost configuration file %s"),
+           vhostConfigurationFile.c_str ());
+      return -1;
+    }
+
+  return 0;
+}
+
+/*!
  * Load static built-in components.
  */
 void Server::loadStaticComponents ()
@@ -502,22 +511,9 @@ void Server::mainLoop ()
                   connectionsScheduler.restart ();
                   listenThreads.initialize ();
 
-                  delete vhostHandler;
-
-                  const char *vhostHandlerN = getData ("server.vhost_manager");
-                  if (!vhostHandlerN)
-                    vhostHandlerN = "xml";
-
-                  string vhostHandlerStr (vhostHandlerN);
-                  vhostHandler = vhostManager.buildHandler (vhostHandlerStr,
-                                                            &listenThreads,
-                                                            logManager);
-                  vhostManager.setHandler (vhostHandler);
-
                   delete oldvhost;
 
-                  /* Load the virtual hosts configuration from the xml file.  
*/
-                  if (vhostHandler->load (vhostConfigurationFile.c_str ()))
+                  if (loadVHostConf ())
                     listenThreads.rollbackFastReboot ();
                   else
                     listenThreads.commitFastReboot ();

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

Summary of changes:
 myserver/documentation/basic_configuration.texi |    8 ++
 myserver/include/server/server.h                |    3 +-
 myserver/src/server/server.cpp                  |   85 ++++++++++++-----------
 3 files changed, 55 insertions(+), 41 deletions(-)


hooks/post-receive
-- 
GNU MyServer




reply via email to

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