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. v0.9.2-432


From: Giuseppe Scrivano
Subject: [myserver-commit] [SCM] GNU MyServer branch, master, updated. v0.9.2-432-g01bec26
Date: Fri, 11 Mar 2011 17:19:23 +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  01bec26fc619c47390a3d7ef706d9ff7030089c0 (commit)
       via  39ff3b05edaa51263eceb5fa3eb00b347b28ce5a (commit)
       via  7ad8d37adcdf0ba31a53678a90003a96ba2b9735 (commit)
      from  3e208e0d780dac871c6611439691cb723553e926 (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 01bec26fc619c47390a3d7ef706d9ff7030089c0
Author: Giuseppe Scrivano <address@hidden>
Date:   Fri Mar 11 18:19:19 2011 +0100

    Show an error if the log files section contain an unexpected element.

diff --git a/myserver/include/conf/vhost/xml_vhost_handler.h 
b/myserver/include/conf/vhost/xml_vhost_handler.h
index 13c0662..2c53279 100644
--- a/myserver/include/conf/vhost/xml_vhost_handler.h
+++ b/myserver/include/conf/vhost/xml_vhost_handler.h
@@ -44,7 +44,7 @@ public:
   int addVHost (Vhost *);
 
   /*! Load the virtual hosts list from a xml configuration file.  */
-  virtual int load (const char *);
+  virtual int load (const char *name);
 
   /*! Set the right owner for the log locations.  */
   void changeLocationsOwner ();
diff --git a/myserver/src/conf/vhost/xml_vhost_handler.cpp 
b/myserver/src/conf/vhost/xml_vhost_handler.cpp
index cc0d928..a329fe3 100644
--- a/myserver/src/conf/vhost/xml_vhost_handler.cpp
+++ b/myserver/src/conf/vhost/xml_vhost_handler.cpp
@@ -213,7 +213,7 @@ int XmlVhostHandler::getHostsNumber ()
   Load a log XML node.
  */
 void
-XmlVhostHandler::loadXMLlogData (string name, Vhost* vh, xmlNode* lcur)
+XmlVhostHandler::loadXMLlogData (string name, Vhost *vh, xmlNode *lcur)
 {
   xmlAttr *attr;
   string opt;
@@ -229,61 +229,71 @@ XmlVhostHandler::loadXMLlogData (string name, Vhost* vh, 
xmlNode* lcur)
         }
       attr = attr->next;
     }
+
   string location;
   list<string> filters;
   u_long cycle;
   xmlNode* stream = lcur->children;
