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. 45e9429f80


From: Giuseppe Scrivano
Subject: [myserver-commit] [SCM] GNU MyServer branch, master, updated. 45e9429f80e9c33f15bd5a914863fe28f6fb8c70
Date: Fri, 25 Sep 2009 16:43:12 +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  45e9429f80e9c33f15bd5a914863fe28f6fb8c70 (commit)
       via  1d7834daa745078dbcfc1777a90298fe210e336f (commit)
       via  204bed30d22e4d7334aaba0377223ae863541bc5 (commit)
      from  b18ca5038ef434b7591e98a45c2d70bb44a7c899 (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 45e9429f80e9c33f15bd5a914863fe28f6fb8c70
Author: Giuseppe Scrivano <address@hidden>
Date:   Fri Sep 25 15:58:21 2009 +0200

    Remove unused method from the Server class.

diff --git a/myserver/include/server/server.h b/myserver/include/server/server.h
index 742c7a1..4bead7b 100644
--- a/myserver/include/server/server.h
+++ b/myserver/include/server/server.h
@@ -138,7 +138,6 @@ public:
   {return log (str.c_str());};
   int setLogLocation (string);
   u_long getBuffersize ();
-  u_long getBuffersize2 ();
   u_long getThrottlingRate ();
   int waitNewConnection (u_long tid, u_long timeout);
   ListenThreads *getListenThreads (){return &listenThreads;}
diff --git a/myserver/src/server/clients_thread.cpp 
b/myserver/src/server/clients_thread.cpp
index e191201..8fcecb9 100644
--- a/myserver/src/server/clients_thread.cpp
+++ b/myserver/src/server/clients_thread.cpp
@@ -137,8 +137,7 @@ DEFINE_THREAD(clients_thread, pParam)
 
   ct->threadIsRunning = true;
   ct->threadIsStopped = false;
-  ct->buffersize = ct->server->getBuffersize ();
-  ct->secondaryBufferSize = ct->server->getBuffersize2 ();
+  ct->buffersize = ct->secondaryBufferSize = ct->server->getBuffersize ();
 
   ct->buffer.setLength (ct->buffersize);
   ct->buffer.m_nSizeLimit = ct->buffersize;
diff --git a/myserver/src/server/server.cpp b/myserver/src/server/server.cpp
index 927dfa1..383474e 100644
--- a/myserver/src/server/server.cpp
+++ b/myserver/src/server/server.cpp
@@ -1882,14 +1882,6 @@ u_long Server::getBuffersize ()
 }
 
 /*!
- *Get the size for the second buffer.
- */
-u_long Server::getBuffersize2 ()
-{
-  return secondaryBufferSize;
-}
-
-/*!
  * Set a global descriptor.
  */
 void Server::setGlobalData (const char* name, void* data)



commit 1d7834daa745078dbcfc1777a90298fe210e336f
Author: Giuseppe Scrivano <address@hidden>
Date:   Fri Sep 25 15:57:46 2009 +0200

    Allow definition of NodeTree in the security and in the MIME configuration 
files

diff --git a/myserver/include/conf/mime/mime_manager.h 
b/myserver/include/conf/mime/mime_manager.h
index d38c38d..1c7a724 100644
--- a/myserver/include/conf/mime/mime_manager.h
+++ b/myserver/include/conf/mime/mime_manager.h
@@ -24,7 +24,7 @@ along with this program.  If not, see 
<http://www.gnu.org/licenses/>.
 # include <include/base/sync/mutex.h>
 # include <include/base/xml/xml_parser.h>
 # include <include/base/regex/myserver_regex.h>
-
+# include <include/conf/nodetree.h>
 
 # ifdef WIN32
 #  include <windows.h>
@@ -58,28 +58,29 @@ struct PathRegex
 
 struct MimeRecord
 {
-       list<string> filters;
-       list<string> extensions;
-       string mimeType;
-       string cmdName;
-       string cgiManager;
+  list<string> filters;
+  list<string> extensions;
+  string mimeType;
+  string cmdName;
+  string cgiManager;
   bool selfExecuted;
   list<Regex*> pathRegex;
-  HashMap<string, string*> hashedData;
+  HashMap<string, NodeTree<string>*> hashedData;
 
-       MimeRecord ();
-       MimeRecord (MimeRecord&);
-       int addFilter (const char*, bool acceptDuplicate = true);
-       ~MimeRecord ();
-       void clear ();
+  MimeRecord ();
+  MimeRecord (MimeRecord&);
+  int addFilter (const char*, bool acceptDuplicate = true);
+  ~MimeRecord ();
+  void clear ();
   const char* getData(string &name);
+  NodeTree<string>* getNodeTree (string &name);
 };
 
 
 class MimeManagerHandler
 {
 public:
-       virtual MimeRecord* getMIME (const char *file){return NULL;}
+  virtual MimeRecord* getMIME (const char *file){return NULL;}
   virtual MimeRecord* getMIME (string const &file)
   {return getMIME (file.c_str ());}
 };
