myserver-commit
[Top][All Lists]
Advanced

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

[myserver-commit] [3081] Do not use XML data to store data but access it


From: Giuseppe Scrivano
Subject: [myserver-commit] [3081] Do not use XML data to store data but access it trought `NodeTree'.
Date: Tue, 05 May 2009 18:29:59 +0000

Revision: 3081
          http://svn.sv.gnu.org/viewvc/?view=rev&root=myserver&revision=3081
Author:   gscrivano
Date:     2009-05-05 18:29:59 +0000 (Tue, 05 May 2009)
Log Message:
-----------
Do not use XML data to store data but access it trought `NodeTree'.

Modified Paths:
--------------
    trunk/myserver/include/http_handler/fastcgi/fastcgi.h
    trunk/myserver/include/http_handler/http_dir/http_dir.h
    trunk/myserver/include/http_handler/http_file/http_file.h
    trunk/myserver/include/http_handler/isapi/isapi.h
    trunk/myserver/include/http_handler/mscgi/mscgi.h
    trunk/myserver/include/http_handler/scgi/scgi.h
    trunk/myserver/include/protocol/http/http_data_handler.h
    trunk/myserver/src/http_handler/fastcgi/fastcgi.cpp
    trunk/myserver/src/http_handler/http_dir/http_dir.cpp
    trunk/myserver/src/http_handler/http_file/http_file.cpp
    trunk/myserver/src/http_handler/isapi/isapi.cpp
    trunk/myserver/src/http_handler/mscgi/mscgi.cpp
    trunk/myserver/src/http_handler/scgi/scgi.cpp
    trunk/myserver/src/plugin/plugins_manager.cpp
    trunk/myserver/src/protocol/http/http.cpp
    trunk/myserver/src/protocol/http/http_data_handler.cpp

Modified: trunk/myserver/include/http_handler/fastcgi/fastcgi.h
===================================================================
--- trunk/myserver/include/http_handler/fastcgi/fastcgi.h       2009-05-04 
20:36:59 UTC (rev 3080)
+++ trunk/myserver/include/http_handler/fastcgi/fastcgi.h       2009-05-05 
18:29:59 UTC (rev 3081)
@@ -1,7 +1,7 @@
 /* -*- mode: c++ -*- */
 /*
 MyServer
-Copyright (C) 2002, 2003, 2004, 2007, 2008 Free Software Foundation, Inc.
+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
@@ -163,7 +163,7 @@
   static int getTimeout ();
   static void setTimeout (int);
        FastCgi ();
-       static int load (XmlParser*);
+       static int load ();
        virtual int send (HttpThreadContext* td, ConnectionPtr connection,
                    const char* scriptpath, const char *cgipath, 
                    int execute = 0, int onlyHeader = 0);

Modified: trunk/myserver/include/http_handler/http_dir/http_dir.h
===================================================================
--- trunk/myserver/include/http_handler/http_dir/http_dir.h     2009-05-04 
20:36:59 UTC (rev 3080)
+++ trunk/myserver/include/http_handler/http_dir/http_dir.h     2009-05-05 
18:29:59 UTC (rev 3081)
@@ -1,7 +1,7 @@
 /* -*- mode: c++ -*- */
 /*
 MyServer
-Copyright (C) 2005, 2007, 2008 Free Software Foundation, Inc.
+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
@@ -37,8 +37,8 @@
     off_t size;
   };
 
-  static int load(XmlParser*);
-  static int unLoad();
+  static int load ();
+  static int unLoad ();
   virtual int send(HttpThreadContext*, ConnectionPtr s, 
                    const char *filenamePath, const char* cgi,
                    int execute = 0, int OnlyHeader = 0); 

Modified: trunk/myserver/include/http_handler/http_file/http_file.h
===================================================================
--- trunk/myserver/include/http_handler/http_file/http_file.h   2009-05-04 
20:36:59 UTC (rev 3080)
+++ trunk/myserver/include/http_handler/http_file/http_file.h   2009-05-05 
18:29:59 UTC (rev 3081)
@@ -28,9 +28,9 @@
 class HttpFile  : public HttpDataHandler
 {
 public:
-  static int load(XmlParser*);
-  static int unLoad();
-  virtual int send(HttpThreadContext*, ConnectionPtr s, 
+  static int load ();
+  static int unLoad ();
+  virtual int send (HttpThreadContext*, ConnectionPtr s, 
                    const char *filenamePath, const char* cgi,
                    int execute = 0, int OnlyHeader = 0); 
   HttpFile();

Modified: trunk/myserver/include/http_handler/isapi/isapi.h
===================================================================
--- trunk/myserver/include/http_handler/isapi/isapi.h   2009-05-04 20:36:59 UTC 
(rev 3080)
+++ trunk/myserver/include/http_handler/isapi/isapi.h   2009-05-05 18:29:59 UTC 
(rev 3081)
@@ -1,7 +1,7 @@
 /* -*- mode: c++ -*- */
 /*
 MyServer
-Copyright (C) 2002, 2003, 2004, 2008 Free Software Foundation, Inc.
+Copyright (C) 2002, 2003, 2004, 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
@@ -149,7 +149,7 @@
 #endif  
   Isapi();
   static Mutex *isapiMutex;
-  static int load(XmlParser*);
+  static int load ();
   static int unLoad();
   static void setTimeout(u_long);
   static u_long getTimeout();

Modified: trunk/myserver/include/http_handler/mscgi/mscgi.h
===================================================================
--- trunk/myserver/include/http_handler/mscgi/mscgi.h   2009-05-04 20:36:59 UTC 
(rev 3080)
+++ trunk/myserver/include/http_handler/mscgi/mscgi.h   2009-05-05 18:29:59 UTC 
(rev 3081)
@@ -1,7 +1,7 @@
 /* -*- mode: c++ -*- */
 /*
 MyServer
-Copyright (C) 2002, 2003, 2004, 2006, 2007, 2008 Free Software Foundation, Inc.
+Copyright (C) 2002, 2003, 2004, 2006, 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
@@ -56,7 +56,7 @@
        /*!
    *Functions to Load and free the MSCGI library.
    */