-  for (; stream; stream = stream->next, location.assign (""), cycle = 0, 
filters.clear ())
+  for (; stream; stream = stream->next)
     {
-      if (stream->type == XML_ELEMENT_NODE &&
-          !xmlStrcmp (stream->name, (xmlChar const*) "STREAM"))
+      location.assign ("");
+      cycle = 0;
+      filters.clear ();
+
+      if (stream->type != XML_ELEMENT_NODE)
+        continue;
+
+      if (xmlStrcmp (stream->name, (xmlChar const *) "STREAM"))
+        Server::getInstance ()->log (MYSERVER_LOG_MSG_ERROR,
+                                     _("Unexpected element in virtual host 
streams"));
+
+      xmlAttr* streamAttr = stream->properties;
+      while (streamAttr)
         {
-          xmlAttr* streamAttr = stream->properties;
-          while (streamAttr)
-            {
-              if (!strcmp ((char *) streamAttr->name, "location"))
-                location.assign ((char *) streamAttr->children->content);
-              else if (!strcmp ((char *) streamAttr->name, "cycle"))
-                cycle = atoi ((char *) streamAttr->children->content);
+          if (!strcmp ((char *) streamAttr->name, "location"))
+            location.assign ((char *) streamAttr->children->content);
+          else if (!strcmp ((char *) streamAttr->name, "cycle"))
+            cycle = atoi ((char *) streamAttr->children->content);
 
-              streamAttr = streamAttr->next;
-            }
-          xmlNode* filterList = stream->children;
-          for (; filterList; filterList = filterList->next)
+          streamAttr = streamAttr->next;
+        }
+
+      xmlNode* filterList = stream->children;
+      for (; filterList; filterList = filterList->next)
+        {
+          if (filterList->type == XML_ELEMENT_NODE &&
+              !xmlStrcmp (filterList->name, (xmlChar const *) "FILTER"))
             {
-              if (filterList->type == XML_ELEMENT_NODE &&
-                  !xmlStrcmp (filterList->name, (xmlChar const*) "FILTER"))
+              if (filterList->children && filterList->children->content)
                 {
-                  if (filterList->children && filterList->children->content)
-                    {
-                      string filter ((char *) filterList->children->content);
-                      filters.push_back (filter);
-                    }
+                  string filter ((char *) filterList->children->content);
+                  filters.push_back (filter);
                 }
             }
-          int err = 1;
-          string str ("XmlVhostHandler::loadXMLlogData : Unrecognized log 
type");
+        }
 
-          if (!name.compare ("ACCESSLOG"))
-            {
-              err = vh->openAccessLog (location, filters, cycle);
-              vh->setAccessLogOpt (opt.c_str ());
-              if (err)
-                Server::getInstance ()->log (MYSERVER_LOG_MSG_ERROR,
-                                                   _("Error opening %s"), 
location.c_str ());
-            }
-          else if (!name.compare ("WARNINGLOG"))
-            {
-              err = vh->openWarningLog (location, filters, cycle);
-              vh->setWarningLogOpt (opt.c_str ());
-              if (err)
-                Server::getInstance ()->log (MYSERVER_LOG_MSG_ERROR,
-                                                   _("Error opening %s"), 
location.c_str ());
-            }
-          else
+      int err = 1;
+      string str ("XmlVhostHandler::loadXMLlogData : Unrecognized log type");
+
+      if (! name.compare ("ACCESSLOG"))
+        {
+          err = vh->openAccessLog (location, filters, cycle);
+          vh->setAccessLogOpt (opt.c_str ());
+          if (err)
+            Server::getInstance ()->log (MYSERVER_LOG_MSG_ERROR,
+                                         _("Error opening %s"), location.c_str 
());
+        }
+      else if (! name.compare ("WARNINGLOG"))
+        {
+          err = vh->openWarningLog (location, filters, cycle);
+          vh->setWarningLogOpt (opt.c_str ());
+          if (err)
             Server::getInstance ()->log (MYSERVER_LOG_MSG_ERROR,
-                                               _(" Unrecognized log type"));
+                                         _("Error opening %s"), location.c_str 
());
         }
+      else
+        Server::getInstance ()->log (MYSERVER_LOG_MSG_ERROR,
+                                     _(" Unrecognized log type"));
     }
 }
 
@@ -410,7 +420,8 @@ int XmlVhostHandler::load (const char *filename)
               int val = atoi ((char *) lcur->children->content);
               if (val > (1 << 16) || val <= 0)
                 Server::getInstance ()->log (MYSERVER_LOG_MSG_ERROR,
-                      _("Specified invalid port %s"), lcur->children->content);
+                      _("An invalid port was specified: %s"),
+                                             lcur->children->content);
               vh->setPort ((u_short)val);
             }
           else if (!xmlStrcmp (lcur->name, (const xmlChar *) "PROTOCOL"))



commit 39ff3b05edaa51263eceb5fa3eb00b347b28ce5a
Author: Giuseppe Scrivano <address@hidden>
Date:   Fri Mar 11 18:06:55 2011 +0100

    doc: fix example for virtual host log files.

diff --git a/myserver/documentation/virtual_hosts.texi 
b/myserver/documentation/virtual_hosts.texi
index cbc7a40..cd0afff 100644
--- a/myserver/documentation/virtual_hosts.texi
+++ b/myserver/documentation/virtual_hosts.texi
@@ -34,8 +34,12 @@ A sample virtual hosts configuration file looks like:
     <DOCROOT>web</DOCROOT>
     <SYSROOT>system</SYSROOT>
     <HOST>foo.bar.com</HOST>
