From MAILER-DAEMON Wed Aug 04 17:25:23 2010
Received: from mailman by lists.gnu.org with archive (Exim 4.43)
	id 1OglSl-00018s-La
	for mharc-myserver-commit@gnu.org; Wed, 04 Aug 2010 17:25:23 -0400
Received: from [140.186.70.92] (port=40481 helo=eggs.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.43) id 1OglSj-00017o-3T
	for myserver-commit@gnu.org; Wed, 04 Aug 2010 17:25:22 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69)
	(envelope-from <gscrivano@gnu.org>) id 1OglSi-0005d2-3M
	for myserver-commit@gnu.org; Wed, 04 Aug 2010 17:25:20 -0400
Received: from colonialone.fsf.org ([140.186.70.51]:48124
	helo=internal.in.savannah.gnu.org)
	by eggs.gnu.org with esmtp (Exim 4.69)
	(envelope-from <gscrivano@gnu.org>) id 1OglSi-0005cy-1y
	for myserver-commit@gnu.org; Wed, 04 Aug 2010 17:25:20 -0400
Received: from [10.1.0.108] (helo=vcs-noshell.in.savannah.gnu.org)
	by internal.in.savannah.gnu.org with esmtp (Exim 4.69)
	(envelope-from <gscrivano@gnu.org>) id 1OglSh-0001Sb-Kl
	for myserver-commit@gnu.org; Wed, 04 Aug 2010 21:25:19 +0000
Received: from gscrivano by vcs-noshell.in.savannah.gnu.org with local (Exim
	4.69) (envelope-from <gscrivano@savannah.gnu.org>)
	id 1OglSb-0004dQ-TC
	for myserver-commit@gnu.org; Wed, 04 Aug 2010 21:25:19 +0000
To: myserver-commit@gnu.org
X-Git-Refname: refs/heads/master
X-Git-Reftype: branch
X-Git-Oldrev: 1d031d5204a745aa28f34784aeeffccbe28f974c
X-Git-Newrev: 8b416844de280703dd1e583efdab9633ae038afe
Message-Id: <E1OglSb-0004dQ-TC@vcs-noshell.in.savannah.gnu.org>
From: Giuseppe Scrivano <gscrivano@gnu.org>
Date: Wed, 04 Aug 2010 21:25:18 +0000
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2)
Subject: [myserver-commit] [SCM] GNU MyServer branch, master,
	updated. v0.9.2-273-g8b41684
X-BeenThere: myserver-commit@gnu.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: myserver-commit.gnu.org
List-Unsubscribe: <http://lists.gnu.org/mailman/listinfo/myserver-commit>,
	<mailto:myserver-commit-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/myserver-commit>
List-Post: <mailto:myserver-commit@gnu.org>
List-Help: <mailto:myserver-commit-request@gnu.org?subject=help>
List-Subscribe: <http://lists.gnu.org/mailman/listinfo/myserver-commit>,
	<mailto:myserver-commit-request@gnu.org?subject=subscribe>
X-List-Received-Date: Wed, 04 Aug 2010 21:25:22 -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  8b416844de280703dd1e583efdab9633ae038afe (commit)
      from  1d031d5204a745aa28f34784aeeffccbe28f974c (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 8b416844de280703dd1e583efdab9633ae038afe
Author: Giuseppe Scrivano <gscrivano@gnu.org>
Date:   Wed Aug 4 23:25:06 2010 +0200

    Print the configuration files used.

diff --git a/myserver/src/server/server.cpp b/myserver/src/server/server.cpp
index 0896eb0..312a80e 100644
--- a/myserver/src/server/server.cpp
+++ b/myserver/src/server/server.cpp
@@ -204,7 +204,8 @@ void Server::start (string &mainConf, string &mimeConf, string &vhostConf,
         return;
       }
 
-    log (MYSERVER_LOG_MSG_INFO, _("Loading server configuration..."));
+    log (MYSERVER_LOG_MSG_INFO, _("Loading server configuration from %s..."),
+         mainConf.c_str ());
 
     if (postLoad ())
       {
@@ -305,7 +306,8 @@ int Server::postLoad ()
     return -1;
 
   /* Load the MIME types.  */
-  log (MYSERVER_LOG_MSG_INFO, _("Loading MIME types..."));
+  log (MYSERVER_LOG_MSG_INFO, _("Loading MIME types from %s..."),
+       mimeConfigurationFile.c_str ());
 
   string handlerStr (getData ("server.mime_handler", "xml"));
   mimeManager.setDefaultHandler (handlerStr);
@@ -366,6 +368,9 @@ int Server::loadVHostConf ()
                                        vhostConfigurationFile.c_str ());
 
   /* Load the virtual hosts configuration.  */
+  log (MYSERVER_LOG_MSG_INFO, _("Loading virtual hosts from %s..."),
+       vhostLocation);
+
   if (vhostHandler->load (vhostLocation))
     {
       log (MYSERVER_LOG_MSG_ERROR,

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

Summary of changes:
 myserver/src/server/server.cpp |    9 +++++++--
 1 files changed, 7 insertions(+), 2 deletions(-)


hooks/post-receive
-- 
GNU MyServer


From MAILER-DAEMON Wed Aug 04 19:11:40 2010
Received: from mailman by lists.gnu.org with archive (Exim 4.43)
	id 1Ogn7c-0004so-De
	for mharc-myserver-commit@gnu.org; Wed, 04 Aug 2010 19:11:40 -0400
Received: from [140.186.70.92] (port=34680 helo=eggs.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.43) id 1Ogn7Z-0004sV-08
	for myserver-commit@gnu.org; Wed, 04 Aug 2010 19:11:38 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69)
	(envelope-from <gscrivano@gnu.org>) id 1Ogn7X-0002l1-Ab
	for myserver-commit@gnu.org; Wed, 04 Aug 2010 19:11:36 -0400
Received: from colonialone.fsf.org ([140.186.70.51]:60922
	helo=internal.in.savannah.gnu.org)
	by eggs.gnu.org with esmtp (Exim 4.69)
	(envelope-from <gscrivano@gnu.org>) id 1Ogn7X-0002kv-8v
	for myserver-commit@gnu.org; Wed, 04 Aug 2010 19:11:35 -0400
Received: from [10.1.0.108] (helo=vcs-noshell.in.savannah.gnu.org)
	by internal.in.savannah.gnu.org with esmtp (Exim 4.69)
	(envelope-from <gscrivano@gnu.org>) id 1Ogn7W-0002jV-V6
	for myserver-commit@gnu.org; Wed, 04 Aug 2010 23:11:34 +0000
Received: from gscrivano by vcs-noshell.in.savannah.gnu.org with local (Exim
	4.69) (envelope-from <gscrivano@savannah.gnu.org>)
	id 1Ogn7U-0002Bv-6Q
	for myserver-commit@gnu.org; Wed, 04 Aug 2010 23:11:34 +0000
To: myserver-commit@gnu.org
X-Git-Refname: refs/heads/master
X-Git-Reftype: branch
X-Git-Oldrev: 8b416844de280703dd1e583efdab9633ae038afe
X-Git-Newrev: 4465064d83e08af1358e15a3679a125bc4ea99c6
Message-Id: <E1Ogn7U-0002Bv-6Q@vcs-noshell.in.savannah.gnu.org>
From: Giuseppe Scrivano <gscrivano@gnu.org>
Date: Wed, 04 Aug 2010 23:11:34 +0000
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2)
Subject: [myserver-commit] [SCM] GNU MyServer branch, master,
	updated. v0.9.2-274-g4465064
X-BeenThere: myserver-commit@gnu.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: myserver-commit.gnu.org
List-Unsubscribe: <http://lists.gnu.org/mailman/listinfo/myserver-commit>,
	<mailto:myserver-commit-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/myserver-commit>
List-Post: <mailto:myserver-commit@gnu.org>
List-Help: <mailto:myserver-commit-request@gnu.org?subject=help>
List-Subscribe: <http://lists.gnu.org/mailman/listinfo/myserver-commit>,
	<mailto:myserver-commit-request@gnu.org?subject=subscribe>
X-List-Received-Date: Wed, 04 Aug 2010 23:11:39 -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  4465064d83e08af1358e15a3679a125bc4ea99c6 (commit)
      from  8b416844de280703dd1e583efdab9633ae038afe (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 4465064d83e08af1358e15a3679a125bc4ea99c6
Author: Giuseppe Scrivano <gscrivano@gnu.org>
Date:   Thu Aug 5 01:11:06 2010 +0200

    Notify if an extension is used more than once.

diff --git a/myserver/include/conf/mime/mime_manager.h b/myserver/include/conf/mime/mime_manager.h
index 72fa38d..9e0a962 100644
--- a/myserver/include/conf/mime/mime_manager.h
+++ b/myserver/include/conf/mime/mime_manager.h
@@ -50,6 +50,7 @@
 # include <list>
 
 using namespace std;
+class ServerLogger;
 
 struct MimeRecord
 {
@@ -81,6 +82,19 @@ public:
   virtual MimeRecord* getMIME (string const &file)
   {return getMIME (file.c_str ());}
   virtual u_long reload (){return 0;}
+
+  ServerLogger *getLogger ()
+  {
+    return logger;
+  }
+
+  void setLogger (ServerLogger *sl)
+  {
+    logger = sl;
+  }
+
+protected:
+  ServerLogger *logger;
 };
 
 
@@ -106,6 +120,19 @@ public:
   void registerBuilder (string &name, MAKE_HANDLER builder);
   MimeManagerHandler *buildHandler (string &name);
 
+  ServerLogger *getLogger ()
+  {
+    return logger;
+  }
+
+  void setLogger (ServerLogger *sl)
+  {
+    logger = sl;
+  }
+
+protected:
+  ServerLogger *logger;
+
 private:
   HashMap<string, MAKE_HANDLER> builders;
   MimeManagerHandler *defHandler;
diff --git a/myserver/include/server/server.h b/myserver/include/server/server.h
index 1663545..e9a7038 100644
--- a/myserver/include/server/server.h
+++ b/myserver/include/server/server.h
@@ -63,7 +63,17 @@ using namespace std;
 
 class XmlValidator;
 
-class Server : public MulticastRegistry<string, void*, int>
+
+class ServerLogger
+{
+public:
+  virtual int log (LoggingLevel level, const char *fmt, ...) = 0;
+  virtual int log (char const*, LoggingLevel level = MYSERVER_LOG_MSG_INFO) = 0;
+  virtual int log (string const &str) = 0;
+};
+
+
+class Server : public MulticastRegistry<string, void*, int>, ServerLogger
 {
 public:
 
@@ -127,9 +137,9 @@ public:
   void stop ();
   void finalCleanup ();
   int terminate ();
-  int log (LoggingLevel level, const char *fmt, ...);
-  int log (char const*, LoggingLevel level = MYSERVER_LOG_MSG_INFO);
-  int log (string const &str)
+  virtual int log (LoggingLevel level, const char *fmt, ...);
+  virtual int log (char const*, LoggingLevel level = MYSERVER_LOG_MSG_INFO);
+  virtual int log (string const &str)
   {return log (str.c_str ());};
   int setLogLocation (string);
   u_long getBuffersize ();
diff --git a/myserver/src/conf/mime/mime_manager.cpp b/myserver/src/conf/mime/mime_manager.cpp
index e3908e7..1660b4f 100644
--- a/myserver/src/conf/mime/mime_manager.cpp
+++ b/myserver/src/conf/mime/mime_manager.cpp
@@ -53,18 +53,18 @@ MimeRecord::~MimeRecord ()
 /*!
   Add a filter to the list of filters to apply on this MIME type.
   Return zero if the filters was not added.
- */
+*/
 int MimeRecord::addFilter (const char* n, bool acceptDuplicate)
 {
   if (!acceptDuplicate)
-  {
-    list<string>::iterator i = filters.begin ();
-    for (; i != filters.end (); i++)
     {
-      if (!stringcmpi (*i, n))
-        return 0;
+      list<string>::iterator i = filters.begin ();
+      for (; i != filters.end (); i++)
+        {
+          if (!stringcmpi (*i, n))
+            return 0;
+        }
     }
-  }
 
   filters.push_back (n);
   return 1;
@@ -80,18 +80,14 @@ MimeRecord::MimeRecord (MimeRecord& m)
   filters.clear ();
 
   for ( ; i != m.filters.end (); i++)
-  {
     filters.push_back (*i);
-  }
 
   i = m.extensions.begin ();
 
   extensions.clear ();
 
   for ( ; i != m.extensions.end (); i++)
-  {
     filters.push_back (*i);
-  }
 
   selfExecuted = m.selfExecuted;
   mimeType.assign (m.mimeType);
@@ -111,15 +107,13 @@ void MimeRecord::clear ()
   cgiManager.assign ("");
 
   for (list<Regex*>::iterator it = pathRegex.begin ();
-       it != pathRegex.end ();
-       it++)
-  {
+       it != pathRegex.end (); it++)
     delete *it;
-  }
 
   HashMap<string, NodeTree<string>*>::Iterator it = hashedData.begin ();
   for (;it != hashedData.end (); it++)
     delete (*it);
+
   hashedData.clear ();
 
   pathRegex.clear ();
@@ -205,6 +199,7 @@ MimeRecord *MimeManager::getMIME (const char *filename, const char *handler)
 void MimeManager::registerHandler (string &name, MimeManagerHandler *handler)
 {
   MimeManagerHandler *old = handlers.put (name, handler);
+  handler->setLogger (getLogger ());
   if (old)
     delete old;
 }
diff --git a/myserver/src/conf/mime/xml_mime_handler.cpp b/myserver/src/conf/mime/xml_mime_handler.cpp
index a93348b..eb686e3 100644
--- a/myserver/src/conf/mime/xml_mime_handler.cpp
+++ b/myserver/src/conf/mime/xml_mime_handler.cpp
@@ -46,7 +46,7 @@ void XmlMimeHandler::registerBuilder (MimeManager& manager)
 
 /*!
   Get the name of the used file.
- */
+*/
 const char *XmlMimeHandler::getFilename ()
 {
   return filename.c_str ();
@@ -54,7 +54,7 @@ const char *XmlMimeHandler::getFilename ()
 
 /*!
   Read a MIME record from a XML node.
- */
+*/
 MimeRecord *XmlMimeHandler::readRecord (xmlNodePtr node)
 {
   xmlNodePtr lcur = node->children;
@@ -63,102 +63,102 @@ MimeRecord *XmlMimeHandler::readRecord (xmlNodePtr node)
   MimeRecord *rc = new MimeRecord;
 
   for (attrs = node->properties; attrs; attrs = attrs->next)
-  {
-    if (!xmlStrcmp (attrs->name, (const xmlChar *)"handler") &&
-        attrs->children && attrs->children->content)
-      rc->cmdName.assign ((const char*)attrs->children->content);
-
-    if (!xmlStrcmp (attrs->name, (const xmlChar *)"self") &&
-        attrs->children && attrs->children->content)
-      rc->selfExecuted = xmlStrcmp (attrs->children->content,
-                                    (const xmlChar *)"YES");
-
-    if (!xmlStrcmp (attrs->name, (const xmlChar *)"mime") &&
-        attrs->children && attrs->children->content)
-      rc->mimeType.assign ((const char*)attrs->children->content);
-
-    if (!xmlStrcmp (attrs->name, (const xmlChar *)"param") &&
-        attrs->children && attrs->children->content)
-      rc->cgiManager.assign ((const char*)attrs->children->content);
-  }
+    {
+      if (!xmlStrcmp (attrs->name, (const xmlChar *)"handler") &&
+          attrs->children && attrs->children->content)
+        rc->cmdName.assign ((const char*)attrs->children->content);
+
+      if (!xmlStrcmp (attrs->name, (const xmlChar *)"self") &&
+          attrs->children && attrs->children->content)
+        rc->selfExecuted = xmlStrcmp (attrs->children->content,
+                                      (const xmlChar *)"YES");
+
+      if (!xmlStrcmp (attrs->name, (const xmlChar *)"mime") &&
+          attrs->children && attrs->children->content)
+        rc->mimeType.assign ((const char*)attrs->children->content);
+
+      if (!xmlStrcmp (attrs->name, (const xmlChar *)"param") &&
+          attrs->children && attrs->children->content)
+        rc->cgiManager.assign ((const char*)attrs->children->content);
+    }
 
   for ( ;lcur; lcur = lcur->next)
-  {
-    if (lcur->name && !xmlStrcmp (lcur->name, (const xmlChar *)"EXTENSION"))
     {
-      for (attrs = lcur->properties; attrs; attrs = attrs->next)
-      {
-        if (!xmlStrcmp (attrs->name, (const xmlChar *)"value") &&
-            attrs->children && attrs->children->content)
+      if (lcur->name && !xmlStrcmp (lcur->name, (const xmlChar *)"EXTENSION"))
         {
-          string ext ((const char*)attrs->children->content);
-          rc->extensions.push_back (ext);
+          for (attrs = lcur->properties; attrs; attrs = attrs->next)
+            {
+              if (!xmlStrcmp (attrs->name, (const xmlChar *)"value") &&
+                  attrs->children && attrs->children->content)
+                {
+                  string ext ((const char*)attrs->children->content);
+                  rc->extensions.push_back (ext);
+                }
+            }
         }
-      }
-    }
-
-    if (lcur->name && !xmlStrcmp (lcur->name, (const xmlChar *)"DEFINE"))
-    {
-      const char *name = NULL;
-      const char *value = NULL;
-
-      for (attrs = lcur->properties; attrs; attrs = attrs->next)
-      {
-        if (!xmlStrcmp (attrs->name, (const xmlChar *)"name") &&
-            attrs->children && attrs->children->content)
-          name = (const char*)attrs->children->content;
-
-        if (!xmlStrcmp (attrs->name, (const xmlChar *)"value") &&
-            attrs->children && attrs->children->content)
-          value = (const char*)attrs->children->content;
-      }
-
-      if (name && value)
-      {
-        string key (name);
-        string val (value);
-        NodeTree<string> *nt = new NodeTree<string> (val);
-        rc->hashedData.put (key, nt);
-      }
-    }
 
-    if (lcur->name && !xmlStrcmp (lcur->name, (const xmlChar *)"PATH"))
-    {
-      for (attrs = lcur->properties; attrs; attrs = attrs->next)
-      {
-        if (!xmlStrcmp (attrs->name, (const xmlChar *)"regex") &&
-            attrs->children && attrs->children->content)
+      if (lcur->name && !xmlStrcmp (lcur->name, (const xmlChar *)"DEFINE"))
         {
-          Regex *r = new Regex;
+          const char *name = NULL;
+          const char *value = NULL;
 
-          if (r->compile ((const char*)attrs->children->content, 0))
+          for (attrs = lcur->properties; attrs; attrs = attrs->next)
             {
-              delete r;
-              return NULL;
+              if (!xmlStrcmp (attrs->name, (const xmlChar *)"name") &&
+                  attrs->children && attrs->children->content)
+                name = (const char*)attrs->children->content;
+
+              if (!xmlStrcmp (attrs->name, (const xmlChar *)"value") &&
+                  attrs->children && attrs->children->content)
+                value = (const char*)attrs->children->content;
             }
 
-          rc->pathRegex.push_back (r);
+          if (name && value)
+            {
+              string key (name);
+              string val (value);
+              NodeTree<string> *nt = new NodeTree<string> (val);
+              rc->hashedData.put (key, nt);
+            }
         }
-      }
-    }
 
-    if (lcur->name && !xmlStrcmp (lcur->name, (const xmlChar *)"FILTER"))
-    {
-      for (attrs = lcur->properties; attrs; attrs = attrs->next)
-      {
-        if (!xmlStrcmp (attrs->name, (const xmlChar *)"value") &&
-            attrs->children && attrs->children->content)
-          rc->addFilter ((const char*)attrs->children->content);
-      }
+      if (lcur->name && !xmlStrcmp (lcur->name, (const xmlChar *)"PATH"))
+        {
+          for (attrs = lcur->properties; attrs; attrs = attrs->next)
+            {
+              if (!xmlStrcmp (attrs->name, (const xmlChar *)"regex") &&
+                  attrs->children && attrs->children->content)
+                {
+                  Regex *r = new Regex;
+
+                  if (r->compile ((const char*)attrs->children->content, 0))
+                    {
+                      delete r;
+                      return NULL;
+                    }
+
+                  rc->pathRegex.push_back (r);
+                }
+            }
+        }
+
+      if (lcur->name && !xmlStrcmp (lcur->name, (const xmlChar *)"FILTER"))
+        {
+          for (attrs = lcur->properties; attrs; attrs = attrs->next)
+            {
+              if (!xmlStrcmp (attrs->name, (const xmlChar *)"value") &&
+                  attrs->children && attrs->children->content)
+                rc->addFilter ((const char*)attrs->children->content);
+            }
+        }
     }
-  }
 
   return rc;
 }
 
 /*!
   Reload using the same configuration file.
- */
+*/
 u_long XmlMimeHandler::reload ()
 {
   if (!filename.length ())
@@ -170,7 +170,7 @@ u_long XmlMimeHandler::reload ()
 /*!
   Load the MIME types from a XML file. Returns the number of
   MIME types loaded successfully.
- */
+*/
 u_long XmlMimeHandler::load (const char *fn)
 {
   XmlParser parser;
@@ -191,7 +191,7 @@ u_long XmlMimeHandler::load (const char *fn)
 /*!
   Load the MIME types from a XML parser object. Returns the number
   of MIME types loaded successfully.
- */
+*/
 u_long XmlMimeHandler::load (XmlParser* parser)
 {
   xmlNodePtr node;
@@ -203,15 +203,14 @@ u_long XmlMimeHandler::load (XmlParser* parser)
   node = doc->children->children;
 
   for (; node; node = node->next)
-  {
-    if (xmlStrcmp (node->name, (const xmlChar *)"MIME"))
-      continue;
-
-    MimeRecord *rc = readRecord (node);
+    {
+      if (xmlStrcmp (node->name, (const xmlChar *) "MIME"))
+        continue;
 
-    if (rc)
-      addRecord (rc);
-  }
+      MimeRecord *rc = readRecord (node);
+      if (rc)
+        addRecord (rc);
+    }
 
   /*! Store the loaded status. */
   loaded = true;
@@ -221,7 +220,7 @@ u_long XmlMimeHandler::load (XmlParser* parser)
 
 /*!
   Destroy the object.
- */
+*/
 XmlMimeHandler::~XmlMimeHandler ()
 {
   clean ();
@@ -229,29 +228,30 @@ XmlMimeHandler::~XmlMimeHandler ()
 
 /*!
   Clean the memory allocated by the structure.
- */
+*/
 void XmlMimeHandler::clean ()
 {
   if (loaded)
-  {
-    loaded = false;
-    filename = "";
-    clearRecords ();
-  }
+    {
+      loaded = false;
+      filename = "";
+      clearRecords ();
+    }
 }
 
 /*!
   Constructor of the class.
- */
+*/
 XmlMimeHandler::XmlMimeHandler ()
 {
+  logger = NULL;
   loaded = false;
 }
 
 /*!
   Add a new record.
   \return Return the position for the new record.
- */
+*/
 int XmlMimeHandler::addRecord (MimeRecord *mr)
 {
   u_long position = records.size ();
@@ -266,7 +266,14 @@ int XmlMimeHandler::addRecord (MimeRecord *mr)
 #ifdef MIME_LOWER_CASE
       transform (ext.begin (), ext.end (), ext.begin (), ::tolower);
 #endif
-      extIndex.put (ext, position);
+      if (extIndex.put (ext, position))
+        {
+          ServerLogger *sl = getLogger ();
+        if (sl)
+          sl->log (MYSERVER_LOG_MSG_WARNING,
+                   _("XmlMimeHandler: Duplicate extension: %s"), ext.c_str ());
+        }
+
     }
 
   for (list<Regex*>::iterator it = mr->pathRegex.begin ();
@@ -284,7 +291,7 @@ int XmlMimeHandler::addRecord (MimeRecord *mr)
 
 /*!
   Remove all the stored records.
- */
+*/
 void XmlMimeHandler::clearRecords ()
 {
   vector <MimeRecord*>::iterator i = records.begin ();
@@ -315,7 +322,7 @@ void XmlMimeHandler::clearRecords ()
   \param filename Find the MIME type for this file.
   \param handler If specified, indicate an external handler to use
   if the mime cannot be found locally.
- */
+*/
 MimeRecord *XmlMimeHandler::getMIME (const char *filename)
 {
   string ext;
@@ -324,16 +331,16 @@ MimeRecord *XmlMimeHandler::getMIME (const char *filename)
   for (list<PathRegex*>::iterator it = pathRegex.begin ();
        it != pathRegex.end ();
        it++)
-  {
-    PathRegex *pr = *it;
-    regmatch_t pm;
-
-    if (pr->regex->exec (filename, 1, &pm, 0) == 0)
     {
-      pos = pr->record;
-      break;
+      PathRegex *pr = *it;
+      regmatch_t pm;
+
+      if (pr->regex->exec (filename, 1, &pm, 0) == 0)
+        {
+          pos = pr->record;
+          break;
+        }
     }
-  }
 
   if (pos == 0)
     {
@@ -349,7 +356,7 @@ MimeRecord *XmlMimeHandler::getMIME (const char *filename)
 
 /*!
   Returns the number of MIME types loaded.
- */
+*/
 u_long XmlMimeHandler::getNumMIMELoaded ()
 {
   return records.size () -1;
diff --git a/myserver/src/server/server.cpp b/myserver/src/server/server.cpp
index 312a80e..da254f0 100644
--- a/myserver/src/server/server.cpp
+++ b/myserver/src/server/server.cpp
@@ -389,6 +389,7 @@ void Server::loadStaticComponents ()
 {
   string xml ("xml");
 
+  mimeManager.setLogger (this);
   mimeManager.registerHandler (xml, new XmlMimeHandler ());
 
   XmlVhostHandler::registerBuilder (vhostManager);

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

Summary of changes:
 myserver/include/conf/mime/mime_manager.h   |   27 ++++
 myserver/include/server/server.h            |   18 ++-
 myserver/src/conf/mime/mime_manager.cpp     |   25 ++--
 myserver/src/conf/mime/xml_mime_handler.cpp |  225 ++++++++++++++-------------
 myserver/src/server/server.cpp              |    1 +
 5 files changed, 168 insertions(+), 128 deletions(-)


hooks/post-receive
-- 
GNU MyServer


From MAILER-DAEMON Thu Aug 05 13:49:01 2010
Received: from mailman by lists.gnu.org with archive (Exim 4.43)
	id 1Oh4Yv-0002FD-8f
	for mharc-myserver-commit@gnu.org; Thu, 05 Aug 2010 13:49:01 -0400
Received: from [140.186.70.92] (port=37152 helo=eggs.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.43) id 1Oh4Yk-0001Lp-Uf
	for myserver-commit@gnu.org; Thu, 05 Aug 2010 13:48:57 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69)
	(envelope-from <gscrivano@gnu.org>) id 1Oh4Xg-0006c1-Sk
	for myserver-commit@gnu.org; Thu, 05 Aug 2010 13:47:55 -0400
Received: from colonialone.fsf.org ([140.186.70.51]:48232
	helo=internal.in.savannah.gnu.org)
	by eggs.gnu.org with esmtp (Exim 4.69)
	(envelope-from <gscrivano@gnu.org>) id 1Oh4Xg-0006ZV-RV
	for myserver-commit@gnu.org; Thu, 05 Aug 2010 13:47:44 -0400
Received: from [10.1.0.108] (helo=vcs-noshell.in.savannah.gnu.org)
	by internal.in.savannah.gnu.org with esmtp (Exim 4.69)
	(envelope-from <gscrivano@gnu.org>) id 1Oh1zV-0005n0-GL
	for myserver-commit@gnu.org; Thu, 05 Aug 2010 15:04:17 +0000
Received: from gscrivano by vcs-noshell.in.savannah.gnu.org with local (Exim
	4.69) (envelope-from <gscrivano@savannah.gnu.org>)
	id 1Oh1zQ-00082N-Pm
	for myserver-commit@gnu.org; Thu, 05 Aug 2010 15:04:17 +0000
To: myserver-commit@gnu.org
X-Git-Refname: refs/heads/master
X-Git-Reftype: branch
X-Git-Oldrev: 4465064d83e08af1358e15a3679a125bc4ea99c6
X-Git-Newrev: 7a0cb3b6917dbd92bb16b9bda3e92c5395937f07
Message-Id: <E1Oh1zQ-00082N-Pm@vcs-noshell.in.savannah.gnu.org>
From: Giuseppe Scrivano <gscrivano@gnu.org>
Date: Thu, 05 Aug 2010 15:04:16 +0000
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2)
Subject: [myserver-commit] [SCM] GNU MyServer branch, master,
	updated. v0.9.2-275-g7a0cb3b
X-BeenThere: myserver-commit@gnu.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: myserver-commit.gnu.org
List-Unsubscribe: <http://lists.gnu.org/mailman/listinfo/myserver-commit>,
	<mailto:myserver-commit-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/myserver-commit>
List-Post: <mailto:myserver-commit@gnu.org>
List-Help: <mailto:myserver-commit-request@gnu.org?subject=help>
List-Subscribe: <http://lists.gnu.org/mailman/listinfo/myserver-commit>,
	<mailto:myserver-commit-request@gnu.org?subject=subscribe>
X-List-Received-Date: Thu, 05 Aug 2010 17:48:58 -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  7a0cb3b6917dbd92bb16b9bda3e92c5395937f07 (commit)
      from  4465064d83e08af1358e15a3679a125bc4ea99c6 (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 7a0cb3b6917dbd92bb16b9bda3e92c5395937f07
Author: Giuseppe Scrivano <gscrivano@gnu.org>
Date:   Thu Aug 5 17:03:51 2010 +0200

    Detect the CGI header correctly.

diff --git a/myserver/src/http_handler/cgi/cgi.cpp b/myserver/src/http_handler/cgi/cgi.cpp
index 5695687..9c1de7a 100644
--- a/myserver/src/http_handler/cgi/cgi.cpp
+++ b/myserver/src/http_handler/cgi/cgi.cpp
@@ -381,6 +381,7 @@ int Cgi::sendHeader (HttpThreadContext *td, Pipe &stdOutFile, FiltersChain &chai
   /* Parse initial chunks of data looking for the HTTP header.  */
   while (!headerCompleted && !nph)
     {
+      u_long headerChecked = 4;
       u_long timeout = td->http->getTimeout ();
       u_long ticks = getTicks () - procStartTime;
       bool term;
@@ -425,8 +426,7 @@ int Cgi::sendHeader (HttpThreadContext *td, Pipe &stdOutFile, FiltersChain &chai
           return 1;
         }
 
-      for (u_long i = std::max (0UL, (headerOffset - nBytesRead - 10));
-           i < headerOffset; i++)
+      for (u_long i = headerChecked; i < headerOffset; i++)
         {
           char *buff = td->auxiliaryBuffer->getBuffer ();
           if ((buff[i] == '\r') && (buff[i+1] == '\n')
@@ -443,6 +443,8 @@ int Cgi::sendHeader (HttpThreadContext *td, Pipe &stdOutFile, FiltersChain &chai
               break;
             }
         }
+
+      headerChecked = std::max (4UL, headerOffset);
     }
 
   /* Send the header.  */

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

Summary of changes:
 myserver/src/http_handler/cgi/cgi.cpp |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)


hooks/post-receive
-- 
GNU MyServer


From MAILER-DAEMON Thu Aug 05 20:07:17 2010
Received: from mailman by lists.gnu.org with archive (Exim 4.43)
	id 1OhASz-0008F2-IL
	for mharc-myserver-commit@gnu.org; Thu, 05 Aug 2010 20:07:17 -0400
Received: from [140.186.70.92] (port=51231 helo=eggs.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.43) id 1OhASw-0008C4-Dq
	for myserver-commit@gnu.org; Thu, 05 Aug 2010 20:07:15 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69)
	(envelope-from <gscrivano@gnu.org>) id 1OhASu-0003KR-BN
	for myserver-commit@gnu.org; Thu, 05 Aug 2010 20:07:14 -0400
Received: from colonialone.fsf.org ([140.186.70.51]:54285
	helo=internal.in.savannah.gnu.org)
	by eggs.gnu.org with esmtp (Exim 4.69)
	(envelope-from <gscrivano@gnu.org>) id 1OhASu-0003KM-8a
	for myserver-commit@gnu.org; Thu, 05 Aug 2010 20:07:12 -0400
Received: from [10.1.0.108] (helo=vcs-noshell.in.savannah.gnu.org)
	by internal.in.savannah.gnu.org with esmtp (Exim 4.69)
	(envelope-from <gscrivano@gnu.org>) id 1OhASt-00046p-W5
	for myserver-commit@gnu.org; Fri, 06 Aug 2010 00:07:12 +0000
Received: from gscrivano by vcs-noshell.in.savannah.gnu.org with local (Exim
	4.69) (envelope-from <gscrivano@savannah.gnu.org>)
	id 1OhASp-0006jG-2I
	for myserver-commit@gnu.org; Fri, 06 Aug 2010 00:07:11 +0000
To: myserver-commit@gnu.org
X-Git-Refname: refs/heads/master
X-Git-Reftype: branch
X-Git-Oldrev: 7a0cb3b6917dbd92bb16b9bda3e92c5395937f07
X-Git-Newrev: 4bc007332aacd6875146985a77fe47dfaf747cfa
Message-Id: <E1OhASp-0006jG-2I@vcs-noshell.in.savannah.gnu.org>
From: Giuseppe Scrivano <gscrivano@gnu.org>
Date: Fri, 06 Aug 2010 00:07:11 +0000
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2)
Subject: [myserver-commit] [SCM] GNU MyServer branch, master,
	updated. v0.9.2-278-g4bc0073
X-BeenThere: myserver-commit@gnu.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: myserver-commit.gnu.org
List-Unsubscribe: <http://lists.gnu.org/mailman/listinfo/myserver-commit>,
	<mailto:myserver-commit-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/myserver-commit>
List-Post: <mailto:myserver-commit@gnu.org>
List-Help: <mailto:myserver-commit-request@gnu.org?subject=help>
List-Subscribe: <http://lists.gnu.org/mailman/listinfo/myserver-commit>,
	<mailto:myserver-commit-request@gnu.org?subject=subscribe>
X-List-Received-Date: Fri, 06 Aug 2010 00:07:16 -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  4bc007332aacd6875146985a77fe47dfaf747cfa (commit)
       via  7af37156b33d4e374013b0bd6bb040d468f03f17 (commit)
       via  3b7670c5c9cd033d25f88b00a43496ddfb0d30b8 (commit)
      from  7a0cb3b6917dbd92bb16b9bda3e92c5395937f07 (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 4bc007332aacd6875146985a77fe47dfaf747cfa
Author: Giuseppe Scrivano <gscrivano@gnu.org>
Date:   Fri Aug 6 02:06:57 2010 +0200

    FilesCache: general refactoring.

diff --git a/myserver/include/base/files_cache/cached_file_buffer.h b/myserver/include/base/files_cache/cached_file_buffer.h
index a8c80c8..5473fb6 100644
--- a/myserver/include/base/files_cache/cached_file_buffer.h
+++ b/myserver/include/base/files_cache/cached_file_buffer.h
@@ -48,7 +48,25 @@ public:
 
   const char* getFilename (){return filename.c_str ();}
   const char* getBuffer (){return buffer;}
+
+  time_t getMtime () {return mtime;}
+
+  bool isSymlink () {return S_ISLNK (fstat.st_mode);}
+
+  bool revalidate (const char *res);
+
+  void refreshExpireTime (u_long now) {expireTime = now + MYSERVER_SEC (5);}
+  u_long getExpireTime () {return expireTime;}
 protected:
+
+  /*! Last mtime for this file.  */
+  time_t mtime;
+
+  /*! Specify when to check again the entry validity.  */
+  u_long expireTime;
+
+  struct stat fstat;
+
   Mutex mutex;
   char *buffer;
   u_long refCounter;
diff --git a/myserver/include/base/files_cache/cached_file_factory.h b/myserver/include/base/files_cache/cached_file_factory.h
index f012a62..449e333 100644
--- a/myserver/include/base/files_cache/cached_file_factory.h
+++ b/myserver/include/base/files_cache/cached_file_factory.h
@@ -45,7 +45,6 @@ public:
   void setSize (u_long m){size = m;}
   u_long getSize (){return size;}
   u_long getUsedSize (){return usedSize;}
-  u_long getUsed (){return used;}
 
   File *open (const char* file, int flags = 0);
   void nullReferences (CachedFileBuffer* cfb);
@@ -66,9 +65,6 @@ protected:
   /*! Size currently used.  */
   u_long usedSize;
 
-  /*! Number of times the cache was used.  */
-  u_long used;
-
   /*! Cache creation time.  */
   u_long created;
 
@@ -80,28 +76,20 @@ protected:
 
   struct CachedFileFactoryRecord
   {
-    struct stat fstat;
-
     /*! Number of times the cache record was used.  */
     u_long used;
 
     /*! Cache record creation time.  */
     u_long created;
 
-    /*! Last mtime for this file.  */
-    time_t mtime;
-
-    /*! Last time we checked for the mtime of the buffered file.  */
-    u_long lastModTimeCheck;
-
     /*! This entry is not valid and will be removed when refCount = 0.  */
     bool invalidCache;
 
     CachedFileBuffer* buffer;
   };
 
-  list<CachedFileFactoryRecord*> buffersToRemove;
-  HashMap<char*, CachedFileFactoryRecord*> buffers;
+  list<CachedFileFactoryRecord *> buffersToRemove;
+  HashMap<char *, CachedFileFactoryRecord *> buffers;
 };
 
 #endif
diff --git a/myserver/src/base/files_cache/cached_file_buffer.cpp b/myserver/src/base/files_cache/cached_file_buffer.cpp
index 9b76c47..d1a96b1 100644
--- a/myserver/src/base/files_cache/cached_file_buffer.cpp
+++ b/myserver/src/base/files_cache/cached_file_buffer.cpp
@@ -45,6 +45,26 @@
 
 /*!
   Load a file in the buffer.
+  \param file The file object.
+ */
+CachedFileBuffer::CachedFileBuffer (File* file)
+{
+  u_long nbr;
+  factoryToNotify = 0;
+  refCounter = 0;
+  fileSize = file->getFileSize ();
+  buffer = new char[fileSize];
+  filename.assign (file->getFilename ());
+  file->seek (0);
+  file->read (buffer, fileSize, &nbr);
+
+  mtime = file->getLastModTime ();
+
+  file->fstat (&fstat);
+}
+
+/*!
+  Load a file in the buffer.
   \param filename The name of the file.
  */
 CachedFileBuffer::CachedFileBuffer (const char* filename)
@@ -63,6 +83,10 @@ CachedFileBuffer::CachedFileBuffer (const char* filename)
 
   file.read (buffer, fileSize, &nbw);
 
+  mtime = file.getLastModTime ();
+
+  file.fstat (&fstat);
+
   file.close ();
 }
 
@@ -131,26 +155,18 @@ CachedFileBuffer::CachedFileBuffer (const char* buffer, u_long size)
 }
 
 /*!
-  Load a file in the buffer.
-  \param file The file object.
+  Destroy the object.
  */
-CachedFileBuffer::CachedFileBuffer (File* file)
+CachedFileBuffer::~CachedFileBuffer ()
 {
-  u_long nbr;
-  factoryToNotify = 0;
-  refCounter = 0;
-  fileSize = file->getFileSize ();
-  buffer = new char[fileSize];
-  filename.assign (file->getFilename ());
-  file->seek (0);
-  file->read (buffer, fileSize, &nbr);
+  mutex.destroy ();
+  delete [] buffer;
 }
 
 /*!
-  Destroy the object.
+  Check if the resource is still valid.
  */
-CachedFileBuffer::~CachedFileBuffer ()
+bool CachedFileBuffer::revalidate (const char *res)
 {
-  mutex.destroy ();
-  delete [] buffer;
+  return FilesUtility::getLastModTime (res) == getMtime ();
 }
diff --git a/myserver/src/base/files_cache/cached_file_factory.cpp b/myserver/src/base/files_cache/cached_file_factory.cpp
index 3695bcb..2d90150 100644
--- a/myserver/src/base/files_cache/cached_file_factory.cpp
+++ b/myserver/src/base/files_cache/cached_file_factory.cpp
@@ -64,11 +64,11 @@ CachedFileFactory::CachedFileFactory (u_long size)
 }
 
 /*!
-  Clean the used resources.
+  Clean the usedm resources.
  */
 void CachedFileFactory::clean ()
 {
-  HashMap<char*, CachedFileFactoryRecord*>::Iterator it = buffers.begin ();
+  HashMap<char *, CachedFileFactoryRecord*>::Iterator it = buffers.begin ();
   for (; it != buffers.end (); it++)
     {
       delete (*it)->buffer;
@@ -120,7 +120,6 @@ u_long CachedFileFactory::getMinSize ()
 void CachedFileFactory::initialize (u_long size)
 {
   setSize (size);
-  used = 0;
   maxSize = 0;
   minSize = 0;
   usedSize = 0;
@@ -146,23 +145,18 @@ File* CachedFileFactory::open (const char* filename, int flags)
   try
     {
       record = buffers.get (filename);
-      buffer = record ? record->buffer : 0;
+      buffer = record ? record->buffer : NULL;
 
-      used++;
-
-      /*
-        If the file on the file system has a different mtime then don't use
-        the cache, in this way when opened instance of this file will be closed
-        the null reference callback can be called and the file reloaded.
-      */
       if (record)
         {
-          record->invalidCache = FilesUtility::getLastModTime (filename)
-            != record->mtime;
-          record->lastModTimeCheck = ticks;
+          if (buffer->getExpireTime () <= ticks)
+            {
+              buffer->refreshExpireTime (ticks);
+              record->invalidCache = ! buffer->revalidate (filename);
+            }
 
           bool noSymlink = (! (flags & File::NO_FOLLOW_SYMLINK))
-            && S_ISLNK (record->fstat.st_mode);
+            && buffer->isSymlink ();
 
           if (record->invalidCache || noSymlink)
             {
@@ -192,11 +186,12 @@ File* CachedFileFactory::open (const char* filename, int flags)
               delete file;
               return NULL;
             }
+
           fileSize = file->getFileSize ();
           purgeRecords ();
-          if ((minSize != 0 && fileSize < minSize) ||
-              (maxSize != 0 && fileSize > maxSize)  ||
-              (fileSize > size - usedSize))
+          if (minSize && fileSize < minSize
+              || maxSize && fileSize > maxSize
+              || fileSize > size - usedSize)
             {
               mutex.unlock ();
               return file;
@@ -205,14 +200,13 @@ File* CachedFileFactory::open (const char* filename, int flags)
             {
               record = new CachedFileFactoryRecord ();
               buffer = new CachedFileBuffer (file);
-              record->mtime = file->getLastModTime ();
-              file->fstat (&record->fstat);
               file->close  ();
               delete file;
 
               buffer->setFactoryToNotify (this);
               record->created = ticks;
               record->buffer = buffer;
+              buffer->refreshExpireTime (ticks);
               buffers.put ((char *) filename, record);
               usedSize += fileSize;
             }
@@ -239,12 +233,15 @@ File* CachedFileFactory::open (const char* filename, int flags)
 void CachedFileFactory::nullReferences (CachedFileBuffer* cfb)
 {
   CachedFileFactoryRecord* record;
-  float averageUsage;
   float bufferAverageUsage;
   float spaceUsage;
   u_long ticks = getTicks ();
-  mutex.lock ();
 
+  spaceUsage = (float) usedSize / size;
+  if (spaceUsage < 0.65f)
+    return;
+
+  mutex.lock ();
   try
     {
       record = buffers.get (cfb->getFilename ());
@@ -254,14 +251,11 @@ void CachedFileFactory::nullReferences (CachedFileBuffer* cfb)
           return;
         }
 
-      spaceUsage = (float)usedSize / size;
-      averageUsage = (float)used * 1000.0f / (ticks - created);
       bufferAverageUsage = (float)record->used * 1000.0f /
         (ticks - record->created);
 
-      if (((spaceUsage > 0.65f) && (bufferAverageUsage < averageUsage)
-           && ((ticks - record->created) > 10000))
-          || (spaceUsage > 0.9f)
+      if ((spaceUsage > 0.65f && (ticks - record->created) > 10000)
+          || spaceUsage > 0.9f
           || record->invalidCache)
         {
           record = buffers.remove (cfb->getFilename ());
@@ -282,7 +276,7 @@ void CachedFileFactory::nullReferences (CachedFileBuffer* cfb)
  */
 u_long CachedFileFactory::purgeRecords ()
 {
-  list<CachedFileFactoryRecord*>::iterator it = buffersToRemove.begin ();
+  list<CachedFileFactoryRecord *>::iterator it = buffersToRemove.begin ();
   u_long ret = 0;
 
   while (it != buffersToRemove.end ())



commit 7af37156b33d4e374013b0bd6bb040d468f03f17
Author: Giuseppe Scrivano <gscrivano@gnu.org>
Date:   Thu Aug 5 21:48:56 2010 +0200

    Change the default server.min_file_cache value.

diff --git a/myserver/binaries/myserver.default.xml b/myserver/binaries/myserver.default.xml
index 9ef7099..921eab1 100755
--- a/myserver/binaries/myserver.default.xml
+++ b/myserver/binaries/myserver.default.xml
@@ -79,7 +79,7 @@
   <DEFINE name="server.max_file_cache" value="1048576" />
 
   <!--MIN CACHE SIZE FOR SINGLE STATIC FILE-->
-  <DEFINE name="server.min_file_cache" value="1048576" />
+  <DEFINE name="server.min_file_cache" value="0" />
 
   <!-- ENABLE HOME DIRECTORY PER USER -->
   <DEFINE name="http.use_home_directory" value="NO" />



commit 3b7670c5c9cd033d25f88b00a43496ddfb0d30b8
Author: Giuseppe Scrivano <gscrivano@gnu.org>
Date:   Thu Aug 5 19:31:15 2010 +0200

    CachedFile: Raise an exception on invalid operations.

diff --git a/myserver/include/base/exceptions/exceptions.h b/myserver/include/base/exceptions/exceptions.h
index d985c5d..6061894 100644
--- a/myserver/include/base/exceptions/exceptions.h
+++ b/myserver/include/base/exceptions/exceptions.h
@@ -90,7 +90,7 @@ class AbstractServerException: public exception
       return gnulib::strerror (localErrno);
     }
 
-    enum LoggingLevel getLogLevel()
+    enum LoggingLevel getLogLevel ()
     {
       return logLevel;
     }
diff --git a/myserver/src/base/files_cache/cached_file.cpp b/myserver/src/base/files_cache/cached_file.cpp
index 1291e4f..8c43eec 100644
--- a/myserver/src/base/files_cache/cached_file.cpp
+++ b/myserver/src/base/files_cache/cached_file.cpp
@@ -22,6 +22,8 @@
 #include <include/base/file/files_utility.h>
 #include <include/base/files_cache/cached_file.h>
 
+#include <include/base/exceptions/checked.h>
+
 #ifndef WIN32
 # include <fcntl.h>
 # include <unistd.h>
@@ -60,6 +62,8 @@ CachedFile::CachedFile (CachedFileBuffer* cfb)
  */
 int CachedFile::writeToFile (const char* buffer, u_long buffersize, u_long* nbw)
 {
+  errno = EBADF;
+  checked::raiseException ();
   return -1;
 }
 
@@ -72,6 +76,8 @@ int CachedFile::writeToFile (const char* buffer, u_long buffersize, u_long* nbw)
  */
 int CachedFile::openFile (const char* nfilename, u_long opt)
 {
+  errno = ENOENT;
+  checked::raiseException ();
   return -1;
 }
 
@@ -80,7 +86,7 @@ int CachedFile::openFile (const char* nfilename, u_long opt)
  */
 Handle CachedFile::getHandle ()
 {
-  return (Handle)-1;
+  return (Handle) -1;
 }
 
 /*!
@@ -140,6 +146,8 @@ int CachedFile::read (char* buffer, u_long buffersize, u_long* nbr)
  */
 int CachedFile::createTemporaryFile (const char *, bool)
 {
+  errno = EINVAL;
+  checked::raiseException ();
   return -1;
 }
 
@@ -179,6 +187,8 @@ int CachedFile::seek (u_long initialByte)
  */
 int CachedFile::write (const char* buffer, u_long len, u_long *nbw)
 {
+  errno = EBADF;
+  checked::raiseException ();
   return -1;
 }
 

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

Summary of changes:
 myserver/binaries/myserver.default.xml             |    2 +-
 myserver/include/base/exceptions/exceptions.h      |    2 +-
 .../include/base/files_cache/cached_file_buffer.h  |   18 +++++++
 .../include/base/files_cache/cached_file_factory.h |   16 +------
 myserver/src/base/files_cache/cached_file.cpp      |   12 ++++-
 .../src/base/files_cache/cached_file_buffer.cpp    |   46 ++++++++++++------
 .../src/base/files_cache/cached_file_factory.cpp   |   50 +++++++++-----------
 7 files changed, 86 insertions(+), 60 deletions(-)


hooks/post-receive
-- 
GNU MyServer


From MAILER-DAEMON Fri Aug 06 12:29:38 2010
Received: from mailman by lists.gnu.org with archive (Exim 4.43)
	id 1OhPnd-0007Vs-Hs
	for mharc-myserver-commit@gnu.org; Fri, 06 Aug 2010 12:29:37 -0400
Received: from [140.186.70.92] (port=43201 helo=eggs.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.43) id 1OhPna-000797-Ci
	for myserver-commit@gnu.org; Fri, 06 Aug 2010 12:29:36 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69)
	(envelope-from <gscrivano@gnu.org>) id 1OhP59-0005gX-P4
	for myserver-commit@gnu.org; Fri, 06 Aug 2010 11:43:40 -0400
Received: from colonialone.fsf.org ([140.186.70.51]:41651
	helo=internal.in.savannah.gnu.org)
	by eggs.gnu.org with esmtp (Exim 4.69)
	(envelope-from <gscrivano@gnu.org>) id 1OhP59-0005gL-M4
	for myserver-commit@gnu.org; Fri, 06 Aug 2010 11:43:39 -0400
Received: from [10.1.0.108] (helo=vcs-noshell.in.savannah.gnu.org)
	by internal.in.savannah.gnu.org with esmtp (Exim 4.69)
	(envelope-from <gscrivano@gnu.org>) id 1OhP59-0006z1-BE
	for myserver-commit@gnu.org; Fri, 06 Aug 2010 15:43:39 +0000
Received: from gscrivano by vcs-noshell.in.savannah.gnu.org with local (Exim
	4.69) (envelope-from <gscrivano@savannah.gnu.org>)
	id 1OhP58-0000aG-8x
	for myserver-commit@gnu.org; Fri, 06 Aug 2010 15:43:39 +0000
To: myserver-commit@gnu.org
X-Git-Refname: refs/heads/master
X-Git-Reftype: branch
X-Git-Oldrev: 3624b0a11510ca0c35739b27a91b1542cb8bf09b
X-Git-Newrev: 886b9317e5afc566d4d16d0566f1a8e0d4e08aef
Message-Id: <E1OhP58-0000aG-8x@vcs-noshell.in.savannah.gnu.org>
From: Giuseppe Scrivano <gscrivano@gnu.org>
Date: Fri, 06 Aug 2010 15:43:38 +0000
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2)
Subject: [myserver-commit] [SCM] GNU MyServer branch, master,
	updated. v0.9.2-280-g886b931
X-BeenThere: myserver-commit@gnu.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: myserver-commit.gnu.org
List-Unsubscribe: <http://lists.gnu.org/mailman/listinfo/myserver-commit>,
	<mailto:myserver-commit-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/myserver-commit>
List-Post: <mailto:myserver-commit@gnu.org>
List-Help: <mailto:myserver-commit-request@gnu.org?subject=help>
List-Subscribe: <http://lists.gnu.org/mailman/listinfo/myserver-commit>,
	<mailto:myserver-commit-request@gnu.org?subject=subscribe>
X-List-Received-Date: Fri, 06 Aug 2010 16:29:36 -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  886b9317e5afc566d4d16d0566f1a8e0d4e08aef (commit)
      from  3624b0a11510ca0c35739b27a91b1542cb8bf09b (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 886b9317e5afc566d4d16d0566f1a8e0d4e08aef
Author: Giuseppe Scrivano <gscrivano@gnu.org>
Date:   Fri Aug 6 17:43:25 2010 +0200

    Do not test missing method.

diff --git a/myserver/tests/test_cached_file_factory.cpp b/myserver/tests/test_cached_file_factory.cpp
index 6e56dc7..aaeb456 100644
--- a/myserver/tests/test_cached_file_factory.cpp
+++ b/myserver/tests/test_cached_file_factory.cpp
@@ -55,7 +55,6 @@ public:
     cff->initialize (20);
 
     CPPUNIT_ASSERT_EQUAL (cff->getSize (), 20ul);
-    CPPUNIT_ASSERT_EQUAL (cff->getUsed (), 0ul);
     CPPUNIT_ASSERT_EQUAL (cff->getUsedSize (), 0ul);
     CPPUNIT_ASSERT_EQUAL (cff->getMaxSize (), 0ul);
     CPPUNIT_ASSERT_EQUAL (cff->getMinSize (), 0ul);

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

Summary of changes:
 myserver/tests/test_cached_file_factory.cpp |    1 -
 1 files changed, 0 insertions(+), 1 deletions(-)


hooks/post-receive
-- 
GNU MyServer


From MAILER-DAEMON Fri Aug 06 12:29:39 2010
Received: from mailman by lists.gnu.org with archive (Exim 4.43)
	id 1OhPne-0007Wo-Um
	for mharc-myserver-commit@gnu.org; Fri, 06 Aug 2010 12:29:39 -0400
Received: from [140.186.70.92] (port=42524 helo=eggs.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.43) id 1OhPnb-0006lJ-GP
	for myserver-commit@gnu.org; Fri, 06 Aug 2010 12:29:36 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69)
	(envelope-from <gscrivano@gnu.org>) id 1OhP4V-00054v-Si
	for myserver-commit@gnu.org; Fri, 06 Aug 2010 11:43:00 -0400
Received: from colonialone.fsf.org ([140.186.70.51]:41650
	helo=internal.in.savannah.gnu.org)
	by eggs.gnu.org with esmtp (Exim 4.69)
	(envelope-from <gscrivano@gnu.org>) id 1OhP4V-00054p-RT
	for myserver-commit@gnu.org; Fri, 06 Aug 2010 11:42:59 -0400
Received: from [10.1.0.108] (helo=vcs-noshell.in.savannah.gnu.org)
	by internal.in.savannah.gnu.org with esmtp (Exim 4.69)
	(envelope-from <gscrivano@gnu.org>) id 1OhP4V-0006yy-GO
	for myserver-commit@gnu.org; Fri, 06 Aug 2010 15:42:59 +0000
Received: from gscrivano by vcs-noshell.in.savannah.gnu.org with local (Exim
	4.69) (envelope-from <gscrivano@savannah.gnu.org>)
	id 1OhP4Q-0000XP-He
	for myserver-commit@gnu.org; Fri, 06 Aug 2010 15:42:59 +0000
To: myserver-commit@gnu.org
X-Git-Refname: refs/heads/master
X-Git-Reftype: branch
X-Git-Oldrev: 4bc007332aacd6875146985a77fe47dfaf747cfa
X-Git-Newrev: 3624b0a11510ca0c35739b27a91b1542cb8bf09b
Message-Id: <E1OhP4Q-0000XP-He@vcs-noshell.in.savannah.gnu.org>
From: Giuseppe Scrivano <gscrivano@gnu.org>
Date: Fri, 06 Aug 2010 15:42:58 +0000
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2)
Subject: [myserver-commit] [SCM] GNU MyServer branch, master,
	updated. v0.9.2-279-g3624b0a
X-BeenThere: myserver-commit@gnu.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: myserver-commit.gnu.org
List-Unsubscribe: <http://lists.gnu.org/mailman/listinfo/myserver-commit>,
	<mailto:myserver-commit-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/myserver-commit>
List-Post: <mailto:myserver-commit@gnu.org>
List-Help: <mailto:myserver-commit-request@gnu.org?subject=help>
List-Subscribe: <http://lists.gnu.org/mailman/listinfo/myserver-commit>,
	<mailto:myserver-commit-request@gnu.org?subject=subscribe>
X-List-Received-Date: Fri, 06 Aug 2010 16:29:37 -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  3624b0a11510ca0c35739b27a91b1542cb8bf09b (commit)
      from  4bc007332aacd6875146985a77fe47dfaf747cfa (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 3624b0a11510ca0c35739b27a91b1542cb8bf09b
Author: Giuseppe Scrivano <gscrivano@gnu.org>
Date:   Fri Aug 6 17:42:45 2010 +0200

    Include missing header.

diff --git a/myserver/include/base/files_cache/cached_file_buffer.h b/myserver/include/base/files_cache/cached_file_buffer.h
index 5473fb6..602b8d7 100644
--- a/myserver/include/base/files_cache/cached_file_buffer.h
+++ b/myserver/include/base/files_cache/cached_file_buffer.h
@@ -23,6 +23,7 @@
 # include "myserver.h"
 # include <include/filter/stream.h>
 # include <include/base/file/file.h>
+# include <include/base/utility.h>
 # include <include/base/sync/mutex.h>
 # include <string>
 

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

Summary of changes:
 .../include/base/files_cache/cached_file_buffer.h  |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)


hooks/post-receive
-- 
GNU MyServer


From MAILER-DAEMON Fri Aug 06 13:13:51 2010
Received: from mailman by lists.gnu.org with archive (Exim 4.43)
	id 1OhQUR-0003C1-1R
	for mharc-myserver-commit@gnu.org; Fri, 06 Aug 2010 13:13:51 -0400
Received: from [140.186.70.92] (port=52947 helo=eggs.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.43) id 1OhQUO-00039D-2f
	for myserver-commit@gnu.org; Fri, 06 Aug 2010 13:13:49 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69)
	(envelope-from <e.dolstra@tudelft.nl>) id 1OhQUM-0004lO-5A
	for myserver-commit@gnu.org; Fri, 06 Aug 2010 13:13:47 -0400
Received: from proliant.st.ewi.tudelft.nl ([130.161.158.3]:37780)
	by eggs.gnu.org with esmtp (Exim 4.69)
	(envelope-from <e.dolstra@tudelft.nl>) id 1OhQUL-0004lA-UZ
	for myserver-commit@gnu.org; Fri, 06 Aug 2010 13:13:46 -0400
Received: from hydra (buildfarm.st.ewi.tudelft.nl [130.161.158.181])
	by proliant.st.ewi.tudelft.nl (8.12.11/8.12.8) with SMTP id
	o76HDhPk026725
	for <myserver-commit@gnu.org>; Fri, 6 Aug 2010 19:13:43 +0200
Message-Id: <201008061713.o76HDhPk026725@proliant.st.ewi.tudelft.nl>
Received: by hydra (sSMTP sendmail emulation); Fri, 06 Aug 2010 19:13:43 +0200
To: myserver-commit@gnu.org
From: Hydra Build Daemon <e.dolstra@tudelft.nl>
X-Hydra-Instance: hydra
X-Hydra-Project: gnu
X-Hydra-Jobset: myserver-master
X-Hydra-Job: tarball
Date: Fri, 6 Aug 2010 19:13:43 +0200
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4-2.6
Subject: [myserver-commit] Hydra job gnu:myserver-master:tarball build
 535215: Failed with non-zero exit code
X-BeenThere: myserver-commit@gnu.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: myserver-commit.gnu.org
List-Unsubscribe: <http://lists.gnu.org/mailman/listinfo/myserver-commit>,
	<mailto:myserver-commit-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/myserver-commit>
List-Post: <mailto:myserver-commit@gnu.org>
List-Help: <mailto:myserver-commit-request@gnu.org?subject=help>
List-Subscribe: <http://lists.gnu.org/mailman/listinfo/myserver-commit>,
	<mailto:myserver-commit-request@gnu.org?subject=subscribe>
X-List-Received-Date: Fri, 06 Aug 2010 17:13:49 -0000

Hi,

This is to let you know that Hydra build 535215 of job gnu:myserver-master:tarball has changed from 'Success' to 'Failed with non-zero exit code'.

Complete build information can be found on this page: http://hydra.nixos.org/build/535215

The last 50 lines of the build log are shown at the bottom of this email.

A summary of the build information follows:

Build ID:              | 535215
Nix name:              | myserver-tarball-0pre4bc007332aacd6875146985a77fe47dfaf747cfa
Short description:     | Build of a source distribution from a checkout
Maintainer(s):         | myserver-commit@gnu.org
System:                | x86_64-linux
Derivation store path: | /nix/store/b9i1d9dv73vbng6gygz18d6sgayrgwqi-myserver-tarball-0pre4bc007332aacd6875146985a77fe47dfaf747cfa.drv
Output store path:     | /nix/store/pcf4izpqn99zd23s1n3k4ydlvpmmfv5k-myserver-tarball-0pre4bc007332aacd6875146985a77fe47dfaf747cfa
Time added:            | 2010-08-06 19:13:43
Build started:         | 2010-08-06 19:06:12
Build finished:        | 2010-08-06 19:13:43
Duration:              | 451s

The build inputs were:

Name        | Type | Value
------------+------+---------------------------------------------------------------------------
myserverSrc | git  | git://git.sv.gnu.org/myserver.git:4bc007332aacd6875146985a77fe47dfaf747cfa
hydraConfig | svn  | https://svn.nixos.org/repos/nix/hydra-config/gnu/trunk:22917
gnulibSrc   | git  | git://git.sv.gnu.org/gnulib.git:1bce9152c7fa70ba4408e43c758900df25f9a775
nixpkgs     | svn  | https://svn.nixos.org/repos/nix/nixpkgs/trunk:22980

Regards,

The Hydra build daemon.

---
	    if test -f $f; then mv $f $backupdir; restore=mv; else :; fi; \
	  done; \
	else :; fi && \
	cd "$am__cwd"; \
	if /bin/sh /tmp/nix-build-b9i1d9dv73vbng6gygz18d6sgayrgwqi-myserver-tarball-0pre4bc007332aacd6875146985a77fe47dfaf747cfa.drv-0/git-export/myserver/build-aux/missing --run makeinfo   -I . \
	 -o myserver ./myserver.texi; \
	then \
	  rc=0; \
	  CDPATH="${ZSH_VERSION+.}:" && cd .; \
	else \
	  rc=$?; \
	  CDPATH="${ZSH_VERSION+.}:" && cd . && \
	  $restore $backupdir/* `echo "./myserver" | sed 's|[^/]*$||'`; \
	fi; \
	rm -rf $backupdir; exit $rc[b
[qmake[2]: Leaving directory `/tmp/nix-build-b9i1d9dv73vbng6gygz18d6sgayrgwqi-myserver-tarball-0pre4bc007332aacd6875146985a77fe47dfaf747cfa.drv-0/git-export/myserver/documentation'
[qMaking all in tests
[pmake[2]: Entering directory `/tmp/nix-build-b9i1d9dv73vbng6gygz18d6sgayrgwqi-myserver-tarball-0pre4bc007332aacd6875146985a77fe47dfaf747cfa.drv-0/git-export/myserver/tests'
[pbuilding main.o
  CXX    main.o
[3s[ag++ -DHAVE_CONFIG_H -I. -I..   -I/nix/store/bvdasppas4lw82k03y2mfpbls03qixfq-libxml2-2.7.7/include/libxml2 -I"../lib" -I"../lib" -I".." -fPIC -DPIC  -c -o main.o main.cpp[b
[q[pbuilding test_auth_domain.o
  CXX    test_auth_domain.o
[3s[ag++ -DHAVE_CONFIG_H -I. -I..   -I/nix/store/bvdasppas4lw82k03y2mfpbls03qixfq-libxml2-2.7.7/include/libxml2 -I"../lib" -I"../lib" -I".." -fPIC -DPIC  -c -o test_auth_domain.o test_auth_domain.cpp[b
[q[pbuilding test_auth_method.o
  CXX    test_auth_method.o
[3s[ag++ -DHAVE_CONFIG_H -I. -I..   -I/nix/store/bvdasppas4lw82k03y2mfpbls03qixfq-libxml2-2.7.7/include/libxml2 -I"../lib" -I"../lib" -I".." -fPIC -DPIC  -c -o test_auth_method.o test_auth_method.cpp[b
[q[pbuilding test_base64.o
  CXX    test_base64.o
[3s[ag++ -DHAVE_CONFIG_H -I. -I..   -I/nix/store/bvdasppas4lw82k03y2mfpbls03qixfq-libxml2-2.7.7/include/libxml2 -I"../lib" -I"../lib" -I".." -fPIC -DPIC  -c -o test_base64.o test_base64.cpp[b
[q[pbuilding test_bitvec.o
  CXX    test_bitvec.o
[3s[ag++ -DHAVE_CONFIG_H -I. -I..   -I/nix/store/bvdasppas4lw82k03y2mfpbls03qixfq-libxml2-2.7.7/include/libxml2 -I"../lib" -I"../lib" -I".." -fPIC -DPIC  -c -o test_bitvec.o test_bitvec.cpp[b
[q[pbuilding test_cached_file.o
  CXX    test_cached_file.o
[3s[ag++ -DHAVE_CONFIG_H -I. -I..   -I/nix/store/bvdasppas4lw82k03y2mfpbls03qixfq-libxml2-2.7.7/include/libxml2 -I"../lib" -I"../lib" -I".." -fPIC -DPIC  -c -o test_cached_file.o test_cached_file.cpp[b
In file included from ../include/base/files_cache/cached_file.h:25,
                 from test_cached_file.cpp:22:
../include/base/files_cache/cached_file_buffer.h: In member function 'void CachedFileBuffer::refreshExpireTime(u_long)':
../include/base/files_cache/cached_file_buffer.h:58: error: 'MYSERVER_SEC' was not declared in this scope
make[2]: *** [test_cached_file.o] Error 1
make[2]: Leaving directory `/tmp/nix-build-b9i1d9dv73vbng6gygz18d6sgayrgwqi-myserver-tarball-0pre4bc007332aacd6875146985a77fe47dfaf747cfa.drv-0/git-export/myserver/tests'
[q[qmake[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/tmp/nix-build-b9i1d9dv73vbng6gygz18d6sgayrgwqi-myserver-tarball-0pre4bc007332aacd6875146985a77fe47dfaf747cfa.drv-0/git-export/myserver'
[q[qmake: *** [all] Error 2
[q[q[qbuild time elapsed:  0m0.031s 0m0.015s 3m6.648s 0m59.001s
builder for `/nix/store/b9i1d9dv73vbng6gygz18d6sgayrgwqi-myserver-tarball-0pre4bc007332aacd6875146985a77fe47dfaf747cfa.drv' failed with exit code 2
error: build of `/nix/store/b9i1d9dv73vbng6gygz18d6sgayrgwqi-myserver-tarball-0pre4bc007332aacd6875146985a77fe47dfaf747cfa.drv' failed
Shared connection to kenny closed.

build of `/nix/store/b9i1d9dv73vbng6gygz18d6sgayrgwqi-myserver-tarball-0pre4bc007332aacd6875146985a77fe47dfaf747cfa.drv' on `buildfarm@kenny' failed with exit code 256


From MAILER-DAEMON Fri Aug 06 14:52:25 2010
Received: from mailman by lists.gnu.org with archive (Exim 4.43)
	id 1OhS1p-0006As-DD
	for mharc-myserver-commit@gnu.org; Fri, 06 Aug 2010 14:52:25 -0400
Received: from [140.186.70.92] (port=49622 helo=eggs.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.43) id 1OhS1m-00068N-7S
	for myserver-commit@gnu.org; Fri, 06 Aug 2010 14:52:23 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69)
	(envelope-from <e.dolstra@tudelft.nl>) id 1OhS1k-0002Oa-QR
	for myserver-commit@gnu.org; Fri, 06 Aug 2010 14:52:22 -0400
Received: from proliant.st.ewi.tudelft.nl ([130.161.158.3]:37820)
	by eggs.gnu.org with esmtp (Exim 4.69)
	(envelope-from <e.dolstra@tudelft.nl>) id 1OhS1k-0002OL-Ja
	for myserver-commit@gnu.org; Fri, 06 Aug 2010 14:52:20 -0400
Received: from hydra (buildfarm.st.ewi.tudelft.nl [130.161.158.181])
	by proliant.st.ewi.tudelft.nl (8.12.11/8.12.8) with SMTP id
	o76IqCwV027827
	for <myserver-commit@gnu.org>; Fri, 6 Aug 2010 20:52:18 +0200
Message-Id: <201008061852.o76IqCwV027827@proliant.st.ewi.tudelft.nl>
Received: by hydra (sSMTP sendmail emulation); Fri, 06 Aug 2010 20:52:12 +0200
To: myserver-commit@gnu.org
From: Hydra Build Daemon <e.dolstra@tudelft.nl>
X-Hydra-Instance: hydra
X-Hydra-Project: gnu
X-Hydra-Jobset: myserver-master
X-Hydra-Job: tarball
Date: Fri, 6 Aug 2010 20:52:12 +0200
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4-2.6
Subject: [myserver-commit] Hydra job gnu:myserver-master:tarball build
	539684: Success
X-BeenThere: myserver-commit@gnu.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: myserver-commit.gnu.org
List-Unsubscribe: <http://lists.gnu.org/mailman/listinfo/myserver-commit>,
	<mailto:myserver-commit-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/myserver-commit>
List-Post: <mailto:myserver-commit@gnu.org>
List-Help: <mailto:myserver-commit-request@gnu.org?subject=help>
List-Subscribe: <http://lists.gnu.org/mailman/listinfo/myserver-commit>,
	<mailto:myserver-commit-request@gnu.org?subject=subscribe>
X-List-Received-Date: Fri, 06 Aug 2010 18:52:23 -0000

Hi,

This is to let you know that Hydra build 539684 of job gnu:myserver-master:tarball has changed from 'Failed with non-zero exit code' to 'Success'.

Complete build information can be found on this page: http://hydra.nixos.org/build/539684

A summary of the build information follows:

Build ID:              | 539684
Nix name:              | myserver-tarball-0pre886b9317e5afc566d4d16d0566f1a8e0d4e08aef
Short description:     | Build of a source distribution from a checkout
Maintainer(s):         | myserver-commit@gnu.org
System:                | x86_64-linux
Derivation store path: | /nix/store/9wsyk6xhn1awsqxw7zqhzrdzvfsy332q-myserver-tarball-0pre886b9317e5afc566d4d16d0566f1a8e0d4e08aef.drv
Output store path:     | /nix/store/g49yhvh0nni9bzvsg5jix9939ykglycm-myserver-tarball-0pre886b9317e5afc566d4d16d0566f1a8e0d4e08aef
Time added:            | 2010-08-06 20:52:12
Build started:         | 2010-08-06 20:46:50
Build finished:        | 2010-08-06 20:52:12
Duration:              | 322s

The build inputs were:

Name        | Type | Value
------------+------+---------------------------------------------------------------------------
myserverSrc | git  | git://git.sv.gnu.org/myserver.git:886b9317e5afc566d4d16d0566f1a8e0d4e08aef
hydraConfig | svn  | https://svn.nixos.org/repos/nix/hydra-config/gnu/trunk:22917
gnulibSrc   | git  | git://git.sv.gnu.org/gnulib.git:1bce9152c7fa70ba4408e43c758900df25f9a775
nixpkgs     | svn  | https://svn.nixos.org/repos/nix/nixpkgs/trunk:23000

Regards,

The Hydra build daemon.


From MAILER-DAEMON Fri Aug 06 15:23:49 2010
Received: from mailman by lists.gnu.org with archive (Exim 4.43)
	id 1OhSWD-0003wR-5B
	for mharc-myserver-commit@gnu.org; Fri, 06 Aug 2010 15:23:49 -0400
Received: from [140.186.70.92] (port=51535 helo=eggs.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.43) id 1OhSWA-0003uA-OX
	for myserver-commit@gnu.org; Fri, 06 Aug 2010 15:23:48 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69)
	(envelope-from <gscrivano@gnu.org>) id 1OhSW8-0006ty-KB
	for myserver-commit@gnu.org; Fri, 06 Aug 2010 15:23:46 -0400
Received: from colonialone.fsf.org ([140.186.70.51]:45966
	helo=internal.in.savannah.gnu.org)
	by eggs.gnu.org with esmtp (Exim 4.69)
	(envelope-from <gscrivano@gnu.org>) id 1OhSW8-0006tr-HV
	for myserver-commit@gnu.org; Fri, 06 Aug 2010 15:23:44 -0400
Received: from [10.1.0.108] (helo=vcs-noshell.in.savannah.gnu.org)
	by internal.in.savannah.gnu.org with esmtp (Exim 4.69)
	(envelope-from <gscrivano@gnu.org>) id 1OhSW8-0001Cy-6q
	for myserver-commit@gnu.org; Fri, 06 Aug 2010 19:23:44 +0000
Received: from gscrivano by vcs-noshell.in.savannah.gnu.org with local (Exim
	4.69) (envelope-from <gscrivano@savannah.gnu.org>)
	id 1OhSW1-0003tf-Qo
	for myserver-commit@gnu.org; Fri, 06 Aug 2010 19:23:44 +0000
To: myserver-commit@gnu.org
X-Git-Refname: refs/heads/master
X-Git-Reftype: branch
X-Git-Oldrev: 886b9317e5afc566d4d16d0566f1a8e0d4e08aef
X-Git-Newrev: 4d0ba86918a76435b88e904ca41e1ef4e1ad7d1e
Message-Id: <E1OhSW1-0003tf-Qo@vcs-noshell.in.savannah.gnu.org>
From: Giuseppe Scrivano <gscrivano@gnu.org>
Date: Fri, 06 Aug 2010 19:23:42 +0000
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2)
Subject: [myserver-commit] [SCM] GNU MyServer branch, master,
	updated. v0.9.2-282-g4d0ba86
X-BeenThere: myserver-commit@gnu.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: myserver-commit.gnu.org
List-Unsubscribe: <http://lists.gnu.org/mailman/listinfo/myserver-commit>,
	<mailto:myserver-commit-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/myserver-commit>
List-Post: <mailto:myserver-commit@gnu.org>
List-Help: <mailto:myserver-commit-request@gnu.org?subject=help>
List-Subscribe: <http://lists.gnu.org/mailman/listinfo/myserver-commit>,
	<mailto:myserver-commit-request@gnu.org?subject=subscribe>
X-List-Received-Date: Fri, 06 Aug 2010 19:23:48 -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  4d0ba86918a76435b88e904ca41e1ef4e1ad7d1e (commit)
       via  d9c9a770be9b1ff1475d426ca44dc48a34abb6ac (commit)
      from  886b9317e5afc566d4d16d0566f1a8e0d4e08aef (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 4d0ba86918a76435b88e904ca41e1ef4e1ad7d1e
Author: Giuseppe Scrivano <gscrivano@gnu.org>
Date:   Fri Aug 6 21:23:28 2010 +0200

    Use the gnulib version for dirfd and mkostemp.

diff --git a/myserver/src/base/file/file.cpp b/myserver/src/base/file/file.cpp
index 106422b..1b4e85c 100644
--- a/myserver/src/base/file/file.cpp
+++ b/myserver/src/base/file/file.cpp
@@ -157,7 +157,7 @@ int File::openFile (const char* nfilename, u_long opt, mode_t mask)
   if (opt & (File::TEMPORARY_DELAYED | File::TEMPORARY))
     {
       auto_ptr <char> templatefn (checked::strdup (nfilename));
-      handle = mkostemp (templatefn.get (), flags);
+      handle = gnulib::mkostemp (templatefn.get (), flags);
       if (handle < 0)
         checked::raiseException ();
 
diff --git a/myserver/src/base/read_directory/read_directory.cpp b/myserver/src/base/read_directory/read_directory.cpp
index 0d87d74..1f29600 100644
--- a/myserver/src/base/read_directory/read_directory.cpp
+++ b/myserver/src/base/read_directory/read_directory.cpp
@@ -157,7 +157,7 @@ int ReadDirectory::find (const char *filename)
 # endif
 
 # ifdef HAVE_FSTATAT
-   if (checked::fstatat (dirfd (dh), name.c_str (), &stats, 0))
+   if (checked::fstatat (gnulib::dirfd (dh), name.c_str (), &stats, 0))
      return -1;
 # else
    string tempName;



commit d9c9a770be9b1ff1475d426ca44dc48a34abb6ac
Author: Giuseppe Scrivano <gscrivano@gnu.org>
Date:   Fri Aug 6 21:23:12 2010 +0200

    CachedFileBuffer: Make the equality tests more robust.  Consider the inode value.

diff --git a/myserver/src/base/files_cache/cached_file_buffer.cpp b/myserver/src/base/files_cache/cached_file_buffer.cpp
index d1a96b1..c114c4a 100644
--- a/myserver/src/base/files_cache/cached_file_buffer.cpp
+++ b/myserver/src/base/files_cache/cached_file_buffer.cpp
@@ -168,5 +168,12 @@ CachedFileBuffer::~CachedFileBuffer ()
  */
 bool CachedFileBuffer::revalidate (const char *res)
 {
-  return FilesUtility::getLastModTime (res) == getMtime ();
+  struct stat st;
+  int ret = stat (res, &st);
+  if (ret < 0)
+    return false;
+
+  return st.st_ino == fstat.st_ino
+    && st.st_dev == fstat.st_dev
+    && st.st_mtime == fstat.st_mtime;
 }

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

Summary of changes:
 myserver/src/base/file/file.cpp                    |    2 +-
 .../src/base/files_cache/cached_file_buffer.cpp    |    9 ++++++++-
 .../src/base/read_directory/read_directory.cpp     |    2 +-
 3 files changed, 10 insertions(+), 3 deletions(-)


hooks/post-receive
-- 
GNU MyServer


From MAILER-DAEMON Fri Aug 06 21:11:25 2010
Received: from mailman by lists.gnu.org with archive (Exim 4.43)
	id 1OhXwb-0005ei-8D
	for mharc-myserver-commit@gnu.org; Fri, 06 Aug 2010 21:11:25 -0400
Received: from [140.186.70.92] (port=33026 helo=eggs.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.43) id 1OhXwY-0005d9-Rw
	for myserver-commit@gnu.org; Fri, 06 Aug 2010 21:11:23 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69)
	(envelope-from <gscrivano@gnu.org>) id 1OhXwY-0006mB-0K
	for myserver-commit@gnu.org; Fri, 06 Aug 2010 21:11:22 -0400
Received: from colonialone.fsf.org ([140.186.70.51]:56755
	helo=internal.in.savannah.gnu.org)
	by eggs.gnu.org with esmtp (Exim 4.69)
	(envelope-from <gscrivano@gnu.org>) id 1OhXwX-0006m7-VA
	for myserver-commit@gnu.org; Fri, 06 Aug 2010 21:11:21 -0400
Received: from [10.1.0.108] (helo=vcs-noshell.in.savannah.gnu.org)
	by internal.in.savannah.gnu.org with esmtp (Exim 4.69)
	(envelope-from <gscrivano@gnu.org>) id 1OhXwX-0005N4-9v
	for myserver-commit@gnu.org; Sat, 07 Aug 2010 01:11:21 +0000
Received: from gscrivano by vcs-noshell.in.savannah.gnu.org with local (Exim
	4.69) (envelope-from <gscrivano@savannah.gnu.org>)
	id 1OhXwP-0007RY-90
	for myserver-commit@gnu.org; Sat, 07 Aug 2010 01:11:21 +0000
To: myserver-commit@gnu.org
X-Git-Refname: refs/heads/master
X-Git-Reftype: branch
X-Git-Oldrev: 4d0ba86918a76435b88e904ca41e1ef4e1ad7d1e
X-Git-Newrev: c5e025441689007017bb5f6e0f330d4873c76284
Message-Id: <E1OhXwP-0007RY-90@vcs-noshell.in.savannah.gnu.org>
From: Giuseppe Scrivano <gscrivano@gnu.org>
Date: Sat, 07 Aug 2010 01:11:19 +0000
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2)
Subject: [myserver-commit] [SCM] GNU MyServer branch, master,
	updated. v0.9.2-283-gc5e0254
X-BeenThere: myserver-commit@gnu.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: myserver-commit.gnu.org
List-Unsubscribe: <http://lists.gnu.org/mailman/listinfo/myserver-commit>,
	<mailto:myserver-commit-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/myserver-commit>
List-Post: <mailto:myserver-commit@gnu.org>
List-Help: <mailto:myserver-commit-request@gnu.org?subject=help>
List-Subscribe: <http://lists.gnu.org/mailman/listinfo/myserver-commit>,
	<mailto:myserver-commit-request@gnu.org?subject=subscribe>
X-List-Received-Date: Sat, 07 Aug 2010 01:11:24 -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  c5e025441689007017bb5f6e0f330d4873c76284 (commit)
      from  4d0ba86918a76435b88e904ca41e1ef4e1ad7d1e (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 c5e025441689007017bb5f6e0f330d4873c76284
Author: Giuseppe Scrivano <gscrivano@gnu.org>
Date:   Sat Aug 7 03:10:59 2010 +0200

    CachedFileFactory: Use a different lock for any record.

diff --git a/myserver/include/base/files_cache/cached_file_buffer.h b/myserver/include/base/files_cache/cached_file_buffer.h
index 602b8d7..42ac0fb 100644
--- a/myserver/include/base/files_cache/cached_file_buffer.h
+++ b/myserver/include/base/files_cache/cached_file_buffer.h
@@ -58,8 +58,8 @@ public:
 
   void refreshExpireTime (u_long now) {expireTime = now + MYSERVER_SEC (5);}
   u_long getExpireTime () {return expireTime;}
-protected:
 
+protected:
   /*! Last mtime for this file.  */
   time_t mtime;
 
diff --git a/myserver/include/base/files_cache/cached_file_factory.h b/myserver/include/base/files_cache/cached_file_factory.h
index 449e333..9a814aa 100644
--- a/myserver/include/base/files_cache/cached_file_factory.h
+++ b/myserver/include/base/files_cache/cached_file_factory.h
@@ -76,6 +76,8 @@ protected:
 
   struct CachedFileFactoryRecord
   {
+    Mutex mutex;
+
     /*! Number of times the cache record was used.  */
     u_long used;
 
@@ -85,7 +87,7 @@ protected:
     /*! This entry is not valid and will be removed when refCount = 0.  */
     bool invalidCache;
 
-    CachedFileBuffer* buffer;
+    CachedFileBuffer *buffer;
   };
 
   list<CachedFileFactoryRecord *> buffersToRemove;
diff --git a/myserver/src/base/files_cache/cached_file_factory.cpp b/myserver/src/base/files_cache/cached_file_factory.cpp
index 2d90150..62bc658 100644
--- a/myserver/src/base/files_cache/cached_file_factory.cpp
+++ b/myserver/src/base/files_cache/cached_file_factory.cpp
@@ -136,19 +136,35 @@ void CachedFileFactory::initialize (u_long size)
 */
 File* CachedFileFactory::open (const char* filename, int flags)
 {
-  CachedFileFactoryRecord *record;
+  CachedFileFactoryRecord *record = NULL;
   CachedFileBuffer *buffer;
   CachedFile* cachedFile;
   u_long ticks = getTicks ();
-
   mutex.lock ();
   try
     {
+      purgeRecords ();
+
       record = buffers.get (filename);
-      buffer = record ? record->buffer : NULL;
+      if (record)
+        record->mutex.lock ();
+
+      mutex.unlock ();
+    }
+  catch (...)
+    {
+      mutex.unlock ();
+      throw;
+    }
 
+  try
+    {
+      buffer = NULL;
+
+      /* Check the record is valid.  */
       if (record)
         {
+          buffer = record->buffer;
           if (buffer->getExpireTime () <= ticks)
             {
               buffer->refreshExpireTime (ticks);
@@ -160,7 +176,7 @@ File* CachedFileFactory::open (const char* filename, int flags)
 
           if (record->invalidCache || noSymlink)
             {
-              mutex.unlock ();
+              record->mutex.unlock ();
 
               File *file = new File ();
               flags = flags & File::NO_FOLLOW_SYMLINK;
@@ -182,27 +198,22 @@ File* CachedFileFactory::open (const char* filename, int flags)
           if (file->openFile (filename, File::OPEN_IF_EXISTS | flags
                               | File::READ))
             {
-              mutex.unlock ();
               delete file;
               return NULL;
             }
 
           fileSize = file->getFileSize ();
-          purgeRecords ();
           if (minSize && fileSize < minSize
-              || maxSize && fileSize > maxSize
+               || maxSize && fileSize > maxSize
               || fileSize > size - usedSize)
-            {
-              mutex.unlock ();
-              return file;
-            }
+            return file;
           else
             {
               record = new CachedFileFactoryRecord ();
+              record->mutex.lock ();
               buffer = new CachedFileBuffer (file);
               file->close  ();
               delete file;
-
               buffer->setFactoryToNotify (this);
               record->created = ticks;
               record->buffer = buffer;
@@ -212,17 +223,17 @@ File* CachedFileFactory::open (const char* filename, int flags)
             }
         }
       record->used++;
-
       cachedFile = new CachedFile (buffer);
-
-      mutex.unlock ();
     }
   catch (...)
     {
-      mutex.unlock ();
+      if (record)
+        record->mutex.unlock ();
       throw;
     }
 
+  record->mutex.unlock ();
+
   return cachedFile;
 }
 
@@ -230,9 +241,9 @@ File* CachedFileFactory::open (const char* filename, int flags)
   Called by CachedFileBuffer when its counter reaches zero references.
   \param cfb A pointer to the source CachedFileBuffer object.
  */
-void CachedFileFactory::nullReferences (CachedFileBuffer* cfb)
+void CachedFileFactory::nullReferences (CachedFileBuffer *cfb)
 {
-  CachedFileFactoryRecord* record;
+  CachedFileFactoryRecord *record;
   float bufferAverageUsage;
   float spaceUsage;
   u_long ticks = getTicks ();
@@ -241,16 +252,13 @@ void CachedFileFactory::nullReferences (CachedFileBuffer* cfb)
   if (spaceUsage < 0.65f)
     return;
 
-  mutex.lock ();
+  record = buffers.get (cfb->getFilename ());
+  if (! record)
+    return;
+
+  record->mutex.lock ();
   try
     {
-      record = buffers.get (cfb->getFilename ());
-      if (! record)
-        {
-          mutex.unlock ();
-          return;
-        }
-
       bufferAverageUsage = (float)record->used * 1000.0f /
         (ticks - record->created);
 
@@ -262,11 +270,11 @@ void CachedFileFactory::nullReferences (CachedFileBuffer* cfb)
           if (record)
             buffersToRemove.push_back (record);
         }
-      mutex.unlock ();
+      record->mutex.unlock ();
     }
   catch (...)
     {
-      mutex.unlock ();
+      record->mutex.unlock ();
       throw;
     }
 }
@@ -292,6 +300,8 @@ u_long CachedFileFactory::purgeRecords ()
           delete rec;
         }
     }
+
   usedSize -= ret;
+
   return ret;
 }

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

Summary of changes:
 .../include/base/files_cache/cached_file_buffer.h  |    2 +-
 .../include/base/files_cache/cached_file_factory.h |    4 +-
 .../src/base/files_cache/cached_file_factory.cpp   |   66 +++++++++++--------
 3 files changed, 42 insertions(+), 30 deletions(-)


hooks/post-receive
-- 
GNU MyServer


From MAILER-DAEMON Sun Aug 08 12:54:37 2010
Received: from mailman by lists.gnu.org with archive (Exim 4.43)
	id 1Oi98u-0005XH-Tz
	for mharc-myserver-commit@gnu.org; Sun, 08 Aug 2010 12:54:37 -0400
Received: from [140.186.70.92] (port=51195 helo=eggs.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.43) id 1Oi98i-0002Dw-H9
	for myserver-commit@gnu.org; Sun, 08 Aug 2010 12:54:34 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69)
	(envelope-from <gscrivano@gnu.org>) id 1Oi98M-0003C1-Ue
	for myserver-commit@gnu.org; Sun, 08 Aug 2010 12:54:14 -0400
Received: from colonialone.fsf.org ([140.186.70.51]:44095
	helo=internal.in.savannah.gnu.org)
	by eggs.gnu.org with esmtp (Exim 4.69)
	(envelope-from <gscrivano@gnu.org>) id 1Oi98M-0003Bv-Rr
	for myserver-commit@gnu.org; Sun, 08 Aug 2010 12:54:02 -0400
Received: from [10.1.0.108] (helo=vcs-noshell.in.savannah.gnu.org)
	by internal.in.savannah.gnu.org with esmtp (Exim 4.69)
	(envelope-from <gscrivano@gnu.org>) id 1Oi98M-0000Ho-Gg
	for myserver-commit@gnu.org; Sun, 08 Aug 2010 16:54:02 +0000
Received: from gscrivano by vcs-noshell.in.savannah.gnu.org with local (Exim
	4.69) (envelope-from <gscrivano@savannah.gnu.org>)
	id 1Oi98I-00012d-DF
	for myserver-commit@gnu.org; Sun, 08 Aug 2010 16:54:02 +0000
To: myserver-commit@gnu.org
X-Git-Refname: refs/heads/master
X-Git-Reftype: branch
X-Git-Oldrev: 3e96839388a2dffa1a06b6ed64d801361050d2f0
X-Git-Newrev: 61ba823d81d5b1e050f8065f54680644801f27ec
Message-Id: <E1Oi98I-00012d-DF@vcs-noshell.in.savannah.gnu.org>
From: Giuseppe Scrivano <gscrivano@gnu.org>
Date: Sun, 08 Aug 2010 16:54:01 +0000
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2)
Subject: [myserver-commit] [SCM] GNU MyServer branch, master,
	updated. v0.9.2-289-g61ba823
X-BeenThere: myserver-commit@gnu.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: myserver-commit.gnu.org
List-Unsubscribe: <http://lists.gnu.org/mailman/listinfo/myserver-commit>,
	<mailto:myserver-commit-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/myserver-commit>
List-Post: <mailto:myserver-commit@gnu.org>
List-Help: <mailto:myserver-commit-request@gnu.org?subject=help>
List-Subscribe: <http://lists.gnu.org/mailman/listinfo/myserver-commit>,
	<mailto:myserver-commit-request@gnu.org?subject=subscribe>
X-List-Received-Date: Sun, 08 Aug 2010 16:54:35 -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  61ba823d81d5b1e050f8065f54680644801f27ec (commit)
       via  ab1c4a2f031eac035ce506b6cc971fd7f4f2977b (commit)
       via  3a5fc2150c67c9e3f5c6a3e96b88888b73ce42ee (commit)
      from  3e96839388a2dffa1a06b6ed64d801361050d2f0 (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 61ba823d81d5b1e050f8065f54680644801f27ec
Author: Giuseppe Scrivano <gscrivano@gnu.org>
Date:   Sun Aug 8 18:53:46 2010 +0200

    Proxy: delay the connection cleanup after the scheduler releases it.

diff --git a/myserver/include/http_handler/proxy/proxy.h b/myserver/include/http_handler/proxy/proxy.h
index a3a3d54..de7943e 100644
--- a/myserver/include/http_handler/proxy/proxy.h
+++ b/myserver/include/http_handler/proxy/proxy.h
@@ -39,6 +39,7 @@ public:
                     const char* exec = 0, bool execute = false,
                     bool onlyHeader = false);
   virtual int load ();
+  virtual int unLoad ();
 
 protected:
   struct ConnectionRecord
@@ -65,7 +66,8 @@ protected:
   void removeConnection (Connection *c);
 
   ConnectionPtr getConnection (const char *host, u_short port);
-  void addConnection (ConnectionPtr con, const char *host, u_short port);
+  void addConnection (ConnectionPtr con, const char *host, u_short port,
+                      bool keepalive);
   Mutex connectionsLock;
   vector<ConnectionRecord> connections;
   size_t maxKeepAliveConnections;
diff --git a/myserver/src/connection/connection.cpp b/myserver/src/connection/connection.cpp
index 1c80b14..17f331f 100644
--- a/myserver/src/connection/connection.cpp
+++ b/myserver/src/connection/connection.cpp
@@ -118,7 +118,7 @@ int Connection::isScheduled ()
 /*!
   Return if the connection may be deleted by the server.
  */
-int Connection::allowDelete (bool bWait/*= false*/)
+int Connection::allowDelete (bool bWait)
 {
   if (isScheduled ())
      return 0;
diff --git a/myserver/src/connections_scheduler/connections_scheduler.cpp b/myserver/src/connections_scheduler/connections_scheduler.cpp
index c471ffc..e8dfbdd 100644
--- a/myserver/src/connections_scheduler/connections_scheduler.cpp
+++ b/myserver/src/connections_scheduler/connections_scheduler.cpp
@@ -349,7 +349,8 @@ void ConnectionsScheduler::initialize ()
   if (err == -1)
     {
       if (server)
-        server->log (MYSERVER_LOG_MSG_ERROR, _("Error initializing socket pair"));
+        server->log (MYSERVER_LOG_MSG_ERROR,
+                     _("Error initializing socket pair"));
       return;
     }
 
@@ -369,7 +370,7 @@ void ConnectionsScheduler::initialize ()
     {
       if (server)
         server->log (MYSERVER_LOG_MSG_ERROR,
-                            _("Error while initializing the dispatcher thread"));
+                     _("Error while initializing the dispatcher thread"));
 
       dispatchedThreadId = 0;
     }
@@ -692,6 +693,10 @@ void ConnectionsScheduler::terminateConnections ()
       for (; it != connections.end (); it++)
         {
           ConnectionPtr c = *it;
+
+          if (c->notifySchedulerHandler (-1))
+            continue;
+
           if (c->allowDelete (true) && c->socket)
             c->socket->close ();
         }
diff --git a/myserver/src/http_handler/proxy/proxy.cpp b/myserver/src/http_handler/proxy/proxy.cpp
index 41fde71..4163a66 100644
--- a/myserver/src/http_handler/proxy/proxy.cpp
+++ b/myserver/src/http_handler/proxy/proxy.cpp
@@ -126,17 +126,16 @@ int Proxy::send (HttpThreadContext *td, const char* scriptpath,
 
       chain.clearAllFilters ();
 
-      if (keepalive)
-        addConnection (con, destUrl.getHost ().c_str (), destUrl.getPort ());
-      else
-        delete con;
+      addConnection (con, destUrl.getHost ().c_str (), destUrl.getPort (),
+                     keepalive);
 
       req.free ();
     }
   catch (exception & e)
     {
       if (con)
-        delete con;
+        addConnection (con, destUrl.getHost ().c_str (), destUrl.getPort (),
+                       false);
       chain.clearAllFilters ();
       return td->http->raiseHTTPError (500);
     }
@@ -345,6 +344,8 @@ int Proxy::load ()
     = Server::getInstance ()->getData ("http.proxy.connections.keepalive",
                                        "64");
   maxKeepAliveConnections = atoi (data);
+
+  return 0;
 }
 
 ConnectionPtr Proxy::getConnection (const char *host, u_short port)
@@ -398,6 +399,12 @@ void Proxy::proxySchedulerHandler (void *p, Connection *c, int event)
 
 void Proxy::removeConnection (Connection *c)
 {
+  if (c->getToRemove ())
+    {
+      delete c;
+      return;
+    }
+
   connectionsLock.lock ();
   try
     {
@@ -422,17 +429,23 @@ void Proxy::removeConnection (Connection *c)
     }
 }
 
-void Proxy::addConnection (ConnectionPtr con, const char *host, u_short port)
+void Proxy::addConnection (ConnectionPtr con, const char *host, u_short port,
+                           bool keepalive)
 {
-  if (connections.size () >= maxKeepAliveConnections)
+  ConnectionsScheduler *cs  = Server::getInstance ()->getConnectionsScheduler ();
+
+  if (!keepalive || connections.size () >= maxKeepAliveConnections)
     {
-      delete con;
+      /* Do not destroy the connection immediately, it can be used by the
+         scheduler, so delay its destruction until we are sure it is not used
+         by the scheduler anymore.  */
+      con->setToRemove (1);
+      cs->addNewWaitingConnection (con);
       return;
     }
 
   con->setSchedulerHandler (Proxy::proxySchedulerHandler, this);
 
-  ConnectionsScheduler *cs  = Server::getInstance ()->getConnectionsScheduler ();
   cs->addNewWaitingConnection (con);
 
   ConnectionRecord cr;
@@ -442,3 +455,29 @@ void Proxy::addConnection (ConnectionPtr con, const char *host, u_short port)
 
   connections.push_back (cr);
 }
+
+int Proxy::unLoad ()
+{
+  ConnectionsScheduler *cs  = Server::getInstance ()->getConnectionsScheduler ();
+
+  connectionsLock.lock ();
+  try
+    {
+      vector<ConnectionRecord>::iterator it = connections.begin ();
+      for (; it != connections.end (); it++)
+        {
+          (*it).connection->setToRemove (1);
+          cs->addNewWaitingConnection ((*it).connection);
+        }
+
+      connections.clear ();
+      connectionsLock.unlock ();
+    }
+  catch (...)
+    {
+      connectionsLock.unlock ();
+      throw;
+    }
+
+  return 0;
+}



commit ab1c4a2f031eac035ce506b6cc971fd7f4f2977b
Author: Giuseppe Scrivano <gscrivano@gnu.org>
Date:   Sun Aug 8 16:16:23 2010 +0200

    Proxy: ensure the connection is still open, otherwise raise an error.

diff --git a/myserver/src/http_handler/proxy/proxy.cpp b/myserver/src/http_handler/proxy/proxy.cpp
index c45517a..41fde71 100644
--- a/myserver/src/http_handler/proxy/proxy.cpp
+++ b/myserver/src/http_handler/proxy/proxy.cpp
@@ -172,6 +172,9 @@ int Proxy::flushToClient (HttpThreadContext* td, Socket& client,
     }
   while (ret);
 
+  if (read == 0)
+    return td->http->raiseHTTPError (500);
+
   checkDataChunks (td, &keepalive, &useChunks);
 
   string *tmp = td->request.getValue ("Host", NULL);



commit 3a5fc2150c67c9e3f5c6a3e96b88888b73ce42ee
Author: Giuseppe Scrivano <gscrivano@gnu.org>
Date:   Sun Aug 8 15:49:39 2010 +0200

    Proxy: do not keep dead connections for reuse.

diff --git a/myserver/include/http_handler/proxy/proxy.h b/myserver/include/http_handler/proxy/proxy.h
index c28687a..a3a3d54 100644
--- a/myserver/include/http_handler/proxy/proxy.h
+++ b/myserver/include/http_handler/proxy/proxy.h
@@ -49,7 +49,7 @@ protected:
   };
 
   int flushToClient (HttpThreadContext* td, Socket& client,
-                     FiltersChain &out, bool onlyHeader);
+                     FiltersChain &out, bool onlyHeader, bool *kaClient);
   int readPayLoad (HttpThreadContext* td,
                    HttpResponseHeader* res,
                    FiltersChain *out,
diff --git a/myserver/src/http_handler/proxy/proxy.cpp b/myserver/src/http_handler/proxy/proxy.cpp
index 21deeed..c45517a 100644
--- a/myserver/src/http_handler/proxy/proxy.cpp
+++ b/myserver/src/http_handler/proxy/proxy.cpp
@@ -49,6 +49,7 @@ int Proxy::send (HttpThreadContext *td, const char* scriptpath,
   FiltersChain chain;
   HttpRequestHeader req;
   u_long nbw;
+  bool keepalive = false;
 
   for (HashMap<string, HttpRequestHeader::Entry*>::Iterator it =
          td->request.begin (); it != td->request.end (); it++)
@@ -121,10 +122,15 @@ int Proxy::send (HttpThreadContext *td, const char* scriptpath,
                                                              1);
 
 
-      flushToClient (td, *sock, chain, onlyHeader);
+      flushToClient (td, *sock, chain, onlyHeader, &keepalive);
 
       chain.clearAllFilters ();
-      addConnection (con, destUrl.getHost ().c_str (), destUrl.getPort ());
+
+      if (keepalive)
+        addConnection (con, destUrl.getHost ().c_str (), destUrl.getPort ());
+      else
+        delete con;
+
       req.free ();
     }
   catch (exception & e)
@@ -142,7 +148,7 @@ int Proxy::send (HttpThreadContext *td, const char* scriptpath,
   Flush the server reply to the client.
  */
 int Proxy::flushToClient (HttpThreadContext* td, Socket& client,
-                          FiltersChain &out, bool onlyHeader)
+                          FiltersChain &out, bool onlyHeader, bool *kaClient)
 {
   u_long read = 0;
   u_long headerLength;
@@ -181,6 +187,9 @@ int Proxy::flushToClient (HttpThreadContext* td, Socket& client,
   else
     td->response.setValue ("Via", via);
 
+  tmp = td->response.getValue ("Connection", NULL);
+  *kaClient = tmp && !strcasecmp (tmp->c_str (), "keep-alive");
+
   string transferEncoding;
   bool hasTransferEncoding = false;
   tmp = td->response.getValue ("Transfer-encoding", NULL);

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

Summary of changes:
 myserver/include/http_handler/proxy/proxy.h        |    6 +-
 myserver/src/connection/connection.cpp             |    2 +-
 .../connections_scheduler.cpp                      |    9 ++-
 myserver/src/http_handler/proxy/proxy.cpp          |   67 +++++++++++++++++---
 4 files changed, 71 insertions(+), 13 deletions(-)


hooks/post-receive
-- 
GNU MyServer


From MAILER-DAEMON Sun Aug 08 13:03:04 2010
Received: from mailman by lists.gnu.org with archive (Exim 4.43)
	id 1Oi9H6-0003kV-D2
	for mharc-myserver-commit@gnu.org; Sun, 08 Aug 2010 13:03:04 -0400
Received: from [140.186.70.92] (port=47004 helo=eggs.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.43) id 1Oi9H1-00018e-9Y
	for myserver-commit@gnu.org; Sun, 08 Aug 2010 13:03:02 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69)
	(envelope-from <gscrivano@gnu.org>) id 1OhuNr-0005Dh-J1
	for myserver-commit@gnu.org; Sat, 07 Aug 2010 21:09:09 -0400
Received: from colonialone.fsf.org ([140.186.70.51]:46341
	helo=internal.in.savannah.gnu.org)
	by eggs.gnu.org with esmtp (Exim 4.69)
	(envelope-from <gscrivano@gnu.org>) id 1OhuNr-0005DC-ER
	for myserver-commit@gnu.org; Sat, 07 Aug 2010 21:09:03 -0400
Received: from [10.1.0.108] (helo=vcs-noshell.in.savannah.gnu.org)
	by internal.in.savannah.gnu.org with esmtp (Exim 4.69)
	(envelope-from <gscrivano@gnu.org>) id 1OhuNr-0005kb-9u
	for myserver-commit@gnu.org; Sun, 08 Aug 2010 01:09:03 +0000
Received: from gscrivano by vcs-noshell.in.savannah.gnu.org with local (Exim
	4.69) (envelope-from <gscrivano@savannah.gnu.org>)
	id 1OhuNn-0004I7-QX
	for myserver-commit@gnu.org; Sun, 08 Aug 2010 01:09:03 +0000
To: myserver-commit@gnu.org
X-Git-Refname: refs/heads/master
X-Git-Reftype: branch
X-Git-Oldrev: c5e025441689007017bb5f6e0f330d4873c76284
X-Git-Newrev: 3e96839388a2dffa1a06b6ed64d801361050d2f0
Message-Id: <E1OhuNn-0004I7-QX@vcs-noshell.in.savannah.gnu.org>
From: Giuseppe Scrivano <gscrivano@gnu.org>
Date: Sun, 08 Aug 2010 01:09:03 +0000
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2)
Subject: [myserver-commit] [SCM] GNU MyServer branch, master,
	updated. v0.9.2-286-g3e96839
X-BeenThere: myserver-commit@gnu.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: myserver-commit.gnu.org
List-Unsubscribe: <http://lists.gnu.org/mailman/listinfo/myserver-commit>,
	<mailto:myserver-commit-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/myserver-commit>
List-Post: <mailto:myserver-commit@gnu.org>
List-Help: <mailto:myserver-commit-request@gnu.org?subject=help>
List-Subscribe: <http://lists.gnu.org/mailman/listinfo/myserver-commit>,
	<mailto:myserver-commit-request@gnu.org?subject=subscribe>
X-List-Received-Date: Sun, 08 Aug 2010 17:03:02 -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  3e96839388a2dffa1a06b6ed64d801361050d2f0 (commit)
       via  5d1529b1e9e3ce359dc72ad0a61afdb97f91f215 (commit)
       via  998e03b7fcc6e38247247034477bd0082ce312c2 (commit)
      from  c5e025441689007017bb5f6e0f330d4873c76284 (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 3e96839388a2dffa1a06b6ed64d801361050d2f0
Author: Giuseppe Scrivano <gscrivano@gnu.org>
Date:   Sun Aug 8 03:08:48 2010 +0200

    The PROXY handler now maintains a pool of keep-alive connections to reuse.

diff --git a/myserver/NEWS b/myserver/NEWS
index eed9f5b..b899b1e 100644
--- a/myserver/NEWS
+++ b/myserver/NEWS
@@ -18,6 +18,9 @@ GNU myserver NEWS                                    -*- outline -*-
 
   The build doesn't fail if zlib is not found.
 
+** New features
+
+   The PROXY handler now maintains a pool of keep-alive connections to reuse.
 
 * Noteworthy changes in release 0.9.2
 
diff --git a/myserver/include/http_handler/proxy/proxy.h b/myserver/include/http_handler/proxy/proxy.h
index 0c5e4c2..c28687a 100644
--- a/myserver/include/http_handler/proxy/proxy.h
+++ b/myserver/include/http_handler/proxy/proxy.h
@@ -38,7 +38,16 @@ public:
   virtual int send (HttpThreadContext*, const char* scriptpath,
                     const char* exec = 0, bool execute = false,
                     bool onlyHeader = false);
+  virtual int load ();
+
 protected:
+  struct ConnectionRecord
+  {
+    string host;
+    u_short port;
+    ConnectionPtr connection;
+  };
+
   int flushToClient (HttpThreadContext* td, Socket& client,
                      FiltersChain &out, bool onlyHeader);
   int readPayLoad (HttpThreadContext* td,
@@ -52,6 +61,14 @@ protected:
                    bool keepalive = false,
                    string *serverTransferEncoding = NULL);
 
+  static void proxySchedulerHandler (void *p, Connection *c, int event);
+  void removeConnection (Connection *c);
+
+  ConnectionPtr getConnection (const char *host, u_short port);
+  void addConnection (ConnectionPtr con, const char *host, u_short port);
+  Mutex connectionsLock;
+  vector<ConnectionRecord> connections;
+  size_t maxKeepAliveConnections;
   static int timeout;
 };
 #endif
diff --git a/myserver/src/conf/mime/xml_mime_handler.cpp b/myserver/src/conf/mime/xml_mime_handler.cpp
index eb686e3..0921067 100644
--- a/myserver/src/conf/mime/xml_mime_handler.cpp
+++ b/myserver/src/conf/mime/xml_mime_handler.cpp
@@ -320,7 +320,6 @@ void XmlMimeHandler::clearRecords ()
 /*!
   Get the MIME type to use on the specified file.
   \param filename Find the MIME type for this file.
-  \param handler If specified, indicate an external handler to use
   if the mime cannot be found locally.
 */
 MimeRecord *XmlMimeHandler::getMIME (const char *filename)
diff --git a/myserver/src/http_handler/proxy/proxy.cpp b/myserver/src/http_handler/proxy/proxy.cpp
index 1dbe690..21deeed 100644
--- a/myserver/src/http_handler/proxy/proxy.cpp
+++ b/myserver/src/http_handler/proxy/proxy.cpp
@@ -44,7 +44,8 @@ int Proxy::send (HttpThreadContext *td, const char* scriptpath,
                  const char* exec, bool execute, bool onlyHeader)
 {
   Url destUrl (exec, 80);
-  Socket sock;
+  ConnectionPtr con = NULL;
+  Socket *sock;
   FiltersChain chain;
   HttpRequestHeader req;
   u_long nbw;
@@ -72,7 +73,14 @@ int Proxy::send (HttpThreadContext *td, const char* scriptpath,
       req.uri.assign ("/");
       req.uri.append (destUrl.getResource ());
       req.uri.append (td->pathInfo);
-      req.setValue ("Connection", "Close");
+      req.setValue ("Connection", "keep-alive");
+      if (td->request.uriOptsPtr)
+        {
+          char buffer[32];
+          u_long size = td->inputData.getFileSize ();
+          sprintf (buffer, "%u", size);
+          req.setValue ("Content-Length", buffer);
+        }
 
       ostringstream host;
       host << destUrl.getHost ();
@@ -88,17 +96,21 @@ int Proxy::send (HttpThreadContext *td, const char* scriptpath,
       xForwardedFor.append (td->connection->getIpAddr ());
       req.setValue ("X-Forwarded-For", xForwardedFor.c_str ());
 
-      sock.connect (destUrl.getHost ().c_str (), destUrl.getPort ());
+      con = getConnection (destUrl.getHost ().c_str (), destUrl.getPort ());
+      if (! con)
+        return td->http->raiseHTTPError (500);
+
+      sock = con->socket;
 
       u_long hdrLen =
         HttpHeaders::buildHTTPRequestHeader (td->auxiliaryBuffer->getBuffer (),
                                              &req);
 
 
-      sock.write (td->auxiliaryBuffer->getBuffer (), hdrLen, &nbw);
+      sock->write (td->auxiliaryBuffer->getBuffer (), hdrLen, &nbw);
 
       if (td->request.uriOptsPtr)
-        td->inputData.fastCopyToSocket (&sock, 0, td->auxiliaryBuffer, &nbw);
+        td->inputData.fastCopyToSocket (sock, 0, td->auxiliaryBuffer, &nbw);
 
       chain.setStream (td->connection->socket);
       if (td->mime)
@@ -109,14 +121,16 @@ int Proxy::send (HttpThreadContext *td, const char* scriptpath,
                                                              1);
 
 
-      flushToClient (td, sock, chain, onlyHeader);
+      flushToClient (td, *sock, chain, onlyHeader);
 
       chain.clearAllFilters ();
-      sock.close ();
+      addConnection (con, destUrl.getHost ().c_str (), destUrl.getPort ());
       req.free ();
     }
   catch (exception & e)
     {
+      if (con)
+        delete con;
       chain.clearAllFilters ();
       return td->http->raiseHTTPError (500);
     }
@@ -312,3 +326,107 @@ int Proxy::readPayLoad (HttpThreadContext* td,
 
   return HttpDataHandler::RET_OK;
 }
+
+int Proxy::load ()
+{
+  const char *data
+    = Server::getInstance ()->getData ("http.proxy.connections.keepalive",
+                                       "64");
+  maxKeepAliveConnections = atoi (data);
+}
+
+ConnectionPtr Proxy::getConnection (const char *host, u_short port)
+{
+  ConnectionPtr ret = NULL;
+
+  connectionsLock.lock ();
+  try
+    {
+      vector<ConnectionRecord>::iterator it = connections.begin ();
+      for (; it != connections.end (); it++)
+        {
+          if ((*it).port == port && (*it).host.compare (host) == 0)
+            {
+              ret = (*it).connection;
+              connections.erase (it);
+              break;
+            }
+        }
+      connectionsLock.unlock ();
+      if (ret)
+        return ret;
+    }
+  catch (...)
+    {
+      connectionsLock.unlock ();
+      throw;
+    }
+
+  ret = new Connection ();
+  ret->socket = new Socket ();
+  try
+    {
+      ret->socket->socket (AF_INET, SOCK_STREAM, 0);
+      ret->socket->connect (host, port);
+    }
+  catch (...)
+    {
+      delete ret;
+      throw;
+    }
+
+  return ret;
+}
+
+void Proxy::proxySchedulerHandler (void *p, Connection *c, int event)
+{
+  Proxy *proxy = (Proxy *) p;
+  proxy->removeConnection (c);
+}
+
+void Proxy::removeConnection (Connection *c)
+{
+  connectionsLock.lock ();
+  try
+    {
+      vector<ConnectionRecord>::iterator it = connections.begin ();
+      for (; it != connections.end (); it++)
+        {
+          /* Remove only if it is found in the buffer.  Otherwise it is
+             used at this time and we can't remove it.  */
+          if ((*it).connection == c)
+            {
+              connections.erase (it);
+              delete c;
+              break;
+            }
+        }
+
+      connectionsLock.unlock ();
+    }
+  catch (...)
+    {
+      connectionsLock.unlock ();
+    }
+}
+
+void Proxy::addConnection (ConnectionPtr con, const char *host, u_short port)
+{
+  if (connections.size () >= maxKeepAliveConnections)
+    {
+      delete con;
+      return;
+    }
+
+  con->setSchedulerHandler (Proxy::proxySchedulerHandler, this);
+
+  ConnectionsScheduler *cs  = Server::getInstance ()->getConnectionsScheduler ();
+  cs->addNewWaitingConnection (con);
+
+  ConnectionRecord cr;
+  cr.host = host;
+  cr.port = port;
+  cr.connection = con;
+
+  connections.push_back (cr);
+}



commit 5d1529b1e9e3ce359dc72ad0a61afdb97f91f215
Author: Giuseppe Scrivano <gscrivano@gnu.org>
Date:   Sun Aug 8 02:43:52 2010 +0200

    Allow to define a different event handler for connection.

diff --git a/myserver/include/connection/connection.h b/myserver/include/connection/connection.h
index eb7360e..1a15bb1 100644
--- a/myserver/include/connection/connection.h
+++ b/myserver/include/connection/connection.h
@@ -132,8 +132,16 @@ public:
   bool hasContinuation (){return continuation ? true : false;}
 
   MemBuf *getConnectionBuffer (){return &connectionBuffer;}
+  void setSchedulerHandler (void (*schedulerHandler) (void *, Connection *,
+                                                      int),
+                            void *schedulerHandlerArgument);
+
+  int notifySchedulerHandler (int event);
 protected:
 
+  void (*schedulerHandler) (void *, Connection *, int event);
+  void *schedulerHandlerArgument;
+
   /*! This buffer must be used only by the ClientsTHREAD class.  */
   MemBuf connectionBuffer;
 
diff --git a/myserver/src/connection/connection.cpp b/myserver/src/connection/connection.cpp
index 859778e..1c80b14 100644
--- a/myserver/src/connection/connection.cpp
+++ b/myserver/src/connection/connection.cpp
@@ -39,6 +39,7 @@ void Connection::init ()
   socket = NULL;
   priority = -1;
   continuation = NULL;
+  setSchedulerHandler (NULL, NULL);
 }
 
 /*!
@@ -320,3 +321,31 @@ void Connection::setPriority (int p)
 {
   priority = p;
 }
+
+/*!
+  Set the handler that the scheduler will call on new data.
+  \param schedulerHandler Handler to call.
+  \param schedulerHandlerArgument Argument for the handler.
+ */
+void
+Connection::setSchedulerHandler (void (*schedulerHandler) (void *,
+                                                           Connection *, int),
+                                 void *schedulerHandlerArgument)
+{
+  this->schedulerHandler = schedulerHandler;
+  this->schedulerHandlerArgument = schedulerHandlerArgument;
+}
+
+/*!
+  If a scheduler handler is configured.  Notify it.
+
+  \return 0 if there is not handler.
+*/
+int Connection::notifySchedulerHandler (int event)
+{
+  if (! schedulerHandler)
+    return 0;
+
+  schedulerHandler (schedulerHandlerArgument, this, event);
+  return 1;
+}
diff --git a/myserver/src/connections_scheduler/connections_scheduler.cpp b/myserver/src/connections_scheduler/connections_scheduler.cpp
index 02a3466..c471ffc 100644
--- a/myserver/src/connections_scheduler/connections_scheduler.cpp
+++ b/myserver/src/connections_scheduler/connections_scheduler.cpp
@@ -91,6 +91,9 @@ void ConnectionsScheduler::newData (short event, SocketHandle handle)
   if (connection == NULL || server == NULL)
     return;
 
+  if (connection->notifySchedulerHandler (event))
+    return;
+
   if (event == EV_READ)
     addReadyConnection (connection);
   else if (event == EV_TIMEOUT)



commit 998e03b7fcc6e38247247034477bd0082ce312c2
Author: Giuseppe Scrivano <gscrivano@gnu.org>
Date:   Sat Aug 7 22:40:06 2010 +0200

    Do not undefine remove.

diff --git a/myserver/src/connections_scheduler/connections_scheduler.cpp b/myserver/src/connections_scheduler/connections_scheduler.cpp
index fed80e5..02a3466 100644
--- a/myserver/src/connections_scheduler/connections_scheduler.cpp
+++ b/myserver/src/connections_scheduler/connections_scheduler.cpp
@@ -17,8 +17,6 @@
 
 #include "myserver.h"
 
-#undef remove
-
 #ifdef WIN32
 # include <w32sock.h>
 

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

Summary of changes:
 myserver/NEWS                                      |    3 +
 myserver/include/connection/connection.h           |    8 ++
 myserver/include/http_handler/proxy/proxy.h        |   17 +++
 myserver/src/conf/mime/xml_mime_handler.cpp        |    1 -
 myserver/src/connection/connection.cpp             |   29 +++++
 .../connections_scheduler.cpp                      |    5 +-
 myserver/src/http_handler/proxy/proxy.cpp          |  132 ++++++++++++++++++-
 7 files changed, 185 insertions(+), 10 deletions(-)


hooks/post-receive
-- 
GNU MyServer


From MAILER-DAEMON Sun Aug 08 13:48:33 2010
Received: from mailman by lists.gnu.org with archive (Exim 4.43)
	id 1Oi9z7-0004Jr-4u
	for mharc-myserver-commit@gnu.org; Sun, 08 Aug 2010 13:48:33 -0400
Received: from [140.186.70.92] (port=41355 helo=eggs.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.43) id 1Oi9z1-0004Ef-0w
	for myserver-commit@gnu.org; Sun, 08 Aug 2010 13:48:28 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69)
	(envelope-from <gscrivano@gnu.org>) id 1Oi9yz-00043N-M2
	for myserver-commit@gnu.org; Sun, 08 Aug 2010 13:48:26 -0400
Received: from colonialone.fsf.org ([140.186.70.51]:55779
	helo=internal.in.savannah.gnu.org)
	by eggs.gnu.org with esmtp (Exim 4.69)
	(envelope-from <gscrivano@gnu.org>) id 1Oi9yz-00043H-IW
	for myserver-commit@gnu.org; Sun, 08 Aug 2010 13:48:25 -0400
Received: from [10.1.0.108] (helo=vcs-noshell.in.savannah.gnu.org)
	by internal.in.savannah.gnu.org with esmtp (Exim 4.69)
	(envelope-from <gscrivano@gnu.org>) id 1Oi9yz-0000x7-Bw
	for myserver-commit@gnu.org; Sun, 08 Aug 2010 17:48:25 +0000
Received: from gscrivano by vcs-noshell.in.savannah.gnu.org with local (Exim
	4.69) (envelope-from <gscrivano@savannah.gnu.org>)
	id 1Oi9yu-00054N-6y
	for myserver-commit@gnu.org; Sun, 08 Aug 2010 17:48:25 +0000
To: myserver-commit@gnu.org
X-Git-Refname: refs/heads/master
X-Git-Reftype: branch
X-Git-Oldrev: 61ba823d81d5b1e050f8065f54680644801f27ec
X-Git-Newrev: 556703b68cca205286663c76a16c324377954797
Message-Id: <E1Oi9yu-00054N-6y@vcs-noshell.in.savannah.gnu.org>
From: Giuseppe Scrivano <gscrivano@gnu.org>
Date: Sun, 08 Aug 2010 17:48:24 +0000
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2)
Subject: [myserver-commit] [SCM] GNU MyServer branch, master,
	updated. v0.9.2-291-g556703b
X-BeenThere: myserver-commit@gnu.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: myserver-commit.gnu.org
List-Unsubscribe: <http://lists.gnu.org/mailman/listinfo/myserver-commit>,
	<mailto:myserver-commit-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/myserver-commit>
List-Post: <mailto:myserver-commit@gnu.org>
List-Help: <mailto:myserver-commit-request@gnu.org?subject=help>
List-Subscribe: <http://lists.gnu.org/mailman/listinfo/myserver-commit>,
	<mailto:myserver-commit-request@gnu.org?subject=subscribe>
X-List-Received-Date: Sun, 08 Aug 2010 17:48:29 -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  556703b68cca205286663c76a16c324377954797 (commit)
       via  ad8601680defc5d6de454909938712b331e85ebf (commit)
      from  61ba823d81d5b1e050f8065f54680644801f27ec (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 556703b68cca205286663c76a16c324377954797
Author: Giuseppe Scrivano <gscrivano@gnu.org>
Date:   Sun Aug 8 19:46:08 2010 +0200

    Proxy: Prevent a double initial slash in request.

diff --git a/myserver/src/http_handler/proxy/proxy.cpp b/myserver/src/http_handler/proxy/proxy.cpp
index 4163a66..1b6b679 100644
--- a/myserver/src/http_handler/proxy/proxy.cpp
+++ b/myserver/src/http_handler/proxy/proxy.cpp
@@ -71,9 +71,11 @@ int Proxy::send (HttpThreadContext *td, const char* scriptpath,
     {
       req.ver.assign ("HTTP/1.1");
       req.cmd.assign (td->request.cmd);
-      req.uri.assign ("/");
+      if (destUrl.getResource ()[0] != '/')
+        req.uri.assign ("/");
       req.uri.append (destUrl.getResource ());
       req.uri.append (td->pathInfo);
+
       req.setValue ("Connection", "keep-alive");
       if (td->request.uriOptsPtr)
         {



commit ad8601680defc5d6de454909938712b331e85ebf
Author: Giuseppe Scrivano <gscrivano@gnu.org>
Date:   Sun Aug 8 19:17:05 2010 +0200

    select: Adjust multipliers for timeout.

diff --git a/myserver/src/base/socket/socket.cpp b/myserver/src/base/socket/socket.cpp
index 27ba6f8..00ebdea 100644
--- a/myserver/src/base/socket/socket.cpp
+++ b/myserver/src/base/socket/socket.cpp
@@ -530,7 +530,7 @@ int Socket::connect (MYSERVER_SOCKADDR* sa, int na)
  */
 int Socket::recv (char* buffer, int len, int flags, u_long timeout)
 {
-  int ret = dataAvailable (timeout / 1000, timeout % 1000);
+  int ret = dataAvailable (timeout / 1000000, timeout % 1000000);
 
   if (ret)
     return recv (buffer, len, flags);

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

Summary of changes:
 myserver/src/base/socket/socket.cpp       |    2 +-
 myserver/src/http_handler/proxy/proxy.cpp |    4 +++-
 2 files changed, 4 insertions(+), 2 deletions(-)


hooks/post-receive
-- 
GNU MyServer


From MAILER-DAEMON Sun Aug 08 21:45:16 2010
Received: from mailman by lists.gnu.org with archive (Exim 4.43)
	id 1OiHQR-0004Q7-V5
	for mharc-myserver-commit@gnu.org; Sun, 08 Aug 2010 21:45:15 -0400
Received: from [140.186.70.92] (port=53449 helo=eggs.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.43) id 1OiHQO-0004Pv-Vi
	for myserver-commit@gnu.org; Sun, 08 Aug 2010 21:45:14 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69)
	(envelope-from <gscrivano@gnu.org>) id 1OiHQN-0004js-Mf
	for myserver-commit@gnu.org; Sun, 08 Aug 2010 21:45:12 -0400
Received: from colonialone.fsf.org ([140.186.70.51]:48193
	helo=internal.in.savannah.gnu.org)
	by eggs.gnu.org with esmtp (Exim 4.69)
	(envelope-from <gscrivano@gnu.org>) id 1OiHQN-0004jo-KH
	for myserver-commit@gnu.org; Sun, 08 Aug 2010 21:45:11 -0400
Received: from [10.1.0.108] (helo=vcs-noshell.in.savannah.gnu.org)
	by internal.in.savannah.gnu.org with esmtp (Exim 4.69)
	(envelope-from <gscrivano@gnu.org>) id 1OiHQM-0006oe-Rn
	for myserver-commit@gnu.org; Mon, 09 Aug 2010 01:45:11 +0000
Received: from gscrivano by vcs-noshell.in.savannah.gnu.org with local (Exim
	4.69) (envelope-from <gscrivano@savannah.gnu.org>)
	id 1OiHQH-00021b-Vd
	for myserver-commit@gnu.org; Mon, 09 Aug 2010 01:45:10 +0000
To: myserver-commit@gnu.org
X-Git-Refname: refs/heads/master
X-Git-Reftype: branch
X-Git-Oldrev: 556703b68cca205286663c76a16c324377954797
X-Git-Newrev: 6e6a0d0d677091bfbcc04ee77f5685ef4659bcd0
Message-Id: <E1OiHQH-00021b-Vd@vcs-noshell.in.savannah.gnu.org>
From: Giuseppe Scrivano <gscrivano@gnu.org>
Date: Mon, 09 Aug 2010 01:45:09 +0000
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2)
Subject: [myserver-commit] [SCM] GNU MyServer branch, master,
	updated. v0.9.2-294-g6e6a0d0
X-BeenThere: myserver-commit@gnu.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: myserver-commit.gnu.org
List-Unsubscribe: <http://lists.gnu.org/mailman/listinfo/myserver-commit>,
	<mailto:myserver-commit-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/myserver-commit>
List-Post: <mailto:myserver-commit@gnu.org>
List-Help: <mailto:myserver-commit-request@gnu.org?subject=help>
List-Subscribe: <http://lists.gnu.org/mailman/listinfo/myserver-commit>,
	<mailto:myserver-commit-request@gnu.org?subject=subscribe>
X-List-Received-Date: Mon, 09 Aug 2010 01:45:14 -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  6e6a0d0d677091bfbcc04ee77f5685ef4659bcd0 (commit)
       via  0f8214b40499d12ab1663c489efdbb8d05bb3297 (commit)
       via  8746fa5b92b981e998b402e61786a5b98c32dbd6 (commit)
      from  556703b68cca205286663c76a16c324377954797 (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 6e6a0d0d677091bfbcc04ee77f5685ef4659bcd0
Author: Giuseppe Scrivano <gscrivano@gnu.org>
Date:   Mon Aug 9 03:44:35 2010 +0200

    FileStream: atomically cycle the log file not copying it.

diff --git a/myserver/src/log/stream/file_stream.cpp b/myserver/src/log/stream/file_stream.cpp
index d02a10c..efcb090 100644
--- a/myserver/src/log/stream/file_stream.cpp
+++ b/myserver/src/log/stream/file_stream.cpp
@@ -43,13 +43,23 @@ FileStream::streamCycle ()
   File *currentFile = dynamic_cast<File*>(out);
   string filepath (currentFile->getFilename ());
   string newFileName (makeNewFileName (currentFile->getFilename ()));
+  u_long opts = currentFile->getOpenOptions ();
 
-  if (FilesUtility::copyFile (currentFile->getFilename (), newFileName.c_str (), 1))
-    return 1;
-
-  cycledStreams.push_back (newFileName);
+  currentFile->close ();
+  try
+    {
+      FilesUtility::renameFile (filepath.c_str (),
+                                newFileName.c_str ());
+      cycledStreams.push_back (newFileName);
+    }
+  catch (...)
+    {
+      /* Whatever happens, try to don't leave the log file closed.  */
+      currentFile->openFile (filepath, opts);
+      throw;
+    }
 
-  currentFile->truncate ();
+  currentFile->openFile (filepath, opts);
 
   return 0;
 }



commit 0f8214b40499d12ab1663c489efdbb8d05bb3297
Author: Giuseppe Scrivano <gscrivano@gnu.org>
Date:   Mon Aug 9 03:38:16 2010 +0200

    tests: Adjust some tests to use exceptions.

diff --git a/myserver/tests/test_cached_file.cpp b/myserver/tests/test_cached_file.cpp
index 493ef6c..edc2ed0 100644
--- a/myserver/tests/test_cached_file.cpp
+++ b/myserver/tests/test_cached_file.cpp
@@ -74,18 +74,56 @@ public:
   void testOpenFile ()
   {
     string filename;
-    CPPUNIT_ASSERT (cf->openFile (NULL, 0));
-    CPPUNIT_ASSERT (cf->openFile (filename, 0));
+    int success = 0;
+    try
+      {
+        cf->openFile (NULL, 0);
+      }
+    catch (...)
+      {
+        success++;
+      }
+
+    try
+      {
+        cf->openFile (filename, 0);
+      }
+    catch (...)
+      {
+        success++;
+      }
+
+    CPPUNIT_ASSERT_EQUAL (success, 2);
   }
 
   void testCreateTemporaryFile ()
   {
-    CPPUNIT_ASSERT (cf->createTemporaryFile (NULL));
+    int success = 0;
+    try
+      {
+        cf->createTemporaryFile (NULL);
+      }
+    catch (...)
+      {
+        success++;
+      }
+
+    CPPUNIT_ASSERT_EQUAL (success, 1);
   }
 
   void testWrite ()
   {
-    CPPUNIT_ASSERT (cf->writeToFile (NULL, 0, NULL));
+    int success = 0;
+    try
+      {
+        cf->writeToFile (NULL, 0, NULL);
+      }
+    catch (...)
+      {
+        success++;
+      }
+
+    CPPUNIT_ASSERT_EQUAL (success, 1);
   }
 
   void testRead ()
@@ -104,9 +142,6 @@ public:
 
     delete [] buffer;
   }
-
-
-
 };
 
 CPPUNIT_TEST_SUITE_REGISTRATION ( TestCachedFile );



commit 8746fa5b92b981e998b402e61786a5b98c32dbd6
Author: Giuseppe Scrivano <gscrivano@gnu.org>
Date:   Mon Aug 9 02:42:15 2010 +0200

    FileStream: Fix a possible memory leak.

diff --git a/myserver/src/log/stream/file_stream_creator.cpp b/myserver/src/log/stream/file_stream_creator.cpp
index 83a47a0..f1c5fda 100644
--- a/myserver/src/log/stream/file_stream_creator.cpp
+++ b/myserver/src/log/stream/file_stream_creator.cpp
@@ -22,20 +22,28 @@ LogStream*
 FileStreamCreator::create (FiltersFactory* ff, string location,
                            list<string>& filters, u_long cycle)
 {
-  File* out = new File ();
-  char* path = const_cast<char*>(location.c_str ());
-  if (out && !out->openFile (path, FileStream::defaultFileMask))
+  File *out = new File ();
+  FiltersChain *fc = NULL;
+  char *path = const_cast<char*>(location.c_str ());
+  try
     {
       u_long nbw;
-      FiltersChain* fc = ff->chain (filters, out, &nbw);
+      out->openFile (path, FileStream::defaultFileMask);
+      fc = ff->chain (filters, out, &nbw);
       if (fc)
-        {
-          return new FileStream (ff, cycle, out, fc);
-        }
+        return new FileStream (ff, cycle, out, fc);
     }
-  if (out)
+  catch (...)
     {
+      if (fc)
+        delete fc;
+
       delete out;
+      throw;
     }
+
+  if (out)
+    delete out;
+
   return 0;
 }

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

Summary of changes:
 myserver/src/log/stream/file_stream.cpp         |   20 +++++++--
 myserver/src/log/stream/file_stream_creator.cpp |   24 +++++++----
 myserver/tests/test_cached_file.cpp             |   49 +++++++++++++++++++---
 3 files changed, 73 insertions(+), 20 deletions(-)


hooks/post-receive
-- 
GNU MyServer


From MAILER-DAEMON Mon Aug 09 12:39:10 2010
Received: from mailman by lists.gnu.org with archive (Exim 4.43)
	id 1OiVNW-0007md-0c
	for mharc-myserver-commit@gnu.org; Mon, 09 Aug 2010 12:39:10 -0400
Received: from [140.186.70.92] (port=54193 helo=eggs.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.43) id 1OiVNT-0007lm-LS
	for myserver-commit@gnu.org; Mon, 09 Aug 2010 12:39:08 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69)
	(envelope-from <gscrivano@gnu.org>) id 1OiVNS-00032S-BW
	for myserver-commit@gnu.org; Mon, 09 Aug 2010 12:39:07 -0400
Received: from colonialone.fsf.org ([140.186.70.51]:60267
	helo=internal.in.savannah.gnu.org)
	by eggs.gnu.org with esmtp (Exim 4.69)
	(envelope-from <gscrivano@gnu.org>) id 1OiVNS-00032L-8p
	for myserver-commit@gnu.org; Mon, 09 Aug 2010 12:39:06 -0400
Received: from [10.1.0.108] (helo=vcs-noshell.in.savannah.gnu.org)
	by internal.in.savannah.gnu.org with esmtp (Exim 4.69)
	(envelope-from <gscrivano@gnu.org>) id 1OiVNR-0000to-L4
	for myserver-commit@gnu.org; Mon, 09 Aug 2010 16:39:05 +0000
Received: from gscrivano by vcs-noshell.in.savannah.gnu.org with local (Exim
	4.69) (envelope-from <gscrivano@savannah.gnu.org>)
	id 1OiVNN-0003Py-IO
	for myserver-commit@gnu.org; Mon, 09 Aug 2010 16:39:05 +0000
To: myserver-commit@gnu.org
X-Git-Refname: refs/heads/master
X-Git-Reftype: branch
X-Git-Oldrev: 6e6a0d0d677091bfbcc04ee77f5685ef4659bcd0
X-Git-Newrev: 2e0bf394baf3c2724c026ce07aa654805af76b62
Message-Id: <E1OiVNN-0003Py-IO@vcs-noshell.in.savannah.gnu.org>
From: Giuseppe Scrivano <gscrivano@gnu.org>
Date: Mon, 09 Aug 2010 16:39:04 +0000
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2)
Subject: [myserver-commit] [SCM] GNU MyServer branch, master,
	updated. v0.9.2-295-g2e0bf39
X-BeenThere: myserver-commit@gnu.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: myserver-commit.gnu.org
List-Unsubscribe: <http://lists.gnu.org/mailman/listinfo/myserver-commit>,
	<mailto:myserver-commit-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/myserver-commit>
List-Post: <mailto:myserver-commit@gnu.org>
List-Help: <mailto:myserver-commit-request@gnu.org?subject=help>
List-Subscribe: <http://lists.gnu.org/mailman/listinfo/myserver-commit>,
	<mailto:myserver-commit-request@gnu.org?subject=subscribe>
X-List-Received-Date: Mon, 09 Aug 2010 16:39:08 -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  2e0bf394baf3c2724c026ce07aa654805af76b62 (commit)
      from  6e6a0d0d677091bfbcc04ee77f5685ef4659bcd0 (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 2e0bf394baf3c2724c026ce07aa654805af76b62
Author: Giuseppe Scrivano <gscrivano@gnu.org>
Date:   Mon Aug 9 18:38:49 2010 +0200

    Documentation: add note for `http.proxy.connections.keepalive'.

diff --git a/myserver/documentation/mime_types.texi b/myserver/documentation/mime_types.texi
index bffaba1..ae8669d 100644
--- a/myserver/documentation/mime_types.texi
+++ b/myserver/documentation/mime_types.texi
@@ -144,6 +144,12 @@ It is done using the @code{PATH} directive in the following way:
 The @code{PATH} regular expressions are checked before the file
 extension, in the order they are specified in the configuration file.
 
+The proxy handler can keep a pool of active connections to the most
+recent used websites in order to make new requests faster.
+The maximum number of active connections that the server should
+maintain, can be configured trough the global variable
+@code{http.proxy.connections.keepalive}.
+
 @section Symbolic links
 MyServer offers the feature to follow symlinks where they are
 supported.

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

Summary of changes:
 myserver/documentation/mime_types.texi |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)


hooks/post-receive
-- 
GNU MyServer


From MAILER-DAEMON Mon Aug 16 20:38:42 2010
Received: from mailman by lists.gnu.org with archive (Exim 4.43)
	id 1OlACP-0006uk-Se
	for mharc-myserver-commit@gnu.org; Mon, 16 Aug 2010 20:38:41 -0400
Received: from [140.186.70.92] (port=34365 helo=eggs.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.43) id 1OlACM-0006ua-Q3
	for myserver-commit@gnu.org; Mon, 16 Aug 2010 20:38:39 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69)
	(envelope-from <gscrivano@gnu.org>) id 1OlACL-0002IB-FF
	for myserver-commit@gnu.org; Mon, 16 Aug 2010 20:38:38 -0400
Received: from colonialone.fsf.org ([140.186.70.51]:38020
	helo=internal.in.savannah.gnu.org)
	by eggs.gnu.org with esmtp (Exim 4.69)
	(envelope-from <gscrivano@gnu.org>) id 1OlACL-0002Ht-4n
	for myserver-commit@gnu.org; Mon, 16 Aug 2010 20:38:37 -0400
Received: from [10.1.0.108] (helo=vcs-noshell.in.savannah.gnu.org)
	by internal.in.savannah.gnu.org with esmtp (Exim 4.69)
	(envelope-from <gscrivano@gnu.org>) id 1OlACK-0002gK-AS
	for myserver-commit@gnu.org; Tue, 17 Aug 2010 00:38:36 +0000
Received: from gscrivano by vcs-noshell.in.savannah.gnu.org with local (Exim
	4.69) (envelope-from <gscrivano@savannah.gnu.org>)
	id 1OlACA-00032D-5j
	for myserver-commit@gnu.org; Tue, 17 Aug 2010 00:38:36 +0000
To: myserver-commit@gnu.org
X-Git-Refname: refs/heads/master
X-Git-Reftype: branch
X-Git-Oldrev: 2e0bf394baf3c2724c026ce07aa654805af76b62
X-Git-Newrev: dd766df8e3096bb69f1430706fc42034a4c82283
Message-Id: <E1OlACA-00032D-5j@vcs-noshell.in.savannah.gnu.org>
From: Giuseppe Scrivano <gscrivano@gnu.org>
Date: Tue, 17 Aug 2010 00:38:31 +0000
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2)
Subject: [myserver-commit] [SCM] GNU MyServer branch, master,
	updated. v0.9.2-296-gdd766df
X-BeenThere: myserver-commit@gnu.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: myserver-commit.gnu.org
List-Unsubscribe: <http://lists.gnu.org/mailman/listinfo/myserver-commit>,
	<mailto:myserver-commit-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/myserver-commit>
List-Post: <mailto:myserver-commit@gnu.org>
List-Help: <mailto:myserver-commit-request@gnu.org?subject=help>
List-Subscribe: <http://lists.gnu.org/mailman/listinfo/myserver-commit>,
	<mailto:myserver-commit-request@gnu.org?subject=subscribe>
X-List-Received-Date: Tue, 17 Aug 2010 00:38:40 -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  dd766df8e3096bb69f1430706fc42034a4c82283 (commit)
      from  2e0bf394baf3c2724c026ce07aa654805af76b62 (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 dd766df8e3096bb69f1430706fc42034a4c82283
Author: Alexandru IANCU <alexandru.iancu@gmail.com>
Date:   Mon Aug 16 23:45:06 2010 +0300

    improve compile time by using precompiled header

diff --git a/myserver/Makefile.am b/myserver/Makefile.am
index b69052d..b9fee8d 100644
--- a/myserver/Makefile.am
+++ b/myserver/Makefile.am
@@ -43,6 +43,9 @@ localedir.h: Makefile
 	echo '/* This file is auto-generated by Makefile!  */' >$@
 	echo '#define LOCALEDIR "$(localedir)"' >> $@
 
+pch: stdafx.h
+	$(CXX) -x c++-header stdafx.h -o stdafx.h.gch
+
 all: config.h localedir.h
 # Generate the localedir.h file before any other rule.
 

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

Summary of changes:
 myserver/Makefile.am |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)


hooks/post-receive
-- 
GNU MyServer


From MAILER-DAEMON Fri Aug 20 09:31:48 2010
Received: from mailman by lists.gnu.org with archive (Exim 4.43)
	id 1OmRhE-0001Rg-Ao
	for mharc-myserver-commit@gnu.org; Fri, 20 Aug 2010 09:31:48 -0400
Received: from [140.186.70.92] (port=59077 helo=eggs.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.43) id 1OmRhC-0001R1-7C
	for myserver-commit@gnu.org; Fri, 20 Aug 2010 09:31:47 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69)
	(envelope-from <gscrivano@gnu.org>) id 1OmRhB-00028t-2R
	for myserver-commit@gnu.org; Fri, 20 Aug 2010 09:31:45 -0400
Received: from colonialone.fsf.org ([140.186.70.51]:42097
	helo=internal.in.savannah.gnu.org)
	by eggs.gnu.org with esmtp (Exim 4.69)
	(envelope-from <gscrivano@gnu.org>) id 1OmRhB-00028n-19
	for myserver-commit@gnu.org; Fri, 20 Aug 2010 09:31:45 -0400
Received: from [10.1.0.108] (helo=vcs-noshell.in.savannah.gnu.org)
	by internal.in.savannah.gnu.org with esmtp (Exim 4.69)
	(envelope-from <gscrivano@gnu.org>) id 1OmRhA-0004zz-M5
	for myserver-commit@gnu.org; Fri, 20 Aug 2010 13:31:44 +0000
Received: from gscrivano by vcs-noshell.in.savannah.gnu.org with local (Exim
	4.69) (envelope-from <gscrivano@savannah.gnu.org>)
	id 1OmRhA-0005ja-JX
	for myserver-commit@gnu.org; Fri, 20 Aug 2010 13:31:44 +0000
To: myserver-commit@gnu.org
X-Git-Refname: refs/heads/master
X-Git-Reftype: branch
X-Git-Oldrev: 8fb19a358c36dda01aa2431169ac2ef66ba3b589
X-Git-Newrev: 2d4ffb0f4bcec6cfda7cd89ba6b34e8969876df5
Message-Id: <E1OmRhA-0005ja-JX@vcs-noshell.in.savannah.gnu.org>
From: Giuseppe Scrivano <gscrivano@gnu.org>
Date: Fri, 20 Aug 2010 13:31:44 +0000
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2)
Subject: [myserver-commit] [SCM] GNU MyServer branch, master,
	updated. v0.9.2-342-g2d4ffb0
X-BeenThere: myserver-commit@gnu.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: myserver-commit.gnu.org
List-Unsubscribe: <http://lists.gnu.org/mailman/listinfo/myserver-commit>,
	<mailto:myserver-commit-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/myserver-commit>
List-Post: <mailto:myserver-commit@gnu.org>
List-Help: <mailto:myserver-commit-request@gnu.org?subject=help>
List-Subscribe: <http://lists.gnu.org/mailman/listinfo/myserver-commit>,
	<mailto:myserver-commit-request@gnu.org?subject=subscribe>
X-List-Received-Date: Fri, 20 Aug 2010 13:31:47 -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  2d4ffb0f4bcec6cfda7cd89ba6b34e8969876df5 (commit)
      from  8fb19a358c36dda01aa2431169ac2ef66ba3b589 (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 2d4ffb0f4bcec6cfda7cd89ba6b34e8969876df5
Author: Giuseppe Scrivano <gscrivano@gnu.org>
Date:   Fri Aug 20 15:31:21 2010 +0200

    Mention WebDAV in the NEWS.

diff --git a/myserver/NEWS b/myserver/NEWS
index b899b1e..d078ad5 100644
--- a/myserver/NEWS
+++ b/myserver/NEWS
@@ -22,6 +22,8 @@ GNU myserver NEWS                                    -*- outline -*-
 
    The PROXY handler now maintains a pool of keep-alive connections to reuse.
 
+   Web-based Distributed Authoring and Versioning (WebDAV) support.
+
 * Noteworthy changes in release 0.9.2
 
 ** Bug fixes

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

Summary of changes:
 myserver/NEWS |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)


hooks/post-receive
-- 
GNU MyServer


From MAILER-DAEMON Fri Aug 20 09:41:29 2010
Received: from mailman by lists.gnu.org with archive (Exim 4.43)
	id 1OmRqb-00036S-9j
	for mharc-myserver-commit@gnu.org; Fri, 20 Aug 2010 09:41:29 -0400
Received: from [140.186.70.92] (port=59776 helo=eggs.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.43) id 1OmRqZ-00036H-4p
	for myserver-commit@gnu.org; Fri, 20 Aug 2010 09:41:28 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69)
	(envelope-from <e.dolstra@tudelft.nl>) id 1OmRqV-0003bS-Kn
	for myserver-commit@gnu.org; Fri, 20 Aug 2010 09:41:26 -0400
Received: from proliant.st.ewi.tudelft.nl ([130.161.158.3]:47441)
	by eggs.gnu.org with esmtp (Exim 4.69)
	(envelope-from <e.dolstra@tudelft.nl>) id 1OmRqV-0003aj-B4
	for myserver-commit@gnu.org; Fri, 20 Aug 2010 09:41:23 -0400
Received: from hydra (buildfarm.st.ewi.tudelft.nl [130.161.158.181])
	by proliant.st.ewi.tudelft.nl (8.12.11/8.12.8) with SMTP id
	o7KDfKSI026494
	for <myserver-commit@gnu.org>; Fri, 20 Aug 2010 15:41:20 +0200
Message-Id: <201008201341.o7KDfKSI026494@proliant.st.ewi.tudelft.nl>
Received: by hydra (sSMTP sendmail emulation); Fri, 20 Aug 2010 15:41:20 +0200
To: myserver-commit@gnu.org
From: Hydra Build Daemon <e.dolstra@tudelft.nl>
X-Hydra-Instance: hydra
X-Hydra-Project: gnu
X-Hydra-Jobset: myserver-master
X-Hydra-Job: tarball
Date: Fri, 20 Aug 2010 15:41:20 +0200
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4-2.6
Subject: [myserver-commit] Hydra job gnu:myserver-master:tarball build
 568597: Failed with non-zero exit code
X-BeenThere: myserver-commit@gnu.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: myserver-commit.gnu.org
List-Unsubscribe: <http://lists.gnu.org/mailman/listinfo/myserver-commit>,
	<mailto:myserver-commit-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/myserver-commit>
List-Post: <mailto:myserver-commit@gnu.org>
List-Help: <mailto:myserver-commit-request@gnu.org?subject=help>
List-Subscribe: <http://lists.gnu.org/mailman/listinfo/myserver-commit>,
	<mailto:myserver-commit-request@gnu.org?subject=subscribe>
X-List-Received-Date: Fri, 20 Aug 2010 13:41:28 -0000

Hi,

This is to let you know that Hydra build 568597 of job gnu:myserver-master:tarball has changed from 'Success' to 'Failed with non-zero exit code'.

Complete build information can be found on this page: http://hydra.nixos.org/build/568597

The last 50 lines of the build log are shown at the bottom of this email.

A summary of the build information follows:

Build ID:              | 568597
Nix name:              | myserver-tarball-0pre8fb19a358c36dda01aa2431169ac2ef66ba3b589
Short description:     | Build of a source distribution from a checkout
Maintainer(s):         | myserver-commit@gnu.org
System:                | x86_64-linux
Derivation store path: | /nix/store/i9726il03riw33rpifhbj4qldc7blkbf-myserver-tarball-0pre8fb19a358c36dda01aa2431169ac2ef66ba3b589.drv
Output store path:     | /nix/store/ybww068a2bnr0p6m93865gfshl9143kg-myserver-tarball-0pre8fb19a358c36dda01aa2431169ac2ef66ba3b589
Time added:            | 2010-08-20 15:41:20
Build started:         | 2010-08-20 15:35:08
Build finished:        | 2010-08-20 15:41:20
Duration:              | 372s

The build inputs were:

Name        | Type | Value
------------+------+---------------------------------------------------------------------------
myserverSrc | git  | git://git.sv.gnu.org/myserver.git:8fb19a358c36dda01aa2431169ac2ef66ba3b589
hydraConfig | svn  | https://svn.nixos.org/repos/nix/hydra-config/gnu/trunk:23187
gnulibSrc   | git  | git://git.sv.gnu.org/gnulib.git:3f08220c1a263dfc45f6e0ce6dcee97631dd5e56
nixpkgs     | svn  | https://svn.nixos.org/repos/nix/nixpkgs/trunk:23272

Regards,

The Hydra build daemon.

---
  CXX    crypt_algo_manager.lo
[3s[a/bin/sh ../../../libtool --silent --tag=CXX   --mode=compile g++ -DHAVE_CONFIG_H -I. -I../../..   -I/nix/store/p7ld4dqll8wh5crv75zd7qnbhf55819n-libxml2-2.7.7/include/libxml2 -I"../../../lib" -I"../../../lib" -I"../../.." -fPIC -DPIC  -c -o crypt_algo_manager.lo crypt_algo_manager.cpp[b
[q[pbuilding md5.lo
  CXX    md5.lo
[3s[a/bin/sh ../../../libtool --silent --tag=CXX   --mode=compile g++ -DHAVE_CONFIG_H -I. -I../../..   -I/nix/store/p7ld4dqll8wh5crv75zd7qnbhf55819n-libxml2-2.7.7/include/libxml2 -I"../../../lib" -I"../../../lib" -I"../../.." -fPIC -DPIC  -c -o md5.lo md5.cpp[b
[q[pbuilding sha1.lo
  CXX    sha1.lo
[3s[a/bin/sh ../../../libtool --silent --tag=CXX   --mode=compile g++ -DHAVE_CONFIG_H -I. -I../../..   -I/nix/store/p7ld4dqll8wh5crv75zd7qnbhf55819n-libxml2-2.7.7/include/libxml2 -I"../../../lib" -I"../../../lib" -I"../../.." -fPIC -DPIC  -c -o sha1.lo sha1.cpp[b
[q[pbuilding libcrypt.la
  CXXLD  libcrypt.la
[qmake[5]: Leaving directory `/tmp/nix-build-i9726il03riw33rpifhbj4qldc7blkbf-myserver-tarball-0pre8fb19a358c36dda01aa2431169ac2ef66ba3b589.drv-0/git-export/myserver/src/base/crypt'
[q[qmake[4]: Leaving directory `/tmp/nix-build-i9726il03riw33rpifhbj4qldc7blkbf-myserver-tarball-0pre8fb19a358c36dda01aa2431169ac2ef66ba3b589.drv-0/git-export/myserver/src/base/crypt'
[qMaking all in dynamic_lib
[pmake[4]: Entering directory `/tmp/nix-build-i9726il03riw33rpifhbj4qldc7blkbf-myserver-tarball-0pre8fb19a358c36dda01aa2431169ac2ef66ba3b589.drv-0/git-export/myserver/src/base/dynamic_lib'
[pbuilding all-recursive
[pmake[5]: Entering directory `/tmp/nix-build-i9726il03riw33rpifhbj4qldc7blkbf-myserver-tarball-0pre8fb19a358c36dda01aa2431169ac2ef66ba3b589.drv-0/git-export/myserver/src/base/dynamic_lib'
[pbuilding dynamiclib.lo
  CXX    dynamiclib.lo
[3s[a/bin/sh ../../../libtool --silent --tag=CXX   --mode=compile g++ -DHAVE_CONFIG_H -I. -I../../..   -I/nix/store/p7ld4dqll8wh5crv75zd7qnbhf55819n-libxml2-2.7.7/include/libxml2 -I"../../../lib" -I"../../../lib" -I"../../.." -fPIC -DPIC  -c -o dynamiclib.lo dynamiclib.cpp[b
[q[pbuilding libdynamic_lib.la
  CXXLD  libdynamic_lib.la
[qmake[5]: Leaving directory `/tmp/nix-build-i9726il03riw33rpifhbj4qldc7blkbf-myserver-tarball-0pre8fb19a358c36dda01aa2431169ac2ef66ba3b589.drv-0/git-export/myserver/src/base/dynamic_lib'
[q[qmake[4]: Leaving directory `/tmp/nix-build-i9726il03riw33rpifhbj4qldc7blkbf-myserver-tarball-0pre8fb19a358c36dda01aa2431169ac2ef66ba3b589.drv-0/git-export/myserver/src/base/dynamic_lib'
[qMaking all in file
[pmake[4]: Entering directory `/tmp/nix-build-i9726il03riw33rpifhbj4qldc7blkbf-myserver-tarball-0pre8fb19a358c36dda01aa2431169ac2ef66ba3b589.drv-0/git-export/myserver/src/base/file'
[pbuilding all-recursive
[pmake[5]: Entering directory `/tmp/nix-build-i9726il03riw33rpifhbj4qldc7blkbf-myserver-tarball-0pre8fb19a358c36dda01aa2431169ac2ef66ba3b589.drv-0/git-export/myserver/src/base/file'
[pbuilding file.lo
  CXX    file.lo
[3s[a/bin/sh ../../../libtool --silent --tag=CXX   --mode=compile g++ -DHAVE_CONFIG_H -I. -I../../..   -I/nix/store/p7ld4dqll8wh5crv75zd7qnbhf55819n-libxml2-2.7.7/include/libxml2 -I"../../../lib" -I"../../../lib" -I"../../.." -fPIC -DPIC  -c -o file.lo file.cpp[b
file.cpp: In member function 'virtual int File::seek(size_t)':
file.cpp:291: error: 'lseek' is not a member of 'gnulib'
file.cpp: In member function 'virtual size_t File::getSeek()':
file.cpp:302: error: 'lseek' is not a member of 'gnulib'
make[5]: *** [file.lo] Error 1
make[5]: Leaving directory `/tmp/nix-build-i9726il03riw33rpifhbj4qldc7blkbf-myserver-tarball-0pre8fb19a358c36dda01aa2431169ac2ef66ba3b589.drv-0/git-export/myserver/src/base/file'
[q[qmake[4]: *** [all-recursive] Error 1
make[4]: Leaving directory `/tmp/nix-build-i9726il03riw33rpifhbj4qldc7blkbf-myserver-tarball-0pre8fb19a358c36dda01aa2431169ac2ef66ba3b589.drv-0/git-export/myserver/src/base/file'
[q[qmake[3]: *** [all-recursive] Error 1
make[3]: Leaving directory `/tmp/nix-build-i9726il03riw33rpifhbj4qldc7blkbf-myserver-tarball-0pre8fb19a358c36dda01aa2431169ac2ef66ba3b589.drv-0/git-export/myserver/src/base'
[q[qmake[2]: *** [all-recursive] Error 1
make[2]: Leaving directory `/tmp/nix-build-i9726il03riw33rpifhbj4qldc7blkbf-myserver-tarball-0pre8fb19a358c36dda01aa2431169ac2ef66ba3b589.drv-0/git-export/myserver/src'
[q[qmake[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/tmp/nix-build-i9726il03riw33rpifhbj4qldc7blkbf-myserver-tarball-0pre8fb19a358c36dda01aa2431169ac2ef66ba3b589.drv-0/git-export/myserver'
[q[qmake: *** [all] Error 2
[q[q[qbuild time elapsed:  0m0.032s 0m0.011s 1m43.035s 0m44.962s
builder for `/nix/store/i9726il03riw33rpifhbj4qldc7blkbf-myserver-tarball-0pre8fb19a358c36dda01aa2431169ac2ef66ba3b589.drv' failed with exit code 2
error: build of `/nix/store/i9726il03riw33rpifhbj4qldc7blkbf-myserver-tarball-0pre8fb19a358c36dda01aa2431169ac2ef66ba3b589.drv' failed
Shared connection to kyle closed.

build of `/nix/store/i9726il03riw33rpifhbj4qldc7blkbf-myserver-tarball-0pre8fb19a358c36dda01aa2431169ac2ef66ba3b589.drv' on `buildfarm@kyle' failed with exit code 256


From MAILER-DAEMON Fri Aug 20 16:01:59 2010
Received: from mailman by lists.gnu.org with archive (Exim 4.43)
	id 1OmXmp-0001pf-Mc
	for mharc-myserver-commit@gnu.org; Fri, 20 Aug 2010 16:01:59 -0400
Received: from [140.186.70.92] (port=42859 helo=eggs.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.43) id 1OmXmm-0001o8-3x
	for myserver-commit@gnu.org; Fri, 20 Aug 2010 16:01:58 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69)
	(envelope-from <gscrivano@gnu.org>) id 1OmXmk-0001sV-1h
	for myserver-commit@gnu.org; Fri, 20 Aug 2010 16:01:55 -0400
Received: from colonialone.fsf.org ([140.186.70.51]:46297
	helo=internal.in.savannah.gnu.org)
	by eggs.gnu.org with esmtp (Exim 4.69)
	(envelope-from <gscrivano@gnu.org>) id 1OmXmj-0001sQ-UX
	for myserver-commit@gnu.org; Fri, 20 Aug 2010 16:01:54 -0400
Received: from [10.1.0.108] (helo=vcs-noshell.in.savannah.gnu.org)
	by internal.in.savannah.gnu.org with esmtp (Exim 4.69)
	(envelope-from <gscrivano@gnu.org>) id 1OmXmj-0001If-Ed
	for myserver-commit@gnu.org; Fri, 20 Aug 2010 20:01:53 +0000
Received: from gscrivano by vcs-noshell.in.savannah.gnu.org with local (Exim
	4.69) (envelope-from <gscrivano@savannah.gnu.org>)
	id 1OmXmi-0006Iv-UZ
	for myserver-commit@gnu.org; Fri, 20 Aug 2010 20:01:53 +0000
To: myserver-commit@gnu.org
X-Git-Refname: refs/heads/master
X-Git-Reftype: branch
X-Git-Oldrev: 2d4ffb0f4bcec6cfda7cd89ba6b34e8969876df5
X-Git-Newrev: 93a4d9b00be9a052eb1ee9158f1c83670584ee24
Message-Id: <E1OmXmi-0006Iv-UZ@vcs-noshell.in.savannah.gnu.org>
From: Giuseppe Scrivano <gscrivano@gnu.org>
Date: Fri, 20 Aug 2010 20:01:52 +0000
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2)
Subject: [myserver-commit] [SCM] GNU MyServer branch, master,
	updated. v0.9.2-344-g93a4d9b
X-BeenThere: myserver-commit@gnu.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: myserver-commit.gnu.org
List-Unsubscribe: <http://lists.gnu.org/mailman/listinfo/myserver-commit>,
	<mailto:myserver-commit-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/myserver-commit>
List-Post: <mailto:myserver-commit@gnu.org>
List-Help: <mailto:myserver-commit-request@gnu.org?subject=help>
List-Subscribe: <http://lists.gnu.org/mailman/listinfo/myserver-commit>,
	<mailto:myserver-commit-request@gnu.org?subject=subscribe>
X-List-Received-Date: Fri, 20 Aug 2010 20:01:58 -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  93a4d9b00be9a052eb1ee9158f1c83670584ee24 (commit)
       via  0e5cdde5f3fe247c583418f48f2f276241db8226 (commit)
      from  2d4ffb0f4bcec6cfda7cd89ba6b34e8969876df5 (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 93a4d9b00be9a052eb1ee9158f1c83670584ee24
Author: Giuseppe Scrivano <gscrivano@gnu.org>
Date:   Fri Aug 20 22:01:25 2010 +0200

    Use `off_t' with file offsets.

diff --git a/myserver/include/base/file/file.h b/myserver/include/base/file/file.h
index d17b72b..ca614e7 100644
--- a/myserver/include/base/file/file.h
+++ b/myserver/include/base/file/file.h
@@ -59,11 +59,10 @@ public:
   virtual int openFile (string const &file, u_long opt, mode_t mask = 00700)
   {return openFile (file.c_str (), opt, mask);}
 
-  /* FIXME: use off_t.  */
-  virtual size_t getFileSize ();
+  virtual off_t getFileSize ();
 
-  virtual int seek (size_t);
-  virtual size_t getSeek ();
+  virtual int seek (off_t);
+  virtual off_t getSeek ();
 
   virtual time_t getLastModTime ();
   virtual time_t getCreationTime ();
@@ -80,7 +79,7 @@ public:
   virtual int read (char* buffer, size_t len, size_t *nbr);
   virtual int write (const char* buffer, size_t len, size_t *nbw);
 
-  virtual int fastCopyToSocket (Socket *dest, size_t offset,
+  virtual int fastCopyToSocket (Socket *dest, off_t offset,
                                 MemBuf *buf, size_t *nbw);
 
   int truncate (u_long size = 0);
@@ -89,6 +88,7 @@ public:
 
   /*! Get the options mask used with openFile.  */
   u_long getOpenOptions (){return opt;}
+
 protected:
   /* Options used by open.  */
   u_long opt;
diff --git a/myserver/include/base/files_cache/cached_file.h b/myserver/include/base/files_cache/cached_file.h
index 6a5e05c..9a72c0b 100644
--- a/myserver/include/base/files_cache/cached_file.h
+++ b/myserver/include/base/files_cache/cached_file.h
@@ -41,20 +41,20 @@ public:
   virtual int openFile (string const &file, u_long opt, mode_t mask = 00700)
   {return openFile (file.c_str (), opt, mask);}
 
-  virtual size_t getFileSize ();
-  virtual int seek (size_t);
+  virtual off_t getFileSize ();
+  virtual int seek (off_t);
 
   using File::operator =;
   virtual int operator =(CachedFile);
   virtual int close ();
 
-  virtual int fastCopyToSocket (Socket *dest, size_t offset,
+  virtual int fastCopyToSocket (Socket *dest, off_t offset,
                                 MemBuf *buf, size_t *nbw);
 
   virtual int write (const char *buffer, size_t len, size_t *nbw);
 
 protected:
-  size_t fseek;
+  off_t fseek;
   CachedFileBuffer *buffer;
 };
 #endif
diff --git a/myserver/include/base/files_cache/cached_file_buffer.h b/myserver/include/base/files_cache/cached_file_buffer.h
index 57dcc84..a9ddc3c 100644
--- a/myserver/include/base/files_cache/cached_file_buffer.h
+++ b/myserver/include/base/files_cache/cached_file_buffer.h
@@ -41,7 +41,7 @@ public:
   void setFactoryToNotify (CachedFileFactory *cff);
   CachedFileFactory* getFactoryToNotify (){return factoryToNotify;}
 
-  size_t getFileSize (){return fileSize;}
+  off_t getFileSize (){return fileSize;}
   CachedFileBuffer (const char* filename);
   CachedFileBuffer (File* file);
   CachedFileBuffer (const char* buffer, u_long size);
diff --git a/myserver/include/base/files_cache/membuf_file.h b/myserver/include/base/files_cache/membuf_file.h
index 2163a2d..4695095 100644
--- a/myserver/include/base/files_cache/membuf_file.h
+++ b/myserver/include/base/files_cache/membuf_file.h
@@ -42,21 +42,21 @@ public:
   virtual int openFile (string const &file, u_long opt, mode_t mask = 00700)
   {return openFile (file.c_str (), opt, mask);}
 
-  virtual size_t getFileSize ();
-  virtual int seek (size_t);
+  virtual off_t getFileSize ();
+  virtual int seek (off_t);
 
   virtual int close ();
 
   using File::operator =;
 
-  virtual int fastCopyToSocket (Socket *dest, size_t offset,
+  virtual int fastCopyToSocket (Socket *dest, off_t offset,
                                 MemBuf *buf, size_t *nbw);
 
-  virtual size_t getSeek ();
+  virtual off_t getSeek ();
   virtual int write (const char* buffer, size_t len, size_t *nbw);
 
 protected:
-  size_t fseek;
+  off_t fseek;
   MemBuf *buffer;
 };
 #endif
diff --git a/myserver/include/http_handler/http_file/http_file.h b/myserver/include/http_handler/http_file/http_file.h
index e672e9a..944197a 100644
--- a/myserver/include/http_handler/http_file/http_file.h
+++ b/myserver/include/http_handler/http_file/http_file.h
@@ -40,8 +40,9 @@ protected:
                string& filename);
   int deleteFile (HttpThreadContext* td,
                   string& filename);
+
 private:
-  static void generateEtag (string & etag, u_long mtime, u_long size);
+  static void generateEtag (string & etag, u_long mtime, off_t size);
 };
 
 
diff --git a/myserver/include/protocol/http/http_request.h b/myserver/include/protocol/http/http_request.h
index b15d69f..8aa386a 100644
--- a/myserver/include/protocol/http/http_request.h
+++ b/myserver/include/protocol/http/http_request.h
@@ -52,8 +52,8 @@ struct HttpRequestHeader : public HttpHeader
   string uriOpts;
   char *uriOptsPtr;
   string rangeType;
-  u_long rangeByteBegin;
-  u_long rangeByteEnd;
+  off_t rangeByteBegin;
+  off_t rangeByteEnd;
   int uriEndsWithSlash;
 
   /*! Digest authorization scheme stuff.  */
diff --git a/myserver/include/protocol/http/http_thread_context.h b/myserver/include/protocol/http/http_thread_context.h
index a778952..56033b1 100644
--- a/myserver/include/protocol/http/http_thread_context.h
+++ b/myserver/include/protocol/http/http_thread_context.h
@@ -85,7 +85,7 @@ struct HttpThreadContext
   File inputData;
   File outputData;
   int authScheme;
-  Http* http;
+  Http *http;
   MimeRecord *mime;
   int sentData;
   SecurityToken securityToken;
diff --git a/myserver/src/base/file/file.cpp b/myserver/src/base/file/file.cpp
index 3a3555c..f103d14 100644
--- a/myserver/src/base/file/file.cpp
+++ b/myserver/src/base/file/file.cpp
@@ -270,22 +270,20 @@ int File::close ()
   Returns the file size in bytes.
   Returns -1 on errors.
  */
-size_t File::getFileSize ()
+off_t File::getFileSize ()
 {
-  u_long ret;
   struct stat fStats;
-  ret = checked::fstat (handle, &fStats);
-  if (ret)
-    return (u_long)(-1);
-  else
-    return fStats.st_size;
+
+  checked::fstat (handle, &fStats);
+
+  return fStats.st_size;
 }
 
 /*!
   Change the position of the pointer to the file.
   \param initialByte The new file pointer position.
  */
-int File::seek (size_t initialByte)
+int File::seek (off_t initialByte)
 {
   u_long ret;
   ret = checked::checkError (gnulib::lseek (handle, initialByte, SEEK_SET));
@@ -297,7 +295,7 @@ int File::seek (size_t initialByte)
 
   \return The current file pointer position.
  */
-size_t File::getSeek ()
+off_t File::getSeek ()
 {
   off_t ret = gnulib::lseek (handle, 0, SEEK_CUR);
   if (ret < 0)
@@ -365,12 +363,12 @@ int File::read (char* buffer, size_t buffersize, size_t* nbr)
   \param buf Temporary buffer that can be used by this function.
   \param nbw Number of bytes sent.
  */
-int File::fastCopyToSocket (Socket *dest, size_t firstByte, MemBuf *buf, size_t *nbw)
+int File::fastCopyToSocket (Socket *dest, off_t firstByte, MemBuf *buf, size_t *nbw)
 {
   *nbw = 0;
 #ifdef HAVE_SYS_SENDFILE_H
   off_t offset = firstByte;
-  size_t fileSize = getFileSize ();
+  off_t fileSize = getFileSize ();
   while (1)
     {
       int ret = sendfile (dest->getHandle (), getHandle (), &offset,
diff --git a/myserver/src/base/files_cache/cached_file.cpp b/myserver/src/base/files_cache/cached_file.cpp
index 2e6eb5f..7b2cc97 100644
--- a/myserver/src/base/files_cache/cached_file.cpp
+++ b/myserver/src/base/files_cache/cached_file.cpp
@@ -125,7 +125,8 @@ int CachedFile::operator =(CachedFile f)
  */
 int CachedFile::read (char* buffer, size_t buffersize, size_t* nbr)
 {
-  size_t toRead = std::min (buffersize, this->buffer->getFileSize () - fseek);
+  size_t toRead = std::min ((size_t) (this->buffer->getFileSize () - fseek),
+                            buffersize);
   const char* src = &(this->buffer->getBuffer ()[fseek]);
   if (nbr)
     *nbr = toRead;
@@ -162,7 +163,7 @@ int CachedFile::close ()
   Returns the file size in bytes.
   Returns -1 on errors.
  */
-size_t CachedFile::getFileSize ()
+off_t CachedFile::getFileSize ()
 {
   return buffer->getFileSize ();
 }
@@ -171,7 +172,7 @@ size_t CachedFile::getFileSize ()
   Change the position of the pointer to the file.
   \param initialByte The new file pointer position.
  */
-int CachedFile::seek (size_t initialByte)
+int CachedFile::seek (off_t initialByte)
 {
   if (initialByte > buffer->getFileSize ())
     return -1;
@@ -197,7 +198,7 @@ int CachedFile::write (const char* buffer, size_t len, size_t *nbw)
   \param buf Temporary buffer that can be used by this function.
   \param nbw Number of bytes sent.
  */
-int CachedFile::fastCopyToSocket (Socket *dest, size_t firstByte,
+int CachedFile::fastCopyToSocket (Socket *dest, off_t firstByte,
                                   MemBuf *buf, size_t *nbw)
 {
   return dest->write (&(this->buffer->getBuffer ()[firstByte]),
diff --git a/myserver/src/base/files_cache/membuf_file.cpp b/myserver/src/base/files_cache/membuf_file.cpp
index 949f634..55e7852 100644
--- a/myserver/src/base/files_cache/membuf_file.cpp
+++ b/myserver/src/base/files_cache/membuf_file.cpp
@@ -71,7 +71,7 @@ int MemBufFile::read (char *data, size_t len, size_t *nbr)
 {
   const char *buf = buffer->getBuffer ();
 
-  *nbr = min (len, buffer->getLength () - fseek);
+  *nbr = min (len, (size_t) (buffer->getLength () - fseek));
   if (*nbr)
     memcpy (data, buf, *nbr);
 
@@ -112,7 +112,7 @@ int MemBufFile::openFile (const char*, u_long, mode_t mask)
 /*!
   \see File#getFileSize.
 */
-size_t MemBufFile::getFileSize ()
+off_t MemBufFile::getFileSize ()
 {
   return buffer->getLength ();
 }
@@ -120,7 +120,7 @@ size_t MemBufFile::getFileSize ()
 /*!
   \see File#seek.
 */
-int MemBufFile::seek (size_t newSeek)
+int MemBufFile::seek (off_t newSeek)
 {
   fseek = newSeek;
   return 0;
@@ -137,7 +137,7 @@ int MemBufFile::close ()
 /*!
   \see File#fastCopyToSocket.
 */
-int MemBufFile::fastCopyToSocket (Socket *dest, size_t offset,
+int MemBufFile::fastCopyToSocket (Socket *dest, off_t offset,
                                   MemBuf *buf, size_t *nbw)
 {
   const char *data = buffer->getBuffer ();
@@ -157,7 +157,7 @@ int MemBufFile::write (const char* buffer, size_t len, size_t *nbw)
 /*!
   \see File#getSeek.
 */
-size_t MemBufFile::getSeek ()
+off_t MemBufFile::getSeek ()
 {
   return fseek;
 }
diff --git a/myserver/src/http_handler/http_file/http_file.cpp b/myserver/src/http_handler/http_file/http_file.cpp
index 4f977a8..e00ae9b 100644
--- a/myserver/src/http_handler/http_file/http_file.cpp
+++ b/myserver/src/http_handler/http_file/http_file.cpp
@@ -41,7 +41,7 @@ using namespace std;
  */
 int HttpFile::putFile (HttpThreadContext* td, string& filename)
 {
-  u_long firstByte = td->request.rangeByteBegin;
+  off_t firstByte = td->request.rangeByteBegin;
   int successCode = 500;
   File file;
   int symFlags = td->http->areSymlinksAllowed () ? 0
@@ -173,7 +173,7 @@ int HttpFile::deleteFile (HttpThreadContext* td,
   \param atime Resource last modified time.
   \param size Resource size.
  */
-void HttpFile::generateEtag (string & etag, u_long mtime, u_long fsize)
+void HttpFile::generateEtag (string & etag, u_long mtime, off_t fsize)
 {
 #define ROL(x, y) ((x << y) | (x >> (32 - y)))
   /* Do a bit rotation to have less significative bits in the middle.  */
@@ -199,11 +199,11 @@ int HttpFile::send (HttpThreadContext* td, const char *filenamePath,
     With this routine we send a file through the HTTP protocol.
     Open the file and save its handle.
    */
-  size_t filesize = 0;
+  off_t filesize = 0;
   File *file = NULL;
   size_t bytesToSend;
-  size_t firstByte = td->request.rangeByteBegin;
-  size_t lastByte = td->request.rangeByteEnd;
+  off_t firstByte = td->request.rangeByteBegin;
+  off_t lastByte = td->request.rangeByteEnd;
   bool keepalive = false;
   bool useChunks = false;
   bool useModifiers = false;
@@ -336,7 +336,7 @@ int HttpFile::send (HttpThreadContext* td, const char *filenamePath,
     if (!useModifiers)
       {
         ostringstream buffer;
-        buffer << (u_int) bytesToSend;
+        buffer << bytesToSend;
         td->response.contentLength.assign (buffer.str ());
       }
 
diff --git a/myserver/src/protocol/http/http_headers.cpp b/myserver/src/protocol/http/http_headers.cpp
index 69c9285..890df6d 100644
--- a/myserver/src/protocol/http/http_headers.cpp
+++ b/myserver/src/protocol/http/http_headers.cpp
@@ -162,14 +162,14 @@ u_long HttpHeaders::buildHTTPRequestHeader (char * str,
                                MAX - (long)(pos - str));
       pos += myserver_strlcpy (pos, " ", MAX - (long)(pos - str));
 
-      if (request->rangeByteBegin != (u_long) -1)
+      if (request->rangeByteBegin < 0)
         {
           sprintf (buffer, "%lu", request->rangeByteBegin);
           pos += myserver_strlcpy (pos, buffer, MAX - (long)(pos - str));
         }
 
       pos += myserver_strlcpy (pos, "-", MAX - (long)(pos - str));
-      if (request->rangeByteEnd != (u_long) -1)
+      if (request->rangeByteEnd < 0)
         {
           sprintf (buffer, "%lu", request->rangeByteEnd);
           pos += myserver_strlcpy (pos, buffer, MAX - (long)(pos - str));
@@ -621,8 +621,8 @@ int HttpHeaders::readReqRangeLine (HttpRequestHeader *request,
                                    const char *token,
                                    int *lenOut)
 {
-  char rangeByteBegin[13];
-  char rangeByteEnd[13];
+  char rangeByteBegin[32];
+  char rangeByteEnd[32];
   const char *localToken = token;
   size_t i = 0;
   rangeByteBegin[0] = '\0';
@@ -676,13 +676,13 @@ int HttpHeaders::readReqRangeLine (HttpRequestHeader *request,
   if (rangeByteBegin[0] == 0)
     request->rangeByteBegin = 0;
   else
-    request->rangeByteBegin = (u_long) atol (rangeByteBegin);
+    request->rangeByteBegin = atoll (rangeByteBegin);
 
   if (rangeByteEnd[0] == '\r')
     request->rangeByteEnd = 0;
   else
     {
-      request->rangeByteEnd = (u_long) atol (rangeByteEnd);
+      request->rangeByteEnd = atoll (rangeByteEnd);
       if (request->rangeByteEnd < request->rangeByteBegin)
         return 400;
     }
diff --git a/myserver/tests/test_file.cpp b/myserver/tests/test_file.cpp
index 258290a..15dd712 100644
--- a/myserver/tests/test_file.cpp
+++ b/myserver/tests/test_file.cpp
@@ -129,7 +129,7 @@ public:
     for (size_t i = 0; i < bufLen; i++)
       CPPUNIT_ASSERT_EQUAL (buf[i], readbuf[i]);
 
-    CPPUNIT_ASSERT_EQUAL (tfile->getFileSize (), nbr);
+    CPPUNIT_ASSERT_EQUAL ((size_t) tfile->getFileSize (), nbr);
     CPPUNIT_ASSERT_EQUAL (tfile->close (), 0);
 
     try
@@ -163,7 +163,7 @@ public:
   {
     CPPUNIT_ASSERT_EQUAL (openHelper (), 0);
     CPPUNIT_ASSERT_EQUAL (tfile->seek (1), 0);
-    CPPUNIT_ASSERT_EQUAL (tfile->getSeek (), (size_t) 1);
+    CPPUNIT_ASSERT_EQUAL (tfile->getSeek (), (off_t) 1);
   }
 
   void testBinary ()
@@ -196,22 +196,22 @@ public:
 
     CPPUNIT_ASSERT_EQUAL (openHelper (), 0);
 
-    CPPUNIT_ASSERT_EQUAL (tfile->getFileSize (), (size_t) 0);
+    CPPUNIT_ASSERT_EQUAL (tfile->getFileSize (), (off_t) 0);
 
     const char *data = "Hello World!"; /* Something very original.  */
     const size_t dataLen = strlen (data);
 
     CPPUNIT_ASSERT_EQUAL (tfile->writeToFile (data, dataLen, &nbw), 0);
 
-    CPPUNIT_ASSERT_EQUAL (tfile->getFileSize (), dataLen);
+    CPPUNIT_ASSERT_EQUAL (tfile->getFileSize (), (off_t) dataLen);
 
     CPPUNIT_ASSERT_EQUAL (tfile->truncate (dataLen / 2), 0);
 
-    CPPUNIT_ASSERT_EQUAL (tfile->getFileSize (), dataLen / 2);
+    CPPUNIT_ASSERT_EQUAL (tfile->getFileSize (), (off_t) dataLen / 2);
 
     CPPUNIT_ASSERT_EQUAL (tfile->writeToFile (data, dataLen, &nbw), 0);
 
-    CPPUNIT_ASSERT_EQUAL (tfile->getFileSize (), dataLen + dataLen / 2);
+    CPPUNIT_ASSERT_EQUAL (tfile->getFileSize (), (off_t) (dataLen + dataLen / 2));
 
     try
       {
diff --git a/myserver/tests/test_membuf_file.cpp b/myserver/tests/test_membuf_file.cpp
index 0225809..ee0009b 100644
--- a/myserver/tests/test_membuf_file.cpp
+++ b/myserver/tests/test_membuf_file.cpp
@@ -93,10 +93,10 @@ public:
     const size_t len = strlen (data);
     size_t nbw;
 
-    CPPUNIT_ASSERT_EQUAL (tfile->getSeek (), (size_t) 0);
+    CPPUNIT_ASSERT_EQUAL (tfile->getSeek (), (off_t) 0);
     CPPUNIT_ASSERT_EQUAL (tfile->write (data, len, &nbw), 0);
     CPPUNIT_ASSERT_EQUAL (len, nbw);
-    CPPUNIT_ASSERT_EQUAL (tfile->getSeek (), nbw);
+    CPPUNIT_ASSERT_EQUAL (tfile->getSeek (), (off_t) nbw);
   }
 
   void testRead ()
@@ -109,7 +109,7 @@ public:
     tfile->read (buffer, len, &nbr);
     CPPUNIT_ASSERT_EQUAL (nbr, (size_t) 0);
     CPPUNIT_ASSERT_EQUAL (tfile->write (data, len, &nbw), 0);
-    CPPUNIT_ASSERT_EQUAL (tfile->getSeek (), nbw);
+    CPPUNIT_ASSERT_EQUAL (tfile->getSeek (), (off_t) nbw);
 
     CPPUNIT_ASSERT_EQUAL (tfile->seek (0), 0);
     CPPUNIT_ASSERT_EQUAL (tfile->read (buffer, 512, &nbr), 0);
@@ -119,9 +119,9 @@ public:
   void testSeek ()
   {
     size_t seek = 12L;
-    CPPUNIT_ASSERT_EQUAL (tfile->getSeek (), (size_t) 0);
+    CPPUNIT_ASSERT_EQUAL (tfile->getSeek (), (off_t) 0);
     CPPUNIT_ASSERT_EQUAL (tfile->seek (seek), 0);
-    CPPUNIT_ASSERT_EQUAL (tfile->getSeek (), seek);
+    CPPUNIT_ASSERT_EQUAL (tfile->getSeek (), (off_t) seek);
   }
 
 };



commit 0e5cdde5f3fe247c583418f48f2f276241db8226
Author: Giuseppe Scrivano <gscrivano@gnu.org>
Date:   Fri Aug 20 21:55:26 2010 +0200

    Add lseek module from gnulib.

diff --git a/myserver/bootstrap.conf b/myserver/bootstrap.conf
index 67c9f5f..e72cd84 100644
--- a/myserver/bootstrap.conf
+++ b/myserver/bootstrap.conf
@@ -47,6 +47,7 @@ gettimeofday
 git-version-gen
 ioctl
 listen
+lseek
 malloc
 mkostemp
 mktime

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

Summary of changes:
 myserver/bootstrap.conf                            |    1 +
 myserver/include/base/file/file.h                  |   10 +++++-----
 myserver/include/base/files_cache/cached_file.h    |    8 ++++----
 .../include/base/files_cache/cached_file_buffer.h  |    2 +-
 myserver/include/base/files_cache/membuf_file.h    |   10 +++++-----
 .../include/http_handler/http_file/http_file.h     |    3 ++-
 myserver/include/protocol/http/http_request.h      |    4 ++--
 .../include/protocol/http/http_thread_context.h    |    2 +-
 myserver/src/base/file/file.cpp                    |   20 +++++++++-----------
 myserver/src/base/files_cache/cached_file.cpp      |    9 +++++----
 myserver/src/base/files_cache/membuf_file.cpp      |   10 +++++-----
 myserver/src/http_handler/http_file/http_file.cpp  |   12 ++++++------
 myserver/src/protocol/http/http_headers.cpp        |   12 ++++++------
 myserver/tests/test_file.cpp                       |   12 ++++++------
 myserver/tests/test_membuf_file.cpp                |   10 +++++-----
 15 files changed, 63 insertions(+), 62 deletions(-)


hooks/post-receive
-- 
GNU MyServer


From MAILER-DAEMON Sat Aug 21 14:38:45 2010
Received: from mailman by lists.gnu.org with archive (Exim 4.43)
	id 1Omsxp-0001hE-B2
	for mharc-myserver-commit@gnu.org; Sat, 21 Aug 2010 14:38:45 -0400
Received: from [140.186.70.92] (port=54401 helo=eggs.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.43) id 1Omsxm-0001fj-PN
	for myserver-commit@gnu.org; Sat, 21 Aug 2010 14:38:43 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69)
	(envelope-from <gscrivano@gnu.org>) id 1Omsxl-0004hK-Ag
	for myserver-commit@gnu.org; Sat, 21 Aug 2010 14:38:42 -0400
Received: from colonialone.fsf.org ([140.186.70.51]:46952
	helo=internal.in.savannah.gnu.org)
	by eggs.gnu.org with esmtp (Exim 4.69)
	(envelope-from <gscrivano@gnu.org>) id 1Omsxl-0004hA-80
	for myserver-commit@gnu.org; Sat, 21 Aug 2010 14:38:41 -0400
Received: from [10.1.0.108] (helo=vcs-noshell.in.savannah.gnu.org)
	by internal.in.savannah.gnu.org with esmtp (Exim 4.69)
	(envelope-from <gscrivano@gnu.org>) id 1Omsxk-0000gf-H0
	for myserver-commit@gnu.org; Sat, 21 Aug 2010 18:38:40 +0000
Received: from gscrivano by vcs-noshell.in.savannah.gnu.org with local (Exim
	4.69) (envelope-from <gscrivano@savannah.gnu.org>)
	id 1Omsxe-0001gu-KM
	for myserver-commit@gnu.org; Sat, 21 Aug 2010 18:38:40 +0000
To: myserver-commit@gnu.org
X-Git-Refname: refs/heads/master
X-Git-Reftype: branch
X-Git-Oldrev: 93a4d9b00be9a052eb1ee9158f1c83670584ee24
X-Git-Newrev: edd637be98e01545ef469f0e55499414b71fb9b9
Message-Id: <E1Omsxe-0001gu-KM@vcs-noshell.in.savannah.gnu.org>
From: Giuseppe Scrivano <gscrivano@gnu.org>
Date: Sat, 21 Aug 2010 18:38:39 +0000
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2)
Subject: [myserver-commit] [SCM] GNU MyServer branch, master,
	updated. v0.9.2-345-gedd637b
X-BeenThere: myserver-commit@gnu.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: myserver-commit.gnu.org
List-Unsubscribe: <http://lists.gnu.org/mailman/listinfo/myserver-commit>,
	<mailto:myserver-commit-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/myserver-commit>
List-Post: <mailto:myserver-commit@gnu.org>
List-Help: <mailto:myserver-commit-request@gnu.org?subject=help>
List-Subscribe: <http://lists.gnu.org/mailman/listinfo/myserver-commit>,
	<mailto:myserver-commit-request@gnu.org?subject=subscribe>
X-List-Received-Date: Sat, 21 Aug 2010 18:38:44 -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  edd637be98e01545ef469f0e55499414b71fb9b9 (commit)
      from  93a4d9b00be9a052eb1ee9158f1c83670584ee24 (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 edd637be98e01545ef469f0e55499414b71fb9b9
Author: Giuseppe Scrivano <gscrivano@gnu.org>
Date:   Sat Aug 21 20:34:20 2010 +0200

    Cache stat result.

diff --git a/myserver/include/base/file/file.h b/myserver/include/base/file/file.h
index ca614e7..faa5128 100644
--- a/myserver/include/base/file/file.h
+++ b/myserver/include/base/file/file.h
@@ -43,7 +43,8 @@ public:
       OPEN_IF_EXISTS = (1 << 6),
       APPEND = (1 << 7),
       NO_INHERIT = (1 << 8),
-      NO_FOLLOW_SYMLINK = (1 << 9)
+      NO_FOLLOW_SYMLINK = (1 << 9),
+      NO_CACHE_STAT = (1 << 10)
     };
 
   File ();
@@ -94,5 +95,7 @@ protected:
   u_long opt;
   FileHandle handle;
   string filename;
+
+  struct stat statS;
 };
 #endif
diff --git a/myserver/src/base/file/file.cpp b/myserver/src/base/file/file.cpp
index f103d14..d632c04 100644
--- a/myserver/src/base/file/file.cpp
+++ b/myserver/src/base/file/file.cpp
@@ -180,6 +180,9 @@ int File::openFile (const char* nfilename, u_long opt, mode_t mask)
         }
     }
 
+  if (! (opt & NO_CACHE_STAT))
+    fstat (&statS);
+
   this->opt = opt;
   return handle < 0;
 }
@@ -272,11 +275,10 @@ int File::close ()
  */
 off_t File::getFileSize ()
 {
-  struct stat fStats;
-
-  checked::fstat (handle, &fStats);
+  if (opt & NO_CACHE_STAT)
+    checked::fstat (handle, &statS);
 
-  return fStats.st_size;
+  return statS.st_size;
 }
 
 /*!

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

Summary of changes:
 myserver/include/base/file/file.h |    5 ++++-
 myserver/src/base/file/file.cpp   |   10 ++++++----
 2 files changed, 10 insertions(+), 5 deletions(-)


hooks/post-receive
-- 
GNU MyServer


From MAILER-DAEMON Sat Aug 21 20:54:22 2010
Received: from mailman by lists.gnu.org with archive (Exim 4.43)
	id 1OmypK-00059W-Mi
	for mharc-myserver-commit@gnu.org; Sat, 21 Aug 2010 20:54:22 -0400
Received: from [140.186.70.92] (port=35924 helo=eggs.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.43) id 1OmypH-00058C-KC
	for myserver-commit@gnu.org; Sat, 21 Aug 2010 20:54:20 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69)
	(envelope-from <gscrivano@gnu.org>) id 1OmypG-0000uo-1s
	for myserver-commit@gnu.org; Sat, 21 Aug 2010 20:54:19 -0400
Received: from colonialone.fsf.org ([140.186.70.51]:45554
	helo=internal.in.savannah.gnu.org)
	by eggs.gnu.org with esmtp (Exim 4.69)
	(envelope-from <gscrivano@gnu.org>) id 1OmypG-0000uj-0M
	for myserver-commit@gnu.org; Sat, 21 Aug 2010 20:54:18 -0400
Received: from [10.1.0.108] (helo=vcs-noshell.in.savannah.gnu.org)
	by internal.in.savannah.gnu.org with esmtp (Exim 4.69)
	(envelope-from <gscrivano@gnu.org>) id 1OmypF-0005A8-Eh
	for myserver-commit@gnu.org; Sun, 22 Aug 2010 00:54:17 +0000
Received: from gscrivano by vcs-noshell.in.savannah.gnu.org with local (Exim
	4.69) (envelope-from <gscrivano@savannah.gnu.org>)
	id 1OmypB-0001vD-0M
	for myserver-commit@gnu.org; Sun, 22 Aug 2010 00:54:17 +0000
To: myserver-commit@gnu.org
X-Git-Refname: refs/heads/master
X-Git-Reftype: branch
X-Git-Oldrev: edd637be98e01545ef469f0e55499414b71fb9b9
X-Git-Newrev: 7b9b7738613c23430876f180bd75efca342dc14a
Message-Id: <E1OmypB-0001vD-0M@vcs-noshell.in.savannah.gnu.org>
From: Giuseppe Scrivano <gscrivano@gnu.org>
Date: Sun, 22 Aug 2010 00:54:14 +0000
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2)
Subject: [myserver-commit] [SCM] GNU MyServer branch, master,
	updated. v0.9.2-352-g7b9b773
X-BeenThere: myserver-commit@gnu.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: myserver-commit.gnu.org
List-Unsubscribe: <http://lists.gnu.org/mailman/listinfo/myserver-commit>,
	<mailto:myserver-commit-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/myserver-commit>
List-Post: <mailto:myserver-commit@gnu.org>
List-Help: <mailto:myserver-commit-request@gnu.org?subject=help>
List-Subscribe: <http://lists.gnu.org/mailman/listinfo/myserver-commit>,
	<mailto:myserver-commit-request@gnu.org?subject=subscribe>
X-List-Received-Date: Sun, 22 Aug 2010 00:54:21 -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  7b9b7738613c23430876f180bd75efca342dc14a (commit)
       via  b59df2c2079163bf57d4ab8da52dc465a6609a9a (commit)
       via  09939b956cc70d3f02987212f42752b550b7d5ea (commit)
       via  7563eeeb309898e4169ac4dc4180638290762486 (commit)
       via  4e6323e25bd8c058bb8ebe35bcc539dda2cf564d (commit)
       via  739df1d72f263c52c3c5c4bdf398fc046ad53816 (commit)
       via  548df9c666c2a77a1c22fb121f94acebd6880b16 (commit)
      from  edd637be98e01545ef469f0e55499414b71fb9b9 (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 7b9b7738613c23430876f180bd75efca342dc14a
Author: Giuseppe Scrivano <gscrivano@gnu.org>
Date:   Sun Aug 22 02:53:43 2010 +0200

    Do not use the stat cache for log files.

diff --git a/myserver/src/log/stream/file_stream.cpp b/myserver/src/log/stream/file_stream.cpp
index 701b9f5..3db6202 100644
--- a/myserver/src/log/stream/file_stream.cpp
+++ b/myserver/src/log/stream/file_stream.cpp
@@ -19,11 +19,12 @@
 #include <include/log/stream/file_stream.h>
 
 int const FileStream::defaultFileMask =
-  File::APPEND |
-  File::FILE_OPEN_ALWAYS |
-  File::WRITE |
-  File::READ |
-  File::NO_INHERIT;
+  File::APPEND
+  | File::NO_CACHE_STAT
+  | File::FILE_OPEN_ALWAYS
+  | File::WRITE
+  | File::READ
+  | File::NO_INHERIT;
 
 FileStream::FileStream (FiltersFactory* ff, u_long cycle, Stream* out,
                         FiltersChain* fc) :
diff --git a/myserver/tests/test_file.cpp b/myserver/tests/test_file.cpp
index 15dd712..e34abf2 100644
--- a/myserver/tests/test_file.cpp
+++ b/myserver/tests/test_file.cpp
@@ -53,6 +53,7 @@ class TestFile : public CppUnit::TestFixture
   {
    return  tfile->openFile (fname.c_str (), File::WRITE
                             | File::READ
+                            | File::NO_CACHE_STAT
                             | File::FILE_OPEN_ALWAYS);
   }
 public:
diff --git a/myserver/tests/test_file_stream.cpp b/myserver/tests/test_file_stream.cpp
index e0b5117..b71b4ff 100644
--- a/myserver/tests/test_file_stream.cpp
+++ b/myserver/tests/test_file_stream.cpp
@@ -89,7 +89,7 @@ public:
     CPPUNIT_ASSERT (!ls->log (message2, level));
     ls->close ();
     File f;
-    f.openFile ("foo", File::READ | File::OPEN_IF_EXISTS);
+    f.openFile ("foo", File::READ | File::OPEN_IF_EXISTS | File::NO_CACHE_STAT);
     char buf[64];
     size_t nbr;
     f.read (buf, 64, &nbr);



commit b59df2c2079163bf57d4ab8da52dc465a6609a9a
Merge: 7563eee 09939b9
Author: Giuseppe Scrivano <gscrivano@gnu.org>
Date:   Sun Aug 22 02:29:56 2010 +0200

    Merge branch 'master' of ~/myserver/w32




commit 09939b956cc70d3f02987212f42752b550b7d5ea
Author: Giuseppe Scrivano <gscrivano@gnu.org>
Date:   Sun Aug 22 02:20:28 2010 +0200

    Fix some build issues under mingw32

diff --git a/myserver/configure.ac b/myserver/configure.ac
index b1663e0..ec59895 100644
--- a/myserver/configure.ac
+++ b/myserver/configure.ac
@@ -56,6 +56,7 @@ AC_C_BIGENDIAN
 LT_INIT
 
 AC_DEFINE([WINVER], [0x0501], [WINVER])
+
 AC_DEFINE([DEPENDS_ON_LIBINTL], [1], [DEPENDS_ON_LIBINTL])
 AC_DEFINE([GNULIB_NAMESPACE], [gnulib], [GNULIB_NAMESPACE])
 
diff --git a/myserver/src/base/file/file.cpp b/myserver/src/base/file/file.cpp
index d632c04..c4185aa 100644
--- a/myserver/src/base/file/file.cpp
+++ b/myserver/src/base/file/file.cpp
@@ -401,7 +401,7 @@ int File::fastCopyToSocket (Socket *dest, off_t firstByte, MemBuf *buf, size_t *
   for (;;)
     {
       size_t nbr;
-      u_long tmpNbw;
+      size_t tmpNbw;
 
       if (read (buffer, size, &nbr))
         return -1;
diff --git a/myserver/src/base/read_directory/rec_read_directory.cpp b/myserver/src/base/read_directory/rec_read_directory.cpp
index 54b8862..e3e8ce4 100644
--- a/myserver/src/base/read_directory/rec_read_directory.cpp
+++ b/myserver/src/base/read_directory/rec_read_directory.cpp
@@ -16,9 +16,8 @@
   along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
 
-#include <fts_.h>
 #include <include/base/read_directory/rec_read_directory.h>
-#include "myserver.h"
+#include <fts_.h>
 
 using namespace std;
 
diff --git a/myserver/src/base/socket/socket.cpp b/myserver/src/base/socket/socket.cpp
index 9f74949..aaf10bf 100644
--- a/myserver/src/base/socket/socket.cpp
+++ b/myserver/src/base/socket/socket.cpp
@@ -25,12 +25,14 @@
 #include <sys/ioctl.h>
 #include <errno.h>
 
-#ifndef WIN32
+
 # include <unistd.h>
-# include <netdb.h>
-# include <netinet/in.h>
-# include <arpa/inet.h>
-#endif
+
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <netdb.h>
+#include <netinet/in.h>
+#include <arpa/inet.h>
 
 #include <include/base/exceptions/checked.h>
 
diff --git a/myserver/src/http_handler/isapi/isapi.cpp b/myserver/src/http_handler/isapi/isapi.cpp
index 14b6dfb..72289a3 100644
--- a/myserver/src/http_handler/isapi/isapi.cpp
+++ b/myserver/src/http_handler/isapi/isapi.cpp
@@ -292,7 +292,7 @@ BOOL WINAPI ISAPI_WriteClientExport (HCONN hConn, LPVOID Buffer, LPDWORD lpdwByt
                       e = new HttpResponseHeader::Entry ();
                       e->name.assign ("transfer-encoding");
                       e->value.assign ("chunked");
-                      ConnInfo->td->response.other.put (*(e->name), e);
+                      ConnInfo->td->response.other.put (e->name, e);
                     }
                 }
               else
@@ -395,27 +395,36 @@ BOOL WINAPI ISAPI_ReadClientExport (HCONN hConn, LPVOID lpvBuffer,
                                    LPDWORD lpdwSize )
 {
   ConnTableRecord *ConnInfo;
-  u_long NumRead;
+  size_t numRead;
 
   Isapi::isapiMutex->lock ();
-  ConnInfo = Isapi::HConnRecord (hConn);
-  Isapi::isapiMutex->unlock ();
+  try
+    {
+      ConnInfo = Isapi::HConnRecord (hConn);
+      Isapi::isapiMutex->unlock ();
+    }
+  catch (...)
+    {
+      Isapi::isapiMutex->unlock ();
+      throw;
+    }
+
   if (ConnInfo == NULL)
-  {
-    ((Vhost*)(ConnInfo->td->connection->host))->warningsLogWrite
-      (_("ISAPI: internal error"));
-    return HttpDataHandler::RET_FAILURE;
-  }
+    {
+      ((Vhost*)(ConnInfo->td->connection->host))->warningsLogWrite
+        (_("ISAPI: internal error"));
+      return HttpDataHandler::RET_FAILURE;
+    }
 
-  ConnInfo->td->inputData.read ((char*) lpvBuffer, *lpdwSize, &NumRead);
+  ConnInfo->td->inputData.read ((char*) lpvBuffer, *lpdwSize, &numRead);
 
-  if (NumRead == -1)
+  if (numRead < 0)
     {
       *lpdwSize = 0;
       return HttpDataHandler::RET_FAILURE;
     }
 
-  *lpdwSize = (DWORD)NumRead;
+  *lpdwSize = (DWORD) numRead;
   return HttpDataHandler::RET_OK;
 }
 
@@ -431,8 +440,16 @@ BOOL WINAPI ISAPI_GetServerVariableExport (HCONN hConn,
   BOOL ret = HttpDataHandler::RET_OK;
 
   Isapi::isapiMutex->lock ();
-  ConnInfo = Isapi::HConnRecord (hConn);
-  Isapi::isapiMutex->unlock ();
+  try
+    {
+      ConnInfo = Isapi::HConnRecord (hConn);
+      Isapi::isapiMutex->unlock ();
+    }
+  catch (...)
+    {
+      Isapi::isapiMutex->unlock ();
+      throw;
+    }
 
   if (ConnInfo == NULL)
     {
diff --git a/myserver/src/http_handler/wincgi/wincgi.cpp b/myserver/src/http_handler/wincgi/wincgi.cpp
index ffd6ef3..183f076 100644
--- a/myserver/src/http_handler/wincgi/wincgi.cpp
+++ b/myserver/src/http_handler/wincgi/wincgi.cpp
@@ -79,7 +79,7 @@ int WinCgi::send (HttpThreadContext* td, const char* scriptpath,
   int ret;
   char execname[MAX_PATH];
   char pathname[MAX_PATH];
-  u_long nBytesRead = 0;
+  size_t nBytesRead = 0;
   u_long headerSize = 0;
   size_t nbw = 0;
   ostringstream stream;
@@ -98,8 +98,9 @@ int WinCgi::send (HttpThreadContext* td, const char* scriptpath,
       GetShortPathName (dataFilePath,dataFilePath,MAX_PATH);
       sprintf (&dataFilePath[strlen (dataFilePath)],"/data_%u.ini",td->id);
 
-      strcpy (outFilePath,td->outputDataPath.c_str ());
-      strcat (outFilePath,"WC");
+
+      GetShortPathName (outFilePath, dataFilePath, MAX_PATH);
+      sprintf (&outFilePath[strlen (outFilePath)],"/out_%i.ini",td->id);
       td->inputData.seek (0);
       chain.setStream (td->connection->socket);
       if (td->mime)
@@ -315,7 +316,7 @@ int WinCgi::send (HttpThreadContext* td, const char* scriptpath,
               return HttpDataHandler::RET_OK;
             }
 
-          u_long written;
+          size_t written;
           chain.write ((char*)(buffer + headerSize), nBytesRead - headerSize,
                        &written);
           nbw += written;



commit 7563eeeb309898e4169ac4dc4180638290762486
Author: Giuseppe Scrivano <gscrivano@gnu.org>
Date:   Sat Aug 21 20:54:36 2010 +0200

    Fix error message.

diff --git a/myserver/src/conf/vhost/xml_vhost_handler.cpp b/myserver/src/conf/vhost/xml_vhost_handler.cpp
index 949571f..af1b4cf 100644
--- a/myserver/src/conf/vhost/xml_vhost_handler.cpp
+++ b/myserver/src/conf/vhost/xml_vhost_handler.cpp
@@ -188,12 +188,12 @@ void XmlVhostHandler::changeLocationsOwner ()
           err = logManager->chown (vh, "ACCESSLOG", uid, gid);
           if (err)
             Server::getInstance ()->log (MYSERVER_LOG_MSG_ERROR,
-                    _("Error while changing accesses log locations owner"));
+                    _("Error while changing accesses log owner"));
 
           err = logManager->chown (vh, "WARNINGLOG", uid, gid);
           if (err)
             Server::getInstance ()->log (MYSERVER_LOG_MSG_ERROR,
-                    _("Error while changing log locations owner"));
+                    _("Error while changing warnings log owner"));
         }
     }
 }



commit 4e6323e25bd8c058bb8ebe35bcc539dda2cf564d
Merge: 739df1d edd637b
Author: Giuseppe Scrivano <gscrivano@gnu.org>
Date:   Sat Aug 21 20:39:11 2010 +0200

    Merge branch 'master' of ssh://git.sv.gnu.org/srv/git/myserver




commit 739df1d72f263c52c3c5c4bdf398fc046ad53816
Merge: 548df9c a7412d6
Author: Giuseppe Scrivano <gscrivano@gnu.org>
Date:   Fri May 7 23:57:32 2010 +0200

    Merge branch 'master' of ssh://git.sv.gnu.org/srv/git/myserver




commit 548df9c666c2a77a1c22fb121f94acebd6880b16
Author: Giuseppe Scrivano <gscrivano@gnu.org>
Date:   Fri Apr 9 21:00:26 2010 +0200

    Workaround a linker error when libintl redefines sprintf/snprintf

diff --git a/myserver/myserver.h b/myserver/myserver.h
index 5e1dbed..013c606 100644
--- a/myserver/myserver.h
+++ b/myserver/myserver.h
@@ -48,8 +48,15 @@ typedef void* HANDLE;
 #endif
 
 #ifdef HAVE_GETTEXT
+
+/*XXX: Fix me.  */
+# undef sprintf
+# undef snprintf
+
 # include <libintl.h>
+
 # define _(X) gettext (X)
+
 #else
 # define _(X) X
 #endif

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

Summary of changes:
 myserver/configure.ac                              |    1 +
 myserver/src/base/file/file.cpp                    |    2 +-
 .../src/base/read_directory/rec_read_directory.cpp |    3 +-
 myserver/src/base/socket/socket.cpp                |   12 +++--
 myserver/src/conf/vhost/xml_vhost_handler.cpp      |    4 +-
 myserver/src/http_handler/isapi/isapi.cpp          |   45 +++++++++++++------
 myserver/src/http_handler/wincgi/wincgi.cpp        |    9 ++--
 myserver/src/log/stream/file_stream.cpp            |   11 +++--
 myserver/tests/test_file.cpp                       |    1 +
 myserver/tests/test_file_stream.cpp                |    2 +-
 10 files changed, 56 insertions(+), 34 deletions(-)


hooks/post-receive
-- 
GNU MyServer


From MAILER-DAEMON Sun Aug 22 11:21:01 2010
Received: from mailman by lists.gnu.org with archive (Exim 4.43)
	id 1OnCM1-0006XP-AE
	for mharc-myserver-commit@gnu.org; Sun, 22 Aug 2010 11:21:01 -0400
Received: from [140.186.70.92] (port=36123 helo=eggs.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.43) id 1OnCLy-0006XI-36
	for myserver-commit@gnu.org; Sun, 22 Aug 2010 11:20:59 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69)
	(envelope-from <gscrivano@gnu.org>) id 1OnCLw-0007Qx-FH
	for myserver-commit@gnu.org; Sun, 22 Aug 2010 11:20:58 -0400
Received: from colonialone.fsf.org ([140.186.70.51]:33825
	helo=internal.in.savannah.gnu.org)
	by eggs.gnu.org with esmtp (Exim 4.69)
	(envelope-from <gscrivano@gnu.org>) id 1OnCLw-0007Qs-CN
	for myserver-commit@gnu.org; Sun, 22 Aug 2010 11:20:56 -0400
Received: from [10.1.0.108] (helo=vcs-noshell.in.savannah.gnu.org)
	by internal.in.savannah.gnu.org with esmtp (Exim 4.69)
	(envelope-from <gscrivano@gnu.org>) id 1OnCLw-0007A3-02
	for myserver-commit@gnu.org; Sun, 22 Aug 2010 15:20:56 +0000
Received: from gscrivano by vcs-noshell.in.savannah.gnu.org with local (Exim
	4.69) (envelope-from <gscrivano@savannah.gnu.org>)
	id 1OnCLn-0006YV-86
	for myserver-commit@gnu.org; Sun, 22 Aug 2010 15:20:55 +0000
To: myserver-commit@gnu.org
X-Git-Refname: refs/heads/master
X-Git-Reftype: branch
X-Git-Oldrev: 7b9b7738613c23430876f180bd75efca342dc14a
X-Git-Newrev: 3a43751716065260b0a009c7f9d890a603f5e862
Message-Id: <E1OnCLn-0006YV-86@vcs-noshell.in.savannah.gnu.org>
From: Giuseppe Scrivano <gscrivano@gnu.org>
Date: Sun, 22 Aug 2010 15:20:54 +0000
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2)
Subject: [myserver-commit] [SCM] GNU MyServer branch, master,
	updated. v0.9.2-355-g3a43751
X-BeenThere: myserver-commit@gnu.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: myserver-commit.gnu.org
List-Unsubscribe: <http://lists.gnu.org/mailman/listinfo/myserver-commit>,
	<mailto:myserver-commit-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/myserver-commit>
List-Post: <mailto:myserver-commit@gnu.org>
List-Help: <mailto:myserver-commit-request@gnu.org?subject=help>
List-Subscribe: <http://lists.gnu.org/mailman/listinfo/myserver-commit>,
	<mailto:myserver-commit-request@gnu.org?subject=subscribe>
X-List-Received-Date: Sun, 22 Aug 2010 15:21:00 -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  3a43751716065260b0a009c7f9d890a603f5e862 (commit)
       via  4b2b0d771b43f30c9ebfed4beae8fdb670ec7c20 (commit)
       via  0d949766f4eb4002bb90bcf9fa59b4e5e5084798 (commit)
      from  7b9b7738613c23430876f180bd75efca342dc14a (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 3a43751716065260b0a009c7f9d890a603f5e862
Author: Giuseppe Scrivano <gscrivano@gnu.org>
Date:   Sun Aug 22 17:22:10 2010 +0200

    Allow arbitrary depth for MIME locations path.

diff --git a/myserver/include/conf/vhost/vhost.h b/myserver/include/conf/vhost/vhost.h
index 8ccbb00..fcec8b0 100644
--- a/myserver/include/conf/vhost/vhost.h
+++ b/myserver/include/conf/vhost/vhost.h
@@ -198,7 +198,7 @@ public:
   /*! Set the protocol data. */
   void setProtocolData (VhostProtocolData* data){protocolData = data;}
 
-  MimeRecord* getLocationMime (string& loc){return locationsMime.get (loc);}
+  MimeRecord* getLocationMime (const string& loc){return locationsMime.get (loc);}
 
   list<NodeTree<string>*> *getHashedDataTrees (){return &hashedDataTrees;}
   HashMap<string, NodeTree<string>*>* getHashedData (){return &hashedData;}
diff --git a/myserver/include/protocol/http/http.h b/myserver/include/protocol/http/http.h
index f881da7..706c75c 100644
--- a/myserver/include/protocol/http/http.h
+++ b/myserver/include/protocol/http/http.h
@@ -152,7 +152,7 @@ public:
 
   u_long getTimeout ();
   int preprocessHttpRequest (string& filename, bool yetmapped,
-                             int* permissions);
+                             int* permissions, bool systemrequest);
 
   int getFilePermissions (string& filename, string& directory,
                           string& file, string &filenamePath,
diff --git a/myserver/src/conf/vhost/xml_vhost_handler.cpp b/myserver/src/conf/vhost/xml_vhost_handler.cpp
index af1b4cf..a7b2a18 100644
--- a/myserver/src/conf/vhost/xml_vhost_handler.cpp
+++ b/myserver/src/conf/vhost/xml_vhost_handler.cpp
@@ -352,12 +352,11 @@ int XmlVhostHandler::load (const char *filename)
             }
           else if (!xmlStrcmp (lcur->name, (const xmlChar *) "LOCATION"))
             {
-              string loc (vh->getDocumentRoot ());
-              loc.append ("/");
+              string loc;
 
               for (xmlAttr *attrs = lcur->properties; attrs; attrs = attrs->next)
                 if (!xmlStrcmp (attrs->name, (const xmlChar *) "path"))
-                  loc.append ((const char*) attrs->children->content);
+                  loc = ((const char*) attrs->children->content);
 
               MimeRecord *record = XmlMimeHandler::readRecord (lcur);
               MimeRecord *prev = vh->addLocationMime (loc, record);
diff --git a/myserver/src/http_handler/mscgi/mscgi.cpp b/myserver/src/http_handler/mscgi/mscgi.cpp
index 134ae6b..4fc0bf8 100644
--- a/myserver/src/http_handler/mscgi/mscgi.cpp
+++ b/myserver/src/http_handler/mscgi/mscgi.cpp
@@ -82,6 +82,9 @@ int MsCgi::send (HttpThreadContext* td, const char* exec, const char* cmdLine,
 
   try
     {
+      if (td->inputData.getHandle () >= 0)
+        td->inputData.seek (0);
+
       td->scriptPath.assign (exec);
 
       {
diff --git a/myserver/src/protocol/http/http.cpp b/myserver/src/protocol/http/http.cpp
index ef42d99..0cfb353 100644
--- a/myserver/src/protocol/http/http.cpp
+++ b/myserver/src/protocol/http/http.cpp
@@ -49,20 +49,10 @@
 
 #include <string>
 #include <ostream>
+#include <errno.h>
 
 using namespace std;
 
-#ifdef WIN32
-# include <direct.h>
-# include <errno.h>
-#endif
-
-#ifndef WIN32
-# include <string.h>
-# include <errno.h>
-#endif
-
-
 int HttpProtocol::loadProtocol ()
 {
   const char *data = NULL;
@@ -129,7 +119,7 @@ int Http::optionsHTTPRESOURCE (string& filename, bool yetmapped)
           it++;
         }
 
-      ret = Http::preprocessHttpRequest (filename, yetmapped, &permissions);
+      ret = Http::preprocessHttpRequest (filename, yetmapped, &permissions, false);
       if (ret != 200)
         return raiseHTTPError (ret);
 
@@ -168,7 +158,7 @@ int Http::traceHTTPRESOURCE (string& filename, bool yetmapped)
       MemBuf tmp;
       HttpRequestHeader::Entry *connection;
 
-      ret = Http::preprocessHttpRequest (filename, yetmapped, &permissions);
+      ret = Http::preprocessHttpRequest (filename, yetmapped, &permissions, false);
       if (ret != 200)
         return raiseHTTPError (ret);
 
@@ -284,12 +274,11 @@ int Http::getFilePermissions (string& filename, string& directory, string& file,
             send a HTTP 401 error page.
            */
           translateEscapeString (filename);
-          if ((filename[0] != '\0') &&
-              (FilesUtility::getPathRecursionLevel (filename) < 1))
+          if ((filename[0] != '\0')
+              && (FilesUtility::getPathRecursionLevel (filename) < 1))
             return 401;
 
           ret = getPath (filenamePath, filename, 0);
-
           if (ret != 200)
             return ret;
         }
@@ -425,17 +414,19 @@ int Http::getFilePermissions (string& filename, string& directory, string& file,
   \param filename Resource to access.
   \param yetmapped Is the resource mapped to the localfilesystem?
   \param permissions Permission mask for this resource.
+  \param system Is it a system request?
   \return Return 200 on success.
   \return Any other value is the HTTP error code.
  */
 int Http::preprocessHttpRequest (string& filename, bool yetmapped,
-                                 int* permissions)
+                                 int* permissions, bool systemrequest)
 {
   string directory;
   string file;
-  u_long filenamePathLen;
+  size_t filenamePathLen;
   string dirscan;
   int ret;
+  size_t splitPoint = string::npos;
 
   try
     {
@@ -455,12 +446,16 @@ int Http::preprocessHttpRequest (string& filename, bool yetmapped,
        */
       td->pathInfo.assign ("");
       td->pathTranslated.assign ("");
-      filenamePathLen = (int) td->filenamePath.length ();
+      filenamePathLen = td->filenamePath.length ();
       dirscan.assign ("");
 
       MimeRecord* mimeLoc = NULL;
+      size_t resOffset = systemrequest ?
+        td->connection->host->getSystemRoot ().length ()
+        : td->connection->host->getDocumentRoot ().length ();
 
-      for (u_long i = 0;;)
+      td->pathInfo = "";
+      for (size_t i = 0;;)
         {
           /*
             http://host/path/to/file/file.txt/PATH_INFO_VALUE?QUERY_INFO_VALUE
@@ -471,12 +466,11 @@ int Http::preprocessHttpRequest (string& filename, bool yetmapped,
             If there is the '/' character check if dirscan is a file.
            */
 
-          u_long next = td->filenamePath.find ('/', i + 1);
+          size_t next = td->filenamePath.find ('/', i + 1);
           string curr = td->filenamePath.substr (0, next);
-
+          const string &resource = curr.substr (resOffset);
           mimeLoc = td->connection->host
-                          ? td->connection->host->getLocationMime (curr) : NULL;
-
+            ? td->connection->host->getLocationMime (resource) : NULL;
           if (mimeLoc)
             {
               if (next != string::npos)
@@ -484,8 +478,6 @@ int Http::preprocessHttpRequest (string& filename, bool yetmapped,
                   td->pathInfo.assign (&(td->filenamePath.c_str ()[next]));
                   td->filenamePath.erase (next);
                 }
-              else
-                td->pathInfo.assign ("");
 
               break;
             }
@@ -493,16 +485,28 @@ int Http::preprocessHttpRequest (string& filename, bool yetmapped,
           if (next >= filenamePathLen)
             break;
 
-          if (mimeLoc || FilesUtility::notDirectory (curr.c_str ()))
-            {
-              td->pathInfo.assign (&(td->filenamePath.c_str ()[next]));
-              td->filenamePath.erase (next);
-              break;
-            }
+          /* Don't exit immediately if we find a non directory element, a
+             location handler can be registered after it.  */
+          if (splitPoint && FilesUtility::notDirectory (curr.c_str ()))
+            splitPoint = next;
 
           i = next;
         }
 
+      if (mimeLoc == NULL)
+        {
+          if (splitPoint == string::npos)
+            {
+              if (! FilesUtility::nodeExists (td->filenamePath.c_str ()))
+                return 404;
+            }
+          else
+            {
+              td->pathInfo.assign (&(td->filenamePath.c_str ()[splitPoint]));
+              td->filenamePath.erase (splitPoint);
+            }
+        }
+
       /*
         PATH_TRANSLATED is the local filesystem mapped version of PATH_INFO.
        */
@@ -678,7 +682,8 @@ Http::sendHTTPResource (string& uri, bool systemrequest, bool onlyHeader,
       filename.assign (uri);
       td->buffer->setLength (0);
 
-      ret = Http::preprocessHttpRequest (filename, yetmapped, &td->permissions);
+      ret = Http::preprocessHttpRequest (filename, yetmapped, &td->permissions,
+                                         systemrequest);
       if (ret != 200)
         return raiseHTTPError (ret);
 
@@ -1508,11 +1513,10 @@ int Http::getPath (HttpThreadContext* td, string& filenamePath,
 {
   if (systemrequest)
     {
-      if (!strlen (td->getVhostSys ())
+      if ((td->getVhostSys ()[0] == '\0')
           || FilesUtility::getPathRecursionLevel (filename) < 2)
-        {
-          return 401;
-        }
+        return 401;
+
       filenamePath.assign (td->getVhostSys ());
       if (filename[0] != '/')
         filenamePath.append ("/");
@@ -1520,7 +1524,9 @@ int Http::getPath (HttpThreadContext* td, string& filenamePath,
     }
   else
     {
-      if (filename[0])
+      if (! filename[0])
+        filenamePath.append (td->getVhostDir ());
+      else
         {
           const char *root;
           /*
@@ -1543,9 +1549,8 @@ int Http::getPath (HttpThreadContext* td, string& filenamePath,
               filename = filename + 5;
             }
           else
-            {
-              root = td->getVhostDir ();
-            }
+            root = td->getVhostDir ();
+
           filenamePath.assign (root);
 
           if (filename[0] != '/')
@@ -1553,10 +1558,6 @@ int Http::getPath (HttpThreadContext* td, string& filenamePath,
 
           filenamePath.append (filename);
         }
-      else
-        {
-          filenamePath.append (td->getVhostDir ());
-        }
 
     }
   return 200;



commit 4b2b0d771b43f30c9ebfed4beae8fdb670ec7c20
Author: Giuseppe Scrivano <gscrivano@gnu.org>
Date:   Sun Aug 22 17:16:11 2010 +0200

    Append query information to the requested URL.

diff --git a/myserver/src/http_handler/proxy/proxy.cpp b/myserver/src/http_handler/proxy/proxy.cpp
index 27b5e7b..446d13c 100644
--- a/myserver/src/http_handler/proxy/proxy.cpp
+++ b/myserver/src/http_handler/proxy/proxy.cpp
@@ -71,10 +71,19 @@ int Proxy::send (HttpThreadContext *td, const char* scriptpath,
     {
       req.ver.assign ("HTTP/1.1");
       req.cmd.assign (td->request.cmd);
-      if (destUrl.getResource ()[0] != '/')
-        req.uri.assign ("/");
-      req.uri.append (destUrl.getResource ());
-      req.uri.append (td->pathInfo);
+
+      if (destUrl.getResource ()[0] == '\0' && td->pathInfo[0] == '\0')
+        req.uri = "/";
+      else
+        {
+          req.uri = destUrl.getResource ();
+          req.uri.append (td->pathInfo);
+        }
+      if (td->request.uriOpts.length ())
+        {
+          req.uri.append ("?");
+          req.uri.append (td->request.uriOpts);
+        }
 
       req.setValue ("Connection", "keep-alive");
       if (td->request.uriOptsPtr)
@@ -196,10 +205,10 @@ int Proxy::flushToClient (HttpThreadContext* td, Socket& client,
 
   string transferEncoding;
   bool hasTransferEncoding = false;
-  tmp = td->response.getValue ("Transfer-encoding", NULL);
+  tmp = td->response.getValue ("Transfer-Encoding", NULL);
   if (tmp)
     {
-      hasTransferEncoding = false;
+      hasTransferEncoding = true;
       transferEncoding.assign (*tmp);
     }
 



commit 0d949766f4eb4002bb90bcf9fa59b4e5e5084798
Author: Giuseppe Scrivano <gscrivano@gnu.org>
Date:   Sun Aug 22 17:15:08 2010 +0200

    Do not use stat cache for temporary files.

diff --git a/myserver/src/base/file/file.cpp b/myserver/src/base/file/file.cpp
index c4185aa..d36cde8 100644
--- a/myserver/src/base/file/file.cpp
+++ b/myserver/src/base/file/file.cpp
@@ -245,7 +245,7 @@ int File::createTemporaryFile (const char* filename, bool unlink)
 {
   u_long temporaryOpt = unlink ? File::TEMPORARY : File::TEMPORARY_DELAYED;
 
-  return openFile (filename, File::READ | File::WRITE
+  return openFile (filename, File::READ | File::WRITE | File::NO_CACHE_STAT
                    | File::FILE_OPEN_ALWAYS | temporaryOpt);
 }
 

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

Summary of changes:
 myserver/include/conf/vhost/vhost.h           |    2 +-
 myserver/include/protocol/http/http.h         |    2 +-
 myserver/src/base/file/file.cpp               |    2 +-
 myserver/src/conf/vhost/xml_vhost_handler.cpp |    5 +-
 myserver/src/http_handler/mscgi/mscgi.cpp     |    3 +
 myserver/src/http_handler/proxy/proxy.cpp     |   21 ++++--
 myserver/src/protocol/http/http.cpp           |   91 +++++++++++++------------
 7 files changed, 69 insertions(+), 57 deletions(-)


hooks/post-receive
-- 
GNU MyServer


From MAILER-DAEMON Sun Aug 22 13:10:52 2010
Received: from mailman by lists.gnu.org with archive (Exim 4.43)
	id 1OnE4J-0001Fe-Ut
	for mharc-myserver-commit@gnu.org; Sun, 22 Aug 2010 13:10:51 -0400
Received: from [140.186.70.92] (port=40851 helo=eggs.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.43) id 1OnE4G-0001F8-IB
	for myserver-commit@gnu.org; Sun, 22 Aug 2010 13:10:50 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69)
	(envelope-from <gscrivano@gnu.org>) id 1OnE4E-0004RF-VE
	for myserver-commit@gnu.org; Sun, 22 Aug 2010 13:10:48 -0400
Received: from colonialone.fsf.org ([140.186.70.51]:53239
	helo=internal.in.savannah.gnu.org)
	by eggs.gnu.org with esmtp (Exim 4.69)
	(envelope-from <gscrivano@gnu.org>) id 1OnE4E-0004RA-S7
	for myserver-commit@gnu.org; Sun, 22 Aug 2010 13:10:46 -0400
Received: from [10.1.0.108] (helo=vcs-noshell.in.savannah.gnu.org)
	by internal.in.savannah.gnu.org with esmtp (Exim 4.69)
	(envelope-from <gscrivano@gnu.org>) id 1OnE4E-0008UZ-GZ
	for myserver-commit@gnu.org; Sun, 22 Aug 2010 17:10:46 +0000
Received: from gscrivano by vcs-noshell.in.savannah.gnu.org with local (Exim
	4.69) (envelope-from <gscrivano@savannah.gnu.org>)
	id 1OnE47-00036f-3Y
	for myserver-commit@gnu.org; Sun, 22 Aug 2010 17:10:46 +0000
To: myserver-commit@gnu.org
X-Git-Refname: refs/heads/master
X-Git-Reftype: branch
X-Git-Oldrev: 3a43751716065260b0a009c7f9d890a603f5e862
X-Git-Newrev: e7b8a7da029dae3a0694003c2c6bc0dfe7d6e087
Message-Id: <E1OnE47-00036f-3Y@vcs-noshell.in.savannah.gnu.org>
From: Giuseppe Scrivano <gscrivano@gnu.org>
Date: Sun, 22 Aug 2010 17:10:46 +0000
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2)
Subject: [myserver-commit] [SCM] GNU MyServer branch, master,
	updated. v0.9.2-361-ge7b8a7d
X-BeenThere: myserver-commit@gnu.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: myserver-commit.gnu.org
List-Unsubscribe: <http://lists.gnu.org/mailman/listinfo/myserver-commit>,
	<mailto:myserver-commit-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/myserver-commit>
List-Post: <mailto:myserver-commit@gnu.org>
List-Help: <mailto:myserver-commit-request@gnu.org?subject=help>
List-Subscribe: <http://lists.gnu.org/mailman/listinfo/myserver-commit>,
	<mailto:myserver-commit-request@gnu.org?subject=subscribe>
X-List-Received-Date: Sun, 22 Aug 2010 17:10:50 -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  e7b8a7da029dae3a0694003c2c6bc0dfe7d6e087 (commit)
       via  837ab55a9c8aae3b3fdb956858aad6ccb1d00165 (commit)
       via  6e8af89c2f8feb43e617cee3347c9bba0966b4e7 (commit)
       via  e9704fe5d6ebb58dce60711fda91a72d6ae7ccb3 (commit)
       via  0a1df68dc8b7436723b7c319a317dd1e6140ed76 (commit)
       via  51c4a5fa2b6cafe41a6e36e93c767e484ef0b0fb (commit)
      from  3a43751716065260b0a009c7f9d890a603f5e862 (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 e7b8a7da029dae3a0694003c2c6bc0dfe7d6e087
Author: Giuseppe Scrivano <gscrivano@gnu.org>
Date:   Sun Aug 22 19:09:51 2010 +0200

    Proxy: work properly with old clients not using keep-alive connections.

diff --git a/myserver/src/http_handler/proxy/proxy.cpp b/myserver/src/http_handler/proxy/proxy.cpp
index 40366e1..c7672b7 100644
--- a/myserver/src/http_handler/proxy/proxy.cpp
+++ b/myserver/src/http_handler/proxy/proxy.cpp
@@ -215,9 +215,12 @@ int Proxy::flushToClient (HttpThreadContext* td, Socket& client,
      client.  */
   checkDataChunks (td, &keepalive, &useChunks);
 
+  td->response.setValue ("Connection", keepalive ? "keep-alive" : "close");
+
   if (useChunks)
     td->response.setValue ("Transfer-encoding", "chunked");
-
+  else
+    td->response.clearValue ("Transfer-encoding");
 
   u_long hdrLen = HttpHeaders::buildHTTPResponseHeader (td->buffer->getBuffer (),
                                                         &td->response);
@@ -294,12 +297,15 @@ int Proxy::readPayLoad (HttpThreadContext* td,
     {
       if (!serverTransferEncoding->compare ("chunked"))
         {
+          size_t remainingChunkSize = 0;
           for (;;)
             {
-              HttpDataRead::readChunkedPostData (initBuffer, &inPos, initBufferSize,
-                                                 client, td->buffer->getBuffer (),
-                                                 td->buffer->getRealLength () - 1,
-                                                 &nbr, timeout, NULL, 1);
+              if (HttpDataRead::readChunkedPostData (initBuffer, &inPos, initBufferSize,
+                                                     client, td->buffer->getBuffer (),
+                                                     td->buffer->getRealLength () - 1,
+                                                     &nbr, timeout, NULL, 1,
+                                                     &remainingChunkSize) < 0)
+                return HttpDataHandler::RET_FAILURE;
 
               if (!nbr)
                 break;



commit 837ab55a9c8aae3b3fdb956858aad6ccb1d00165
Author: Giuseppe Scrivano <gscrivano@gnu.org>
Date:   Sun Aug 22 19:09:25 2010 +0200

    HttpDataRead::readChunkedPostData: Support partial data chunks.

diff --git a/myserver/include/protocol/http/http_data_read.h b/myserver/include/protocol/http/http_data_read.h
index 14b95b5..4eee988 100644
--- a/myserver/include/protocol/http/http_data_read.h
+++ b/myserver/include/protocol/http/http_data_read.h
@@ -62,7 +62,8 @@ public:
                                   size_t *nbr,
                                   u_long timeout,
                                   Stream *out,
-                                  long maxChunks);
+                                  long maxChunks,
+                                  size_t *remainingChunk = NULL);
 
 };
 
diff --git a/myserver/src/protocol/http/http_data_read.cpp b/myserver/src/protocol/http/http_data_read.cpp
index 8fbfa97..9d1e14c 100644
--- a/myserver/src/protocol/http/http_data_read.cpp
+++ b/myserver/src/protocol/http/http_data_read.cpp
@@ -97,6 +97,7 @@ int HttpDataRead::readContiguousPrimitivePostData (const char *inBuffer,
   \param timeout Timeout value to use on the socket.
   \param out Output file, may be  a NULL pointer.
   \param maxChunks The maximum number of chunks to read.
+  \param remainingChunk Size of the previous remaining chunk.
   \return Return 0 on success.
   \return -1 on internal error.
   \return Any other value is the HTTP error code.
@@ -110,7 +111,8 @@ int HttpDataRead::readChunkedPostData (const char *inBuffer,
                                        size_t *outNbr,
                                        u_long timeout,
                                        Stream *out,
-                                       long maxChunks)
+                                       long maxChunks,
+                                       size_t *remainingChunk)
 {
   size_t nbr;
   *outNbr = 0;
@@ -120,41 +122,48 @@ int HttpDataRead::readChunkedPostData (const char *inBuffer,
       size_t chunkNbr;
       size_t dataToRead;
       size_t nbw;
+      size_t tmpNbr;
       u_long bufferlen;
       char buffer[20];
       char c;
-      bufferlen = 0;
-      buffer[0] = '\0';
-      for (;;)
-        {
-          int timedOut = readContiguousPrimitivePostData (inBuffer, inBufferPos,
-                                                          inBufferSize, inSocket,
-                                                          &c, 1, &nbr, timeout);
-          if (nbr != 1)
-            return -1;
 
-          if ((c != '\r') && (bufferlen < 19))
+      if (remainingChunk && *remainingChunk)
+        dataToRead = *remainingChunk;
+      else
+        {
+          bufferlen = 0;
+          buffer[0] = '\0';
+          for (;;)
             {
-              buffer[bufferlen++] = c;
-              buffer[bufferlen] = '\0';
-            }
-          else
-            break;
+              int timedOut = readContiguousPrimitivePostData (inBuffer, inBufferPos,
+                                                              inBufferSize, inSocket,
+                                                              &c, 1, &nbr, timeout);
+              if (nbr != 1)
+                return -1;
 
-          if (timedOut)
-            break;
-        }
+              if ((c != '\r') && (bufferlen < 19))
+                {
+                  buffer[bufferlen++] = c;
+                  buffer[bufferlen] = '\0';
+                }
+              else
+                break;
+
+              if (timedOut)
+                break;
+            }
 
-      /* Read the \n character too. */
-      if (readContiguousPrimitivePostData (inBuffer, inBufferPos, inBufferSize,
-                                           inSocket, &c, 1, &nbr, timeout))
-        return -1;
+          /* Read the \n character too. */
+          if (readContiguousPrimitivePostData (inBuffer, inBufferPos, inBufferSize,
+                                               inSocket, &c, 1, &nbr, timeout))
+            return -1;
 
-      dataToRead = (u_long) hexToInt (buffer);
+          dataToRead = (u_long) hexToInt (buffer);
 
-      /* The last chunk length is 0.  */
-      if (dataToRead == 0)
-        break;
+          /* The last chunk length is 0.  */
+          if (dataToRead == 0)
+            break;
+        }
 
       chunkNbr = 0;
 
@@ -172,32 +181,46 @@ int HttpDataRead::readChunkedPostData (const char *inBuffer,
 
           chunkNbr += nbr;
 
-          if (out && out->write (outBuffer, nbr, &nbw))
-            return -1;
+          if (out == NULL)
+            *outNbr += nbr;
+          else
+            {
+              if (out->write (outBuffer, nbr, &nbw))
+                return -1;
 
-          if (nbw != nbr)
-            return -1;
+              if (nbw != nbr)
+                return -1;
 
-          if (out)
-            *outNbr += nbw;
-          else
-            *outNbr += nbr;
+              *outNbr += nbw;
+            }
 
           if (timedOut)
             break;
 
-          if (readContiguousPrimitivePostData (inBuffer,
-                                               inBufferPos,
-                                               inBufferSize,
-                                               inSocket,
-                                               outBuffer,
-                                               2,
-                                               &nbr,
-                                               timeout))
+          char tmpBuf[2];
+          if (chunkNbr == dataToRead
+              && readContiguousPrimitivePostData (inBuffer,
+                                                  inBufferPos,
+                                                  inBufferSize,
+                                                  inSocket,
+                                                  tmpBuf,
+                                                  2,
+                                                  &nbr,
+                                                  timeout))
             return -1;
+
+          if (out == NULL)
+            {
+              if (remainingChunk)
+                *remainingChunk = dataToRead - chunkNbr;
+              return 0;
+            }
         }
 
     }
+
+  if (remainingChunk)
+    *remainingChunk = 0;
   return 0;
 }
 



commit 6e8af89c2f8feb43e617cee3347c9bba0966b4e7
Author: Giuseppe Scrivano <gscrivano@gnu.org>
Date:   Sun Aug 22 19:07:59 2010 +0200

    HttpHeader: New method clearValue.

diff --git a/myserver/include/protocol/http/http_header.h b/myserver/include/protocol/http/http_header.h
index 3a61ce7..f004b8a 100644
--- a/myserver/include/protocol/http/http_header.h
+++ b/myserver/include/protocol/http/http_header.h
@@ -45,9 +45,10 @@ struct HttpHeader
     ~Entry ()
     {
     }
-
   };
 
+  void clearValue (const char *name);
+
   virtual string* getValue (const char *name, string *out);
   virtual string* setValue (const char *name, const char *in);
   virtual ~HttpHeader (){}
diff --git a/myserver/src/protocol/http/http_header.cpp b/myserver/src/protocol/http/http_header.cpp
index f27095b..f3f8123 100644
--- a/myserver/src/protocol/http/http_header.cpp
+++ b/myserver/src/protocol/http/http_header.cpp
@@ -68,3 +68,16 @@ string* HttpHeader::setValue (const char *name, const char *in)
 
   return NULL;
 }
+
+/*!
+  Remove a value from the collection.
+ */
+void HttpHeader::clearValue (const char *name)
+{
+  string key (name);
+  transform (key.begin (), key.end (), key.begin (), ::tolower);
+
+  Entry *e = other.remove (key);
+  if (e)
+    delete e;
+}



commit e9704fe5d6ebb58dce60711fda91a72d6ae7ccb3
Author: Giuseppe Scrivano <gscrivano@gnu.org>
Date:   Sun Aug 22 18:17:07 2010 +0200

    If a host is not specified, remove the connection immediately.

diff --git a/myserver/src/server/clients_thread.cpp b/myserver/src/server/clients_thread.cpp
index 0d2eb0f..63c2cc3 100644
--- a/myserver/src/server/clients_thread.cpp
+++ b/myserver/src/server/clients_thread.cpp
@@ -306,13 +306,18 @@ int ClientsThread::controlConnections ()
       }
     else
       {
-        protocol = server->getProtocol (c->host->getProtocolName ());
-        if (protocol)
-          retcode = protocol->controlConnection (c, (char*) buffer.getBuffer (),
-                                                 (char*) auxiliaryBuffer.getBuffer (),
-                                                 buffer.getRealLength (),
-                                                 auxiliaryBuffer.getRealLength (),
-                                                 nBytesToRead, id);
+        if (c->host == NULL)
+          retcode = ClientsThread::DELETE_CONNECTION;
+        else
+          {
+            protocol = server->getProtocol (c->host->getProtocolName ());
+            if (protocol)
+              retcode = protocol->controlConnection (c, buffer.getBuffer (),
+                                                     auxiliaryBuffer.getBuffer (),
+                                                     buffer.getRealLength (),
+                                                     auxiliaryBuffer.getRealLength (),
+                                                     nBytesToRead, id);
+          }
       }
   }
   catch (...)



commit 0a1df68dc8b7436723b7c319a317dd1e6140ed76
Author: Giuseppe Scrivano <gscrivano@gnu.org>
Date:   Sun Aug 22 18:12:35 2010 +0200

    Proxy: Modify the response header after we read the information we need.

diff --git a/myserver/src/http_handler/proxy/proxy.cpp b/myserver/src/http_handler/proxy/proxy.cpp
index 446d13c..40366e1 100644
--- a/myserver/src/http_handler/proxy/proxy.cpp
+++ b/myserver/src/http_handler/proxy/proxy.cpp
@@ -167,6 +167,7 @@ int Proxy::flushToClient (HttpThreadContext* td, Socket& client,
   bool useChunks = false;
   bool keepalive = false;
 
+  td->response.free ();
   do
     {
       ret = client.recv (td->auxiliaryBuffer->getBuffer () + read,
@@ -185,8 +186,6 @@ int Proxy::flushToClient (HttpThreadContext* td, Socket& client,
   if (read == 0)
     return td->http->raiseHTTPError (500);
 
-  checkDataChunks (td, &keepalive, &useChunks);
-
   string *tmp = td->request.getValue ("Host", NULL);
   const char *via = tmp ? tmp->c_str () : td->connection->getLocalIpAddr ();
 
@@ -212,6 +211,10 @@ int Proxy::flushToClient (HttpThreadContext* td, Socket& client,
       transferEncoding.assign (*tmp);
     }
 
+  /* At this point we can modify the response struct before send it to the
+     client.  */
+  checkDataChunks (td, &keepalive, &useChunks);
+
   if (useChunks)
     td->response.setValue ("Transfer-encoding", "chunked");
 



commit 51c4a5fa2b6cafe41a6e36e93c767e484ef0b0fb
Author: Giuseppe Scrivano <gscrivano@gnu.org>
Date:   Sun Aug 22 18:10:08 2010 +0200

    Rename variable.

diff --git a/myserver/src/protocol/http/http.cpp b/myserver/src/protocol/http/http.cpp
index 0cfb353..8054f79 100644
--- a/myserver/src/protocol/http/http.cpp
+++ b/myserver/src/protocol/http/http.cpp
@@ -232,7 +232,7 @@ int Http::putHTTPRESOURCE (string& filename, bool sysReq, bool onlyHeader,
 
 /*!
   Get the file permissions mask.
-  \param filename Resource to access.
+  \param resource Resource to access.
   \param directory Directory where the resource is.
   \param file The file specified by the resource.
   \param filenamePath Complete path to the file.
@@ -241,7 +241,7 @@ int Http::putHTTPRESOURCE (string& filename, bool sysReq, bool onlyHeader,
   \return Return 200 on success.
   \return Any other value is the HTTP error code.
  */
-int Http::getFilePermissions (string& filename, string& directory, string& file,
+int Http::getFilePermissions (string& resource, string& directory, string& file,
                               string &filenamePath, bool yetmapped, int* permissions)
 {
   try
@@ -252,7 +252,7 @@ int Http::getFilePermissions (string& filename, string& directory, string& file,
 
       td->securityToken.setVhost (td->connection->host);
 
-      FilesUtility::splitPath (filename, directory, file);
+      FilesUtility::splitPath (resource, directory, file);
       FilesUtility::completePath (directory);
 
       td->securityToken.setResource (&filenamePath);
@@ -265,7 +265,7 @@ int Http::getFilePermissions (string& filename, string& directory, string& file,
         If filename is already mapped on the file system don't map it again.
        */
       if (yetmapped)
-        filenamePath.assign (filename);
+        filenamePath.assign (resource);
       else
         {
           int ret;
@@ -273,12 +273,12 @@ int Http::getFilePermissions (string& filename, string& directory, string& file,
             If the client tries to access files that aren't in the web directory
             send a HTTP 401 error page.
            */
-          translateEscapeString (filename);
-          if ((filename[0] != '\0')
-              && (FilesUtility::getPathRecursionLevel (filename) < 1))
+          translateEscapeString (resource);
+          if ((resource[0] != '\0')
+              && (FilesUtility::getPathRecursionLevel (resource) < 1))
             return 401;
 
-          ret = getPath (filenamePath, filename, 0);
+          ret = getPath (filenamePath, resource, 0);
           if (ret != 200)
             return ret;
         }
@@ -393,7 +393,7 @@ int Http::getFilePermissions (string& filename, string& directory, string& file,
     {
       td->connection->host->warningsLogWrite (
                                  _E ("HTTP: cannot get permissions for %s"),
-                                 filename.c_str (), &e);
+                                 resource.c_str (), &e);
       return 500;
     }
 
@@ -411,14 +411,14 @@ int Http::getFilePermissions (string& filename, string& directory, string& file,
 
 /*!
   Preprocess a HTTP request.
-  \param filename Resource to access.
+  \param resource Resource to access.
   \param yetmapped Is the resource mapped to the localfilesystem?
   \param permissions Permission mask for this resource.
   \param system Is it a system request?
   \return Return 200 on success.
   \return Any other value is the HTTP error code.
  */
-int Http::preprocessHttpRequest (string& filename, bool yetmapped,
+int Http::preprocessHttpRequest (string &resource, bool yetmapped,
                                  int* permissions, bool systemrequest)
 {
   string directory;
@@ -433,7 +433,7 @@ int Http::preprocessHttpRequest (string& filename, bool yetmapped,
       if (td->request.isKeepAlive ())
         td->response.setValue ("connection", "keep-alive");
 
-      ret = getFilePermissions (filename, directory, file,
+      ret = getFilePermissions (resource, directory, file,
                                 td->filenamePath, yetmapped, permissions);
       if (ret != 200)
         return ret;

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

Summary of changes:
 myserver/include/protocol/http/http_data_read.h |    3 +-
 myserver/include/protocol/http/http_header.h    |    3 +-
 myserver/src/http_handler/proxy/proxy.cpp       |   23 ++++--
 myserver/src/protocol/http/http.cpp             |   24 +++---
 myserver/src/protocol/http/http_data_read.cpp   |  109 ++++++++++++++---------
 myserver/src/protocol/http/http_header.cpp      |   13 +++
 myserver/src/server/clients_thread.cpp          |   19 +++--
 7 files changed, 123 insertions(+), 71 deletions(-)


hooks/post-receive
-- 
GNU MyServer


From MAILER-DAEMON Sun Aug 22 21:15:34 2010
Received: from mailman by lists.gnu.org with archive (Exim 4.43)
	id 1OnLdO-0005Fc-I0
	for mharc-myserver-commit@gnu.org; Sun, 22 Aug 2010 21:15:34 -0400
Received: from [140.186.70.92] (port=35457 helo=eggs.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.43) id 1OnLdL-0005E2-R5
	for myserver-commit@gnu.org; Sun, 22 Aug 2010 21:15:32 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69)
	(envelope-from <gscrivano@gnu.org>) id 1OnLdK-0003JK-C7
	for myserver-commit@gnu.org; Sun, 22 Aug 2010 21:15:31 -0400
Received: from colonialone.fsf.org ([140.186.70.51]:53241
	helo=internal.in.savannah.gnu.org)
	by eggs.gnu.org with esmtp (Exim 4.69)
	(envelope-from <gscrivano@gnu.org>) id 1OnLdK-0003IO-8T
	for myserver-commit@gnu.org; Sun, 22 Aug 2010 21:15:30 -0400
Received: from [10.1.0.108] (helo=vcs-noshell.in.savannah.gnu.org)
	by internal.in.savannah.gnu.org with esmtp (Exim 4.69)
	(envelope-from <gscrivano@gnu.org>) id 1OnLdJ-0005rc-Lb
	for myserver-commit@gnu.org; Mon, 23 Aug 2010 01:15:29 +0000
Received: from gscrivano by vcs-noshell.in.savannah.gnu.org with local (Exim
	4.69) (envelope-from <gscrivano@savannah.gnu.org>)
	id 1OnLd7-00029H-L5
	for myserver-commit@gnu.org; Mon, 23 Aug 2010 01:15:29 +0000
To: myserver-commit@gnu.org
X-Git-Refname: refs/heads/master
X-Git-Reftype: branch
X-Git-Oldrev: e7b8a7da029dae3a0694003c2c6bc0dfe7d6e087
X-Git-Newrev: 97b336221bbda87f4cf56ac31d39a6b8bdb0d157
Message-Id: <E1OnLd7-00029H-L5@vcs-noshell.in.savannah.gnu.org>
From: Giuseppe Scrivano <gscrivano@gnu.org>
Date: Mon, 23 Aug 2010 01:15:28 +0000
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2)
Subject: [myserver-commit] [SCM] GNU MyServer branch, master,
	updated. v0.9.2-362-g97b3362
X-BeenThere: myserver-commit@gnu.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: myserver-commit.gnu.org
List-Unsubscribe: <http://lists.gnu.org/mailman/listinfo/myserver-commit>,
	<mailto:myserver-commit-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/myserver-commit>
List-Post: <mailto:myserver-commit@gnu.org>
List-Help: <mailto:myserver-commit-request@gnu.org?subject=help>
List-Subscribe: <http://lists.gnu.org/mailman/listinfo/myserver-commit>,
	<mailto:myserver-commit-request@gnu.org?subject=subscribe>
X-List-Received-Date: Mon, 23 Aug 2010 01:15:32 -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  97b336221bbda87f4cf56ac31d39a6b8bdb0d157 (commit)
      from  e7b8a7da029dae3a0694003c2c6bc0dfe7d6e087 (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 97b336221bbda87f4cf56ac31d39a6b8bdb0d157
Author: Giuseppe Scrivano <gscrivano@gnu.org>
Date:   Mon Aug 23 02:21:20 2010 +0200

    tests: Add test for HttpHeader::clearValue.

diff --git a/myserver/tests/test_http_request.cpp b/myserver/tests/test_http_request.cpp
index 5687b9a..bf17484 100644
--- a/myserver/tests/test_http_request.cpp
+++ b/myserver/tests/test_http_request.cpp
@@ -44,6 +44,7 @@ class TestHttpRequest : public CppUnit::TestFixture
   CPPUNIT_TEST (testValidRequest);
   CPPUNIT_TEST (testKeepAlive);
   CPPUNIT_TEST (testResetHttpRequest);
+  CPPUNIT_TEST (testClearValue);
   CPPUNIT_TEST_SUITE_END ();
 
 public:
@@ -267,7 +268,7 @@ public:
     CPPUNIT_ASSERT (header.uriOpts.compare ("") == 0);
     CPPUNIT_ASSERT (header.ver.compare ("HTTP/1.1") == 0);
     CPPUNIT_ASSERT (header.uriOptsPtr == NULL);
-    CPPUNIT_ASSERT (header.getValue ("NotExists", 0) == NULL);
+    CPPUNIT_ASSERT (header.getValue ("NotExists", NULL) == NULL);
   }
 
 
@@ -281,9 +282,20 @@ public:
     CPPUNIT_ASSERT (header.uriOpts.compare ("") == 0);
     CPPUNIT_ASSERT (header.ver.compare ("") == 0);
     CPPUNIT_ASSERT (header.uriOptsPtr == NULL);
-    CPPUNIT_ASSERT (header.getValue ("NotExists", 0) == NULL);
+    CPPUNIT_ASSERT (header.getValue ("NotExists", NULL) == NULL);
   }
 
+  void testClearValue ()
+  {
+    HttpRequestHeader header;
+    CPPUNIT_ASSERT (header.getValue ("Foo", NULL) == NULL);
+    header.setValue ("Foo", "Bar");
+    CPPUNIT_ASSERT (header.getValue ("Foo", NULL));
+    header.clearValue ("Foo");
+    CPPUNIT_ASSERT (header.getValue ("Foo", NULL) == NULL);
+
+
+  }
 };
 
 

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

Summary of changes:
 myserver/tests/test_http_request.cpp |   16 ++++++++++++++--
 1 files changed, 14 insertions(+), 2 deletions(-)


hooks/post-receive
-- 
GNU MyServer


From MAILER-DAEMON Thu Aug 26 16:07:18 2010
Received: from mailman by lists.gnu.org with archive (Exim 4.43)
	id 1OoijG-0000qL-4O
	for mharc-myserver-commit@gnu.org; Thu, 26 Aug 2010 16:07:18 -0400
Received: from [140.186.70.92] (port=58216 helo=eggs.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.43) id 1Ooij9-0000pJ-9B
	for myserver-commit@gnu.org; Thu, 26 Aug 2010 16:07:16 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69)
	(envelope-from <gscrivano@gnu.org>) id 1Ooiiy-0003Pf-J5
	for myserver-commit@gnu.org; Thu, 26 Aug 2010 16:07:10 -0400
Received: from colonialone.fsf.org ([140.186.70.51]:45498
	helo=internal.in.savannah.gnu.org)
	by eggs.gnu.org with esmtp (Exim 4.69)
	(envelope-from <gscrivano@gnu.org>) id 1Ooiiy-0003PZ-GI
	for myserver-commit@gnu.org; Thu, 26 Aug 2010 16:07:00 -0400
Received: from [10.1.0.108] (helo=vcs-noshell.in.savannah.gnu.org)
	by internal.in.savannah.gnu.org with esmtp (Exim 4.69)
	(envelope-from <gscrivano@gnu.org>) id 1Ooiiy-000553-4s
	for myserver-commit@gnu.org; Thu, 26 Aug 2010 20:07:00 +0000
Received: from gscrivano by vcs-noshell.in.savannah.gnu.org with local (Exim
	4.69) (envelope-from <gscrivano@savannah.gnu.org>)
	id 1Ooiiu-0001lw-Uv
	for myserver-commit@gnu.org; Thu, 26 Aug 2010 20:07:00 +0000
To: myserver-commit@gnu.org
X-Git-Refname: refs/heads/master
X-Git-Reftype: branch
X-Git-Oldrev: 97b336221bbda87f4cf56ac31d39a6b8bdb0d157
X-Git-Newrev: cbfdd2c73fadd5b06565244d70260b18316601dc
Message-Id: <E1Ooiiu-0001lw-Uv@vcs-noshell.in.savannah.gnu.org>
From: Giuseppe Scrivano <gscrivano@gnu.org>
Date: Thu, 26 Aug 2010 20:06:57 +0000
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2)
Subject: [myserver-commit] [SCM] GNU MyServer branch, master,
	updated. v0.9.2-368-gcbfdd2c
X-BeenThere: myserver-commit@gnu.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: myserver-commit.gnu.org
List-Unsubscribe: <http://lists.gnu.org/mailman/listinfo/myserver-commit>,
	<mailto:myserver-commit-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/myserver-commit>
List-Post: <mailto:myserver-commit@gnu.org>
List-Help: <mailto:myserver-commit-request@gnu.org?subject=help>
List-Subscribe: <http://lists.gnu.org/mailman/listinfo/myserver-commit>,
	<mailto:myserver-commit-request@gnu.org?subject=subscribe>
X-List-Received-Date: Thu, 26 Aug 2010 20:07:16 -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  cbfdd2c73fadd5b06565244d70260b18316601dc (commit)
       via  4b445c980923deca0c6b9441ef8dca8281070ea1 (commit)
       via  a42782f48497ded7e19c5a02dbe4dbf406643870 (commit)
       via  ea0de3c421e4bb1134183be584c95a198d4738b2 (commit)
       via  3082ab4e97e68bdac383bffbbf085e3c6270009e (commit)
       via  879da1b3cc6757c4a8d9bd20a0041d250f6e45ca (commit)
      from  97b336221bbda87f4cf56ac31d39a6b8bdb0d157 (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 cbfdd2c73fadd5b06565244d70260b18316601dc
Author: Giuseppe Scrivano <gscrivano@gnu.org>
Date:   Thu Aug 26 20:35:55 2010 +0200

    File: use checked::ftruncate and change its argument type to off_t.

diff --git a/myserver/include/base/file/file.h b/myserver/include/base/file/file.h
index faa5128..dfb1cee 100644
--- a/myserver/include/base/file/file.h
+++ b/myserver/include/base/file/file.h
@@ -83,7 +83,7 @@ public:
   virtual int fastCopyToSocket (Socket *dest, off_t offset,
                                 MemBuf *buf, size_t *nbw);
 
-  int truncate (u_long size = 0);
+  int truncate (off_t size = 0);
 
   void fstat (struct stat *fstat);
 
diff --git a/myserver/src/base/file/file.cpp b/myserver/src/base/file/file.cpp
index d36cde8..1239b4f 100644
--- a/myserver/src/base/file/file.cpp
+++ b/myserver/src/base/file/file.cpp
@@ -109,13 +109,10 @@ File::File (char *nfilename, int opt)
   Truncate the file.
   \param size Specify the new file size.
  */
-int File::truncate (u_long size)
+int File::truncate (off_t size)
 {
-  int err = ftruncate (handle, size);
-  if (err)
-    return err;
-
-  return seek (size);
+  checked::ftruncate (handle, size);
+  return 0;
 }
 
 /*!



commit 4b445c980923deca0c6b9441ef8dca8281070ea1
Author: Giuseppe Scrivano <gscrivano@gnu.org>
Date:   Thu Aug 26 20:33:08 2010 +0200

    checked: add truncate and ftruncate.

diff --git a/myserver/include/base/exceptions/checked.h b/myserver/include/base/exceptions/checked.h
index 3001970..6685dc2 100644
--- a/myserver/include/base/exceptions/checked.h
+++ b/myserver/include/base/exceptions/checked.h
@@ -90,6 +90,7 @@ namespace checked
   int stat(const char *path, struct stat *buf);
   int fstat (int fd, struct stat *buf);
   int fstatat (int fd, char const *name, struct stat *st, int flags);
+  int ftruncate (int fd, off_t length);
   char *getcwd (char *buf, size_t size);
   int gethostname (char *name, size_t len);
   int getsockname (int fd, struct sockaddr *addr, socklen_t *addrlen);
@@ -122,6 +123,7 @@ namespace checked
   char *strdup (char const *__s);
   int unlink (char const *file);
   ssize_t write (int fd, const void *buf, size_t count);
+  int truncate (const char *path, off_t length);
 }
 
 #endif
diff --git a/myserver/src/base/exceptions/checked.cpp b/myserver/src/base/exceptions/checked.cpp
index a575282..670ad1c 100644
--- a/myserver/src/base/exceptions/checked.cpp
+++ b/myserver/src/base/exceptions/checked.cpp
@@ -78,6 +78,11 @@ namespace checked
     return checkError (gnulib::fstatat (fd, name, st, flags));
   }
 
+  int ftruncate (int fd, off_t length)
+  {
+    return checkError (ftruncate (fd, length));
+  }
+
   char *getcwd (char *buf, size_t size)
   {
     return (char *) checkErrorNull (gnulib::getcwd (buf, size));
@@ -245,6 +250,11 @@ namespace checked
     return checkError (gnulib::write (fd, buf, count));
   }
 
+  int truncate (const char *path, off_t length)
+  {
+    return checkError (truncate (path, length));
+  }
+
   /*
     Maps POSIX errors to exceptions
    */



commit a42782f48497ded7e19c5a02dbe4dbf406643870
Author: Giuseppe Scrivano <gscrivano@gnu.org>
Date:   Thu Aug 26 20:17:05 2010 +0200

    Control: truncate the file to zero instead of open it after it was deleted.

diff --git a/myserver/src/protocol/control/control_protocol.cpp b/myserver/src/protocol/control/control_protocol.cpp
index 8b22074..3558f58 100644
--- a/myserver/src/protocol/control/control_protocol.cpp
+++ b/myserver/src/protocol/control/control_protocol.cpp
@@ -638,8 +638,8 @@ int ControlProtocol::getFile (ConnectionPtr a, char *fn, File *in, File *out,
 }
 
 /*!
-  Save the file on the local FS.
- */
+  Save the file locally.
+*/
 int ControlProtocol::putFile (ConnectionPtr a, char *fn, File *in,
                               File *out, char *buffer, int bufferSize,
                               ControlHeader &header)
@@ -647,38 +647,14 @@ int ControlProtocol::putFile (ConnectionPtr a, char *fn, File *in,
   const char *filename = 0;
   File localfile;
   int ret = 0;
-  /*! # of bytes read.  */
   size_t nbr = 0;
-  /*! # of bytes written.  */
   size_t nbw = 0;
   Server::getInstance ()->disableAutoReboot ();
 
   filename = fn;
 
-  /* Remove the file before create it.  */
-  ret = FilesUtility::deleteFile (filename);
-
-  /* An internal server error happens.  */
-  if (ret)
-    {
-      a->host->warningsLogWrite (_("Control: internal error"));
-      return CONTROL_INTERNAL;
-    }
-
-  ret = localfile.openFile (filename, File::WRITE | File::FILE_OPEN_ALWAYS);
-
-  /* An internal server error happens.  */
-  if (ret)
-    {
-      a->host->warningsLogWrite (_("Control: internal error"));
-      return CONTROL_INTERNAL;
-    }
-
-  if (in == NULL)
-    {
-      a->host->warningsLogWrite (_("Control: internal error"));
-      return CONTROL_INTERNAL;
-    }
+  localfile.openFile (filename, File::WRITE | File::FILE_OPEN_ALWAYS);
+  localfile.truncate (0);
 
   for (;;)
     {
@@ -691,7 +667,7 @@ int ControlProtocol::putFile (ConnectionPtr a, char *fn, File *in,
         }
 
       /* Break the loop when we can't read no more data.  */
-      if (!nbr)
+      if (! nbr)
         break;
 
       ret = localfile.writeToFile (buffer, nbr, &nbw);
@@ -703,7 +679,6 @@ int ControlProtocol::putFile (ConnectionPtr a, char *fn, File *in,
         }
     }
   localfile.close ();
-
   return 0;
 }
 



commit ea0de3c421e4bb1134183be584c95a198d4738b2
Author: Giuseppe Scrivano <gscrivano@gnu.org>
Date:   Thu Aug 26 15:26:11 2010 +0200

    Http::computeDigest accepts only one parameter.

diff --git a/myserver/include/protocol/http/http.h b/myserver/include/protocol/http/http.h
index 0507178..68433aa 100644
--- a/myserver/include/protocol/http/http.h
+++ b/myserver/include/protocol/http/http.h
@@ -172,7 +172,7 @@ protected:
 
   struct HttpThreadContext *td;
   void clean ();
-  void computeDigest (char*, char*);
+  void computeDigest (char *out);
   u_long checkDigest ();
 
   HttpProtocol *staticData;
diff --git a/myserver/src/protocol/http/http.cpp b/myserver/src/protocol/http/http.cpp
index bba7b1b..43902ad 100644
--- a/myserver/src/protocol/http/http.cpp
+++ b/myserver/src/protocol/http/http.cpp
@@ -1183,14 +1183,12 @@ int Http::controlConnection (ConnectionPtr a, char*, char*, u_long, u_long,
 }
 
 /*!
-  Compute the Digest outputting it to a buffer.
+  Compute the Digest and write it to out.
  */
-void Http::computeDigest (char* out, char* buffer)
+void Http::computeDigest (char* out)
 {
   Md5 md5;
-  if (!out)
-    return;
-
+  char buffer[64];
   sprintf (buffer, "%i-%u-%s", (int) clock (), (u_int) td->id,
            td->connection->getIpAddr ());
 
@@ -1255,7 +1253,7 @@ int Http::requestAuthorization ()
       if (td->connection->protocolBuffer &&
           ((!(hud->digest)) || (hud->nonce[0] == '\0')))
         {
-          computeDigest (hud->nonce, md5Str);
+          computeDigest (hud->nonce);
           hud->nc = 0;
         }
 



commit 3082ab4e97e68bdac383bffbbf085e3c6270009e
Author: Giuseppe Scrivano <gscrivano@gnu.org>
Date:   Thu Aug 26 15:13:43 2010 +0200

    Http: use true/false instead of 1/0.

diff --git a/myserver/src/protocol/http/http.cpp b/myserver/src/protocol/http/http.cpp
index a0c6352..bba7b1b 100644
--- a/myserver/src/protocol/http/http.cpp
+++ b/myserver/src/protocol/http/http.cpp
@@ -1105,16 +1105,16 @@ int Http::controlConnection (ConnectionPtr a, char*, char*, u_long, u_long,
               else if (!td->request.cmd.compare ("HEAD"))
                 {
                   td->onlyHeader = true;
-                  ret = sendHTTPResource (td->request.uri, 0, 1);
+                  ret = sendHTTPResource (td->request.uri, false, true);
                 }
               else if (!td->request.cmd.compare ("DELETE"))
                 ret = dav.davdelete (td);
               else if (!td->request.cmd.compare ("PUT"))
-                ret = putHTTPRESOURCE (td->request.uri, 0, 1);
+                ret = putHTTPRESOURCE (td->request.uri, false, true);
               else if (!td->request.cmd.compare ("OPTIONS"))
-                ret = optionsHTTPRESOURCE (td->request.uri, 0);
+                ret = optionsHTTPRESOURCE (td->request.uri, false);
               else if (!td->request.cmd.compare ("TRACE"))
-                ret = traceHTTPRESOURCE (td->request.uri, 0);
+                ret = traceHTTPRESOURCE (td->request.uri, false);
               else if (!td->request.cmd.compare ("MKCOL"))
                 ret = dav.mkcol (td);
               else if (!td->request.cmd.compare ("PROPFIND"))



commit 879da1b3cc6757c4a8d9bd20a0041d250f6e45ca
Author: Giuseppe Scrivano <gscrivano@gnu.org>
Date:   Thu Aug 26 15:09:51 2010 +0200

    Remove method Http::deleteHTTPRESOURCE.

diff --git a/myserver/include/protocol/http/http.h b/myserver/include/protocol/http/http.h
index 706c75c..0507178 100644
--- a/myserver/include/protocol/http/http.h
+++ b/myserver/include/protocol/http/http.h
@@ -98,11 +98,6 @@ public:
   int traceHTTPRESOURCE (string& filename,
                          bool yetMapped = false);
 
-  int deleteHTTPRESOURCE (string &filename,
-                          bool systemrequest = false,
-                          bool onlyHeader = false,
-                          bool yetMapped = false);
-
   bool allowMethod (const char *name);
 
   int raiseHTTPError (int ID);
diff --git a/myserver/src/protocol/http/http.cpp b/myserver/src/protocol/http/http.cpp
index 8054f79..a0c6352 100644
--- a/myserver/src/protocol/http/http.cpp
+++ b/myserver/src/protocol/http/http.cpp
@@ -542,15 +542,6 @@ int Http::preprocessHttpRequest (string &resource, bool yetmapped,
 }
 
 /*!
-  Delete the resource identified by filename.
- */
-int Http::deleteHTTPRESOURCE (string& filename, bool sysReq, bool onlyHeader,
-                              bool yetmapped)
-{
-  return sendHTTPResource (filename, sysReq, onlyHeader, yetmapped);
-}
-
-/*!
   Check the Digest authorization
 
   \return 1 if the client credentials are OK.

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

Summary of changes:
 myserver/include/base/exceptions/checked.h         |    2 +
 myserver/include/base/file/file.h                  |    2 +-
 myserver/include/protocol/http/http.h              |    7 +---
 myserver/src/base/exceptions/checked.cpp           |   10 ++++++
 myserver/src/base/file/file.cpp                    |    9 ++---
 myserver/src/protocol/control/control_protocol.cpp |   35 +++-----------------
 myserver/src/protocol/http/http.cpp                |   27 ++++-----------
 7 files changed, 30 insertions(+), 62 deletions(-)


hooks/post-receive
-- 
GNU MyServer


From MAILER-DAEMON Fri Aug 27 07:44:48 2010
Received: from mailman by lists.gnu.org with archive (Exim 4.43)
	id 1OoxMV-0000kL-Kz
	for mharc-myserver-commit@gnu.org; Fri, 27 Aug 2010 07:44:47 -0400
Received: from [140.186.70.92] (port=56072 helo=eggs.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.43) id 1OoxMS-0000bL-Ik
	for myserver-commit@gnu.org; Fri, 27 Aug 2010 07:44:45 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69)
	(envelope-from <gscrivano@gnu.org>) id 1OoxI5-0005pP-T9
	for myserver-commit@gnu.org; Fri, 27 Aug 2010 07:40:18 -0400
Received: from colonialone.fsf.org ([140.186.70.51]:49817
	helo=internal.in.savannah.gnu.org)
	by eggs.gnu.org with esmtp (Exim 4.69)
	(envelope-from <gscrivano@gnu.org>) id 1OoxI5-0005pI-Rm
	for myserver-commit@gnu.org; Fri, 27 Aug 2010 07:40:13 -0400
Received: from [10.1.0.108] (helo=vcs-noshell.in.savannah.gnu.org)
	by internal.in.savannah.gnu.org with esmtp (Exim 4.69)
	(envelope-from <gscrivano@gnu.org>) id 1OoxI5-000818-G7
	for myserver-commit@gnu.org; Fri, 27 Aug 2010 11:40:13 +0000
Received: from gscrivano by vcs-noshell.in.savannah.gnu.org with local (Exim
	4.69) (envelope-from <gscrivano@savannah.gnu.org>)
	id 1OoxHp-0005D5-KM
	for myserver-commit@gnu.org; Fri, 27 Aug 2010 11:40:04 +0000
To: myserver-commit@gnu.org
X-Git-Refname: refs/heads/master
X-Git-Reftype: branch
X-Git-Oldrev: cbfdd2c73fadd5b06565244d70260b18316601dc
X-Git-Newrev: 05a98093a733cb9e92f29bffeb1a652c6c16fb3d
Message-Id: <E1OoxHp-0005D5-KM@vcs-noshell.in.savannah.gnu.org>
From: Giuseppe Scrivano <gscrivano@gnu.org>
Date: Fri, 27 Aug 2010 11:40:01 +0000
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2)
Subject: [myserver-commit] [SCM] GNU MyServer branch, master,
	updated. v0.9.2-370-g05a9809
X-BeenThere: myserver-commit@gnu.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: myserver-commit.gnu.org
List-Unsubscribe: <http://lists.gnu.org/mailman/listinfo/myserver-commit>,
	<mailto:myserver-commit-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/myserver-commit>
List-Post: <mailto:myserver-commit@gnu.org>
List-Help: <mailto:myserver-commit-request@gnu.org?subject=help>
List-Subscribe: <http://lists.gnu.org/mailman/listinfo/myserver-commit>,
	<mailto:myserver-commit-request@gnu.org?subject=subscribe>
X-List-Received-Date: Fri, 27 Aug 2010 11:44:46 -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  05a98093a733cb9e92f29bffeb1a652c6c16fb3d (commit)
       via  f7791f12d0dc0c1c7fe48a49115558d29de2de1e (commit)
      from  cbfdd2c73fadd5b06565244d70260b18316601dc (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 05a98093a733cb9e92f29bffeb1a652c6c16fb3d
Author: Giuseppe Scrivano <gscrivano@gnu.org>
Date:   Fri Aug 27 13:35:42 2010 +0200

    File::truncate doesn't do a seek.  Change TestFile::testTruncate accordingly.

diff --git a/myserver/tests/test_file.cpp b/myserver/tests/test_file.cpp
index e34abf2..f688029 100644
--- a/myserver/tests/test_file.cpp
+++ b/myserver/tests/test_file.cpp
@@ -210,9 +210,11 @@ public:
 
     CPPUNIT_ASSERT_EQUAL (tfile->getFileSize (), (off_t) dataLen / 2);
 
+    CPPUNIT_ASSERT_EQUAL (tfile->seek (0), 0);
+
     CPPUNIT_ASSERT_EQUAL (tfile->writeToFile (data, dataLen, &nbw), 0);
 
-    CPPUNIT_ASSERT_EQUAL (tfile->getFileSize (), (off_t) (dataLen + dataLen / 2));
+    CPPUNIT_ASSERT_EQUAL (tfile->getFileSize (), (off_t) dataLen);
 
     try
       {



commit f7791f12d0dc0c1c7fe48a49115558d29de2de1e
Author: Giuseppe Scrivano <gscrivano@gnu.org>
Date:   Fri Aug 27 13:32:12 2010 +0200

    Fix segfault caused by recursive call of the same function.

diff --git a/myserver/src/base/exceptions/checked.cpp b/myserver/src/base/exceptions/checked.cpp
index 670ad1c..3dd1d39 100644
--- a/myserver/src/base/exceptions/checked.cpp
+++ b/myserver/src/base/exceptions/checked.cpp
@@ -80,7 +80,7 @@ namespace checked
 
   int ftruncate (int fd, off_t length)
   {
-    return checkError (ftruncate (fd, length));
+    return checkError (::ftruncate (fd, length));
   }
 
   char *getcwd (char *buf, size_t size)

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

Summary of changes:
 myserver/src/base/exceptions/checked.cpp |    2 +-
 myserver/tests/test_file.cpp             |    4 +++-
 2 files changed, 4 insertions(+), 2 deletions(-)


hooks/post-receive
-- 
GNU MyServer


From MAILER-DAEMON Fri Aug 27 09:35:09 2010
Received: from mailman by lists.gnu.org with archive (Exim 4.43)
	id 1Ooz5J-0007QE-JD
	for mharc-myserver-commit@gnu.org; Fri, 27 Aug 2010 09:35:09 -0400
Received: from [140.186.70.92] (port=52159 helo=eggs.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.43) id 1Ooz5G-0007Q9-IF
	for myserver-commit@gnu.org; Fri, 27 Aug 2010 09:35:08 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69)
	(envelope-from <gscrivano@gnu.org>) id 1Ooz5A-0007SR-MQ
	for myserver-commit@gnu.org; Fri, 27 Aug 2010 09:35:06 -0400
Received: from colonialone.fsf.org ([140.186.70.51]:56227
	helo=internal.in.savannah.gnu.org)
	by eggs.gnu.org with esmtp (Exim 4.69)
	(envelope-from <gscrivano@gnu.org>) id 1Ooz5A-0007SM-Jm
	for myserver-commit@gnu.org; Fri, 27 Aug 2010 09:35:00 -0400
Received: from [10.1.0.108] (helo=vcs-noshell.in.savannah.gnu.org)
	by internal.in.savannah.gnu.org with esmtp (Exim 4.69)
	(envelope-from <gscrivano@gnu.org>) id 1Ooz5A-0000uw-F1
	for myserver-commit@gnu.org; Fri, 27 Aug 2010 13:35:00 +0000
Received: from gscrivano by vcs-noshell.in.savannah.gnu.org with local (Exim
	4.69) (envelope-from <gscrivano@savannah.gnu.org>)
	id 1Ooz55-0003pD-IZ
	for myserver-commit@gnu.org; Fri, 27 Aug 2010 13:35:00 +0000
To: myserver-commit@gnu.org
X-Git-Refname: refs/heads/master
X-Git-Reftype: branch
X-Git-Oldrev: 05a98093a733cb9e92f29bffeb1a652c6c16fb3d
X-Git-Newrev: 8249ef25c77a6121f27fa55f4f74c50e9d300600
Message-Id: <E1Ooz55-0003pD-IZ@vcs-noshell.in.savannah.gnu.org>
From: Giuseppe Scrivano <gscrivano@gnu.org>
Date: Fri, 27 Aug 2010 13:34:59 +0000
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2)
Subject: [myserver-commit] [SCM] GNU MyServer branch, master,
	updated. v0.9.2-373-g8249ef2
X-BeenThere: myserver-commit@gnu.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: myserver-commit.gnu.org
List-Unsubscribe: <http://lists.gnu.org/mailman/listinfo/myserver-commit>,
	<mailto:myserver-commit-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/myserver-commit>
List-Post: <mailto:myserver-commit@gnu.org>
List-Help: <mailto:myserver-commit-request@gnu.org?subject=help>
List-Subscribe: <http://lists.gnu.org/mailman/listinfo/myserver-commit>,
	<mailto:myserver-commit-request@gnu.org?subject=subscribe>
X-List-Received-Date: Fri, 27 Aug 2010 13:35:08 -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  8249ef25c77a6121f27fa55f4f74c50e9d300600 (commit)
       via  6fa1707fe728ce7dd36ac37e782cf48a1f4438c4 (commit)
       via  ea4e11eb0144ec86c1cb2b1f663d6481d7f6dd29 (commit)
      from  05a98093a733cb9e92f29bffeb1a652c6c16fb3d (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 8249ef25c77a6121f27fa55f4f74c50e9d300600
Author: Giuseppe Scrivano <gscrivano@gnu.org>
Date:   Fri Aug 27 15:19:51 2010 +0200

    Control: Use special names to access configuration files.

diff --git a/myserver/include/protocol/control/control_protocol.h b/myserver/include/protocol/control/control_protocol.h
index 70b5c90..8efa361 100644
--- a/myserver/include/protocol/control/control_protocol.h
+++ b/myserver/include/protocol/control/control_protocol.h
@@ -45,7 +45,7 @@ protected:
   static char adminLogin[64];
   static char adminPassword[64];
   static int controlEnabled;
-
+  const char *mapPath (const char *path);
   int checkAuth (ControlHeader&);
   int showConnections (ConnectionPtr,File* out, char *b1,int bs1, ControlHeader&);
   int showDynamicProtocols (ConnectionPtr,File* out, char *b1,int bs1, ControlHeader&);
diff --git a/myserver/include/server/server.h b/myserver/include/server/server.h
index e9a7038..ac05fdd 100644
--- a/myserver/include/server/server.h
+++ b/myserver/include/server/server.h
@@ -173,6 +173,10 @@ public:
   MainConfiguration *getConfiguration ();
   CryptAlgoManager *getCryptAlgoManager () {return &cryptAlgoManager;}
 
+  const char *getMainConfigurationFile () {return mainConfigurationFile.c_str ();}
+  const char *getVhostConfigurationFile () {return vhostConfigurationFile.c_str ();}
+  const char *getMimeConfigurationFile () {return mimeConfigurationFile.c_str ();}
+
 private:
   XmlValidator *xmlValidator;
   VhostManagerHandler *vhostHandler;
diff --git a/myserver/src/GUI/MyServer/pycontrollib/controller.py b/myserver/src/GUI/MyServer/pycontrollib/controller.py
index 64cb7c6..69affff 100644
--- a/myserver/src/GUI/MyServer/pycontrollib/controller.py
+++ b/myserver/src/GUI/MyServer/pycontrollib/controller.py
@@ -1,7 +1,7 @@
 # -*- coding: utf-8 -*-
 '''
 MyServer
-Copyright (C) 2009 Free Software Foundation, Inc.
+Copyright (C) 2009, 2010 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
@@ -122,24 +122,24 @@ class BasicController():
 class Controller(BasicController):
     def get_MIME_type_configuration(self):
         '''Get MIME types settings.'''
-        return MIMETypes.from_string(self.get_file('mimetypes.xml'))
+        return MIMETypes.from_string(self.get_file('&&&mime'))
 
     def get_vhost_configuration(self):
         '''Get VHosts settings.'''
-        return VHosts.from_string(self.get_file('virtualhosts.xml'))
+        return VHosts.from_string(self.get_file('&&&vhost'))
 
     def get_server_configuration(self):
         '''Get server settings.'''
-        return MyServerConfig.from_string(self.get_file('myserver.xml'))
+        return MyServerConfig.from_string(self.get_file('&&&server'))
 
     def put_MIME_type_configuration(self, config):
         '''Put MIME types settings.'''
-        self.put_file(str(config), 'mimetypes.xml')
+        self.put_file(str(config), '&&&mime')
 
     def put_vhost_configuration(self, config):
         '''Put VHost settings.'''
-        self.put_file(str(config), 'virtualhosts.xml')
+        self.put_file(str(config), '&&&vhost')
 
     def put_server_configuration(self, config):
         '''Put server settings.'''
-        self.put_file(str(config), 'myserver.xml')
+        self.put_file(str(config), '&&&server')
diff --git a/myserver/src/protocol/control/control_protocol.cpp b/myserver/src/protocol/control/control_protocol.cpp
index 56f928e..bcadb9e 100644
--- a/myserver/src/protocol/control/control_protocol.cpp
+++ b/myserver/src/protocol/control/control_protocol.cpp
@@ -593,7 +593,7 @@ int ControlProtocol::getFile (ConnectionPtr a, char *fn, File *in, File *out,
   /* # of bytes written.  */
   size_t nbw = 0;
 
-  filename = fn;
+  filename = mapPath (fn);
 
   ret = localfile.openFile (filename, File::READ | File::OPEN_IF_EXISTS);
 
@@ -644,7 +644,7 @@ int ControlProtocol::putFile (ConnectionPtr a, char *fn, File *in,
   size_t nbw = 0;
   Server::getInstance ()->disableAutoReboot ();
 
-  filename = fn;
+  filename = mapPath (fn);
 
   localfile.openFile (filename, File::WRITE | File::FILE_OPEN_ALWAYS);
   localfile.truncate (0);
@@ -685,3 +685,17 @@ int ControlProtocol::getVersion (ConnectionPtr a, File *out, char *buffer,
   myserver_strlcpy (buffer, MYSERVER_VERSION, bufferSize);
   return out->writeToFile (buffer, strlen (buffer), &nbw);
 }
+
+const char *ControlProtocol::mapPath (const char *path)
+{
+  if (!strcmp (path, "&&&server"))
+    return Server::getInstance ()->getMainConfigurationFile ();
+
+  if (!strcmp (path, "&&&vhost"))
+    return Server::getInstance ()->getVhostConfigurationFile ();
+
+  if (!strcmp (path, "&&&mime"))
+    return Server::getInstance ()->getMimeConfigurationFile ();
+
+  return path;
+}



commit 6fa1707fe728ce7dd36ac37e782cf48a1f4438c4
Author: Giuseppe Scrivano <gscrivano@gnu.org>
Date:   Fri Aug 27 14:58:05 2010 +0200

    ControlProtocol: use FilesUtility::temporaryFileName to generate temporary file name.

diff --git a/myserver/src/protocol/control/control_protocol.cpp b/myserver/src/protocol/control/control_protocol.cpp
index 3558f58..56f928e 100644
--- a/myserver/src/protocol/control/control_protocol.cpp
+++ b/myserver/src/protocol/control/control_protocol.cpp
@@ -194,8 +194,8 @@ int ControlProtocol::controlConnection (ConnectionPtr a, char *request,
   int ret;
   int realHeaderLength;
   int dataWritten = 0;
-  ostringstream inFilePath;
-  ostringstream outFilePath;
+  string inFilePath;
+  string outFilePath;
   size_t nbw;
   int specifiedLength;
   char *version = 0;
@@ -251,9 +251,8 @@ int ControlProtocol::controlConnection (ConnectionPtr a, char *request,
       timeout = getTicks ();
       if (specifiedLength)
         {
-          inFilePath << getdefaultwd (0,0) << "/ControlInput_" << (u_int) id;
-
-          inFile.createTemporaryFile (inFilePath.str ().c_str ());
+          FilesUtility::temporaryFileName (id, inFilePath);
+          inFile.createTemporaryFile (inFilePath.c_str ());
 
           if (nbtr - realHeaderLength)
             {
@@ -285,7 +284,7 @@ int ControlProtocol::controlConnection (ConnectionPtr a, char *request,
                   sendResponse (auxBuffer, bufferSize, a, CONTROL_BAD_LEN, header,
                                 0);
                   inFile.close ();
-                  FilesUtility::deleteFile (inFilePath.str ().c_str ());
+                  FilesUtility::deleteFile (inFilePath.c_str ());
                   return 0;
                 }
               else
@@ -293,13 +292,11 @@ int ControlProtocol::controlConnection (ConnectionPtr a, char *request,
             }
         }
 
-      inFile.seek (0);
-
       if (strcasecmp (version, "CONTROL/1.0"))
         {
           a->host->warningsLogWrite (_("Control: specified version not supported"));
           inFile.close ();
-          FilesUtility::deleteFile (inFilePath.str ().c_str ());
+          FilesUtility::deleteFile (inFilePath.c_str ());
           sendResponse (auxBuffer, bufferSize, a, CONTROL_BAD_VERSION, header, 0);
           return 0;
         }
@@ -312,7 +309,7 @@ int ControlProtocol::controlConnection (ConnectionPtr a, char *request,
       if (authorized == 0)
         {
           inFile.close ();
-          FilesUtility::deleteFile (inFilePath.str ().c_str ());
+          FilesUtility::deleteFile (inFilePath.c_str ());
           sendResponse (auxBuffer, bufferSize, a, CONTROL_AUTH, header, 0);
           return 0;
         }
@@ -323,7 +320,7 @@ int ControlProtocol::controlConnection (ConnectionPtr a, char *request,
       if (dataWritten != specifiedLength)
         {
           inFile.close ();
-          FilesUtility::deleteFile (inFilePath.str ().c_str ());
+          FilesUtility::deleteFile (inFilePath.c_str ());
           sendResponse (auxBuffer, bufferSize, a, CONTROL_BAD_LEN, header, 0);
           return 0;
         }
@@ -334,10 +331,8 @@ int ControlProtocol::controlConnection (ConnectionPtr a, char *request,
       knownCommand = 0;
 
       /* Create an out file. This can be used by commands needing it. */
-      outFilePath << getdefaultwd (0, 0) << "/ControlOutput_" << (u_int) id;
-
-      outFile.createTemporaryFile (outFilePath.str ().c_str ());
-
+      FilesUtility::temporaryFileName (id, outFilePath);
+      outFile.createTemporaryFile (outFilePath.c_str ());
       if (!strcmp (command, "SHOWCONNECTIONS"))
         {
           knownCommand = 1;
@@ -401,8 +396,8 @@ int ControlProtocol::controlConnection (ConnectionPtr a, char *request,
           inFile.close ();
           outFile.close ();
 
-          FilesUtility::deleteFile (inFilePath.str ().c_str ());
-          FilesUtility::deleteFile (outFilePath.str ().c_str ());
+          FilesUtility::deleteFile (inFilePath.c_str ());
+          FilesUtility::deleteFile (outFilePath.c_str ());
           connection = header.getConnection ();
 
           /*
@@ -421,8 +416,8 @@ int ControlProtocol::controlConnection (ConnectionPtr a, char *request,
 
           inFile.close ();
           outFile.close ();
-          FilesUtility::deleteFile (inFilePath.str ().c_str ());
-          FilesUtility::deleteFile (outFilePath.str ().c_str ());
+          FilesUtility::deleteFile (inFilePath.c_str ());
+          FilesUtility::deleteFile (outFilePath.c_str ());
 
           return ClientsThread::DELETE_CONNECTION;
         }
@@ -431,8 +426,8 @@ int ControlProtocol::controlConnection (ConnectionPtr a, char *request,
     {
       inFile.close ();
       outFile.close ();
-      FilesUtility::deleteFile (inFilePath.str ().c_str ());
-      FilesUtility::deleteFile (outFilePath.str ().c_str ());
+      FilesUtility::deleteFile (inFilePath.c_str ());
+      FilesUtility::deleteFile (outFilePath.c_str ());
       a->host->warningsLogWrite (_E ("Control: internal error"), &e);
       return ClientsThread::DELETE_CONNECTION;
     }
@@ -581,8 +576,6 @@ int ControlProtocol::visitConnection (ConnectionPtr con, void *argP)
   return 0;
 }
 
-
-
 /*!
   Return the requested file to the client.
  */



commit ea4e11eb0144ec86c1cb2b1f663d6481d7f6dd29
Author: Giuseppe Scrivano <gscrivano@gnu.org>
Date:   Fri Aug 27 14:33:45 2010 +0200

    Use root as default system administrator name.

diff --git a/myserver/binaries/myserver.default.xml b/myserver/binaries/myserver.default.xml
index 921eab1..e0635ff 100755
--- a/myserver/binaries/myserver.default.xml
+++ b/myserver/binaries/myserver.default.xml
@@ -64,7 +64,7 @@
   <DEFINE name="http.dir.css" value="/sys/css/browsestyle.css" />
 
   <!--DEFINE THE ADMINISTRATOR E-MAIL-->
-  <DEFINE name="server.admin" value="administrator@localhost" />
+  <DEFINE name="server.admin" value="root@localhost" />
 
   <!--DEFINE THE GZIP COMPRESSION THRESHOLD VALUE-->
   <DEFINE name="gzip.threshold" value="1048576" />

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

Summary of changes:
 myserver/binaries/myserver.default.xml             |    2 +-
 .../include/protocol/control/control_protocol.h    |    2 +-
 myserver/include/server/server.h                   |    4 ++
 .../src/GUI/MyServer/pycontrollib/controller.py    |   14 +++---
 myserver/src/protocol/control/control_protocol.cpp |   57 +++++++++++---------
 5 files changed, 45 insertions(+), 34 deletions(-)


hooks/post-receive
-- 
GNU MyServer


From MAILER-DAEMON Fri Aug 27 14:10:01 2010
Received: from mailman by lists.gnu.org with archive (Exim 4.43)
	id 1Op3NJ-0006ZA-AV
	for mharc-myserver-commit@gnu.org; Fri, 27 Aug 2010 14:10:01 -0400
Received: from [140.186.70.92] (port=51390 helo=eggs.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.43) id 1Op3NF-0006Yn-QG
	for myserver-commit@gnu.org; Fri, 27 Aug 2010 14:09:59 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69)
	(envelope-from <gscrivano@gnu.org>) id 1Op3NE-0006gG-AI
	for myserver-commit@gnu.org; Fri, 27 Aug 2010 14:09:57 -0400
Received: from colonialone.fsf.org ([140.186.70.51]:45003
	helo=internal.in.savannah.gnu.org)
	by eggs.gnu.org with esmtp (Exim 4.69)
	(envelope-from <gscrivano@gnu.org>) id 1Op3NE-0006gC-7P
	for myserver-commit@gnu.org; Fri, 27 Aug 2010 14:09:56 -0400
Received: from [10.1.0.108] (helo=vcs-noshell.in.savannah.gnu.org)
	by internal.in.savannah.gnu.org with esmtp (Exim 4.69)
	(envelope-from <gscrivano@gnu.org>) id 1Op3NE-0004JE-5y
	for myserver-commit@gnu.org; Fri, 27 Aug 2010 18:09:56 +0000
Received: from gscrivano by vcs-noshell.in.savannah.gnu.org with local (Exim
	4.69) (envelope-from <gscrivano@savannah.gnu.org>)
	id 1Op3N7-0007sO-Fh
	for myserver-commit@gnu.org; Fri, 27 Aug 2010 18:09:56 +0000
To: myserver-commit@gnu.org
X-Git-Refname: refs/heads/master
X-Git-Reftype: branch
X-Git-Oldrev: 8249ef25c77a6121f27fa55f4f74c50e9d300600
X-Git-Newrev: 636bc002bb4e20137a86b94292e8d6f3b2952554
Message-Id: <E1Op3N7-0007sO-Fh@vcs-noshell.in.savannah.gnu.org>
From: Giuseppe Scrivano <gscrivano@gnu.org>
Date: Fri, 27 Aug 2010 18:09:54 +0000
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2)
Subject: [myserver-commit] [SCM] GNU MyServer branch, master,
	updated. v0.9.2-376-g636bc00
X-BeenThere: myserver-commit@gnu.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: myserver-commit.gnu.org
List-Unsubscribe: <http://lists.gnu.org/mailman/listinfo/myserver-commit>,
	<mailto:myserver-commit-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/myserver-commit>
List-Post: <mailto:myserver-commit@gnu.org>
List-Help: <mailto:myserver-commit-request@gnu.org?subject=help>
List-Subscribe: <http://lists.gnu.org/mailman/listinfo/myserver-commit>,
	<mailto:myserver-commit-request@gnu.org?subject=subscribe>
X-List-Received-Date: Fri, 27 Aug 2010 18:10:00 -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  636bc002bb4e20137a86b94292e8d6f3b2952554 (commit)
       via  5c464b25c828e249cf7b559cbb7e5fc90ed15977 (commit)
       via  92fce90eaea3d4e12e0b581ed1c7c911e0a5f0fa (commit)
      from  8249ef25c77a6121f27fa55f4f74c50e9d300600 (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 636bc002bb4e20137a86b94292e8d6f3b2952554
Author: Giuseppe Scrivano <gscrivano@gnu.org>
Date:   Fri Aug 27 20:06:18 2010 +0200

    Server: do not remove webdav locks on shutdown.

diff --git a/myserver/src/server/server.cpp b/myserver/src/server/server.cpp
index fff780d..e02b3b4 100644
--- a/myserver/src/server/server.cpp
+++ b/myserver/src/server/server.cpp
@@ -463,6 +463,8 @@ void Server::mainLoop ()
 
       if (autoRebootEnabled)
         {
+          bool doBeep = false;
+
           time_t mainConfTimeNow =
             FilesUtility::getLastModTime (mainConfigurationFile.c_str ());
           time_t hostsConfTimeNow =
@@ -474,7 +476,7 @@ void Server::mainLoop ()
           if (((mainConfTimeNow != -1) && (hostsConfTimeNow != -1)
                && (mimeConfNow != -1)) || toReboot)
             {
-              if ( (mainConfTimeNow  != mainConfTime) || toReboot)
+              if ((mainConfTimeNow  != mainConfTime) || toReboot)
                 {
                   string msg ("main-conf-changed");
                   notifyMulticast (msg, 0);
@@ -489,13 +491,8 @@ void Server::mainLoop ()
                   string msg ("mime-conf-changed");
                   notifyMulticast (msg, 0);
 
-                  if (logLocation.find ("console://") != string::npos)
-                    {
-                      char beep[] = { static_cast<char>(0x7), '\0' };
-                      string beepStr (beep);
-                      logManager->log (this, "MAINLOG", logLocation, beepStr);
-                    }
-                  log (MYSERVER_LOG_MSG_INFO, _("Reloading MIME types"));
+                  log (MYSERVER_LOG_MSG_INFO, _("Reloading MIME types from %s"),
+                       mimeConfigurationFile.c_str ());
 
                   getMimeManager ()->reload ();
 
@@ -540,6 +537,13 @@ void Server::mainLoop ()
                   hostsConfTime = hostsConfTimeNow;
                   log (MYSERVER_LOG_MSG_INFO, _("Reloaded"));
                 }
+
+              if (doBeep && logLocation.find ("console://") != string::npos)
+                {
+                  char beep[] = { static_cast<char>(0x7), '\0' };
+                  string beepStr (beep);
+                  logManager->log (this, "MAINLOG", logLocation, beepStr);
+                }
             }
         }
     }
@@ -711,7 +715,6 @@ void Server::stop ()
  */
 int Server::terminate ()
 {
-  FilesUtility::deleteDir ("system/webdav");
   log (MYSERVER_LOG_MSG_INFO, _("Stopping threads"));
 
   listenThreads.terminate ();



commit 5c464b25c828e249cf7b559cbb7e5fc90ed15977
Author: Giuseppe Scrivano <gscrivano@gnu.org>
Date:   Fri Aug 27 19:36:46 2010 +0200

    Control: by default specify an empty password.

diff --git a/myserver/binaries/myserver.default.xml b/myserver/binaries/myserver.default.xml
index e0635ff..2159b06 100755
--- a/myserver/binaries/myserver.default.xml
+++ b/myserver/binaries/myserver.default.xml
@@ -1,27 +1,27 @@
 <?xml version="1.0"?>
 
-<!--MODIFY THE FILE ONLY IF YOU ARE SURE OF WHAT YOU ARE DOING-->
+<!--MODIFY THE FILE ONLY IF YOU ARE SURE OF WHAT YOU ARE DOING.  -->
 <MYSERVER>
 
-  <!--CHOOSE THE LANGUAGE TO USE FOR THE SERVER-->
+  <!--CHOOSE THE LANGUAGE TO USE FOR THE SERVER.  -->
   <DEFINE name="server.language" value="english.xml" />
 
-  <!--VERBOSITY ON LOG FILE-->
+  <!--VERBOSITY ON LOG FILE.  -->
   <DEFINE name="server.verbosity" value="2" />
 
-  <!--NUMBER OF SERVING THREADS ALWAYS ACTIVE-->
+  <!--NUMBER OF SERVING THREADS ALWAYS ACTIVE.  -->
   <DEFINE name="server.static_threads" value="5" />
 
-  <!--MAXIMUM NUMBER OF SERVING THREADS THAT THE SCHEDULER CAN
-      CREATE-->
+  <!--MAXIMUM NUMBER OF WORKER THREADS THAT THE SCHEDULER CAN
+      CREATE.  -->
   <DEFINE name="server.max_threads" value="200" />
 
-  <!-- BUFFER SIZE AVAILABLE TO EVERY THREAD.  -->
+  <!-- BUFFER SIZE AVAILABLE FOR EVERY THREAD.  -->
   <DEFINE name="server.buffer_size" value="102400" />
 
   <!--DEFAULT FILENAME TO SEND IN A DIRECTORY
       IF THE FILE ISN'T IN THE PATH THEN THE DIRECTORY
-      CONTENT IS SENT. -->
+      CONTENT IS SENT.  -->
   <DEFINE name="http.default_file">
     <DEFINE value="default.html"/>
     <DEFINE value="default.htm"/>
@@ -33,7 +33,7 @@
       IF THE CLIENT DOESN'T REQUEST ANYTHING FOR N
       SECONDS THE CONNECTION WITH THE CLIENT IS
       CLOSED. SET THIS TO 0 IF YOU DON'T WANT USE
-      KEEP-ALIVE CONNECTIONS. -->
+      KEEP-ALIVE CONNECTIONS.  -->
   <DEFINE name="connection.timeout" value="180" />
 
   <!--SET THIS TO YES FOR USE PERSONALIZED PAGES TO SEND MESSAGE,
@@ -41,13 +41,13 @@
   <DEFINE name="http.use_error_file" value="YES" />
 
   <!--DEFINE THE MAX NUMBER OF CONNECTIONS TO ALLOW TO THE SERVER. IF
-      0 THEN INFINITE CONNECTIONS ARE ALLOWED.-->
+      0 THEN INFINITE CONNECTIONS ARE ALLOWED.  -->
   <DEFINE name="server.max_connections" value="0" />
 
-  <!--DEFINE THE MAX NUMBER OF CONNECTIONS TO ACCEPT.-->
+  <!--DEFINE THE MAX NUMBER OF CONNECTIONS TO ACCEPT.  -->
   <DEFINE name="server.max_accepted_connections" value="0" />
 
-  <!--TEXT AND BACKGROUND ATTRIBUTES FOR CONSOLE LOG MESSAGES. -->
+  <!--TEXT AND BACKGROUND ATTRIBUTES FOR CONSOLE LOG MESSAGES.  -->
   <DEFINE name="log_color.info_fg" value="white" />
   <DEFINE name="log_color.info_bg" value="black" />
 
@@ -60,60 +60,60 @@
   <!--MAX SIZE OF THE LOG FILE IN BYTES.  -->
   <DEFINE name="server.max_log_size" value="1048576" />
 
-  <!--DEFINE THE FOLDER BROWSING STYLE-->
+  <!--DEFINE THE FOLDER BROWSING STYLE.  -->
   <DEFINE name="http.dir.css" value="/sys/css/browsestyle.css" />
 
-  <!--DEFINE THE ADMINISTRATOR E-MAIL-->
+  <!--DEFINE THE ADMINISTRATOR E-MAIL.  -->
   <DEFINE name="server.admin" value="root@localhost" />
 
-  <!--DEFINE THE GZIP COMPRESSION THRESHOLD VALUE-->
+  <!--DEFINE THE GZIP COMPRESSION THRESHOLD VALUE.  -->
   <DEFINE name="gzip.threshold" value="1048576" />
 
-  <!--DEFINE IF LINKS SHOULD BE FOLLOWED-->
+  <!--DEFINE IF LINKS SHOULD BE FOLLOWED.  -->
   <DEFINE name="symlinks.follow" value="YES" />
 
-  <!--MAX CACHE SIZE FOR STATIC FILES-->
+  <!--MAX CACHE SIZE FOR STATIC FILES.  -->
   <DEFINE name="server.max_files_cache" value="10485760" />
 
-  <!--MAX CACHE SIZE FOR SINGLE STATIC FILE-->
+  <!--MAX CACHE SIZE FOR SINGLE STATIC FILE.  -->
   <DEFINE name="server.max_file_cache" value="1048576" />
 
-  <!--MIN CACHE SIZE FOR SINGLE STATIC FILE-->
+  <!--MIN CACHE SIZE FOR SINGLE STATIC FILE.  -->
   <DEFINE name="server.min_file_cache" value="0" />
 
-  <!-- ENABLE HOME DIRECTORY PER USER -->
+  <!-- ENABLE HOME DIRECTORY PER USER .  -->
   <DEFINE name="http.use_home_directory" value="NO" />
 
   <!-- DEFINE NAME FOR HOME DIRECTORY BROWSING, BY DEFAULT THE SERVER
-       USES public_html -->
+       USES public_html .  -->
   <DEFINE name="http.home_directory" value="public_html" />
 
-  <!--SET THIS TO YES IF YOU WANT TO ENABLE THE CONTROL PROTOCOL-->
+  <!--SET THIS TO YES IF YOU WANT TO ENABLE THE CONTROL PROTOCOL.  -->
   <DEFINE name="control.enabled" value="NO" />
 
-  <!--MAXIMUM NUMBER OF EXTERNAL SERVERS THAT CAN BE EXECUTED-->
+  <!--MAXIMUM NUMBER OF EXTERNAL SERVERS THAT CAN BE EXECUTED.  -->
   <DEFINE name="server.max_servers" value="100" />
 
   <!--SET HERE THE NAME FOR THE CONTROL ADMIN. WE SUGGEST YOU YO USE
-      SOMETHING DIFFERENT FROM ADMIN, ADMINISTRATOR OR ROOT-->
+      SOMETHING DIFFERENT FROM ADMIN, ADMINISTRATOR OR ROOT.  -->
   <DEFINE name="control.admin" value="ADMIN" />
 
-  <!--DEFINE HERE A GOOD STRONG PASSWORD FOR THE ADMIN-->
-  <DEFINE name="control.password" value="PLEASE_CHANGE_THIS_PASSWORD" />
+  <!--DEFINE HERE THE PASSWORD FOR THE ADMINISTRATOR.  -->
+  <DEFINE name="control.password" value="" />
 
-  <!--FTP GLOBAL CONFIGURATION-->
-  <!--ALLOW ANONYMOUS LOGIN-->
+  <!--FTP GLOBAL CONFIGURATION.  -->
+  <!--ALLOW ANONYMOUS LOGIN.  -->
   <DEFINE name="ftp.allow_anonymous" value="YES" />
 
-  <!--IF ANONYMOUS ALLOWED, TELLS IF NEEDS PASS-->
+  <!--IF ANONYMOUS ALLOWED, TELLS IF NEEDS PASS.  -->
   <DEFINE name="ftp.anonymous_need_pass" value="NO" />
 
-  <!--ALLOW ASYNCHRONOUS CMDS LIKE Abor, Quit, Stat-->
+  <!--ALLOW ASYNCHRONOUS CMDS LIKE Abor, Quit, Stat.  -->
   <DEFINE name="ftp.allow_asynchronous_cmds" value="YES" />
 
-  <!--ALLOW CLIENTS TO SEND MORE THAN ONE COMMAND TO SERVER INTO ONE REQUEST-->
+  <!--ALLOW CLIENTS TO SEND MORE THAN ONE COMMAND TO SERVER INTO ONE REQUEST.  -->
   <DEFINE name="ftp.allow_pipelining" value="NO" />
 
-  <!--ALLOW CLIENTS TO CHANGE SERVER FILES-->
+  <!--ALLOW CLIENTS TO CHANGE SERVER FILES.  -->
   <DEFINE name="ftp.allow_store" value="NO" />
 </MYSERVER>



commit 92fce90eaea3d4e12e0b581ed1c7c911e0a5f0fa
Author: Giuseppe Scrivano <gscrivano@gnu.org>
Date:   Fri Aug 27 19:32:04 2010 +0200

    Control: do not allow empty password.

diff --git a/myserver/include/protocol/control/control_protocol.h b/myserver/include/protocol/control/control_protocol.h
index 8efa361..11d88c7 100644
--- a/myserver/include/protocol/control/control_protocol.h
+++ b/myserver/include/protocol/control/control_protocol.h
@@ -46,7 +46,7 @@ protected:
   static char adminPassword[64];
   static int controlEnabled;
   const char *mapPath (const char *path);
-  int checkAuth (ControlHeader&);
+  int checkAuth (ConnectionPtr, ControlHeader&);
   int showConnections (ConnectionPtr,File* out, char *b1,int bs1, ControlHeader&);
   int showDynamicProtocols (ConnectionPtr,File* out, char *b1,int bs1, ControlHeader&);
   int killConnection (ConnectionPtr,u_long ID, File* out, char *b1,int bs1, ControlHeader&);
diff --git a/myserver/src/protocol/control/control_protocol.cpp b/myserver/src/protocol/control/control_protocol.cpp
index bcadb9e..4d0e56b 100644
--- a/myserver/src/protocol/control/control_protocol.cpp
+++ b/myserver/src/protocol/control/control_protocol.cpp
@@ -127,9 +127,8 @@ int ControlProtocol::loadProtocol ()
       adminNameMD5ized = 1;
 
   data = Server::getInstance ()->getData ("control.password.md5");
-  if (data)
-    if (strcasecmp (data, "YES") == 0)
-      adminPasswordMD5ized = 1;
+  if (data && strcasecmp (data, "YES") == 0)
+    adminPasswordMD5ized = 1;
 
   if (adminNameMD5ized)
     strncpy (adminLogin, tmpName, 64);
@@ -156,7 +155,7 @@ int ControlProtocol::loadProtocol ()
   Check if the client is allowed to connect to.
   Return 1 if the client is allowed.
  */
-int ControlProtocol::checkAuth (ControlHeader& header)
+int ControlProtocol::checkAuth (ConnectionPtr con, ControlHeader& header)
 {
   char authLoginHeaderMD5[64];
   char authPasswordHeaderMD5[64];
@@ -164,10 +163,21 @@ int ControlProtocol::checkAuth (ControlHeader& header)
   char *headerPassword;
   Md5 md5;
   /*! Return 0 if we haven't enabled the service. */
-  if (!controlEnabled)
-    return 0;
+  if (! controlEnabled)
+    {
+      con->host->warningsLogWrite (_E ("Control: not enabled"));
+      return 0;
+    }
+
+  if (adminPassword[0] == '\0')
+    {
+      con->host->warningsLogWrite (_E ("Control: empty password not allowed"));
+      return 0;
+    }
+
   headerLogin = header.getAuthLogin ();
   headerPassword = header.getAuthPassword ();
+
   authLoginHeaderMD5[0] = authPasswordHeaderMD5[0] = '\0';
   md5.init ();
   md5.update (headerLogin, (unsigned int) strlen (headerLogin));
@@ -301,7 +311,7 @@ int ControlProtocol::controlConnection (ConnectionPtr a, char *request,
           return 0;
         }
 
-      authorized = checkAuth (header);
+      authorized = checkAuth (a, header);
 
       /*
         If the client is not authorized remove the connection.

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

Summary of changes:
 myserver/binaries/myserver.default.xml             |   64 ++++++++++----------
 .../include/protocol/control/control_protocol.h    |    2 +-
 myserver/src/protocol/control/control_protocol.cpp |   24 +++++--
 myserver/src/server/server.cpp                     |   21 ++++---
 4 files changed, 62 insertions(+), 49 deletions(-)


hooks/post-receive
-- 
GNU MyServer


From MAILER-DAEMON Fri Aug 27 14:54:26 2010
Received: from mailman by lists.gnu.org with archive (Exim 4.43)
	id 1Op44I-0002jD-LD
	for mharc-myserver-commit@gnu.org; Fri, 27 Aug 2010 14:54:26 -0400
Received: from [140.186.70.92] (port=38014 helo=eggs.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.43) id 1Op447-0002fz-D1
	for myserver-commit@gnu.org; Fri, 27 Aug 2010 14:54:25 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69)
	(envelope-from <gscrivano@gnu.org>) id 1Op43s-0003ti-Py
	for myserver-commit@gnu.org; Fri, 27 Aug 2010 14:54:15 -0400
Received: from colonialone.fsf.org ([140.186.70.51]:59772
	helo=internal.in.savannah.gnu.org)
	by eggs.gnu.org with esmtp (Exim 4.69)
	(envelope-from <gscrivano@gnu.org>) id 1Op43s-0003ta-Oa
	for myserver-commit@gnu.org; Fri, 27 Aug 2010 14:54:00 -0400
Received: from [10.1.0.108] (helo=vcs-noshell.in.savannah.gnu.org)
	by internal.in.savannah.gnu.org with esmtp (Exim 4.69)
	(envelope-from <gscrivano@gnu.org>) id 1Op43s-0004rI-EG
	for myserver-commit@gnu.org; Fri, 27 Aug 2010 18:54:00 +0000
Received: from gscrivano by vcs-noshell.in.savannah.gnu.org with local (Exim
	4.69) (envelope-from <gscrivano@savannah.gnu.org>)
	id 1Op43r-0002xa-U9
	for myserver-commit@gnu.org; Fri, 27 Aug 2010 18:54:00 +0000
To: myserver-commit@gnu.org
X-Git-Refname: refs/heads/master
X-Git-Reftype: branch
X-Git-Oldrev: 636bc002bb4e20137a86b94292e8d6f3b2952554
X-Git-Newrev: 899954999f452fa3f5ceeed1fa5989452354f18d
Message-Id: <E1Op43r-0002xa-U9@vcs-noshell.in.savannah.gnu.org>
From: Giuseppe Scrivano <gscrivano@gnu.org>
Date: Fri, 27 Aug 2010 18:54:00 +0000
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2)
Subject: [myserver-commit] [SCM] GNU MyServer branch, master,
	updated. v0.9.2-378-g8999549
X-BeenThere: myserver-commit@gnu.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: myserver-commit.gnu.org
List-Unsubscribe: <http://lists.gnu.org/mailman/listinfo/myserver-commit>,
	<mailto:myserver-commit-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/myserver-commit>
List-Post: <mailto:myserver-commit@gnu.org>
List-Help: <mailto:myserver-commit-request@gnu.org?subject=help>
List-Subscribe: <http://lists.gnu.org/mailman/listinfo/myserver-commit>,
	<mailto:myserver-commit-request@gnu.org?subject=subscribe>
X-List-Received-Date: Fri, 27 Aug 2010 18:54:25 -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  899954999f452fa3f5ceeed1fa5989452354f18d (commit)
       via  187988d3a2ec21470ad5fccb27a4110117723dbe (commit)
      from  636bc002bb4e20137a86b94292e8d6f3b2952554 (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 899954999f452fa3f5ceeed1fa5989452354f18d
Author: Giuseppe Scrivano <gscrivano@gnu.org>
Date:   Fri Aug 27 20:50:36 2010 +0200

    install: ensure /lib/myserver/plugins is created

diff --git a/myserver/binaries/plugins/Makefile.am b/myserver/binaries/plugins/Makefile.am
index 8a42123..4265fda 100644
--- a/myserver/binaries/plugins/Makefile.am
+++ b/myserver/binaries/plugins/Makefile.am
@@ -14,4 +14,5 @@
 #
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
-all:
+install:
+	$(INSTALL) -d '$(DESTDIR)$(prefix)/lib/myserver/plugins'



commit 187988d3a2ec21470ad5fccb27a4110117723dbe
Author: Giuseppe Scrivano <gscrivano@gnu.org>
Date:   Fri Aug 27 20:45:39 2010 +0200

    Http: start resolution of PATH_INFO from the end of the virtual host path.

diff --git a/myserver/src/protocol/http/http.cpp b/myserver/src/protocol/http/http.cpp
index 43902ad..4039deb 100644
--- a/myserver/src/protocol/http/http.cpp
+++ b/myserver/src/protocol/http/http.cpp
@@ -455,7 +455,7 @@ int Http::preprocessHttpRequest (string &resource, bool yetmapped,
         : td->connection->host->getDocumentRoot ().length ();
 
       td->pathInfo = "";
-      for (size_t i = 0;;)
+      for (size_t i = resOffset;;)
         {
           /*
             http://host/path/to/file/file.txt/PATH_INFO_VALUE?QUERY_INFO_VALUE

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

Summary of changes:
 myserver/binaries/plugins/Makefile.am |    3 ++-
 myserver/src/protocol/http/http.cpp   |    2 +-
 2 files changed, 3 insertions(+), 2 deletions(-)


hooks/post-receive
-- 
GNU MyServer


From MAILER-DAEMON Sun Aug 29 07:56:14 2010
Received: from mailman by lists.gnu.org with archive (Exim 4.43)
	id 1OpgUg-00013v-2S
	for mharc-myserver-commit@gnu.org; Sun, 29 Aug 2010 07:56:14 -0400
Received: from [140.186.70.92] (port=47004 helo=eggs.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.43) id 1OpgUc-00013i-Ub
	for myserver-commit@gnu.org; Sun, 29 Aug 2010 07:56:12 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69)
	(envelope-from <gscrivano@gnu.org>) id 1OpgUb-0003lc-HM
	for myserver-commit@gnu.org; Sun, 29 Aug 2010 07:56:10 -0400
Received: from colonialone.fsf.org ([140.186.70.51]:49324
	helo=internal.in.savannah.gnu.org)
	by eggs.gnu.org with esmtp (Exim 4.69)
	(envelope-from <gscrivano@gnu.org>) id 1OpgUb-0003lX-Fw
	for myserver-commit@gnu.org; Sun, 29 Aug 2010 07:56:09 -0400
Received: from [10.1.0.108] (helo=vcs-noshell.in.savannah.gnu.org)
	by internal.in.savannah.gnu.org with esmtp (Exim 4.69)
	(envelope-from <gscrivano@gnu.org>) id 1OpgUa-00016i-Qu
	for myserver-commit@gnu.org; Sun, 29 Aug 2010 11:56:08 +0000
Received: from gscrivano by vcs-noshell.in.savannah.gnu.org with local (Exim
	4.69) (envelope-from <gscrivano@savannah.gnu.org>)
	id 1OpgUW-0002W3-7t
	for myserver-commit@gnu.org; Sun, 29 Aug 2010 11:56:08 +0000
To: myserver-commit@gnu.org
X-Git-Refname: refs/heads/master
X-Git-Reftype: branch
X-Git-Oldrev: 899954999f452fa3f5ceeed1fa5989452354f18d
X-Git-Newrev: 5c729562268bb36eb9ccd1a11d14e91f7e0ecf8f
Message-Id: <E1OpgUW-0002W3-7t@vcs-noshell.in.savannah.gnu.org>
From: Giuseppe Scrivano <gscrivano@gnu.org>
Date: Sun, 29 Aug 2010 11:56:08 +0000
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2)
Subject: [myserver-commit] [SCM] GNU MyServer branch, master,
	updated. v0.9.2-381-g5c72956
X-BeenThere: myserver-commit@gnu.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: myserver-commit.gnu.org
List-Unsubscribe: <http://lists.gnu.org/mailman/listinfo/myserver-commit>,
	<mailto:myserver-commit-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/myserver-commit>
List-Post: <mailto:myserver-commit@gnu.org>
List-Help: <mailto:myserver-commit-request@gnu.org?subject=help>
List-Subscribe: <http://lists.gnu.org/mailman/listinfo/myserver-commit>,
	<mailto:myserver-commit-request@gnu.org?subject=subscribe>
X-List-Received-Date: Sun, 29 Aug 2010 11:56: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  5c729562268bb36eb9ccd1a11d14e91f7e0ecf8f (commit)
       via  59c6a312660cdde1d872f63d914bfca377c52b35 (commit)
       via  260c262bfb03250aa6bc426736888e09a11a060f (commit)
      from  899954999f452fa3f5ceeed1fa5989452354f18d (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 5c729562268bb36eb9ccd1a11d14e91f7e0ecf8f
Author: Giuseppe Scrivano <gscrivano@gnu.org>
Date:   Sun Aug 29 13:46:26 2010 +0200

    Http: use HttpHeaders::buildDefaultHTTPResponseHeader only in one place.

diff --git a/myserver/src/protocol/http/http.cpp b/myserver/src/protocol/http/http.cpp
index 4039deb..18e1df7 100644
--- a/myserver/src/protocol/http/http.cpp
+++ b/myserver/src/protocol/http/http.cpp
@@ -858,6 +858,8 @@ int Http::controlConnection (ConnectionPtr a, char*, char*, u_long, u_long,
       HttpHeaders::resetHTTPRequest (&td->request);
       HttpHeaders::resetHTTPResponse (&td->response);
 
+      HttpHeaders::buildDefaultHTTPResponseHeader (&(td->response));
+
       /* Reset the HTTP status once per request. */
       td->response.httpStatus = 200;
 
@@ -1324,8 +1326,6 @@ int Http::raiseHTTPError (int ID)
 
       td->lastError = ID;
 
-      HttpHeaders::buildDefaultHTTPResponseHeader (&(td->response));
-
       if (connection && !stringcmpi (connection->value.c_str (), "keep-alive"))
         td->response.setValue ("connection", "keep-alive");
 
diff --git a/myserver/src/protocol/http/webdav/webdav.cpp b/myserver/src/protocol/http/webdav/webdav.cpp
index 55b9593..0c425ba 100644
--- a/myserver/src/protocol/http/webdav/webdav.cpp
+++ b/myserver/src/protocol/http/webdav/webdav.cpp
@@ -301,7 +301,6 @@ int WebDAV::propfind (HttpThreadContext* td)
 
       ff->chain (&chain, filters, td->connection->socket, &nbw, 1);
 
-      HttpHeaders::buildDefaultHTTPResponseHeader (&(td->response));
       HttpDataHandler::checkDataChunks (td, &keepalive, &useChunks);
       td->response.httpStatus = 207;
       if (keepalive)
@@ -623,7 +622,6 @@ int WebDAV::lock (HttpThreadContext* td)
 
       ff->chain (&chain, filters, td->connection->socket, &nbw, 1);
 
-      HttpHeaders::buildDefaultHTTPResponseHeader (&(td->response));
       HttpDataHandler::checkDataChunks (td, &keepalive, &useChunks);
       td->response.httpStatus = 201;
 



commit 59c6a312660cdde1d872f63d914bfca377c52b35
Author: Giuseppe Scrivano <gscrivano@gnu.org>
Date:   Sun Aug 29 11:22:52 2010 +0200

    Proxy: check if the protocol is supported using `stringcmpi'.

diff --git a/myserver/src/http_handler/proxy/proxy.cpp b/myserver/src/http_handler/proxy/proxy.cpp
index c7672b7..c4f9cdd 100644
--- a/myserver/src/http_handler/proxy/proxy.cpp
+++ b/myserver/src/http_handler/proxy/proxy.cpp
@@ -18,6 +18,8 @@
 #include "myserver.h"
 #include <include/http_handler/proxy/proxy.h>
 
+#include <include/base/string/stringutils.h>
+
 #include <include/protocol/http/http_thread_context.h>
 #include <include/protocol/http/http.h>
 #include <include/protocol/url.h>
@@ -58,8 +60,7 @@ int Proxy::send (HttpThreadContext *td, const char* scriptpath,
       req.setValue (e->name.c_str (), e->value.c_str ());
     }
 
-  if (destUrl.getProtocol ().compare ("http")
-      && destUrl.getProtocol ().compare ("HTTP"))
+  if (stringcmpi (destUrl.getProtocol (), "http"))
     {
       td->connection->host->warningsLogWrite
         ("Proxy: %s is not a supported protocol",



commit 260c262bfb03250aa6bc426736888e09a11a060f
Author: Giuseppe Scrivano <gscrivano@gnu.org>
Date:   Fri Aug 27 21:38:49 2010 +0200

    Use `unsigned long long' to represent off_t.

diff --git a/myserver/src/protocol/ftp/ftp.cpp b/myserver/src/protocol/ftp/ftp.cpp
index e6b4863..5752de0 100644
--- a/myserver/src/protocol/ftp/ftp.cpp
+++ b/myserver/src/protocol/ftp/ftp.cpp
@@ -2531,7 +2531,7 @@ void Ftp::size (const std::string & sPath)
     }
 
   char size[12];
-  sprintf (size, "%lu", static_cast <size_t> (f.getFileSize ()));
+  sprintf (size, "%llu", static_cast <unsigned long long> (f.getFileSize ()));
   f.close ();
 
   ftpReply (213, size);
diff --git a/myserver/src/protocol/http/http_headers.cpp b/myserver/src/protocol/http/http_headers.cpp
index 890df6d..4b27bff 100644
--- a/myserver/src/protocol/http/http_headers.cpp
+++ b/myserver/src/protocol/http/http_headers.cpp
@@ -164,14 +164,16 @@ u_long HttpHeaders::buildHTTPRequestHeader (char * str,
 
       if (request->rangeByteBegin < 0)
         {
-          sprintf (buffer, "%lu", request->rangeByteBegin);
+          sprintf (buffer, "%llu",
+                   static_cast<unsigned long long> (request->rangeByteBegin));
           pos += myserver_strlcpy (pos, buffer, MAX - (long)(pos - str));
         }
 
       pos += myserver_strlcpy (pos, "-", MAX - (long)(pos - str));
       if (request->rangeByteEnd < 0)
         {
-          sprintf (buffer, "%lu", request->rangeByteEnd);
+          sprintf (buffer, "%llu",
+                   static_cast<unsigned long long> (request->rangeByteEnd));
           pos += myserver_strlcpy (pos, buffer, MAX - (long)(pos - str));
         }
       pos += myserver_strlcpy (pos, "\r\n", MAX - (long)(pos - str));

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

Summary of changes:
 myserver/src/http_handler/proxy/proxy.cpp    |    5 +++--
 myserver/src/protocol/ftp/ftp.cpp            |    2 +-
 myserver/src/protocol/http/http.cpp          |    4 ++--
 myserver/src/protocol/http/http_headers.cpp  |    6 ++++--
 myserver/src/protocol/http/webdav/webdav.cpp |    2 --
 5 files changed, 10 insertions(+), 9 deletions(-)


hooks/post-receive
-- 
GNU MyServer


From MAILER-DAEMON Sun Aug 29 09:33:50 2010
Received: from mailman by lists.gnu.org with archive (Exim 4.43)
	id 1Opi18-00067N-Nk
	for mharc-myserver-commit@gnu.org; Sun, 29 Aug 2010 09:33:50 -0400
Received: from [140.186.70.92] (port=55023 helo=eggs.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.43) id 1Opi0F-00062L-C1
	for myserver-commit@gnu.org; Sun, 29 Aug 2010 09:33:49 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69)
	(envelope-from <gscrivano@gnu.org>) id 1Opi0C-0005op-2V
	for myserver-commit@gnu.org; Sun, 29 Aug 2010 09:32:53 -0400
Received: from colonialone.fsf.org ([140.186.70.51]:48604
	helo=internal.in.savannah.gnu.org)
	by eggs.gnu.org with esmtp (Exim 4.69)
	(envelope-from <gscrivano@gnu.org>) id 1Opi0B-0005oj-UH
	for myserver-commit@gnu.org; Sun, 29 Aug 2010 09:32:52 -0400
Received: from [10.1.0.108] (helo=vcs-noshell.in.savannah.gnu.org)
	by internal.in.savannah.gnu.org with esmtp (Exim 4.69)
	(envelope-from <gscrivano@gnu.org>) id 1Opi0B-0002JM-Q9
	for myserver-commit@gnu.org; Sun, 29 Aug 2010 13:32:51 +0000
Received: from gscrivano by vcs-noshell.in.savannah.gnu.org with local (Exim
	4.69) (envelope-from <gscrivano@savannah.gnu.org>)
	id 1Opi07-0000HB-1Q
	for myserver-commit@gnu.org; Sun, 29 Aug 2010 13:32:51 +0000
To: myserver-commit@gnu.org
X-Git-Refname: refs/heads/master
X-Git-Reftype: branch
X-Git-Oldrev: 5c729562268bb36eb9ccd1a11d14e91f7e0ecf8f
X-Git-Newrev: a31b099e0be9149abedea8b28e7f8ef9891c93a6
Message-Id: <E1Opi07-0000HB-1Q@vcs-noshell.in.savannah.gnu.org>
From: Giuseppe Scrivano <gscrivano@gnu.org>
Date: Sun, 29 Aug 2010 13:32:50 +0000
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2)
Subject: [myserver-commit] [SCM] GNU MyServer branch, master,
	updated. v0.9.2-382-ga31b099
X-BeenThere: myserver-commit@gnu.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: myserver-commit.gnu.org
List-Unsubscribe: <http://lists.gnu.org/mailman/listinfo/myserver-commit>,
	<mailto:myserver-commit-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/myserver-commit>
List-Post: <mailto:myserver-commit@gnu.org>
List-Help: <mailto:myserver-commit-request@gnu.org?subject=help>
List-Subscribe: <http://lists.gnu.org/mailman/listinfo/myserver-commit>,
	<mailto:myserver-commit-request@gnu.org?subject=subscribe>
X-List-Received-Date: Sun, 29 Aug 2010 13:33:49 -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  a31b099e0be9149abedea8b28e7f8ef9891c93a6 (commit)
      from  5c729562268bb36eb9ccd1a11d14e91f7e0ecf8f (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 a31b099e0be9149abedea8b28e7f8ef9891c93a6
Author: Giuseppe Scrivano <gscrivano@gnu.org>
Date:   Sun Aug 29 15:32:37 2010 +0200

    Possibility to change response header values from security files.

diff --git a/myserver/NEWS b/myserver/NEWS
index d078ad5..08f1834 100644
--- a/myserver/NEWS
+++ b/myserver/NEWS
@@ -24,6 +24,9 @@ GNU myserver NEWS                                    -*- outline -*-
 
    Web-based Distributed Authoring and Versioning (WebDAV) support.
 
+   Possibility to change response header values from the local configuration
+   files.
+
 * Noteworthy changes in release 0.9.2
 
 ** Bug fixes
@@ -33,8 +36,7 @@ GNU myserver NEWS                                    -*- outline -*-
   Sockets operations under Windows are now done using gnulib.
 
   Fix the X-Sendfile directive when using keep-alive connections.
-
-
+
 * Noteworthy changes in release 0.9.1
 
 ** New features
diff --git a/myserver/documentation/security.texi b/myserver/documentation/security.texi
index f9235f7..c433d3e 100644
--- a/myserver/documentation/security.texi
+++ b/myserver/documentation/security.texi
@@ -255,3 +255,22 @@ there is need to do like:
 Pay attention, if at the same time you want to change the permissions
 then you will need to specify them explicitly by the @code{PERMISSION}
 command.
+
+@subsubsection SET_HEADER
+The @code{SET_HEADER} directive specifies a value to be used for the
+response header, for protocols supporting it.
+
+This directive, for HTTP/HTTPS, overwrites default values for the
+response header, anything specified at this stage of the pipeline can be
+modified later by web applications, such as CGIs.
+
+For example, it is possible to specify a directive for caching using
+something like:
+
+@example
+<SET_HEADER name="Cache-Control" value="no-store" />
+@end example
+
+The server doesn't check how these values are changed and if they can
+cause problems in the protocol flow, it is your responsibility to use
+safe values.
diff --git a/myserver/include/conf/security/security_token.h b/myserver/include/conf/security/security_token.h
index 1665a93..97e901b 100644
--- a/myserver/include/conf/security/security_token.h
+++ b/myserver/include/conf/security/security_token.h
@@ -46,6 +46,12 @@ enum SECURITY_RING
     MYSERVER_SERVER_CONF = (1 << 4),
   };
 
+class SecurityHeaderData
+{
+public:
+  virtual string* setValue (const char *name, const char *in) = 0;
+};
+
 class SecurityToken
 {
 public:
@@ -214,7 +220,20 @@ public:
     mimeRecord = mr;
   }
 
+  void setResponseHeaderData (SecurityHeaderData *header)
+  {
+    this->responseHeader = header;
+  }
+
+  SecurityHeaderData *getResponseHeaderData ()
+  {
+    return responseHeader;
+  }
+
 private:
+  /*! Protocol specific response header data.  */
+  SecurityHeaderData *responseHeader;
+
   /*! User to check for.  */
   string user;
 
diff --git a/myserver/include/conf/security/xml_validator.h b/myserver/include/conf/security/xml_validator.h
index c95c3cd..0ccae7e 100644
--- a/myserver/include/conf/security/xml_validator.h
+++ b/myserver/include/conf/security/xml_validator.h
@@ -60,6 +60,9 @@ private:
                  SecurityToken *st,
                  HashMap<string, SecurityDomain*> *hashedDomains);
 
+  void doSetHeader (xmlNodePtr node,
+                    SecurityToken *st);
+
   void doPermission (xmlNodePtr node,
                      SecurityToken *st,
                      HashMap<string, SecurityDomain*> *hashedDomains);
diff --git a/myserver/include/protocol/http/http_header.h b/myserver/include/protocol/http/http_header.h
index f004b8a..3aeb745 100644
--- a/myserver/include/protocol/http/http_header.h
+++ b/myserver/include/protocol/http/http_header.h
@@ -20,14 +20,18 @@
 # define HTTP_HEADER_H
 
 # include "myserver.h"
-
 # include <string>
+
+/* Include for SecurityHeaderData.  */
+# include <include/conf/security/security_token.h>
+
 # include <include/base/hash_map/hash_map.h>
 
 using namespace std;
 
-struct HttpHeader
+class HttpHeader : public SecurityHeaderData
 {
+public:
   struct Entry
   {
     string name;
diff --git a/myserver/src/conf/security/security_token.cpp b/myserver/src/conf/security/security_token.cpp
index a2a8c83..2d4afbb 100644
--- a/myserver/src/conf/security/security_token.cpp
+++ b/myserver/src/conf/security/security_token.cpp
@@ -53,6 +53,7 @@ void SecurityToken::reset ()
   for (;it != values.end (); it++)
     delete (*it);
   values.clear ();
+  responseHeader = NULL;
 }
 
 /*!
diff --git a/myserver/src/conf/security/xml_validator.cpp b/myserver/src/conf/security/xml_validator.cpp
index e64f03c..1a17f97 100644
--- a/myserver/src/conf/security/xml_validator.cpp
+++ b/myserver/src/conf/security/xml_validator.cpp
@@ -254,31 +254,15 @@ XmlValidator::computeXmlNode (xmlNodePtr node,
   if (!node)
     return 0;
 
-  xmlNodePtr cur = node->children;
-  for (;;)
+  for (xmlNodePtr cur = node->children; cur; cur = cur->next)
     {
-      if (cur->next == NULL)
-        {
-          cur = cur->parent;
-
-          /* The root is reached.  */
-          if (cur == node)
-            return 1;
-
-          /* This should never happen.  */
-          if (cur == NULL)
-            return 0;
-        }
-      else
-        cur = cur->next;
-
       if (cur->type != XML_ELEMENT_NODE)
         continue;
 
       if (!xmlStrcmp (cur->name, (const xmlChar *) "CONDITION"))
         {
           if (doCondition (cur, hashedDomains))
-            cur = cur->children;
+            computeXmlNode (cur, st, cmd, hashedDomains);
         }
       else if (!xmlStrcmp (cur->name, (const xmlChar *) "RETURN"))
         {
@@ -287,6 +271,8 @@ XmlValidator::computeXmlNode (xmlNodePtr node,
         }
       else if (!xmlStrcmp (cur->name, (const xmlChar *) "DEFINE"))
         doDefine (cur, st, hashedDomains);
+      else if (!xmlStrcmp (cur->name, (const xmlChar *) "SET_HEADER"))
+        doSetHeader (cur, st);
       else if (!xmlStrcmp (cur->name, (const xmlChar *) "PERMISSION"))
         doPermission (cur, st, hashedDomains);
     }
@@ -425,3 +411,35 @@ void XmlValidator::doReturn (xmlNodePtr node, int *cmd,
   else
     *cmd = 0;
 }
+
+/*!
+  Handle a SET_HEADER.
+ */
+void XmlValidator::doSetHeader (xmlNodePtr node, SecurityToken *st)
+{
+  xmlAttr *attrs = node->properties;
+  const char *name = NULL;
+  const char *value = NULL;
+  SecurityHeaderData *headerData = st->getResponseHeaderData ();
+
+  if (headerData == NULL)
+    return;
+
+  while (attrs)
+    {
+      if (!xmlStrcmp (attrs->name, (const xmlChar *) "name") &&
+          attrs->children && attrs->children->content)
+        name = (const char *) attrs->children->content;
+
+      if (!xmlStrcmp (attrs->name, (const xmlChar *) "value") &&
+          attrs->children && attrs->children->content)
+        value = (const char *) attrs->children->content;
+
+      attrs = attrs->next;
+    }
+
+  if (name == NULL || value == NULL)
+    return;
+
+  headerData->setValue (name, value);
+}
diff --git a/myserver/src/protocol/http/http.cpp b/myserver/src/protocol/http/http.cpp
index 18e1df7..c2f6838 100644
--- a/myserver/src/protocol/http/http.cpp
+++ b/myserver/src/protocol/http/http.cpp
@@ -860,6 +860,8 @@ int Http::controlConnection (ConnectionPtr a, char*, char*, u_long, u_long,
 
       HttpHeaders::buildDefaultHTTPResponseHeader (&(td->response));
 
+      td->securityToken.setResponseHeaderData (&td->response);
+
       /* Reset the HTTP status once per request. */
       td->response.httpStatus = 200;
 

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

Summary of changes:
 myserver/NEWS                                   |    6 ++-
 myserver/documentation/security.texi            |   19 ++++++++
 myserver/include/conf/security/security_token.h |   19 ++++++++
 myserver/include/conf/security/xml_validator.h  |    3 +
 myserver/include/protocol/http/http_header.h    |    8 +++-
 myserver/src/conf/security/security_token.cpp   |    1 +
 myserver/src/conf/security/xml_validator.cpp    |   54 +++++++++++++++--------
 myserver/src/protocol/http/http.cpp             |    2 +
 8 files changed, 90 insertions(+), 22 deletions(-)


hooks/post-receive
-- 
GNU MyServer


From MAILER-DAEMON Sun Aug 29 20:17:37 2010
Received: from mailman by lists.gnu.org with archive (Exim 4.43)
	id 1Ops48-0008BF-SD
	for mharc-myserver-commit@gnu.org; Sun, 29 Aug 2010 20:17:36 -0400
Received: from [140.186.70.92] (port=53942 helo=eggs.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.43) id 1Ops45-00089H-Ih
	for myserver-commit@gnu.org; Sun, 29 Aug 2010 20:17:34 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69)
	(envelope-from <gscrivano@gnu.org>) id 1Ops44-0000zw-Di
	for myserver-commit@gnu.org; Sun, 29 Aug 2010 20:17:33 -0400
Received: from colonialone.fsf.org ([140.186.70.51]:37952
	helo=internal.in.savannah.gnu.org)
	by eggs.gnu.org with esmtp (Exim 4.69)
	(envelope-from <gscrivano@gnu.org>) id 1Ops44-0000zr-6U
	for myserver-commit@gnu.org; Sun, 29 Aug 2010 20:17:32 -0400
Received: from [10.1.0.108] (helo=vcs-noshell.in.savannah.gnu.org)
	by internal.in.savannah.gnu.org with esmtp (Exim 4.69)
	(envelope-from <gscrivano@gnu.org>) id 1Ops44-0001oq-0J
	for myserver-commit@gnu.org; Mon, 30 Aug 2010 00:17:32 +0000
Received: from gscrivano by vcs-noshell.in.savannah.gnu.org with local (Exim
	4.69) (envelope-from <gscrivano@savannah.gnu.org>)
	id 1Ops3y-0006ZU-KR
	for myserver-commit@gnu.org; Mon, 30 Aug 2010 00:17:31 +0000
To: myserver-commit@gnu.org
X-Git-Refname: refs/heads/master
X-Git-Reftype: branch
X-Git-Oldrev: a31b099e0be9149abedea8b28e7f8ef9891c93a6
X-Git-Newrev: a2f8be3feb4375098298d9d00dded7fa2895ba29
Message-Id: <E1Ops3y-0006ZU-KR@vcs-noshell.in.savannah.gnu.org>
From: Giuseppe Scrivano <gscrivano@gnu.org>
Date: Mon, 30 Aug 2010 00:17:31 +0000
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2)
Subject: [myserver-commit] [SCM] GNU MyServer branch, master,
	updated. v0.9.2-387-ga2f8be3
X-BeenThere: myserver-commit@gnu.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: myserver-commit.gnu.org
List-Unsubscribe: <http://lists.gnu.org/mailman/listinfo/myserver-commit>,
	<mailto:myserver-commit-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/myserver-commit>
List-Post: <mailto:myserver-commit@gnu.org>
List-Help: <mailto:myserver-commit-request@gnu.org?subject=help>
List-Subscribe: <http://lists.gnu.org/mailman/listinfo/myserver-commit>,
	<mailto:myserver-commit-request@gnu.org?subject=subscribe>
X-List-Received-Date: Mon, 30 Aug 2010 00:17:35 -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  a2f8be3feb4375098298d9d00dded7fa2895ba29 (commit)
       via  efe029b8a534ef0920180157a731e9ffc8e8da9b (commit)
       via  bf9d13b0649df69d24f5c7048064cb6caf361268 (commit)
       via  dbd89a9633fa114587b535c5e614a87d4880d44e (commit)
       via  b8548618700c90cf1868466d694db77b622e096c (commit)
      from  a31b099e0be9149abedea8b28e7f8ef9891c93a6 (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 a2f8be3feb4375098298d9d00dded7fa2895ba29
Author: Giuseppe Scrivano <gscrivano@gnu.org>
Date:   Mon Aug 30 02:07:30 2010 +0200

    Specify O_BINARY as flag to `open' when it is defined.

diff --git a/myserver/src/base/file/file.cpp b/myserver/src/base/file/file.cpp
index 1239b4f..4b4f2b0 100644
--- a/myserver/src/base/file/file.cpp
+++ b/myserver/src/base/file/file.cpp
@@ -150,6 +150,9 @@ int File::openFile (const char* nfilename, u_long opt, mode_t mask)
   if (opt & File::APPEND)
     flags |= O_APPEND;
 
+#ifdef O_BINARY
+  flags |= O_BINARY;
+#endif
 
   if (opt & (File::TEMPORARY_DELAYED | File::TEMPORARY))
     {



commit efe029b8a534ef0920180157a731e9ffc8e8da9b
Author: Giuseppe Scrivano <gscrivano@gnu.org>
Date:   Mon Aug 30 01:53:27 2010 +0200

    ListenThread: make clearer some error messages.

diff --git a/myserver/src/connections_scheduler/listen_threads.cpp b/myserver/src/connections_scheduler/listen_threads.cpp
index b2cbd2a..b8a8d9b 100644
--- a/myserver/src/connections_scheduler/listen_threads.cpp
+++ b/myserver/src/connections_scheduler/listen_threads.cpp
@@ -102,7 +102,7 @@ int ListenThreads::createServerAndListener (u_short port)
   catch (exception & e)
     {
       server->log (MYSERVER_LOG_MSG_ERROR,
-                   _E ("Error while creating the server socket"), &e);
+                   _E ("Error while creating the server socket : %e"), &e);
       delete serverSocketIPv4;
       serverSocketIPv4 = NULL;
     }
@@ -133,7 +133,7 @@ int ListenThreads::createServerAndListener (u_short port)
   catch (exception & e)
     {
       server->log (MYSERVER_LOG_MSG_ERROR,
-                   _("Error while creating the server socket"));
+                   _("Error while creating the IPv6 server socket : %e"), &e);
       delete serverSocketIPv6;
       serverSocketIPv6 = NULL;
     }



commit bf9d13b0649df69d24f5c7048064cb6caf361268
Author: Giuseppe Scrivano <gscrivano@gnu.org>
Date:   Mon Aug 30 01:42:14 2010 +0200

    Fix compiler warnings

diff --git a/myserver/tests/test_mutex.cpp b/myserver/tests/test_mutex.cpp
index 8a543db..2df78a9 100644
--- a/myserver/tests/test_mutex.cpp
+++ b/myserver/tests/test_mutex.cpp
@@ -49,7 +49,7 @@ static DEFINE_THREAD (test_mutex_incrementer, pParam)
     arg->mutex->unlock ();
   }
 
-  return NULL;
+  return 0;
 }
 
 
diff --git a/myserver/tests/test_thread.cpp b/myserver/tests/test_thread.cpp
index 04e6b48..29adb50 100644
--- a/myserver/tests/test_thread.cpp
+++ b/myserver/tests/test_thread.cpp
@@ -34,7 +34,7 @@ static DEFINE_THREAD (test_thread,pParam)
 
   *arg *= *arg;
 
-  return NULL;
+  return 0;
 }
 
 static DEFINE_THREAD (test_terminate_thread, pParam)
@@ -48,7 +48,7 @@ static DEFINE_THREAD (test_terminate_thread, pParam)
   /* Should never be here.  */
   *arg = 1;
 
-  return NULL;
+  return 0;
 }
 
 class TestThread : public CppUnit::TestFixture



commit dbd89a9633fa114587b535c5e614a87d4880d44e
Author: Giuseppe Scrivano <gscrivano@gnu.org>
Date:   Mon Aug 30 01:03:55 2010 +0200

    Do not protect "localedir.h"

diff --git a/myserver/src/myserver.cpp b/myserver/src/myserver.cpp
index 698b2c1..2390b95 100644
--- a/myserver/src/myserver.cpp
+++ b/myserver/src/myserver.cpp
@@ -37,11 +37,8 @@
 # include <signal.h>
 #endif
 
-
-#ifdef HAVE_GETTEXT
-# include "localedir.h"
-#endif
-
+#include <libintl.h>
+#include "localedir.h"
 
 enum
 {



commit b8548618700c90cf1868466d694db77b622e096c
Author: Giuseppe Scrivano <gscrivano@gnu.org>
Date:   Sun Aug 29 21:23:50 2010 +0200

    Under W32, allow both back slash and forward slash in paths.

diff --git a/myserver/src/myserver.cpp b/myserver/src/myserver.cpp
index 249554a..698b2c1 100644
--- a/myserver/src/myserver.cpp
+++ b/myserver/src/myserver.cpp
@@ -353,10 +353,10 @@ static void updateWorkingDirectory (const char *firstArgument)
   string path (firstArgument);
   size_t index;
 
-#ifdef WIN32
-  index = path.find_last_of ('\\');
-#else
   index = path.find_last_of ('/');
+
+#ifdef WIN32
+  index = max (index, path.find_last_of ('\\'));
 #endif
 
   if (index != string::npos)

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

Summary of changes:
 myserver/src/base/file/file.cpp                    |    3 +++
 .../src/connections_scheduler/listen_threads.cpp   |    4 ++--
 myserver/src/myserver.cpp                          |   13 +++++--------
 myserver/tests/test_mutex.cpp                      |    2 +-
 myserver/tests/test_thread.cpp                     |    4 ++--
 5 files changed, 13 insertions(+), 13 deletions(-)


hooks/post-receive
-- 
GNU MyServer


From MAILER-DAEMON Sun Aug 29 20:41:18 2010
Received: from mailman by lists.gnu.org with archive (Exim 4.43)
	id 1OpsR4-00030T-Qz
	for mharc-myserver-commit@gnu.org; Sun, 29 Aug 2010 20:41:18 -0400
Received: from [140.186.70.92] (port=41344 helo=eggs.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.43) id 1OpsR2-00030E-Ji
	for myserver-commit@gnu.org; Sun, 29 Aug 2010 20:41:17 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69)
	(envelope-from <gscrivano@gnu.org>) id 1OpsR1-0003Dn-F6
	for myserver-commit@gnu.org; Sun, 29 Aug 2010 20:41:16 -0400
Received: from colonialone.fsf.org ([140.186.70.51]:47322
	helo=internal.in.savannah.gnu.org)
	by eggs.gnu.org with esmtp (Exim 4.69)
	(envelope-from <gscrivano@gnu.org>) id 1OpsR1-0003Dh-BC
	for myserver-commit@gnu.org; Sun, 29 Aug 2010 20:41:15 -0400
Received: from [10.1.0.108] (helo=vcs-noshell.in.savannah.gnu.org)
	by internal.in.savannah.gnu.org with esmtp (Exim 4.69)
	(envelope-from <gscrivano@gnu.org>) id 1OpsR0-000287-Vf
	for myserver-commit@gnu.org; Mon, 30 Aug 2010 00:41:15 +0000
Received: from gscrivano by vcs-noshell.in.savannah.gnu.org with local (Exim
	4.69) (envelope-from <gscrivano@savannah.gnu.org>)
	id 1OpsR0-0007h8-K4
	for myserver-commit@gnu.org; Mon, 30 Aug 2010 00:41:14 +0000
To: myserver-commit@gnu.org
X-Git-Refname: refs/heads/master
X-Git-Reftype: branch
X-Git-Oldrev: a2f8be3feb4375098298d9d00dded7fa2895ba29
X-Git-Newrev: 99eb202fbb6442f0d8a3cebc1de824b76ec1d8c6
Message-Id: <E1OpsR0-0007h8-K4@vcs-noshell.in.savannah.gnu.org>
From: Giuseppe Scrivano <gscrivano@gnu.org>
Date: Mon, 30 Aug 2010 00:41:14 +0000
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2)
Subject: [myserver-commit] [SCM] GNU MyServer branch, master,
	updated. v0.9.2-388-g99eb202
X-BeenThere: myserver-commit@gnu.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: myserver-commit.gnu.org
List-Unsubscribe: <http://lists.gnu.org/mailman/listinfo/myserver-commit>,
	<mailto:myserver-commit-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/myserver-commit>
List-Post: <mailto:myserver-commit@gnu.org>
List-Help: <mailto:myserver-commit-request@gnu.org?subject=help>
List-Subscribe: <http://lists.gnu.org/mailman/listinfo/myserver-commit>,
	<mailto:myserver-commit-request@gnu.org?subject=subscribe>
X-List-Received-Date: Mon, 30 Aug 2010 00:41:17 -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  99eb202fbb6442f0d8a3cebc1de824b76ec1d8c6 (commit)
      from  a2f8be3feb4375098298d9d00dded7fa2895ba29 (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 99eb202fbb6442f0d8a3cebc1de824b76ec1d8c6
Author: Giuseppe Scrivano <gscrivano@gnu.org>
Date:   Mon Aug 30 02:33:47 2010 +0200

    Fix some possible memory leaks.

diff --git a/myserver/src/base/files_cache/cached_file_factory.cpp b/myserver/src/base/files_cache/cached_file_factory.cpp
index 62bc658..e59dc0f 100644
--- a/myserver/src/base/files_cache/cached_file_factory.cpp
+++ b/myserver/src/base/files_cache/cached_file_factory.cpp
@@ -180,11 +180,15 @@ File* CachedFileFactory::open (const char* filename, int flags)
 
               File *file = new File ();
               flags = flags & File::NO_FOLLOW_SYMLINK;
-              if (file->openFile (filename, File::OPEN_IF_EXISTS | flags
-                                  | File::READ))
+              try
+                {
+                  file->openFile (filename, File::OPEN_IF_EXISTS | flags
+                                  | File::READ);
+                }
+              catch (...)
                 {
                   delete file;
-                  return NULL;
+                  throw;
                 }
               return file;
             }
@@ -195,16 +199,20 @@ File* CachedFileFactory::open (const char* filename, int flags)
           u_long fileSize;
           File *file = new File ();
           flags = flags & File::NO_FOLLOW_SYMLINK;
-          if (file->openFile (filename, File::OPEN_IF_EXISTS | flags
-                              | File::READ))
+          try
+            {
+              file->openFile (filename, File::OPEN_IF_EXISTS | flags
+                              | File::READ);
+            }
+          catch (...)
             {
               delete file;
-              return NULL;
+              throw;
             }
 
           fileSize = file->getFileSize ();
           if (minSize && fileSize < minSize
-               || maxSize && fileSize > maxSize
+              || maxSize && fileSize > maxSize
               || fileSize > size - usedSize)
             return file;
           else
diff --git a/myserver/src/conf/mime/xml_mime_handler.cpp b/myserver/src/conf/mime/xml_mime_handler.cpp
index 0921067..009226c 100644
--- a/myserver/src/conf/mime/xml_mime_handler.cpp
+++ b/myserver/src/conf/mime/xml_mime_handler.cpp
@@ -133,6 +133,7 @@ MimeRecord *XmlMimeHandler::readRecord (xmlNodePtr node)
 
                   if (r->compile ((const char*)attrs->children->content, 0))
                     {
+                      delete rc;
                       delete r;
                       return NULL;
                     }
diff --git a/myserver/src/protocol/gopher/gopher_content.cpp b/myserver/src/protocol/gopher/gopher_content.cpp
index ac96e4c..0227035 100644
--- a/myserver/src/protocol/gopher/gopher_content.cpp
+++ b/myserver/src/protocol/gopher/gopher_content.cpp
@@ -348,13 +348,21 @@ void GopherData::toProtocol (Socket *s)
 GopherFileContent::GopherFileContent (string fnome)
 {
   sfile = new File ();
-  sfile->openFile (fnome.c_str (), File::READ);
+  try
+    {
+      sfile->openFile (fnome.c_str (), File::READ);
+    }
+  catch (...)
+    {
+      delete sfile;
+      throw;
+    }
+
   buf.setLength (4096);
 }
 
 GopherFileContent::~GopherFileContent ()
 {
-  sfile->close ();
   delete sfile;
 }
 

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

Summary of changes:
 .../src/base/files_cache/cached_file_factory.cpp   |   22 +++++++++++++------
 myserver/src/conf/mime/xml_mime_handler.cpp        |    1 +
 myserver/src/protocol/gopher/gopher_content.cpp    |   12 +++++++++-
 3 files changed, 26 insertions(+), 9 deletions(-)


hooks/post-receive
-- 
GNU MyServer


From MAILER-DAEMON Mon Aug 30 07:58:07 2010
Received: from mailman by lists.gnu.org with archive (Exim 4.43)
	id 1Oq303-00027I-7j
	for mharc-myserver-commit@gnu.org; Mon, 30 Aug 2010 07:58:07 -0400
Received: from [140.186.70.92] (port=37676 helo=eggs.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.43) id 1Oq2xj-0001jv-9t
	for myserver-commit@gnu.org; Mon, 30 Aug 2010 07:58:06 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69)
	(envelope-from <gscrivano@gnu.org>) id 1Oq2vP-0006N8-HQ
	for myserver-commit@gnu.org; Mon, 30 Aug 2010 07:53:20 -0400
Received: from colonialone.fsf.org ([140.186.70.51]:45001
	helo=internal.in.savannah.gnu.org)
	by eggs.gnu.org with esmtp (Exim 4.69)
	(envelope-from <gscrivano@gnu.org>) id 1Oq2vP-0006My-Fh
	for myserver-commit@gnu.org; Mon, 30 Aug 2010 07:53:19 -0400
Received: from [10.1.0.108] (helo=vcs-noshell.in.savannah.gnu.org)
	by internal.in.savannah.gnu.org with esmtp (Exim 4.69)
	(envelope-from <gscrivano@gnu.org>) id 1Oq2vP-0001zX-3r
	for myserver-commit@gnu.org; Mon, 30 Aug 2010 11:53:19 +0000
Received: from gscrivano by vcs-noshell.in.savannah.gnu.org with local (Exim
	4.69) (envelope-from <gscrivano@savannah.gnu.org>)
	id 1Oq2vJ-0006Aq-OE
	for myserver-commit@gnu.org; Mon, 30 Aug 2010 11:53:19 +0000
To: myserver-commit@gnu.org
X-Git-Refname: refs/heads/master
X-Git-Reftype: branch
X-Git-Oldrev: 99eb202fbb6442f0d8a3cebc1de824b76ec1d8c6
X-Git-Newrev: f9eafc6c5ea79ad6804f16de5b0fcd37cefc6d1d
Message-Id: <E1Oq2vJ-0006Aq-OE@vcs-noshell.in.savannah.gnu.org>
From: Giuseppe Scrivano <gscrivano@gnu.org>
Date: Mon, 30 Aug 2010 11:53:18 +0000
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2)
Subject: [myserver-commit] [SCM] GNU MyServer branch, master,
	updated. v0.9.2-389-gf9eafc6
X-BeenThere: myserver-commit@gnu.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: myserver-commit.gnu.org
List-Unsubscribe: <http://lists.gnu.org/mailman/listinfo/myserver-commit>,
	<mailto:myserver-commit-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/myserver-commit>
List-Post: <mailto:myserver-commit@gnu.org>
List-Help: <mailto:myserver-commit-request@gnu.org?subject=help>
List-Subscribe: <http://lists.gnu.org/mailman/listinfo/myserver-commit>,
	<mailto:myserver-commit-request@gnu.org?subject=subscribe>
X-List-Received-Date: Mon, 30 Aug 2010 11:58:06 -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  f9eafc6c5ea79ad6804f16de5b0fcd37cefc6d1d (commit)
      from  99eb202fbb6442f0d8a3cebc1de824b76ec1d8c6 (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 f9eafc6c5ea79ad6804f16de5b0fcd37cefc6d1d
Author: Giuseppe Scrivano <gscrivano@gnu.org>
Date:   Mon Aug 30 13:47:13 2010 +0200

    SecurityCache: track number of references to any node.

diff --git a/myserver/include/conf/security/security_cache.h b/myserver/include/conf/security/security_cache.h
index 5fe1039..c3bd750 100644
--- a/myserver/include/conf/security/security_cache.h
+++ b/myserver/include/conf/security/security_cache.h
@@ -28,32 +28,48 @@
 # include <include/conf/security/auth_method.h>
 # include <include/conf/security/validator_factory.h>
 # include <include/conf/security/validator.h>
-# include <include/conf/security/xml_validator.h>
 
+# include <list>
 # include <string>
 
 using namespace std;
 
 class SecurityCache
 {
-
 public:
+  struct CacheNode
+  {
+    SecurityCache *cache;
+    CacheNode (SecurityCache *cache) {this->cache = cache; ref = 0;}
+    void addRef (){ref++;}
+    int getRef () {return ref;}
+    void decRef ();
+    XmlParser parser;
+    int ref;
+    string key;
+  };
+
   SecurityCache ();
   ~SecurityCache ();
   void free ();
   void setMaxNodes (int);
   int getMaxNodes ();
 
-  XmlParser* getParser (const string &dir, const string &sys, bool useXpath = true,
-                        const char* secName = ".security.xml", u_long maxSize = 0);
+  SecurityCache::CacheNode* getParser (const string &dir, const string &sys,
+                                       bool useXpath = true,
+                                       const char* secName = ".security.xml",
+                                       u_long maxSize = 0);
   int getSecurityFile (const string &file, const string &sys,
                        string &out, const char* secName = ".security.xml");
   int getErrorFileName (const char *root, int error,
                         const char* sysdirectory, string& out){return 0;}
-private:
+  void mayDrop (CacheNode *cn);
 
+private:
+  Mutex mutex;
   /* Store a list of opened files using a hash dictionary.  */
-  HashMap<string, XmlParser*> dictionary;
+  HashMap<string, CacheNode *> dictionary;
+  list<CacheNode *> toRemove;
   int limit;
 };
 
diff --git a/myserver/include/conf/security/xml_validator.h b/myserver/include/conf/security/xml_validator.h
index 0ccae7e..2fa9c80 100644
--- a/myserver/include/conf/security/xml_validator.h
+++ b/myserver/include/conf/security/xml_validator.h
@@ -22,6 +22,8 @@
 # include "myserver.h"
 # include <include/base/hash_map/hash_map.h>
 
+# include <include/conf/security/security_cache.h>
+
 # include <include/conf/security/security_domain.h>
 # include <include/conf/security/security_manager.h>
 # include <include/server/server.h>
@@ -31,8 +33,6 @@
 
 # include <include/base/crypt/crypt_algo_manager.h>
 
-class SecurityCache;
-
 class XmlValidator : public Validator, public AuthMethod
 {
 public:
@@ -41,14 +41,14 @@ public:
 
   using Validator::getPermissionMask;
 
-  virtual int getPermissionMask (SecurityToken* st);
+  virtual int getPermissionMask (SecurityToken *st);
 
   virtual int
-  getPermissionMaskImpl (SecurityToken* st,
+  getPermissionMaskImpl (SecurityToken *st,
                          HashMap<string, SecurityDomain*> *hashedDomains,
                          AuthMethod* authMethod);
 private:
-  XmlParser* getParser (SecurityToken* st);
+  SecurityCache::CacheNode *getParser (SecurityToken *st);
   bool doCondition (xmlNodePtr node,
                     HashMap<string, SecurityDomain*> *hashedDomains);
 
diff --git a/myserver/src/conf/security/security_cache.cpp b/myserver/src/conf/security/security_cache.cpp
index ea8f15f..d66525c 100644
--- a/myserver/src/conf/security/security_cache.cpp
+++ b/myserver/src/conf/security/security_cache.cpp
@@ -52,12 +52,19 @@ SecurityCache::~SecurityCache ()
 */
 void SecurityCache::free ()
 {
-  HashMap<string, XmlParser*>::Iterator it = dictionary.begin ();
+  HashMap<string, CacheNode *>::Iterator it = dictionary.begin ();
 
   for (;it != dictionary.end (); it++)
     delete (*it);
 
+
   dictionary.clear ();
+
+  list<CacheNode *>::iterator it2;
+  for (it2 = toRemove.begin (); it2 != toRemove.end (); it2++)
+    delete *it2;
+
+  toRemove.clear ();
 }
 
 /*!
@@ -70,13 +77,6 @@ void SecurityCache::setMaxNodes (int newLimit)
   if (newLimit <= 0)
     newLimit = 1;
 
-  /*! Remove all the additional nodes from the dictionary. */
-  while (newLimit < dictionary.size ())
-    {
-      XmlParser* toremove = dictionary.remove (dictionary.begin ());
-      if (toremove)
-        delete toremove;
-    }
   limit = newLimit;
 }
 
@@ -167,26 +167,36 @@ int SecurityCache::getMaxNodes ()
   \param secFileName The security file name.
   \param maxSize The maximum file size allowed for the security file.
 */
-XmlParser* SecurityCache::getParser (const string &dir,
-                                     const string &sys,
-                                     bool useXpath,
-                                     const char* secFileName,
-                                     u_long maxSize)
+SecurityCache::CacheNode *SecurityCache::getParser (const string &dir,
+                                                    const string &sys,
+                                                    bool useXpath,
+                                                    const char* secFileName,
+                                                    u_long maxSize)
 {
   XmlParser* parser;
   string file;
+  CacheNode* node;
 
   if (getSecurityFile (dir, sys, file, secFileName))
     return NULL;
 
-  parser = dictionary.get (file);
+  mutex.lock ();
+  try
+    {
+      node = dictionary.get (file);
+      if (node)
+        node->addRef ();
+    }
+  catch (...)
+    {}
+  mutex.unlock ();
 
   /* If the parser is already present and satisfy XPath then use it.  */
-  if (parser && (!useXpath || parser->isXpathEnabled ()))
+  if (node && (!useXpath || node->parser.isXpathEnabled ()))
     {
       time_t fileModTime;
       fileModTime = FilesUtility::getLastModTime (file.c_str ());
-
+      parser = &(node->parser);
       if ((fileModTime != static_cast<time_t>(-1))  &&
           (parser->getLastModTime () != fileModTime))
         {
@@ -207,36 +217,58 @@ XmlParser* SecurityCache::getParser (const string &dir,
             }
 
           if (parser->open (file.c_str (), useXpath) == -1)
-            {
-              dictionary.remove (file.c_str ());
-              return NULL;
-            }
-
+            return NULL;
         }
     }
   else
     {
       /* Create the parser and add it to the dictionary.  */
-      XmlParser* old;
-      parser = new XmlParser ();
+      CacheNode* old;
+      node = new CacheNode (this);
+      node->key = file;
+      if (node->parser.open (file.c_str (), useXpath) == -1)
+        {
+          delete node;
+          return NULL;
+        }
 
-      if (parser == NULL)
-        return NULL;
+      old = dictionary.put (file, node);
+      if (old)
+        toRemove.push_back (old);
+    }
 
-      if (dictionary.size () >= limit)
+  return node;
+}
+
+void SecurityCache::mayDrop (CacheNode *cn)
+{
+  mutex.lock ();
+  try
+    {
+      list<CacheNode *>::iterator it;
+      for (it = toRemove.begin (); it != toRemove.end (); it++)
         {
-          XmlParser* toremove = dictionary.remove (dictionary.begin ());
-          if (toremove)
-            delete toremove;
+          CacheNode *cn = *it;
+          if (cn->getRef () == 0)
+            {
+              delete cn;
+              toRemove.erase (it);
+            }
         }
 
-      if (parser->open (file.c_str (), useXpath) == -1)
-        return NULL;
-
-      old = dictionary.put (file, parser);
-      if (old)
-        delete old;
+      if (dictionary.size () >= limit)
+        {
+          dictionary.remove (cn->key);
+          toRemove.push_back (cn);
+        }
     }
+  catch (...)
+    {}
+  mutex.unlock ();
+}
 
-  return parser;
+void SecurityCache::CacheNode::decRef ()
+{
+  if (--ref == 0)
+    cache->mayDrop (this);
 }
diff --git a/myserver/src/conf/security/xml_validator.cpp b/myserver/src/conf/security/xml_validator.cpp
index 1a17f97..f6cd99c 100644
--- a/myserver/src/conf/security/xml_validator.cpp
+++ b/myserver/src/conf/security/xml_validator.cpp
@@ -17,7 +17,6 @@
 
 #include "myserver.h"
 
-
 #include <include/conf/security/xml_validator.h>
 #include <include/conf/security/auth_domain.h>
 #include <include/conf/security/security_cache.h>
@@ -62,10 +61,9 @@ SecurityCache* XmlValidator::getCache (SecurityToken *st)
 /*!
   Get the XML parser to use.
 */
-XmlParser* XmlValidator::getParser (SecurityToken* st)
+SecurityCache::CacheNode* XmlValidator::getParser (SecurityToken* st)
 {
   const char *secName;
-
   SecurityCache *cache = getCache (st);
 
   if (!cache)
@@ -85,11 +83,13 @@ XmlParser* XmlValidator::getParser (SecurityToken* st)
 int XmlValidator::getPermissionMask (SecurityToken* st)
 {
   xmlNodePtr root;
-  XmlParser* xmlFile = getParser (st);
+  SecurityCache::CacheNode *node = getParser (st);
 
-  if (!xmlFile)
+  if (! node)
     return 0;
 
+  XmlParser* xmlFile = &node->parser;
+
   for (xmlNodePtr cur = xmlFile->getDoc ()->children; cur; cur = cur->next)
     if (cur->type == XML_ELEMENT_NODE)
       {
@@ -139,9 +139,11 @@ int XmlValidator::getPermissionMask (SecurityToken* st)
           st->setMask (0);
         }
 
+      node->decRef ();
       return st->getMask ();
     }
 
+  node->decRef ();
   return 0;
 }
 
@@ -212,9 +214,14 @@ XmlValidator::getPermissionMaskImpl (SecurityToken* st,
                                HashMap<string, SecurityDomain*> *hashedDomains,
                                      AuthMethod* authMethod)
 {
-  XmlParser* xmlFile = getParser (st);
+  SecurityCache::CacheNode *node = getParser (st);
+
+  if (! node)
+    return 0;
+
+  XmlParser* xmlFile = &node->parser;
 
-  if (!xmlFile || !xmlFile->getDoc ())
+  if (! xmlFile->getDoc ())
     return 0;
 
   for (xmlNodePtr cur = xmlFile->getDoc ()->children; cur; cur = cur->next)
@@ -226,19 +233,27 @@ XmlValidator::getPermissionMaskImpl (SecurityToken* st,
 
         /* By default return ALLOW.  */
         if (cmd == -1)
-          return 1;
+          {
+            node->decRef ();
+            return 1;
+          }
 
         if (cmd == 0)
-          return 0;
+          {
+            node->decRef ();
+            return 0;
+          }
 
         if (cmd == 1)
           {
+            node->decRef ();
             st->setMask (MYSERVER_PERMISSION_ALL);
             return 1;
           }
 
       }
 
+  node->decRef ();
   return 0;
 }
 
diff --git a/myserver/src/http_handler/proxy/proxy.cpp b/myserver/src/http_handler/proxy/proxy.cpp
index c4f9cdd..da8fa56 100644
--- a/myserver/src/http_handler/proxy/proxy.cpp
+++ b/myserver/src/http_handler/proxy/proxy.cpp
@@ -30,6 +30,7 @@
 #include <include/protocol/http/http_data_handler.h>
 #include <include/protocol/http/http_headers.h>
 #include <include/filter/filters_chain.h>
+#include <include/server/server.h>
 
 #include <sstream>
 
diff --git a/myserver/src/protocol/http/webdav/webdav.cpp b/myserver/src/protocol/http/webdav/webdav.cpp
index 0c425ba..5a06373 100644
--- a/myserver/src/protocol/http/webdav/webdav.cpp
+++ b/myserver/src/protocol/http/webdav/webdav.cpp
@@ -20,6 +20,7 @@
 #include <include/protocol/http/http.h>
 #include <include/protocol/http/http_errors.h>
 #include <include/http_handler/http_file/http_file.h>
+#include <include/server/server.h>
 
 #include <fts_.h>
 
diff --git a/myserver/src/server/server.cpp b/myserver/src/server/server.cpp
index e02b3b4..d5d4e50 100644
--- a/myserver/src/server/server.cpp
+++ b/myserver/src/server/server.cpp
@@ -37,6 +37,7 @@
 #include <include/base/crypt/sha1.h>
 
 #include <include/conf/main/xml_main_configuration.h>
+#include <include/conf/security/xml_validator.h>
 
 #include <cstdarg>
 
diff --git a/myserver/tests/test_security_cache.cpp b/myserver/tests/test_security_cache.cpp
index 768ef9d..144c4a9 100644
--- a/myserver/tests/test_security_cache.cpp
+++ b/myserver/tests/test_security_cache.cpp
@@ -81,7 +81,8 @@ public:
   {
     string dir ("foo/bar/not/exist/in/reality");
     string file ("baz");
-    CPPUNIT_ASSERT_EQUAL (secCache->getParser (dir, dir, false), (XmlParser*)NULL);
+    CPPUNIT_ASSERT_EQUAL (secCache->getParser (dir, dir, false),
+                          (SecurityCache::CacheNode *) NULL);
   }
 
 

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

Summary of changes:
 myserver/include/conf/security/security_cache.h |   28 +++++--
 myserver/include/conf/security/xml_validator.h  |   10 +-
 myserver/src/conf/security/security_cache.cpp   |  104 +++++++++++++++--------
 myserver/src/conf/security/xml_validator.cpp    |   33 +++++--
 myserver/src/http_handler/proxy/proxy.cpp       |    1 +
 myserver/src/protocol/http/webdav/webdav.cpp    |    1 +
 myserver/src/server/server.cpp                  |    1 +
 myserver/tests/test_security_cache.cpp          |    3 +-
 8 files changed, 124 insertions(+), 57 deletions(-)


hooks/post-receive
-- 
GNU MyServer