-       static int load(XmlParser*);
+       static int load();
        static int unLoad();
        /*!
        *Use this to send a MSCGI file through the HTTP protocol.

Modified: trunk/myserver/include/http_handler/scgi/scgi.h
===================================================================
--- trunk/myserver/include/http_handler/scgi/scgi.h     2009-05-04 20:36:59 UTC 
(rev 3080)
+++ trunk/myserver/include/http_handler/scgi/scgi.h     2009-05-05 18:29:59 UTC 
(rev 3081)
@@ -1,7 +1,7 @@
 /* -*- mode: c++ -*- */
 /*
 MyServer
-Copyright (C) 2002, 2003, 2004, 2007, 2008 Free Software Foundation, Inc.
+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
@@ -55,7 +55,7 @@
   static int getTimeout();
   static void setTimeout(int);
   Scgi();
-  static int load(XmlParser*);
+  static int load();
   int send(HttpThreadContext* td, ConnectionPtr connection,
            const char* scriptpath, const char *cgipath = 0,
            int execute = 0, int onlyHeader = 0);

Modified: trunk/myserver/include/protocol/http/http_data_handler.h
===================================================================
--- trunk/myserver/include/protocol/http/http_data_handler.h    2009-05-04 
20:36:59 UTC (rev 3080)
+++ trunk/myserver/include/protocol/http/http_data_handler.h    2009-05-05 
18:29:59 UTC (rev 3081)
@@ -1,7 +1,7 @@
 /* -*- mode: c++ -*- */
 /*
 MyServer
-Copyright (C) 2005, 2007, 2008 Free Software Foundation, Inc.
+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
@@ -18,10 +18,10 @@
 
 #ifndef HTTP_DATA_HANDLER_H
 #define HTTP_DATA_HANDLER_H
+
 #include "stdafx.h"
 #include <include/protocol/protocol.h>
 #include "include/protocol/http/http_headers.h"
-#include <include/base/xml/xml_parser.h>
 #include <include/filter/filters_chain.h>
 
 /*!
@@ -30,8 +30,8 @@
 class HttpDataHandler
 {
 public:
-  static int load(XmlParser* );
-  static int unLoad();
+  static int load ();
+  static int unLoad ();
 
        virtual int send(HttpThreadContext*, ConnectionPtr s,
                    const char* exec, const char* cmdLine = 0,

Modified: trunk/myserver/src/http_handler/fastcgi/fastcgi.cpp
===================================================================
--- trunk/myserver/src/http_handler/fastcgi/fastcgi.cpp 2009-05-04 20:36:59 UTC 
(rev 3080)
+++ trunk/myserver/src/http_handler/fastcgi/fastcgi.cpp 2009-05-05 18:29:59 UTC 
(rev 3081)
@@ -456,7 +456,7 @@
 /*!
  *Initialize the FastCGI protocol implementation
  */
