myserver-commit
[Top][All Lists]
Advanced

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

[myserver-commit] [SCM] GNU MyServer branch, guile, updated. v0.9.2-525-


From: Giuseppe Scrivano
Subject: [myserver-commit] [SCM] GNU MyServer branch, guile, updated. v0.9.2-525-g252b888
Date: Wed, 01 Feb 2012 15:33:13 +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, guile has been updated
       via  252b8885d4a82e8006d3cc4c4929340c104df710 (commit)
       via  c5416305efcdc30fd4a93f88236f1372b55b8fac (commit)
      from  73bf0fe4442039c78d5fe6f30a7039886d1fb95a (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 252b8885d4a82e8006d3cc4c4929340c104df710
Author: Giuseppe Scrivano <address@hidden>
Date:   Wed Feb 1 16:31:33 2012 +0100

    Read virtual hosts configuration from a scheme file.

diff --git a/myserver/binaries/virtualhosts.default.sch 
b/myserver/binaries/virtualhosts.default.sch
new file mode 100644
index 0000000..785e010
--- /dev/null
+++ b/myserver/binaries/virtualhosts.default.sch
@@ -0,0 +1,2 @@
+(define vhosts
+  '(("example" "8080" "web" "system" "http")))
diff --git a/myserver/src/myserver.cpp b/myserver/src/myserver.cpp
index b4eee6d..c3e4f1e 100644
--- a/myserver/src/myserver.cpp
+++ b/myserver/src/myserver.cpp
@@ -342,7 +342,7 @@ int loadConfFilesLocation (string &mainConfigurationFile,
   if (loadConfFileLocation (mimeConfigurationFile, "MIMEtypes.xml", dir))
     return -1;
 
-  if (loadConfFileLocation (vhostConfigurationFile, "virtualhosts.xml", dir))
+  if (loadConfFileLocation (vhostConfigurationFile, "virtualhosts.sch", dir))
     return -1;
 
   if (loadExternalPath (externalPath))
diff --git a/myserver/src/server/server.cpp b/myserver/src/server/server.cpp
index 1c9c09d..f05fec1 100644
--- a/myserver/src/server/server.cpp
+++ b/myserver/src/server/server.cpp
@@ -340,7 +340,7 @@ int Server::postLoad ()
  */
 int Server::loadVHostConf ()
 {
-  string vhostHandlerStr (getData ("server.vhost_handler", "xml"));
+  string vhostHandlerStr (getData ("server.vhost_handler", "guile"));
   vhostHandler = vhostManager.buildHandler (vhostHandlerStr, &listenThreads,
                                             logManager);
 



commit c5416305efcdc30fd4a93f88236f1372b55b8fac
Author: Giuseppe Scrivano <address@hidden>
Date:   Wed Feb 1 16:13:05 2012 +0100

    Read main configuration from a scheme file.

diff --git a/myserver/binaries/myserver.default.sch 
b/myserver/binaries/myserver.default.sch
new file mode 100644
index 0000000..db5c421
--- /dev/null
+++ b/myserver/binaries/myserver.default.sch
@@ -0,0 +1,3 @@
+(define configuration 
+  '(((name . "server.static_threads") "2")
+))
diff --git a/myserver/include/conf/guile_conf.h 
b/myserver/include/conf/guile_conf.h
index b47df81..62582c7 100644
--- a/myserver/include/conf/guile_conf.h
+++ b/myserver/include/conf/guile_conf.h
@@ -25,13 +25,11 @@
 #include <include/conf/vhost/xml_vhost_handler.h>
 #include <include/server/server.h>
 
-#define CONF_FILE_NAME "myserver.sch"
-
 /*! Define the interface to read from the main configuration file.  */
 class GuileConfiguration : public MainConfiguration
 {
 public:
-  GuileConfiguration ();
+  GuileConfiguration (const char *filename);
   virtual const char *getValue (const char* field);
   virtual void readData (list<NodeTree<string>*> *hashedDataTrees,
                          HashMap<string, NodeTree<string>*> *hashedData);
diff --git a/myserver/src/conf/guile_conf.cpp b/myserver/src/conf/guile_conf.cpp
index d7974fd..62359c1 100644
--- a/myserver/src/conf/guile_conf.cpp
+++ b/myserver/src/conf/guile_conf.cpp
@@ -28,17 +28,12 @@
 
 #define CONF_FILE_NAME "myserver.sch"
 
-static MainConfiguration *genGuileMainConf (Server *server, const char *arg)
-{
-  return new GuileConfiguration ();
-}
-
 static VhostManagerHandler* guile_vhost_builder (ListenThreads* lt, 
LogManager* lm);
 
 
 extern MainConfiguration* (*genMainConf) (Server *server, const char *arg);
 
-GuileConfiguration::GuileConfiguration ()
+GuileConfiguration::GuileConfiguration (const char *filename)
 {
   serverInstance = Server::getInstance ();
 
@@ -54,10 +49,11 @@ GuileConfiguration::GuileConfiguration ()
                                _("GuileConf: cannot find file %s"), 
CONF_FILE_NAME);
         }
 
-      genMainConf = &genGuileMainConf;
+      VhostManager *vhostManager = serverInstance->getVhosts ();
+      vhostManager->registerBuilder ("guile", guile_vhost_builder);
+
       initialized = 1;
     }
-
 }
 
 const char *
@@ -109,19 +105,9 @@ GuileVhostManagerHandler::load (const char *resource)
       addVHost (vh);
     }
 