-    <ACCESSLOG>logs/myServer.log</ACCESSLOG>
-    <WARNINGLOG>logs/myServer.err</WARNINGLOG>
+    <ACCESSLOG>
+      <STREAM location="file://logs/myServer.log" cycle="1048576"/>
+         </ACCESSLOG>
+    <WARNINGLOG>
+      <STREAM location="file://logs/myServer.err" cycle="1048576"/>
+    </WARNINGLOG>
     <ALLOW_CGI>NO</ALLOW_CGI>
   </VHOST>
 </VHOSTS>
@@ -63,9 +67,10 @@ it is your virtual host's name. The optional useRegex="YES"
 means the address would act as a regular expression, not only a fixed
 value.  Multiple host names can be defined for the same virtual host.
 @item <ACCESSLOG>
-it is the access log used by the virtual host
+it is a list of streams where log accesses to the virtual host.
 @item <WARNINGLOG>
-it is the errors log file used by the virtual host.
+it is a list of streams where log warning and error messages for the
+virtual host.
 @end itemize
 
 Log files can have extra options:
@@ -93,8 +98,12 @@ Here is an example of a FTP virtual host:
     <DOCROOT>web</DOCROOT>
     <SYSROOT>system</SYSROOT>
     <HOST>ftp.foo.bar.com</HOST>
-    <ACCESSLOG>logs/myServer.log</ACCESSLOG>
-    <WARNINGLOG>logs/myServer.err</WARNINGLOG>
+    <ACCESSLOG>
+      <STREAM location="file://logs/myServer.log" cycle="1048576"/>
+         </ACCESSLOG>
+    <WARNINGLOG>
+      <STREAM location="file://logs/myServer.err" cycle="1048576"/>
+    </WARNINGLOG>
   </VHOST>
 </VHOSTS>
 @end example



commit 7ad8d37adcdf0ba31a53678a90003a96ba2b9735
Author: Giuseppe Scrivano <address@hidden>
Date:   Fri Mar 11 17:07:12 2011 +0100

    Minor aesthetic changes.