-int FastCgi::load(XmlParser* /*confFile*/)
+int FastCgi::load()
 {
   if(initialized)
     return 1;

Modified: trunk/myserver/src/http_handler/http_dir/http_dir.cpp
===================================================================
--- trunk/myserver/src/http_handler/http_dir/http_dir.cpp       2009-05-04 
20:36:59 UTC (rev 3080)
+++ trunk/myserver/src/http_handler/http_dir/http_dir.cpp       2009-05-05 
18:29:59 UTC (rev 3081)
@@ -93,7 +93,7 @@
 /*!
  *Load the static elements.
  */
-int HttpDir::load(XmlParser* /*confFile*/)
+int HttpDir::load ()
 {
   return 0;
 }
@@ -101,7 +101,7 @@
 /*!
  *Unload the static elements.
  */
-int HttpDir::unLoad()
+int HttpDir::unLoad ()
 {
   return 0;
 }

Modified: trunk/myserver/src/http_handler/http_file/http_file.cpp
===================================================================
--- trunk/myserver/src/http_handler/http_file/http_file.cpp     2009-05-04 
20:36:59 UTC (rev 3080)
+++ trunk/myserver/src/http_handler/http_file/http_file.cpp     2009-05-05 
18:29:59 UTC (rev 3081)
@@ -729,7 +729,7 @@
  *Load the static elements.
  *\param confFile Not used.
  */
-int HttpFile::load(XmlParser* confFile)
+int HttpFile::load ()
 {
   return 0;
 }

Modified: trunk/myserver/src/http_handler/isapi/isapi.cpp
===================================================================
--- trunk/myserver/src/http_handler/isapi/isapi.cpp     2009-05-04 20:36:59 UTC 
(rev 3080)
+++ trunk/myserver/src/http_handler/isapi/isapi.cpp     2009-05-05 18:29:59 UTC 
(rev 3081)
@@ -1009,7 +1009,7 @@
 /*!
 *Initialize the ISAPI engine under WIN32.
 */
-int Isapi::load(XmlParser*/* confFile*/)
+int Isapi::load ()
 {
 #ifdef WIN32
   u_long nThreads = Server::getInstance()->getMaxThreads()/2;

Modified: trunk/myserver/src/http_handler/mscgi/mscgi.cpp
===================================================================
--- trunk/myserver/src/http_handler/mscgi/mscgi.cpp     2009-05-04 20:36:59 UTC 
(rev 3080)
+++ trunk/myserver/src/http_handler/mscgi/mscgi.cpp     2009-05-05 18:29:59 UTC 
(rev 3081)
@@ -233,7 +233,7 @@
  *Map the library in the application address space.
  *\param confFile The xml parser with configuration.
  */
-int MsCgi::load(XmlParser* confFile)
+int MsCgi::load()
 {
   return 1;
 }

Modified: trunk/myserver/src/http_handler/scgi/scgi.cpp
===================================================================
--- trunk/myserver/src/http_handler/scgi/scgi.cpp       2009-05-04 20:36:59 UTC 
(rev 3080)
+++ trunk/myserver/src/http_handler/scgi/scgi.cpp       2009-05-05 18:29:59 UTC 
(rev 3081)
@@ -482,7 +482,7 @@
 /*!
  *Initialize the SCGI protocol implementation
  */
-int Scgi::load(XmlParser* /*confFile*/)
+int Scgi::load ()
 {
   if(initialized)
     return 1;

Modified: trunk/myserver/src/plugin/plugins_manager.cpp
===================================================================
--- trunk/myserver/src/plugin/plugins_manager.cpp       2009-05-04 20:36:59 UTC 
(rev 3080)
+++ trunk/myserver/src/plugin/plugins_manager.cpp       2009-05-05 18:29:59 UTC 
(rev 3081)
@@ -20,7 +20,7 @@
 #include <include/base/xml/xml_parser.h>
 #include <include/base/find_data/find_data.h>
 #include <include/server/server.h>
-
+#include <include/base/string/stringutils.h>
 #include <string>
 using namespace std;
 
@@ -58,65 +58,63 @@
  *\param languageFile The language file to use to get errors and warnings 
  *messages.
  */
-int PluginsManager::loadOptions(Server *server, XmlParser* languageFile)
+int PluginsManager::loadOptions (Server *server, XmlParser* languageFile)
 {
-  xmlDocPtr xmlDoc;
   int ret = 0;
-  XmlParser* configuration;
-  
-  configuration = server->getConfiguration();
-  
-  xmlDoc = configuration->getDoc();
-  
+  string key ("plugins");
 
-  for(xmlNode *root = xmlDoc->children; root; root = root->next)
-    if(!xmlStrcmp(root->name, (const xmlChar *)"MYSERVER"))
-      for(xmlNode *node = root->children; node; node = node->next)
-        {
-          string namespaceName;
-          string pluginName;
+  NodeTree<string>* node = server->getNodeTree (key);
+
+  if (node == NULL)
+    return 0;
+
+  list<NodeTree<string>*> *children = node->getChildren ();
+
+  if (children == NULL)
+    return 0;
+
+  string namespaceKey ("namespace");
+  string pluginKey ("plugin");
+  string globalKey ("global");
+  string enabledKey ("enabled");
+
+  for(list<NodeTree<string>*>::iterator it = children->begin ();
+      it != children->end ();
+      it++)
+    {
+      NodeTree<string>* node = *it;
+
+      string plugin;
+      string namespaceName;
                  bool global = false;
                  bool enabled = false;
-          
-          if(!xmlStrcmp(node->name, (const xmlChar *)"PLUGIN"))
-          {
-            xmlAttrPtr properties = node->properties;
-            
-            while(properties)
-            {
-              if(!xmlStrcmp(properties->name, (const xmlChar *)"name"))
-              {
-                if(properties->children && properties->children->content)
-                  pluginName.assign((char*)properties->children->content);
-              }
-              properties = properties->next;
-            }
-            
-            for(xmlNode *internal = node->children; internal; internal = 
internal->next)  
-            {
-              if(!xmlStrcmp(internal->name, (const xmlChar *)"ENABLED"))
-                enabled = strcmpi("NO", (const 
char*)internal->children->content) ? true : false;
-              else if(!xmlStrcmp(internal->name, (const xmlChar *)"GLOBAL"))
-                global = strcmpi("YES", (const 
char*)internal->children->content) ? false : true;
-            }
 
-            if(!pluginName.length())
-            {
-              string error;
-              error.assign("PLUGINS MANAGER: Warning: invalid plugin name in 
PLUGIN block");
-              server->logWriteln(error.c_str(), MYSERVER_LOG_MSG_ERROR);
-              ret = -1;  
-            }
-            else
-            {
-                addPluginInfo(pluginName, new 
PluginInfo(pluginName,enabled,global));
-            }
+      if (node->getAttr (namespaceKey))
+        namespaceName.assign (*node->getAttr (namespaceKey));
 
-          }
+      if (node->getAttr (pluginKey))
+        plugin.assign (*node->getAttr (pluginKey));
+
+      if (node->getAttr (globalKey))
+        global = stringcmpi (*node->getAttr (globalKey), "YES") == 0;
+
+      if (node->getAttr (enabledKey))
+        enabled = stringcmpi (*node->getAttr (enabledKey), "YES") == 0;
+
+      if (!plugin.length ())
+        {
+          string error;
+          error.assign ("PLUGINS MANAGER: Warning: invalid plugin name in 
PLUGIN block");
+          server->logWriteln (error.c_str (), MYSERVER_LOG_MSG_ERROR);
+          ret = -1;  
         }
+      else
+        {
+          addPluginInfo (plugin, new PluginInfo (plugin, enabled, global));
+        }
+    }
 
   return ret;
-  
 }
 
 

Modified: trunk/myserver/src/protocol/http/http.cpp
===================================================================
--- trunk/myserver/src/protocol/http/http.cpp   2009-05-04 20:36:59 UTC (rev 
3080)
+++ trunk/myserver/src/protocol/http/http.cpp   2009-05-05 18:29:59 UTC (rev 
3081)
@@ -1850,10 +1850,8 @@
  */
 int Http::loadProtocolStatic(XmlParser* languageParser)
 {
-  char *data = 0;
-  XmlParser *configurationFileManager = 
Server::getInstance()->getConfiguration();
+  const char *data = NULL;
   string pluginsResource(Server::getInstance()->getExternalPath());
-  xmlDocPtr xmlDoc = configurationFileManager->getDoc();
 
   /*
    *Store defaults value.
@@ -1867,19 +1865,19 @@
   HttpErrors::load ();
 
   /* Initialize ISAPI.  */
-  Isapi::load (configurationFileManager);
+  Isapi::load ();
 
   /* Initialize FastCGI.  */
-  FastCgi::load (configurationFileManager);
+  FastCgi::load ();
 
   /* Initialize SCGI.  */
-  Scgi::load (configurationFileManager);
+  Scgi::load ();
 
   /* Load the MSCGI library.  */
-  MsCgi::load (configurationFileManager);
+  MsCgi::load ();
 
-  HttpFile::load (configurationFileManager);
-  HttpDir::load (configurationFileManager);
+  HttpFile::load ();
+  HttpDir::load ();
 
   staticHttp.dynManagerList.addHttpManager ("SEND", staticHttp.httpFile);
   staticHttp.dynManagerList.addHttpManager ("DIR", staticHttp.httpDir);
@@ -1890,7 +1888,7 @@
   staticHttp.dynManagerList.addHttpManager ("FASTCGI", staticHttp.fastcgi);
   staticHttp.dynManagerList.addHttpManager ("ISAPI", staticHttp.isapi);
 
-  data = configurationFileManager->getValue("vhost.allow_mime");
+  data = Server::getInstance ()->getHashedData ("vhost.allow_mime");
   if(data)
   {
 
@@ -1899,16 +1897,16 @@
     else
       staticHttp.allowVhostMime = 0;
   }
-  data = configurationFileManager->getValue("cgi.timeout");
+  data = Server::getInstance ()->getHashedData ("cgi.timeout");
   if(data)
   {
-    staticHttp.cgiTimeout = MYSERVER_SEC(atoi(data));
+    staticHttp.cgiTimeout = MYSERVER_SEC (atoi (data));
   }
 
-  Cgi::setTimeout(staticHttp.cgiTimeout);
-  Scgi::setTimeout(staticHttp.cgiTimeout);
-  WinCgi::setTimeout(staticHttp.cgiTimeout);
-  Isapi::setTimeout(staticHttp.cgiTimeout);
+  Cgi::setTimeout (staticHttp.cgiTimeout);
+  Scgi::setTimeout (staticHttp.cgiTimeout);
+  WinCgi::setTimeout (staticHttp.cgiTimeout);
+  Isapi::setTimeout (staticHttp.cgiTimeout);
 
   return 1;
 }

Modified: trunk/myserver/src/protocol/http/http_data_handler.cpp
===================================================================
--- trunk/myserver/src/protocol/http/http_data_handler.cpp      2009-05-04 
20:36:59 UTC (rev 3080)
+++ trunk/myserver/src/protocol/http/http_data_handler.cpp      2009-05-05 
18:29:59 UTC (rev 3081)
@@ -1,6 +1,6 @@
 /*
 MyServer
-Copyright (C) 2005, 2007, 2008 Free Software Foundation, Inc.
+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
@@ -47,7 +47,7 @@
 /*!
  *Load the static elements.
  */
-int HttpDataHandler::load(XmlParser* /*confFile*/)
+int HttpDataHandler::load ()
 {
   return 0;
 }





reply via email to

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