-
-  static int initialized = 0;
-  if (! initialized)
-  {
-    VhostManager *vhostManager = serverInstance->getVhosts ();
-    vhostManager->registerBuilder ("guile", guile_vhost_builder);
-    initialized = 1;
-  }
-
   return 0;
 }
 
-
 static NodeTree<string>*
 traverse (SCM node, HashMap<string, NodeTree<string>*> *hashedData)
 {
diff --git a/myserver/src/myserver.cpp b/myserver/src/myserver.cpp
index 76bcd18..b4eee6d 100644
--- a/myserver/src/myserver.cpp
+++ b/myserver/src/myserver.cpp
@@ -1,7 +1,7 @@
 /*
   MyServer
   Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
-  2011 Free Software Foundation, Inc.
+  2011, 2012 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
@@ -336,7 +336,7 @@ int loadConfFilesLocation (string &mainConfigurationFile,
                            string &externalPath,
                            const char *dir)
 {
-  if (loadConfFileLocation (mainConfigurationFile, "myserver.xml", dir))
+  if (loadConfFileLocation (mainConfigurationFile, "myserver.sch", dir))
     return -1;
 
   if (loadConfFileLocation (mimeConfigurationFile, "MIMEtypes.xml", dir))
@@ -369,19 +369,6 @@ static void updateWorkingDirectory (const char 
*firstArgument)
     }
 }
 
-static MainConfiguration *_genMainConf (Server *server, const char *arg)
-{
-  XmlMainConfiguration *conf = new XmlMainConfiguration ();
-  if (conf->open (arg))
-    {
-      delete conf;
-      return NULL;
-    }
-  return conf;
-}
-
-MainConfiguration* (*genMainConf) (Server *server, const char *arg) = 
&_genMainConf;
-
 const char *program_name = NULL;
 
 int main (int argn, char **argv)
@@ -516,7 +503,7 @@ int main (int argn, char **argv)
             return 1;
 #endif
         case MYSERVER_RUNAS_CONSOLE:
-          consoleService (mainConf, mimeConf, vhostConf, externPath, 
genMainConf);
+          consoleService (mainConf, mimeConf, vhostConf, externPath, NULL);
         }
     }
   catch (...)
diff --git a/myserver/src/server/server.cpp b/myserver/src/server/server.cpp
index 37daaf4..1c9c09d 100644
--- a/myserver/src/server/server.cpp
+++ b/myserver/src/server/server.cpp
@@ -1,7 +1,7 @@
 /*
   MyServer
   Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
-  2011 Free Software Foundation, Inc.
+  2011, 2012 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
@@ -39,6 +39,8 @@
 #include <include/conf/main/xml_main_configuration.h>
 #include <include/conf/security/xml_validator.h>
 
+#include <include/conf/guile_conf.h>
+
 #include <cstdarg>
 
 
@@ -822,16 +824,21 @@ int Server::initialize ()
     }
   else
     {
-      XmlMainConfiguration *xmlMainConf = new XmlMainConfiguration ();
-      if (xmlMainConf->open (mainConfigurationFile.c_str ()))
+      GuileConfiguration *guileMainConf;
+      try
+        {
+          guileMainConf = new GuileConfiguration (mainConfigurationFile.c_str 
());
+        }
+      catch (...)
         {
           log (MYSERVER_LOG_MSG_ERROR,
                _("Error while loading the %s configuration file"),
                mainConfigurationFile.c_str ());
-          delete xmlMainConf;
+          delete guileMainConf;
           return -1;
         }
-      configurationFileManager = xmlMainConf;
+
+      configurationFileManager = guileMainConf;
     }
 
   configurationFileManager->readData (&hashedDataTrees, &hashedData);

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

Summary of changes:
 myserver/binaries/myserver.default.sch     |    3 +++
 myserver/binaries/virtualhosts.default.sch |    2 ++
 myserver/include/conf/guile_conf.h         |    4 +---
 myserver/src/conf/guile_conf.cpp           |   22 ++++------------------
 myserver/src/myserver.cpp                  |   21 ++++-----------------
 myserver/src/server/server.cpp             |   19 +++++++++++++------
 6 files changed, 27 insertions(+), 44 deletions(-)
 create mode 100644 myserver/binaries/myserver.default.sch
 create mode 100644 myserver/binaries/virtualhosts.default.sch


hooks/post-receive
-- 
GNU MyServer



reply via email to

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