diff --git a/myserver/src/conf/vhost/vhost.cpp 
b/myserver/src/conf/vhost/vhost.cpp
index d0e8e7b..b24b15d 100644
--- a/myserver/src/conf/vhost/vhost.cpp
+++ b/myserver/src/conf/vhost/vhost.cpp
@@ -185,8 +185,8 @@ Vhost::openWarningLog (string location, list<string>& 
filters, u_long cycle)
 int
 Vhost::openLogFiles ()
 {
-  return logManager->count (this, accessLogType) == 0 ||
-    logManager->count (this, warningLogType) == 0;
+  return logManager->count (this, accessLogType) == 0
+    || logManager->count (this, warningLogType) == 0;
 }
 
 /*!
diff --git a/myserver/src/conf/vhost/xml_vhost_handler.cpp 
b/myserver/src/conf/vhost/xml_vhost_handler.cpp
index bd494ed..cc0d928 100644
--- a/myserver/src/conf/vhost/xml_vhost_handler.cpp
+++ b/myserver/src/conf/vhost/xml_vhost_handler.cpp
@@ -220,9 +220,9 @@ XmlVhostHandler::loadXMLlogData (string name, Vhost* vh, 
xmlNode* lcur)
   attr = lcur->properties;
   while (attr)
     {
-      opt.append ((char*)attr->name);
+      opt.append ((char *) attr->name);
       opt.append ("=");
-      opt.append ((char*)attr->children->content);
+      opt.append ((char *) attr->children->content);
       if (attr->next)
         {
           opt.append (",");
@@ -241,14 +241,11 @@ XmlVhostHandler::loadXMLlogData (string name, Vhost* vh, 
xmlNode* lcur)
           xmlAttr* streamAttr = stream->properties;
           while (streamAttr)
             {
-              if (!strcmp ((char*)streamAttr->name, "location"))
-                {
-                  location.assign ((char*)streamAttr->children->content);
-                }
-              else if (!strcmp ((char*)streamAttr->name, "cycle"))
-                {
-                  cycle = atoi ((char*)streamAttr->children->content);
-                }
+              if (!strcmp ((char *) streamAttr->name, "location"))
+                location.assign ((char *) streamAttr->children->content);
+              else if (!strcmp ((char *) streamAttr->name, "cycle"))
+                cycle = atoi ((char *) streamAttr->children->content);
+
               streamAttr = streamAttr->next;
             }
           xmlNode* filterList = stream->children;
@@ -259,7 +256,7 @@ XmlVhostHandler::loadXMLlogData (string name, Vhost* vh, 
xmlNode* lcur)
                 {
                   if (filterList->children && filterList->children->content)
                     {
-                      string filter ((char*)filterList->children->content);
+                      string filter ((char *) filterList->children->content);
                       filters.push_back (filter);
                     }
                 }
@@ -345,11 +342,11 @@ int XmlVhostHandler::load (const char *filename)
                         useRegex = 1;
                 }
 
-              vh->addHost ((const char*)lcur->children->content, useRegex);
+              vh->addHost ((const char *)lcur->children->content, useRegex);
             }
           else if (!xmlStrcmp (lcur->name, (const xmlChar *) "NAME"))
             {
-              vh->setName ((char*)lcur->children->content);
+              vh->setName ((char *) lcur->children->content);
             }
           else if (!xmlStrcmp (lcur->name, (const xmlChar *) "LOCATION"))
             {
@@ -357,7 +354,7 @@ int XmlVhostHandler::load (const char *filename)
 
               for (xmlAttr *attrs = lcur->properties; attrs; attrs = 
attrs->next)
                 if (!xmlStrcmp (attrs->name, (const xmlChar *) "path"))
-                  loc = ((const char*) attrs->children->content);
+                  loc = ((const char *) attrs->children->content);
 
               MimeRecord *record = XmlMimeHandler::readRecord (lcur);
               MimeRecord *prev = vh->addLocationMime (loc, record);
@@ -374,21 +371,21 @@ int XmlVhostHandler::load (const char *filename)
             }
           else if (!xmlStrcmp (lcur->name, (const xmlChar *) "SSL_PRIVATEKEY"))
             {
-              string pk ((char*)lcur->children->content);
+              string pk ((char *) lcur->children->content);
               sslContext->setPrivateKeyFile (pk);
             }
           else if (!xmlStrcmp (lcur->name, (const xmlChar *) 
"SSL_CERTIFICATE"))
             {
-              string certificate ((char*)lcur->children->content);
+              string certificate ((char *) lcur->children->content);
               sslContext->setCertificateFile (certificate);
             }
           else if (!xmlStrcmp (lcur->name, (const xmlChar *) 
"CONNECTIONS_PRIORITY"))
             {
-              vh->setDefaultPriority (atoi ((const 
char*)lcur->children->content));
+              vh->setDefaultPriority (atoi ((const char 
*)lcur->children->content));
             }
           else if (!xmlStrcmp (lcur->name, (const xmlChar *) "SSL_PASSWORD"))
             {
-              string pw ((char*)lcur->children->content);
+              string pw ((char *) lcur->children->content);
               sslContext->setPassword (pw);
             }
           else if (!xmlStrcmp (lcur->name, (const xmlChar *) "IP"))
@@ -406,11 +403,11 @@ int XmlVhostHandler::load (const char *filename)
                   attrs = attrs->next;
                 }
 
-              vh->addIP ((char*)lcur->children->content, useRegex);
+              vh->addIP ((char *) lcur->children->content, useRegex);
             }
           else if (!xmlStrcmp (lcur->name, (const xmlChar *) "PORT"))
             {
-              int val = atoi ((char*)lcur->children->content);
+              int val = atoi ((char *) lcur->children->content);
               if (val > (1 << 16) || val <= 0)
                 Server::getInstance ()->log (MYSERVER_LOG_MSG_ERROR,
                       _("Specified invalid port %s"), lcur->children->content);
@@ -418,28 +415,28 @@ int XmlVhostHandler::load (const char *filename)
             }
           else if (!xmlStrcmp (lcur->name, (const xmlChar *) "PROTOCOL"))
             {
-              char* lastChar = (char*)lcur->children->content;
+              char* lastChar = (char *) lcur->children->content;
               while (*lastChar != '\0')
                 {
                   *lastChar = tolower (*lastChar);
                   lastChar++;
                 }
-              vh->setProtocolName ((char*)lcur->children->content);
+              vh->setProtocolName ((char *) lcur->children->content);
             }
           else if (!xmlStrcmp (lcur->name, (const xmlChar *) "DOCROOT"))
             {
-              char* lastChar = (char*)lcur->children->content;
+              char* lastChar = (char *) lcur->children->content;
               while (*(lastChar+1) != '\0')
                 lastChar++;
 
               if (*lastChar == '\\' || *lastChar == '/')
                 *lastChar = '\0';
 
-              vh->setDocumentRoot ((const char*)lcur->children->content);
+              vh->setDocumentRoot ((const char *)lcur->children->content);
             }
           else if (!xmlStrcmp (lcur->name, (const xmlChar *) "SYSROOT"))
             {
-              char* lastChar = (char*)lcur->children->content;
+              char* lastChar = (char *) lcur->children->content;
 
               while (*(lastChar+1) != '\0')
                 lastChar++;
@@ -447,7 +444,7 @@ int XmlVhostHandler::load (const char *filename)
               if (*lastChar == '\\' || *lastChar == '/')
                 *lastChar = '\0';
 
-              vh->setSystemRoot ((const char*)lcur->children->content);
+              vh->setSystemRoot ((const char *)lcur->children->content);
             }
           else if (!xmlStrcmp (lcur->name, (const xmlChar *) "ACCESSLOG"))
             {
@@ -464,10 +461,10 @@ int XmlVhostHandler::load (const char *filename)
                 {
                   if (!xmlStrcmp (attrs->name, (const xmlChar *) "name")
                       && attrs->children && attrs->children->content)
-                    hnd.assign((const char*) attrs->children->content);
+                    hnd.assign((const char *) attrs->children->content);
                 }
 
-              const char *filename = (const char*) lcur->children->content;
+              const char *filename = (const char *) lcur->children->content;
               MimeManagerHandler *handler =
                 Server::getInstance ()->getMimeManager ()->buildHandler (hnd);
 
@@ -488,7 +485,7 @@ int XmlVhostHandler::load (const char *filename)
             }
           else if (!xmlStrcmp (lcur->name, (const xmlChar *) 
"THROTTLING_RATE"))
             {
-              u_long rate = (u_long)atoi ((char*)lcur->children->content);
+              u_long rate = (u_long)atoi ((char *) lcur->children->content);
               vh->setThrottlingRate (rate);
             }
 
diff --git a/myserver/src/log/stream/file_stream_creator.cpp 
b/myserver/src/log/stream/file_stream_creator.cpp
index 0039e99..70609cd 100644
--- a/myserver/src/log/stream/file_stream_creator.cpp
+++ b/myserver/src/log/stream/file_stream_creator.cpp
@@ -25,11 +25,11 @@ FileStreamCreator::create (FiltersFactory* ff, string 
location,
 {
   File *out = new File ();
   FiltersChain *fc = NULL;
-  char *path = const_cast<char*>(location.c_str ());
   try
     {
       size_t nbw;
-      out->openFile (path, FileStream::defaultFileMask);
+      out->openFile (location.c_str (),
+                     FileStream::defaultFileMask);
       fc = ff->chain (filters, out, &nbw);
       if (fc)
         return new FileStream (ff, cycle, out, fc);

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

Summary of changes:
 myserver/documentation/virtual_hosts.texi       |   21 +++-
 myserver/include/conf/vhost/xml_vhost_handler.h |    2 +-
 myserver/src/conf/vhost/vhost.cpp               |    4 +-
 myserver/src/conf/vhost/xml_vhost_handler.cpp   |  142 ++++++++++++-----------
 myserver/src/log/stream/file_stream_creator.cpp |    4 +-
 5 files changed, 95 insertions(+), 78 deletions(-)


hooks/post-receive
-- 
GNU MyServer



reply via email to

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