@@ -87,28 +88,28 @@ public:
 class MimeManager
 {
 public:
-       MimeManager ();
+  MimeManager ();
   ~MimeManager ();
-       u_long getNumMIMELoaded ();
+  u_long getNumMIMELoaded ();
 
   u_long loadXML (XmlParser* parser);
-       u_long loadXML (const char *filename);
-       u_long loadXML (string &filename) {return loadXML (filename.c_str ());}
+  u_long loadXML (const char *filename);
+  u_long loadXML (string &filename) {return loadXML (filename.c_str ());}
 
-       MimeRecord* getMIME (const char *file, const char *handler = NULL);
+  MimeRecord* getMIME (const char *file, const char *handler = NULL);
   MimeRecord* getMIME (string const &file, const char *handler = NULL);
 
   bool isLoaded ();
-       void clean ();
-       int addRecord (MimeRecord *record);
+  void clean ();
+  int addRecord (MimeRecord *record);
 
   static MimeRecord *readRecord (xmlNodePtr node);
 
   void registerHandler (string &name, MimeManagerHandler *handler);
 
 protected:
-       const char *getFilename ();
-       void clearRecords ();
+  const char *getFilename ();
+  void clearRecords ();
 
 private:
   HashMap<string, MimeManagerHandler*> handlers;
@@ -117,8 +118,8 @@ private:
   vector<MimeRecord*> records;
   list<PathRegex*> pathRegex;
 
-       u_long numMimeTypesLoaded;
-       string filename;
+  u_long numMimeTypesLoaded;
+  string filename;
 };
 
 #endif
diff --git a/myserver/include/conf/security/security_token.h 
b/myserver/include/conf/security/security_token.h
index 1d03b2d..07f75d0 100644
--- a/myserver/include/conf/security/security_token.h
+++ b/myserver/include/conf/security/security_token.h
@@ -54,7 +54,6 @@ public:
   const char* getData (const char* name, int domains, const char *def = NULL);
   NodeTree<string>* getNodeTree (string& key, int domains, NodeTree<string>* 
def = NULL);
 
-
   string& getUser ()
   {
     return user;
@@ -65,7 +64,7 @@ public:
     return password;
   }
 
-       HashMap<string,string*>* getValues ()
+  HashMap<string, NodeTree<string>*>* getValues ()
   {
     return &values;
   }
@@ -224,7 +223,7 @@ private:
   int providedMask;
 
   /*! Stored values.  */
-       HashMap<string,string*> values;
+  HashMap<string, NodeTree<string>*> values;
 
   /*! If it is true the security manager will use the cached values.  */
   bool done;
diff --git a/myserver/src/conf/mime/mime_manager.cpp 
b/myserver/src/conf/mime/mime_manager.cpp
index a680c1a..a29d68f 100644
--- a/myserver/src/conf/mime/mime_manager.cpp
+++ b/myserver/src/conf/mime/mime_manager.cpp
@@ -116,25 +116,30 @@ void MimeRecord::clear ()
     delete *it;
   }
 
-  HashMap<string, string*>::Iterator it = hashedData.begin ();
+  HashMap<string, NodeTree<string>*>::Iterator it = hashedData.begin ();
   for (;it != hashedData.end (); it++)
-  {
     delete (*it);
-  }
   hashedData.clear ();
 
-
   pathRegex.clear ();
 }
 
 /*!
+ * Get the node tree stored in the hash dictionary for the `name' key.
+ */
+NodeTree<string>* MimeRecord::getNodeTree (string &name)
+{
+  return hashedData.get (name);
+}
+
+/*!
  * Get the value stored in the hash dictionary for the `name' key.
  */
 const char* MimeRecord::getData(string &name)
 {
-  string *str = hashedData.get (name);
+  NodeTree<string> *str = hashedData.get (name);
   if (str)
-    return str->c_str ();
+    return str->getValue ()->c_str ();
 
   return NULL;
 }
@@ -207,8 +212,9 @@ MimeRecord *MimeManager::readRecord (xmlNodePtr node)
       if (name && value)
       {
         string key (name);
-        string *v = new string (value);
-        rc->hashedData.put(key, v);
+       string val (value);
+       NodeTree<string> *nt = new NodeTree<string> (val);
+        rc->hashedData.put(key, nt);
       }
 
     }
diff --git a/myserver/src/conf/security/security_token.cpp 
b/myserver/src/conf/security/security_token.cpp
index b9af5c8..ffcf5d0 100644
--- a/myserver/src/conf/security/security_token.cpp
+++ b/myserver/src/conf/security/security_token.cpp
@@ -47,10 +47,12 @@ void SecurityToken::reset ()
   directory = NULL;
   sysdirectory = NULL;
   resource = NULL;
-
+  HashMap<string, NodeTree<string>*>::Iterator it = values.begin ();
+  for (;it != values.end (); it++)
+    delete (*it);
+  values.clear ();
 }
 
-
 /*!
  *Get the value for the variable using the specified domains.
  *\param key Variable name.
@@ -63,14 +65,13 @@ void SecurityToken::reset ()
  */
 NodeTree<string>* SecurityToken::getNodeTree (string& key, int domains, 
NodeTree<string>* def)
 {
-/*
   if (domains & MYSERVER_SECURITY_CONF)
   {
     string strName (key);
     NodeTree<string>* ret = values.get (strName);
 
     if (ret)
-      return ret->c_str ();
+      return ret;
   }
 
   if (mimeRecord && (domains & MYSERVER_MIME_CONF))
@@ -81,7 +82,7 @@ NodeTree<string>* SecurityToken::getNodeTree (string& key, 
int domains, NodeTree
     if (ret)
       return ret;
   }
-*/
+
   if (vhost && (domains & MYSERVER_VHOST_CONF))
   {
     NodeTree<string>* ret = vhost->getNodeTree (key);
@@ -117,10 +118,10 @@ const char* SecurityToken::getData (const char* name, int 
domains, const char *d
   if (domains & MYSERVER_SECURITY_CONF)
   {
     string strName (name);
-    string *ret = values.get (strName);
+    NodeTree<string> *ret = values.get (strName);
 
     if (ret)
-      return ret->c_str ();
+      return ret->getValue ()->c_str ();
   }
 
   if (mimeRecord && (domains & MYSERVER_MIME_CONF))
diff --git a/myserver/src/conf/security/xml_validator.cpp 
b/myserver/src/conf/security/xml_validator.cpp
index 5db26f0..a5fe690 100644
--- a/myserver/src/conf/security/xml_validator.cpp
+++ b/myserver/src/conf/security/xml_validator.cpp
@@ -371,9 +371,9 @@ void XmlValidator::doDefine (xmlNodePtr node, SecurityToken 
*st, HashMap<string,
   if (!value)
     return;
 
-  string *valStr = new string ((const char *)value);
-
-  string *old = st->getValues ()->put (name, valStr);
+  string valStr ((const char*)value);
+  NodeTree<string> *nt = new NodeTree<string> (valStr);
+  NodeTree<string> *old = st->getValues ()->put (name, nt);
 
   if (old)
     delete old;



commit 204bed30d22e4d7334aaba0377223ae863541bc5
Author: Giuseppe Scrivano <address@hidden>
Date:   Fri Sep 25 15:21:49 2009 +0200

    Move the XmlValidator definition inside the Server class.

diff --git a/myserver/include/server/server.h b/myserver/include/server/server.h
index 4a5b80e..742c7a1 100644
--- a/myserver/include/server/server.h
+++ b/myserver/include/server/server.h
@@ -64,6 +64,8 @@ unsigned int __stdcall listenServer(void* pParam);
 void* listenServer(void* pParam);
 # endif
 
+class XmlValidator;
+
 class Server : public MulticastRegistry<string, void*, int>
 {
 public:
@@ -165,6 +167,7 @@ public:
   XmlParser *getXmlConfiguration ();
 private:
   friend class ClientsThread;
+  XmlValidator *xmlValidator;
 
   XmlParser configurationFileManager;
 
diff --git a/myserver/src/server/server.cpp b/myserver/src/server/server.cpp
index 491f32c..927dfa1 100644
--- a/myserver/src/server/server.cpp
+++ b/myserver/src/server/server.cpp
@@ -90,6 +90,7 @@ Server::Server () : connectionsScheduler (this),
   purgeThreadsThreshold = 1;
   freeThreads = 0;
   logManager = new LogManager (&filtersFactory);
+  xmlValidator = new XmlValidator ();
   initLogManager ();
   connectionsPoolLock.init ();
 }
@@ -258,6 +259,9 @@ Server::~Server ()
     delete externalPath;
   externalPath = 0;
 
+  if (xmlValidator)
+    delete xmlValidator;
+
   if (path)
     delete path;
   path = 0;
@@ -441,11 +445,9 @@ int Server::postLoad ()
 void Server::loadPlugins ()
 {
   string xml ("xml");
-  //FIXME: xmlV is never freed.
-  XmlValidator *xmlV = new XmlValidator ();
 
-  validatorFactory.addValidator (xml, xmlV);
-  authMethodFactory.addAuthMethod (xml, (AuthMethod*) xmlV);
+  validatorFactory.addValidator (xml, xmlValidator);
+  authMethodFactory.addAuthMethod (xml, (AuthMethod*) xmlValidator);
 
   if (filtersFactory.insert ("gzip", Gzip::factory))
     log (MYSERVER_LOG_MSG_ERROR, _("Error while loading plugins"));

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

Summary of changes:
 myserver/include/conf/mime/mime_manager.h       |   49 ++++++++++++-----------
 myserver/include/conf/security/security_token.h |    5 +-
 myserver/include/server/server.h                |    4 +-
 myserver/src/conf/mime/mime_manager.cpp         |   22 ++++++----
 myserver/src/conf/security/security_token.cpp   |   15 ++++---
 myserver/src/conf/security/xml_validator.cpp    |    6 +-
 myserver/src/server/clients_thread.cpp          |    3 +-
 myserver/src/server/server.cpp                  |   18 +++------
 8 files changed, 62 insertions(+), 60 deletions(-)


hooks/post-receive
-- 
GNU MyServer




reply via email to

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