From MAILER-DAEMON Wed Oct 01 15:43:41 2008
Received: from mailman by lists.gnu.org with archive (Exim 4.43)
	id 1Kl7bo-0005wm-TA
	for mharc-myserver-commit@gnu.org; Wed, 01 Oct 2008 15:43:40 -0400
Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43)
	id 1Kl7bn-0005w5-7A
	for myserver-commit@gnu.org; Wed, 01 Oct 2008 15:43:39 -0400
Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43)
	id 1Kl7bm-0005vY-9b
	for myserver-commit@gnu.org; Wed, 01 Oct 2008 15:43:38 -0400
Received: from [199.232.76.173] (port=46142 helo=monty-python.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.43) id 1Kl7bm-0005vV-51
	for myserver-commit@gnu.org; Wed, 01 Oct 2008 15:43:38 -0400
Received: from savannah.gnu.org ([199.232.41.3]:45938 helo=sv.gnu.org)
	by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32)
	(Exim 4.60) (envelope-from <INVALID.NOREPLY@gnu.org>)
	id 1Kl7bl-0000dr-LP
	for myserver-commit@gnu.org; Wed, 01 Oct 2008 15:43:37 -0400
Received: from cvs.savannah.gnu.org ([199.232.41.69])
	by sv.gnu.org with esmtp (Exim 4.63)
	(envelope-from <INVALID.NOREPLY@gnu.org>) id 1Kl7bk-0007fZ-Lh
	for myserver-commit@gnu.org; Wed, 01 Oct 2008 19:43:36 +0000
Received: from gscrivano by cvs.savannah.gnu.org with local (Exim 4.63)
	(envelope-from <gscrivano@savannah.gnu.org>) id 1Kl7bk-0007fC-9f
	for myserver-commit@gnu.org; Wed, 01 Oct 2008 19:43:36 +0000
MIME-Version: 1.0
Errors-To: gscrivano
To: myserver-commit@gnu.org
X-Mailer: SVN::Notify 2.64: http://search.cpan.org/dist/SVN-Notify/
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
From: Giuseppe Scrivano <gscrivano@gnu.org>
Message-Id: <E1Kl7bk-0007fC-9f@cvs.savannah.gnu.org>
Date: Wed, 01 Oct 2008 19:43:36 +0000
X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 3)
Subject: [myserver-commit] [2858] Added new `HttpReqSecurityDomain' class.
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/pipermail/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, 01 Oct 2008 19:43:39 -0000

Revision: 2858
          http://svn.sv.gnu.org/viewvc/?view=rev&root=myserver&revision=2858
Author:   gscrivano
Date:     2008-10-01 19:43:35 +0000 (Wed, 01 Oct 2008)

Log Message:
-----------
Added new `HttpReqSecurityDomain' class.

Modified Paths:
--------------
    branches/myserver_sec_new/include/conf/security/security_domain.h
    branches/myserver_sec_new/include/protocol/http/Makefile.am
    branches/myserver_sec_new/src/conf/security/security_domain.cpp
    branches/myserver_sec_new/src/protocol/http/Makefile.am
    branches/myserver_sec_new/tests/Makefile.am

Added Paths:
-----------
    branches/myserver_sec_new/include/protocol/http/http_req_security_domain.h
    branches/myserver_sec_new/tests/test_http_req_security_domain.cpp

Modified: branches/myserver_sec_new/include/conf/security/security_domain.h
===================================================================
--- branches/myserver_sec_new/include/conf/security/security_domain.h	2008-09-30 20:33:12 UTC (rev 2857)
+++ branches/myserver_sec_new/include/conf/security/security_domain.h	2008-10-01 19:43:35 UTC (rev 2858)
@@ -29,6 +29,7 @@
 {
 public:
   SecurityDomain ();
+  SecurityDomain (const char* name);
   SecurityDomain (string &name);
   virtual ~SecurityDomain ();
   virtual string *getValue (string &name);

Modified: branches/myserver_sec_new/include/protocol/http/Makefile.am
===================================================================
--- branches/myserver_sec_new/include/protocol/http/Makefile.am	2008-09-30 20:33:12 UTC (rev 2857)
+++ branches/myserver_sec_new/include/protocol/http/Makefile.am	2008-10-01 19:43:35 UTC (rev 2858)
@@ -1,4 +1,4 @@
 httpincludedir=$(includedir)/myserver/include/protocol/http
-httpinclude_HEADERS = http_data_handler.h http_data_read.h http_errors.h http.h http_header_checker.h http_header.h http_headers.h http_request.h http_response.h http_thread_context.h
+httpinclude_HEADERS = http_data_handler.h http_data_read.h http_errors.h http.h http_header_checker.h http_header.h http_headers.h http_request.h http_req_security_domain.cpp http_response.h http_thread_context.h
 SUBDIRS = env
 

Added: branches/myserver_sec_new/include/protocol/http/http_req_security_domain.h
===================================================================
--- branches/myserver_sec_new/include/protocol/http/http_req_security_domain.h	                        (rev 0)
+++ branches/myserver_sec_new/include/protocol/http/http_req_security_domain.h	2008-10-01 19:43:35 UTC (rev 2858)
@@ -0,0 +1,42 @@
+/* -*- mode: c++ -*- */
+/*
+MyServer
+Copyright (C) 2008 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
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program.  If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef HTTP_REQ_SECURITY_DOMAIN_H
+#define HTTP_REQ_SECURITY_DOMAIN_H
+
+#include "stdafx.h"
+
+#include <include/conf/security/security_domain.h>
+#include <include/protocol/http/http_request.h>
+#include <string>
+
+using namespace std;
+
+class HttpReqSecurityDomain : public SecurityDomain
+{
+public:
+  HttpReqSecurityDomain (HttpRequestHeader *request);
+  virtual ~HttpReqSecurityDomain ();
+  virtual string *getValue (string &name);
+  HttpRequestHeader *getRequest () {return request;}
+protected:
+  HttpRequestHeader *request;
+  string name;
+};
+
+#endif

Modified: branches/myserver_sec_new/src/conf/security/security_domain.cpp
===================================================================
--- branches/myserver_sec_new/src/conf/security/security_domain.cpp	2008-09-30 20:33:12 UTC (rev 2857)
+++ branches/myserver_sec_new/src/conf/security/security_domain.cpp	2008-10-01 19:43:35 UTC (rev 2858)
@@ -21,16 +21,20 @@
 
 SecurityDomain::SecurityDomain ()
 {
-  this->name.assign("");
+  this->name.assign ("");
 }
 
 SecurityDomain::SecurityDomain (string& name)
 {
-  this->name.assign(name);
+  this->name.assign (name);
 }
+SecurityDomain::SecurityDomain (const char* name)
+{
+  this->name.assign (name);
+}
 
 
-SecurityDomain::~SecurityDomain()
+SecurityDomain::~SecurityDomain ()
 {
 
 }

Modified: branches/myserver_sec_new/src/protocol/http/Makefile.am
===================================================================
--- branches/myserver_sec_new/src/protocol/http/Makefile.am	2008-09-30 20:33:12 UTC (rev 2857)
+++ branches/myserver_sec_new/src/protocol/http/Makefile.am	2008-10-01 19:43:35 UTC (rev 2858)
@@ -1,5 +1,5 @@
 lib_LIBRARIES = libhttp.a
-libhttp_a_SOURCES = http.cpp http_data_handler.cpp http_data_read.cpp http_errors.cpp http_header_checker.cpp http_headers.cpp http_request.cpp http_response.cpp http_thread_context.cpp
+libhttp_a_SOURCES = http.cpp http_data_handler.cpp http_data_read.cpp http_errors.cpp http_header_checker.cpp http_headers.cpp http_request.cpp http_req_security_domain.cpp http_response.cpp http_thread_context.cpp
 SUBDIRS = env
 INCLUDES = $(all_includes)
 

Modified: branches/myserver_sec_new/tests/Makefile.am
===================================================================
--- branches/myserver_sec_new/tests/Makefile.am	2008-09-30 20:33:12 UTC (rev 2857)
+++ branches/myserver_sec_new/tests/Makefile.am	2008-10-01 19:43:35 UTC (rev 2858)
@@ -2,5 +2,5 @@
 #
 
 bin_PROGRAMS = tests_suite
-tests_suite_SOURCES = main.cpp test_connection.cpp test_ftp.cpp test_log_manager.cpp test_mutex.cpp test_security_domain.cpp test_validator.cpp test_auth_domain.cpp test_connections_scheduler.cpp test_gzip.cpp test_log_stream_factory.cpp test_pipe.cpp test_security_manager.cpp test_validator_factory.cpp test_base64.cpp test_file_stream.cpp test_hashmap.cpp test_md5.cpp test_recursive_mutex.cpp test_semaphore.cpp test_xml.cpp test_cached_file_buffer.cpp test_file_stream_creator.cpp test_homedir.cpp test_mem_buff.cpp test_regex.cpp test_socket_stream_creator.cpp test_cached_file.cpp test_files_utility.cpp test_http_request.cpp test_mem_stream.cpp test_safetime.cpp test_thread.cpp test_cached_file_factory.cpp test_filter_chain.cpp test_http_response.cpp test_multicast.cpp test_security_cache.cpp test_utility.cpp  test_xml_validator.cpp
+tests_suite_SOURCES = main.cpp test_connection.cpp test_ftp.cpp test_log_manager.cpp test_mutex.cpp test_security_domain.cpp test_validator.cpp test_auth_domain.cpp test_connections_scheduler.cpp test_gzip.cpp test_log_stream_factory.cpp test_pipe.cpp test_security_manager.cpp test_validator_factory.cpp test_base64.cpp test_file_stream.cpp test_hashmap.cpp test_md5.cpp test_recursive_mutex.cpp test_semaphore.cpp test_xml.cpp test_cached_file_buffer.cpp test_file_stream_creator.cpp test_homedir.cpp test_mem_buff.cpp test_regex.cpp test_socket_stream_creator.cpp test_cached_file.cpp test_files_utility.cpp test_http_request.cpp test_http_req_security_domain.cpp test_mem_stream.cpp test_safetime.cpp test_thread.cpp test_cached_file_factory.cpp test_filter_chain.cpp test_http_response.cpp test_multicast.cpp test_security_cache.cpp test_utility.cpp  test_xml_validator.cpp
 tests_suite_LDADD = ../src/libmyserver.a $(CPPUNIT_LDFLAGS) $(PTHREAD_LIB) $(IDN_LIB) $(XNET_LIB) $(EVENT_LIB) $(DL_LIB) $(OPENSSL_LIB) $(ZLIB_LIB) $(XML_LIBS) $(LDFLAGS)

Added: branches/myserver_sec_new/tests/test_http_req_security_domain.cpp
===================================================================
--- branches/myserver_sec_new/tests/test_http_req_security_domain.cpp	                        (rev 0)
+++ branches/myserver_sec_new/tests/test_http_req_security_domain.cpp	2008-10-01 19:43:35 UTC (rev 2858)
@@ -0,0 +1,82 @@
+/*
+ MyServer
+ Copyright (C) 2008 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
+ (at your option) any later version.
+ 
+ This program is distributed in the hope that it will be useful, 
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ GNU General Public License for more details.
+ 
+ You should have received a copy of the GNU General Public License
+ along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include <ctype.h>
+
+#include <string.h>
+
+#include <cppunit/CompilerOutputter.h>
+#include <cppunit/extensions/TestFactoryRegistry.h>
+#include <cppunit/ui/text/TestRunner.h>
+#include <cppunit/extensions/HelperMacros.h>
+
+#include <include/protocol/http/http_req_security_domain.h>
+
+#include <iostream>
+using namespace std;
+
+class TestHttpReqSecurityDomain : public CppUnit::TestFixture
+{
+  CPPUNIT_TEST_SUITE( TestHttpReqSecurityDomain );
+  CPPUNIT_TEST( testConstructor );
+  CPPUNIT_TEST( testGetValue );
+  CPPUNIT_TEST_SUITE_END();
+
+public:
+  void setUp()
+  {
+
+  }
+
+  void tearDown()
+  {
+
+  }
+
+
+  void testConstructor ()
+  {
+    HttpRequestHeader req;
+    HttpReqSecurityDomain *dom = new  HttpReqSecurityDomain (&req);
+
+    CPPUNIT_ASSERT_EQUAL (&req, dom->getRequest ());
+
+    delete dom;
+  }
+
+
+  void testGetValue ()
+  {
+    HttpRequestHeader req;
+    const char *name = "My-Header";
+    const char *value = "foo-bar";
+    string nameStr (name);
+    HttpReqSecurityDomain *dom = new  HttpReqSecurityDomain (&req);
+
+    req.setValue (name, value);
+
+    string *ret = dom->getValue (nameStr);
+
+    CPPUNIT_ASSERT_EQUAL (ret->compare (value), 0);
+
+    delete dom;
+  }
+
+};
+
+
+CPPUNIT_TEST_SUITE_REGISTRATION( TestHttpReqSecurityDomain );





From MAILER-DAEMON Thu Oct 02 15:20:34 2008
Received: from mailman by lists.gnu.org with archive (Exim 4.43)
	id 1KlTj0-0004Cr-2s
	for mharc-myserver-commit@gnu.org; Thu, 02 Oct 2008 15:20:34 -0400
Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43)
	id 1KlTiy-0004CW-HE
	for myserver-commit@gnu.org; Thu, 02 Oct 2008 15:20:32 -0400
Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43)
	id 1KlTix-0004CK-Vx
	for myserver-commit@gnu.org; Thu, 02 Oct 2008 15:20:32 -0400
Received: from [199.232.76.173] (port=50900 helo=monty-python.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.43) id 1KlTix-0004CH-Sx
	for myserver-commit@gnu.org; Thu, 02 Oct 2008 15:20:31 -0400
Received: from savannah.gnu.org ([199.232.41.3]:34029 helo=sv.gnu.org)
	by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32)
	(Exim 4.60) (envelope-from <INVALID.NOREPLY@gnu.org>)
	id 1KlTix-0004PG-IJ
	for myserver-commit@gnu.org; Thu, 02 Oct 2008 15:20:31 -0400
Received: from cvs.savannah.gnu.org ([199.232.41.69])
	by sv.gnu.org with esmtp (Exim 4.63)
	(envelope-from <INVALID.NOREPLY@gnu.org>) id 1KlTiv-00008I-OG
	for myserver-commit@gnu.org; Thu, 02 Oct 2008 19:20:30 +0000
Received: from gscrivano by cvs.savannah.gnu.org with local (Exim 4.63)
	(envelope-from <gscrivano@savannah.gnu.org>) id 1KlTiu-00007R-59
	for myserver-commit@gnu.org; Thu, 02 Oct 2008 19:20:28 +0000
MIME-Version: 1.0
Errors-To: gscrivano
To: myserver-commit@gnu.org
X-Mailer: SVN::Notify 2.64: http://search.cpan.org/dist/SVN-Notify/
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
From: Giuseppe Scrivano <gscrivano@gnu.org>
Message-Id: <E1KlTiu-00007R-59@cvs.savannah.gnu.org>
Date: Thu, 02 Oct 2008 19:20:28 +0000
X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 3)
Subject: [myserver-commit] [2859]
 Added possibility to redefine permissions mask in the security file through
 the `PERMISSION ' command.
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/pipermail/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, 02 Oct 2008 19:20:32 -0000

Revision: 2859
          http://svn.sv.gnu.org/viewvc/?view=rev&root=myserver&revision=2859
Author:   gscrivano
Date:     2008-10-02 19:20:25 +0000 (Thu, 02 Oct 2008)

Log Message:
-----------
Added possibility to redefine permissions mask in the security file through the `PERMISSION' command.

Modified Paths:
--------------
    branches/myserver_sec_new/include/conf/security/security_manager.h
    branches/myserver_sec_new/include/conf/security/xml_validator.h
    branches/myserver_sec_new/src/conf/security/xml_validator.cpp

Modified: branches/myserver_sec_new/include/conf/security/security_manager.h
===================================================================
--- branches/myserver_sec_new/include/conf/security/security_manager.h	2008-10-01 19:43:35 UTC (rev 2858)
+++ branches/myserver_sec_new/include/conf/security/security_manager.h	2008-10-02 19:20:25 UTC (rev 2859)
@@ -87,8 +87,13 @@
    *where the password is not sent in clear on the network.
    */
   string neededPassword;
-  
+
   /*!
+   *The provided password is correct.
+   */
+  bool authenticated;
+ 
+  /*!
    *The obtained mask if password were correct.
    */
   int providedMask;

Modified: branches/myserver_sec_new/include/conf/security/xml_validator.h
===================================================================
--- branches/myserver_sec_new/include/conf/security/xml_validator.h	2008-10-01 19:43:35 UTC (rev 2858)
+++ branches/myserver_sec_new/include/conf/security/xml_validator.h	2008-10-02 19:20:25 UTC (rev 2859)
@@ -58,11 +58,17 @@
                  SecurityToken *st, 
                  HashMap<string, SecurityDomain*> *hashedDomains);
 
+  void doPermission (xmlNodePtr node,
+                     SecurityToken *st, 
+                     HashMap<string, SecurityDomain*> *hashedDomains);
+
   int computeXmlNode (xmlNodePtr node, 
                       SecurityToken *st, 
                       int *cmd, 
                       HashMap<string, SecurityDomain*> *hashedDomains);
 
+  int getPermissions (xmlAttr* attrs, xmlChar** user = NULL, xmlChar** password = NULL);
+
   SecurityCache *getCache(Server*);
   SecurityCache *secCache;
   Mutex cacheMutex;

Modified: branches/myserver_sec_new/src/conf/security/xml_validator.cpp
===================================================================
--- branches/myserver_sec_new/src/conf/security/xml_validator.cpp	2008-10-01 19:43:35 UTC (rev 2858)
+++ branches/myserver_sec_new/src/conf/security/xml_validator.cpp	2008-10-02 19:20:25 UTC (rev 2859)
@@ -105,20 +105,56 @@
      
     xmlAttr *attrs = cur->properties;
   
-    const xmlChar* name;
-    const xmlChar* password;
+    xmlChar* name = NULL;
+    xmlChar* password = NULL;
 
+    int permissions =  getPermissions (attrs, &name, &password);
+
+    if (!name || !password)
+      continue;
+
+    if (xmlStrcmp (name, (const xmlChar *)st->user.c_str ()))
+      continue;
+
+    st->providedMask = permissions;
+
+    if (xmlStrcmp (password, (const xmlChar *)st->password.c_str ()))
+    {
+      st->authenticated = false;
+      st->mask = 0;
+    }
+    else
+    {
+      st->authenticated = true;
+      st->mask = permissions;
+    }
+    
+    return st->mask;
+  }
+
+  return 0;
+}
+
+/*!
+ *Get a permission mask from the attributes.
+ *\param attrs Attributes list.
+ *\param user The found user name.
+ *\param password The found password.
+ *\return the permissions mask.
+ */
+int XmlValidator::getPermissions (xmlAttr* attrs, xmlChar** user, xmlChar** password )
+{
     int permissions = 0;
 
     while (attrs)
     {
-      if (!xmlStrcmp (attrs->name, (const xmlChar *)"name") &&
+      if (user && !xmlStrcmp (attrs->name, (const xmlChar *)"name") &&
           attrs->children && attrs->children->content)
-        name = attrs->children->content;
+        *user = attrs->children->content;
     
-      if (!xmlStrcmp (attrs->name, (const xmlChar *)"password") &&
+      if (password && !xmlStrcmp (attrs->name, (const xmlChar *)"password") &&
           attrs->children && attrs->children->content)
-        password = attrs->children->content;
+        *password = attrs->children->content;
 
       if (!xmlStrcmp (attrs->name, (const xmlChar *)"read") &&
           attrs->children && attrs->children->content &&
@@ -143,20 +179,7 @@
       attrs = attrs->next;
     }
 
-    if (xmlStrcmp (name, (const xmlChar *)st->user.c_str ()))
-      continue;
-
-    st->providedMask = permissions;
-
-    if (xmlStrcmp (password, (const xmlChar *)st->password.c_str ()))
-      st->mask = 0;
-    else
-      st->mask = permissions;
-    
-    return st->mask;
-  }
-
-  return 0;
+    return permissions;
 }
 
 
@@ -215,6 +238,10 @@
     {
       doDefine (cur, st, hashedDomains);
     }
+    else if (!xmlStrcmp (cur->name, (const xmlChar *) "PERMISSION"))
+    {
+      doPermission (cur, st, hashedDomains);
+    }
   }
 
   return 0;
@@ -261,6 +288,23 @@
 }
 
 /*!
+ *Handle a PERMISSION.
+ */
+void XmlValidator::doPermission (xmlNodePtr node, SecurityToken *st, HashMap<string, SecurityDomain*> *hashedDomains)
+{
+  string name;
+  const xmlChar *isNot = (const xmlChar*)"";
+  const xmlChar *value = (const xmlChar*)"";
+  xmlAttr *attrs = node->properties;
+
+  st->providedMask =  getPermissions (attrs);
+
+  if (st->authenticated)
+    st->mask = st->providedMask;
+}
+
+
+/*!
  *Handle a DEFINE.
  */
 void XmlValidator::doDefine (xmlNodePtr node, SecurityToken *st, HashMap<string, SecurityDomain*> *hashedDomains)





From MAILER-DAEMON Fri Oct 03 06:59:19 2008
Received: from mailman by lists.gnu.org with archive (Exim 4.43)
	id 1KliNT-0007jR-AC
	for mharc-myserver-commit@gnu.org; Fri, 03 Oct 2008 06:59:19 -0400
Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43)
	id 1KliNR-0007iG-K1
	for myserver-commit@gnu.org; Fri, 03 Oct 2008 06:59:17 -0400
Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43)
	id 1KliNQ-0007hX-8Q
	for myserver-commit@gnu.org; Fri, 03 Oct 2008 06:59:17 -0400
Received: from [199.232.76.173] (port=48473 helo=monty-python.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.43) id 1KliNQ-0007hL-21
	for myserver-commit@gnu.org; Fri, 03 Oct 2008 06:59:16 -0400
Received: from savannah.gnu.org ([199.232.41.3]:46188 helo=sv.gnu.org)
	by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32)
	(Exim 4.60) (envelope-from <INVALID.NOREPLY@gnu.org>)
	id 1KliNP-0004og-KJ
	for myserver-commit@gnu.org; Fri, 03 Oct 2008 06:59:15 -0400
Received: from cvs.savannah.gnu.org ([199.232.41.69])
	by sv.gnu.org with esmtp (Exim 4.63)
	(envelope-from <INVALID.NOREPLY@gnu.org>) id 1KliNO-0008QP-Pr
	for myserver-commit@gnu.org; Fri, 03 Oct 2008 10:59:14 +0000
Received: from gscrivano by cvs.savannah.gnu.org with local (Exim 4.63)
	(envelope-from <gscrivano@savannah.gnu.org>) id 1KliNO-0008QD-4r
	for myserver-commit@gnu.org; Fri, 03 Oct 2008 10:59:14 +0000
MIME-Version: 1.0
Errors-To: gscrivano
To: myserver-commit@gnu.org
X-Mailer: SVN::Notify 2.64: http://search.cpan.org/dist/SVN-Notify/
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
From: Giuseppe Scrivano <gscrivano@gnu.org>
Message-Id: <E1KliNO-0008QD-4r@cvs.savannah.gnu.org>
Date: Fri, 03 Oct 2008 10:59:14 +0000
X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 3)
Subject: [myserver-commit] [2860] Don't add the security domain `AuthDomain'
	by default.
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/pipermail/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, 03 Oct 2008 10:59:18 -0000

Revision: 2860
          http://svn.sv.gnu.org/viewvc/?view=rev&root=myserver&revision=2860
Author:   gscrivano
Date:     2008-10-03 10:59:13 +0000 (Fri, 03 Oct 2008)

Log Message:
-----------
Don't add the security domain `AuthDomain' by default.  It must be done explicitly.

Modified Paths:
--------------
    branches/myserver_sec_new/include/conf/security/security_domain.h
    branches/myserver_sec_new/include/conf/security/security_manager.h
    branches/myserver_sec_new/include/conf/security/validator.h
    branches/myserver_sec_new/include/protocol/http/Makefile.am
    branches/myserver_sec_new/src/conf/security/auth_domain.cpp
    branches/myserver_sec_new/src/conf/security/security_cache.cpp
    branches/myserver_sec_new/src/conf/security/security_manager.cpp
    branches/myserver_sec_new/src/conf/security/validator.cpp
    branches/myserver_sec_new/src/conf/security/xml_validator.cpp
    branches/myserver_sec_new/tests/test_security_manager.cpp
    branches/myserver_sec_new/tests/test_validator.cpp
    branches/myserver_sec_new/tests/test_xml_validator.cpp

Modified: branches/myserver_sec_new/include/conf/security/security_domain.h
===================================================================
--- branches/myserver_sec_new/include/conf/security/security_domain.h	2008-10-02 19:20:25 UTC (rev 2859)
+++ branches/myserver_sec_new/include/conf/security/security_domain.h	2008-10-03 10:59:13 UTC (rev 2860)
@@ -33,7 +33,7 @@
   SecurityDomain (string &name);
   virtual ~SecurityDomain ();
   virtual string *getValue (string &name);
-  const string& getName(){return name;}
+  string& getName(){return name;}
 protected:
   string name;
 };

Modified: branches/myserver_sec_new/include/conf/security/security_manager.h
===================================================================
--- branches/myserver_sec_new/include/conf/security/security_manager.h	2008-10-02 19:20:25 UTC (rev 2859)
+++ branches/myserver_sec_new/include/conf/security/security_manager.h	2008-10-03 10:59:13 UTC (rev 2860)
@@ -29,6 +29,8 @@
 
 using namespace std;
 
+class AuthMethod;
+class Validator;
 class SecurityDomain;
 class AuthMethodFactory;
 class ValidatorFactory;
@@ -76,9 +78,7 @@
   /*! Resource that the user tried to access.  */
   string *resource;
 
-  /*!
-   *Permission mask.
-   */
+  /*! Permission mask.  */
   int mask;
 
   /*!
@@ -88,17 +88,13 @@
    */
   string neededPassword;
 
-  /*!
-   *The provided password is correct.
-   */
+  /*! The provided password is correct.  */
   bool authenticated;
  
-  /*!
-   *The obtained mask if password were correct.
-   */
+  /*! The obtained mask if password were correct.  */
   int providedMask;
 
-
+  /*! Stored values.  */
 	HashMap<string,string*> values;
 
   /*! If it is true the security manager will use the cached values.  */
@@ -126,12 +122,22 @@
   SecurityManager(ValidatorFactory*, AuthMethodFactory*);
   ~SecurityManager();
 
-  int getPermissionMask(SecurityToken* st, 
-                        list<SecurityDomain*> *domains, 
-                        string& validator,
-                        string& authMethod);
+  int getPermissionMask (SecurityToken* st, 
+                         SecurityDomain **domains, 
+                         string& validator,
+                         string& authMethod);
 
+  int getPermissionMask (SecurityToken* st, 
+                         list<SecurityDomain*> *domains, 
+                         string& validator,
+                         string& authMethod);
+
 private:
+  int getValidatorAndAuthMethod (string &validatorName,
+                                 string &authMethodName,
+                                 Validator **validator,
+                                 AuthMethod **authMethod);
+
   ValidatorFactory *validatorFactory;
   AuthMethodFactory *authMethodFactory;
 };

Modified: branches/myserver_sec_new/include/conf/security/validator.h
===================================================================
--- branches/myserver_sec_new/include/conf/security/validator.h	2008-10-02 19:20:25 UTC (rev 2859)
+++ branches/myserver_sec_new/include/conf/security/validator.h	2008-10-03 10:59:13 UTC (rev 2860)
@@ -37,6 +37,10 @@
   virtual ~Validator ();
 
   int getPermissionMask (SecurityToken* st, 
+                         SecurityDomain **domains,
+                         AuthMethod* authMethod);
+
+  int getPermissionMask (SecurityToken* st, 
                          list<SecurityDomain*> *domains,
                          AuthMethod* authMethod);
 
@@ -48,10 +52,16 @@
   string *getValue (HashMap<string, SecurityDomain*> *hashedDomains,
                     string &name);
 protected:
-  int initializeDomains (HashMap<string, SecurityDomain*> *hashedDomains,
-                         SecurityToken* st, 
-                         list<SecurityDomain*> *domains);
-  void clearDomains (HashMap<string, SecurityDomain*> *hashedDomains);
+  inline void addDomain (HashMap<string, SecurityDomain*> *hashedDomains,
+                         SecurityDomain *domain)
+                        {
+                          string &name = domain->getName ();
+                          hashedDomains->put (name, domain);
+                        }
+
+  int getPermissionMaskInt (SecurityToken* st, 
+                            HashMap<string, SecurityDomain*> *hashedDomains,
+                            AuthMethod* authMethod);
 };
 
 #endif

Modified: branches/myserver_sec_new/include/protocol/http/Makefile.am
===================================================================
--- branches/myserver_sec_new/include/protocol/http/Makefile.am	2008-10-02 19:20:25 UTC (rev 2859)
+++ branches/myserver_sec_new/include/protocol/http/Makefile.am	2008-10-03 10:59:13 UTC (rev 2860)
@@ -1,4 +1,4 @@
 httpincludedir=$(includedir)/myserver/include/protocol/http
-httpinclude_HEADERS = http_data_handler.h http_data_read.h http_errors.h http.h http_header_checker.h http_header.h http_headers.h http_request.h http_req_security_domain.cpp http_response.h http_thread_context.h
+httpinclude_HEADERS = http_data_handler.h http_data_read.h http_errors.h http.h http_header_checker.h http_header.h http_headers.h http_request.h http_req_security_domain.h http_response.h http_thread_context.h
 SUBDIRS = env
 

Modified: branches/myserver_sec_new/src/conf/security/auth_domain.cpp
===================================================================
--- branches/myserver_sec_new/src/conf/security/auth_domain.cpp	2008-10-02 19:20:25 UTC (rev 2859)
+++ branches/myserver_sec_new/src/conf/security/auth_domain.cpp	2008-10-03 10:59:13 UTC (rev 2860)
@@ -22,7 +22,7 @@
 
 AuthDomain::AuthDomain (SecurityToken *st)
 {
-  this->name.assign("");
+  this->name.assign ("auth");
   securityToken = st;
 }
 
@@ -45,7 +45,7 @@
   if (!name.compare ("directory"))
     return securityToken->directory;
 
-  if (!name.compare("sysdirectory"))
+  if (!name.compare ("sysdirectory"))
     return securityToken->sysdirectory;
 
   return NULL;

Modified: branches/myserver_sec_new/src/conf/security/security_cache.cpp
===================================================================
--- branches/myserver_sec_new/src/conf/security/security_cache.cpp	2008-10-02 19:20:25 UTC (rev 2859)
+++ branches/myserver_sec_new/src/conf/security/security_cache.cpp	2008-10-03 10:59:13 UTC (rev 2860)
@@ -17,6 +17,7 @@
 
 #include <include/conf/security/security_cache.h>
 #include <include/conf/security/security_manager.h>
+#include <include/conf/security/auth_domain.h>
 #include <include/base/file/file.h>
 #include <include/base/file/files_utility.h>
 
@@ -39,7 +40,10 @@
     validatorFactory.addValidator (xml, xmlV);
     authMethodFactory.addAuthMethod (xml, (AuthMethod*) xmlV);
   }
-  return sm.getPermissionMask (st, NULL, xml, xml);
+
+  AuthDomain auth (st);
+  SecurityDomain* domains[] = {&auth, NULL};
+  return sm.getPermissionMask (st, domains, xml, xml);
 }
 /////////////////////////////////////////////////////////////////////////////////////
   

Modified: branches/myserver_sec_new/src/conf/security/security_manager.cpp
===================================================================
--- branches/myserver_sec_new/src/conf/security/security_manager.cpp	2008-10-02 19:20:25 UTC (rev 2859)
+++ branches/myserver_sec_new/src/conf/security/security_manager.cpp	2008-10-03 10:59:13 UTC (rev 2860)
@@ -74,23 +74,64 @@
  *Get the permission mask for the requested resource.
  */
 int SecurityManager::getPermissionMask (SecurityToken* st, 
+                                        SecurityDomain **domains, 
+                                        string &validator,
+                                        string &authMethod)
+{
+  Validator *v;
+  AuthMethod *am;
+
+  if (getValidatorAndAuthMethod (validator, authMethod, &v, &am))
+    return 0;
+
+  return v->getPermissionMask (st, domains, am);
+}
+
+/*!
+ *Get the permission mask for the requested resource.
+ */
+int SecurityManager::getPermissionMask (SecurityToken* st, 
                                         list<SecurityDomain*> *domains, 
                                         string &validator,
                                         string &authMethod)
 {
+  Validator *v;
+  AuthMethod *am;
+
+  if (getValidatorAndAuthMethod (validator, authMethod, &v, &am))
+    return 0;
+
+  return v->getPermissionMask (st, domains, am);
+}
+
+
+/*!
+ *Initialize the pointers to the specified Validator and AuthMethod.
+ *\param validatorName The validator name to find.
+ *\param authMethodName The auth method name to find.
+ *\param validator Pointer to the Validator to initialize. 
+ *\param validator Pointer to the AuthMethod initialize.
+ *\return 0 if the pointers were successfully initialized.
+ */
+int SecurityManager::getValidatorAndAuthMethod (string &validatorName,
+                                                string &authMethodName,
+                                                Validator **validator,
+                                                AuthMethod **authMethod)
+{
+
   string xml ("xml");
 
-  Validator *v = validatorFactory->getValidator (validator);
-  AuthMethod *am = authMethodFactory->getAuthMethod (authMethod);
+  *validator = validatorFactory->getValidator (validatorName);
+  *authMethod = authMethodFactory->getAuthMethod (authMethodName);
 
-  if (!v)
-    v = validatorFactory->getValidator (xml);
+  if (!(*validator))
+    *validator = validatorFactory->getValidator (xml);
 
-  if (!am)
-    am = authMethodFactory->getAuthMethod (xml);
+  if (!(*authMethod))
+    *authMethod = authMethodFactory->getAuthMethod (xml);
 
-  if (!am || !v)
+  if (*validator && *authMethod)
     return 0;
 
-  return v->getPermissionMask (st, domains, am);
+  return 1;
 }

Modified: branches/myserver_sec_new/src/conf/security/validator.cpp
===================================================================
--- branches/myserver_sec_new/src/conf/security/validator.cpp	2008-10-02 19:20:25 UTC (rev 2859)
+++ branches/myserver_sec_new/src/conf/security/validator.cpp	2008-10-03 10:59:13 UTC (rev 2860)
@@ -29,9 +29,10 @@
 
 }
 
+
 /*!
  *Get the permission mask for the requested resource.
- *Decorate getPermissionMaskImpl.
+ *Delegate the problem to getPermissionMaskInt.
  */
 int Validator::getPermissionMask (SecurityToken* st, 
                                   list<SecurityDomain*> *domains,
@@ -42,76 +43,77 @@
   if (st->done)
     return st->mask;
 
-  int ret = initializeDomains (&hashedDomains, st, domains);
+  if (domains)
+  {
+    for (list<SecurityDomain*>::iterator it = domains->begin (); 
+         it != domains->end (); it++)
+    {
+      addDomain (&hashedDomains, *it);
+    }
+  }
 
-  if(ret)
-    return ret;
-
-  if (authMethod)
-    ret = authMethod->getPermissionMask (st);
-  
-  if (!getPermissionMaskImpl (st, &hashedDomains, authMethod))
-    ret = 0;
-  
-  clearDomains (&hashedDomains);
-
-  st->done = true;
-
-  return ret;
+  return getPermissionMaskInt (st, &hashedDomains, authMethod);
 }
 
-
 /*!
  *Get the permission mask for the requested resource.
+ *Delegate the problem to getPermissionMaskInt.
  */
-int Validator::getPermissionMaskImpl (SecurityToken* st,
-                                      HashMap<string, SecurityDomain*> *hashedDomains,
-                                      AuthMethod* authMethod)
+int Validator::getPermissionMask (SecurityToken* st, 
+                                  SecurityDomain **domains,
+                                  AuthMethod* authMethod)
 {
-  return 0;
-}
+  HashMap<string, SecurityDomain*> hashedDomains;
 
+  if (st->done)
+    return st->mask;
 
-
-/*!
- *Initialize the domains.
- */
-int Validator::initializeDomains (HashMap<string, SecurityDomain*> *hashedDomains,
-                                  SecurityToken* st, 
-                                  list<SecurityDomain*> *domains)
-{
-  string authName ("auth");
-
-  hashedDomains->put (authName, new AuthDomain(st));
-
   if (domains)
   {
-    for (list<SecurityDomain*>::iterator it = domains->begin (); it != domains->end (); it++)
+    for (u_int i = 0; domains[i]; i++)
     {
-      SecurityDomain *domain = *it;
-      string name = domain->getName ();
-      hashedDomains->put (name, domain);
+      addDomain (&hashedDomains, domains[i]);
     }
   }
 
-  return 0;
+  return getPermissionMaskInt (st, &hashedDomains, authMethod);
 }
 
+
+
 /*!
- *Clear the resources used by the domains.
+ *Get the permission mask for the requested resource.
+ *Decorate getPermissionMaskImpl.
  */
-void Validator::clearDomains (HashMap<string, SecurityDomain*> *hashedDomains)
+int Validator::getPermissionMaskInt (SecurityToken* st, 
+                                     HashMap<string, SecurityDomain*> *hashedDomains,
+                                     AuthMethod* authMethod)
 {
-  HashMap<string, SecurityDomain*>::Iterator it = hashedDomains->begin();
+  int ret = 0;
+
+  if (authMethod)
+    ret = authMethod->getPermissionMask (st);
   
-  for (;it != hashedDomains->end(); it++)
-  {
-    delete *it;
-  }
+  if (!getPermissionMaskImpl (st, hashedDomains, authMethod))
+    ret = 0;
+  
+  st->done = true;
 
+  return ret;
 }
 
+
 /*!
+ *Get the permission mask for the requested resource.
+ */
+int Validator::getPermissionMaskImpl (SecurityToken* st,
+                                      HashMap<string, SecurityDomain*> *hashedDomains,
+                                      AuthMethod* authMethod)
+{
+  return 0;
+}
+
+/*!
  *Get the value for [name] in the form domain.variable.
  *\param hashedDomains Registered security domains.
  *\param name Variable name.

Modified: branches/myserver_sec_new/src/conf/security/xml_validator.cpp
===================================================================
--- branches/myserver_sec_new/src/conf/security/xml_validator.cpp	2008-10-02 19:20:25 UTC (rev 2859)
+++ branches/myserver_sec_new/src/conf/security/xml_validator.cpp	2008-10-03 10:59:13 UTC (rev 2860)
@@ -110,12 +110,10 @@
 
     int permissions =  getPermissions (attrs, &name, &password);
 
-    if (!name || !password)
+    if (!name || !password || 
+        xmlStrcmp (name, (const xmlChar *)st->user.c_str ()))
       continue;
 
-    if (xmlStrcmp (name, (const xmlChar *)st->user.c_str ()))
-      continue;
-
     st->providedMask = permissions;
 
     if (xmlStrcmp (password, (const xmlChar *)st->password.c_str ()))
@@ -152,26 +150,26 @@
           attrs->children && attrs->children->content)
         *user = attrs->children->content;
     
-      if (password && !xmlStrcmp (attrs->name, (const xmlChar *)"password") &&
+      else if (password && !xmlStrcmp (attrs->name, (const xmlChar *)"password") &&
           attrs->children && attrs->children->content)
         *password = attrs->children->content;
 
-      if (!xmlStrcmp (attrs->name, (const xmlChar *)"read") &&
+      else if (!xmlStrcmp (attrs->name, (const xmlChar *)"read") &&
           attrs->children && attrs->children->content &&
           !xmlStrcmp(attrs->children->content, (const xmlChar *) "YES"))
         permissions |= MYSERVER_PERMISSION_READ;
 
-      if (!xmlStrcmp (attrs->name, (const xmlChar *)"write") &&
+      else if (!xmlStrcmp (attrs->name, (const xmlChar *)"write") &&
           attrs->children && attrs->children->content &&
           !xmlStrcmp(attrs->children->content, (const xmlChar *) "YES"))
         permissions |= MYSERVER_PERMISSION_WRITE;
 
-      if (!xmlStrcmp (attrs->name, (const xmlChar *)"execute") &&
+      else if (!xmlStrcmp (attrs->name, (const xmlChar *)"execute") &&
           attrs->children && attrs->children->content &&
           !xmlStrcmp(attrs->children->content, (const xmlChar *) "YES"))
         permissions |= MYSERVER_PERMISSION_EXECUTE;
 
-      if (!xmlStrcmp (attrs->name, (const xmlChar *)"browse") &&
+      else if (!xmlStrcmp (attrs->name, (const xmlChar *)"browse") &&
           attrs->children && attrs->children->content &&
           !xmlStrcmp(attrs->children->content, (const xmlChar *) "YES"))
         permissions |= MYSERVER_PERMISSION_BROWSE;

Modified: branches/myserver_sec_new/tests/test_security_manager.cpp
===================================================================
--- branches/myserver_sec_new/tests/test_security_manager.cpp	2008-10-02 19:20:25 UTC (rev 2859)
+++ branches/myserver_sec_new/tests/test_security_manager.cpp	2008-10-03 10:59:13 UTC (rev 2860)
@@ -55,8 +55,8 @@
   {
     SecurityToken secToken;
     string xml("xml");
-    CPPUNIT_ASSERT_EQUAL(securityManager->getPermissionMask(&secToken, NULL, xml, xml), 0);
- 
+    CPPUNIT_ASSERT_EQUAL(securityManager->getPermissionMask(&secToken, (list<SecurityDomain*>*)NULL, xml, xml), 0);
+    CPPUNIT_ASSERT_EQUAL(securityManager->getPermissionMask(&secToken, (SecurityDomain**)NULL, xml, xml), 0);
   }
 };
 

Modified: branches/myserver_sec_new/tests/test_validator.cpp
===================================================================
--- branches/myserver_sec_new/tests/test_validator.cpp	2008-10-02 19:20:25 UTC (rev 2859)
+++ branches/myserver_sec_new/tests/test_validator.cpp	2008-10-03 10:59:13 UTC (rev 2860)
@@ -52,9 +52,9 @@
   {
     string val ("value");
     SecurityToken secToken;
-    CPPUNIT_ASSERT_EQUAL (validator->getPermissionMask (&secToken, NULL, NULL), 0);
- 
-  }
+    CPPUNIT_ASSERT_EQUAL (validator->getPermissionMask (&secToken, (SecurityDomain**) NULL, NULL), 0);
+    CPPUNIT_ASSERT_EQUAL (validator->getPermissionMask (&secToken, (list<SecurityDomain*>*) NULL, NULL), 0);
+   }
 };
 
 

Modified: branches/myserver_sec_new/tests/test_xml_validator.cpp
===================================================================
--- branches/myserver_sec_new/tests/test_xml_validator.cpp	2008-10-02 19:20:25 UTC (rev 2859)
+++ branches/myserver_sec_new/tests/test_xml_validator.cpp	2008-10-03 10:59:13 UTC (rev 2860)
@@ -52,10 +52,9 @@
 
   void testGetPermissionMask()
   {
-    string val("value");
     SecurityToken secToken;
-    CPPUNIT_ASSERT_EQUAL(xmlValidator->getPermissionMask(&secToken, NULL, NULL), 0);
- 
+    CPPUNIT_ASSERT_EQUAL (xmlValidator->getPermissionMask (&secToken, (SecurityDomain**) NULL, NULL), 0);
+    CPPUNIT_ASSERT_EQUAL (xmlValidator->getPermissionMask (&secToken, (list<SecurityDomain*>*) NULL, NULL), 0);
   }
 };
 





From MAILER-DAEMON Fri Oct 03 08:53:17 2008
Received: from mailman by lists.gnu.org with archive (Exim 4.43)
	id 1Klk9l-00026O-IF
	for mharc-myserver-commit@gnu.org; Fri, 03 Oct 2008 08:53:17 -0400
Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43)
	id 1Klk9k-000260-GW
	for myserver-commit@gnu.org; Fri, 03 Oct 2008 08:53:16 -0400
Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43)
	id 1Klk9j-00024p-2H
	for myserver-commit@gnu.org; Fri, 03 Oct 2008 08:53:15 -0400
Received: from [199.232.76.173] (port=60182 helo=monty-python.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.43) id 1Klk9i-00024i-Sp
	for myserver-commit@gnu.org; Fri, 03 Oct 2008 08:53:14 -0400
Received: from savannah.gnu.org ([199.232.41.3]:45929 helo=sv.gnu.org)
	by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32)
	(Exim 4.60) (envelope-from <INVALID.NOREPLY@gnu.org>)
	id 1Klk9i-0001Ad-HP
	for myserver-commit@gnu.org; Fri, 03 Oct 2008 08:53:14 -0400
Received: from cvs.savannah.gnu.org ([199.232.41.69])
	by sv.gnu.org with esmtp (Exim 4.63)
	(envelope-from <INVALID.NOREPLY@gnu.org>) id 1Klk9i-0004Cs-2q
	for myserver-commit@gnu.org; Fri, 03 Oct 2008 12:53:14 +0000
Received: from gscrivano by cvs.savannah.gnu.org with local (Exim 4.63)
	(envelope-from <gscrivano@savannah.gnu.org>) id 1Klk9h-0004Co-RF
	for myserver-commit@gnu.org; Fri, 03 Oct 2008 12:53:13 +0000
MIME-Version: 1.0
Errors-To: gscrivano
To: myserver-commit@gnu.org
X-Mailer: SVN::Notify 2.64: http://search.cpan.org/dist/SVN-Notify/
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
From: Giuseppe Scrivano <gscrivano@gnu.org>
Message-Id: <E1Klk9h-0004Co-RF@cvs.savannah.gnu.org>
Date: Fri, 03 Oct 2008 12:53:13 +0000
X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 3)
Subject: [myserver-commit] [2861] Fixed documentation directory location.
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/pipermail/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, 03 Oct 2008 12:53:16 -0000

Revision: 2861
          http://svn.sv.gnu.org/viewvc/?view=rev&root=myserver&revision=2861
Author:   gscrivano
Date:     2008-10-03 12:53:13 +0000 (Fri, 03 Oct 2008)

Log Message:
-----------
Fixed documentation directory location.

Modified Paths:
--------------
    trunk/myserver/binaries/clean_copy.sh

Modified: trunk/myserver/binaries/clean_copy.sh
===================================================================
--- trunk/myserver/binaries/clean_copy.sh	2008-10-03 10:59:13 UTC (rev 2860)
+++ trunk/myserver/binaries/clean_copy.sh	2008-10-03 12:53:13 UTC (rev 2861)
@@ -1,5 +1,6 @@
 #!/bin/sh
-#Create a *nix copy to be easily distribute
+#Create a clean binaries package.
+
 if [  $# = 0 ]; then
   echo "Usage: $0 dir_to_create [tar.bz2]"
   exit
@@ -58,20 +59,9 @@
 cp web/downloads/*.sh $1/web/downloads
 
 mkdir $1/web/documentation
-cp ../documentation/english/index.htm $1/web/documentation/
+cp ../documentation/myserver/*.html $1/web/documentation/
 
-mkdir $1/web/documentation/texts
-cp ../documentation/english/texts/*.htm $1/web/documentation/texts/
-
-mkdir $1/web/documentation/style
-cp ../documentation/english/style/*.css $1/web/documentation/style/
-
-mkdir $1/web/documentation/images
-cp ../documentation/english/images/*.png $1/web/documentation/images/
-cp ../documentation/english/images/*.jpg $1/web/documentation/images/
-
-
 if [  $# = 2 ]; then
-tar --create --bzip2 --file=$2.tar.bz2 $1
-rm -rf $1
+    tar --create --bzip2 --file=$2.tar.bz2 $1
+    rm -rf $1
 fi





From MAILER-DAEMON Fri Oct 03 18:09:03 2008
Received: from mailman by lists.gnu.org with archive (Exim 4.43)
	id 1Klspb-0003tn-Ae
	for mharc-myserver-commit@gnu.org; Fri, 03 Oct 2008 18:09:03 -0400
Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43)
	id 1KlspZ-0003t7-W7
	for myserver-commit@gnu.org; Fri, 03 Oct 2008 18:09:02 -0400
Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43)
	id 1KlspY-0003sD-Oz
	for myserver-commit@gnu.org; Fri, 03 Oct 2008 18:09:01 -0400
Received: from [199.232.76.173] (port=37406 helo=monty-python.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.43) id 1KlspY-0003rn-Fh
	for myserver-commit@gnu.org; Fri, 03 Oct 2008 18:09:00 -0400
Received: from savannah.gnu.org ([199.232.41.3]:43880 helo=sv.gnu.org)
	by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32)
	(Exim 4.60) (envelope-from <INVALID.NOREPLY@gnu.org>)
	id 1KlspX-0008Ex-8A
	for myserver-commit@gnu.org; Fri, 03 Oct 2008 18:08:59 -0400
Received: from cvs.savannah.gnu.org ([199.232.41.69])
	by sv.gnu.org with esmtp (Exim 4.63)
	(envelope-from <INVALID.NOREPLY@gnu.org>) id 1KlspU-0004Gm-4M
	for myserver-commit@gnu.org; Fri, 03 Oct 2008 22:08:56 +0000
Received: from gscrivano by cvs.savannah.gnu.org with local (Exim 4.63)
	(envelope-from <gscrivano@savannah.gnu.org>) id 1KlspT-0004Gi-R4
	for myserver-commit@gnu.org; Fri, 03 Oct 2008 22:08:56 +0000
MIME-Version: 1.0
Errors-To: gscrivano
To: myserver-commit@gnu.org
X-Mailer: SVN::Notify 2.64: http://search.cpan.org/dist/SVN-Notify/
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
From: Giuseppe Scrivano <gscrivano@gnu.org>
Message-Id: <E1KlspT-0004Gi-R4@cvs.savannah.gnu.org>
Date: Fri, 03 Oct 2008 22:08:55 +0000
X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 3)
Subject: [myserver-commit] [2862] Moved `SecurityToken' in a separate file.
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/pipermail/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, 03 Oct 2008 22:09:02 -0000

Revision: 2862
          http://svn.sv.gnu.org/viewvc/?view=rev&root=myserver&revision=2862
Author:   gscrivano
Date:     2008-10-03 22:08:55 +0000 (Fri, 03 Oct 2008)

Log Message:
-----------
Moved `SecurityToken' in a separate file.  It requires additional refactoring.

Modified Paths:
--------------
    branches/myserver_sec_new/include/conf/security/Makefile.am
    branches/myserver_sec_new/include/conf/security/security_manager.h
    branches/myserver_sec_new/src/conf/security/Makefile.am
    branches/myserver_sec_new/src/conf/security/security_manager.cpp

Added Paths:
-----------
    branches/myserver_sec_new/include/conf/security/security_token.h
    branches/myserver_sec_new/src/conf/security/security_token.cpp

Modified: branches/myserver_sec_new/include/conf/security/Makefile.am
===================================================================
--- branches/myserver_sec_new/include/conf/security/Makefile.am	2008-10-03 12:53:13 UTC (rev 2861)
+++ branches/myserver_sec_new/include/conf/security/Makefile.am	2008-10-03 22:08:55 UTC (rev 2862)
@@ -1,4 +1,4 @@
 securityincludedir=$(includedir)/myserver/include/conf/security
-securityinclude_HEADERS = auth_domain.h auth_method.h auth_method_factory.h security_cache.h security_domain.h security_manager.h validator.h validator_factory.h xml_validator.h
+securityinclude_HEADERS = auth_domain.h auth_method.h auth_method_factory.h security_cache.h security_domain.h security_manager.h security_token.h validator.h validator_factory.h xml_validator.h
 SUBDIRS =
 

Modified: branches/myserver_sec_new/include/conf/security/security_manager.h
===================================================================
--- branches/myserver_sec_new/include/conf/security/security_manager.h	2008-10-03 12:53:13 UTC (rev 2861)
+++ branches/myserver_sec_new/include/conf/security/security_manager.h	2008-10-03 22:08:55 UTC (rev 2862)
@@ -20,6 +20,7 @@
 #define SECURITY_MANAGER_H
 
 #include "stdafx.h"
+#include <include/conf/security/security_token.h>
 #include <include/connection/connection.h>
 #include <include/base/xml/xml_parser.h>
 #include <include/protocol/http/http_headers.h>
@@ -42,80 +43,22 @@
  */
 enum PERMISSION_MASK
 {
-  /*! Current user can read the file. */
+  /*! Current user can read the file.  */
   MYSERVER_PERMISSION_READ     =	(1<<0),
 
-  /*! Current user can write to the file. */
+  /*! Current user can write to the file.  */
   MYSERVER_PERMISSION_WRITE	  = (1<<1),
 
-  /*! Current user can execute the file. */
+  /*! Current user can execute the file.  */
   MYSERVER_PERMISSION_EXECUTE  = (1<<2),
 
-  /*! Current user can remove the file. */
+  /*! Current user can remove the file.  */
   MYSERVER_PERMISSION_DELETE	  = (1<<3),
 
-/*! Current user can browse the directory content. */
+/*! Current user can browse the directory content.  */
   MYSERVER_PERMISSION_BROWSE	  = (1<<4)
 };
 
-struct SecurityToken
-{
-  SecurityToken();
-  void reset();
-
-  /*! User to check for.  */
-  string user;
-
-  /*! Password provided by the user.  */
-  string password;
-
-  /*! Directory that the user is in.  */
-  string *directory;
-
-  /*! System directory for the host.  */
-  string *sysdirectory;
-
-  /*! Resource that the user tried to access.  */
-  string *resource;
-
-  /*! Permission mask.  */
-  int mask;
-
-  /*!
-   *Password that the user should provide to have access. 
-   *This is used in authorization schemes like the HTTP digest,
-   *where the password is not sent in clear on the network.
-   */
-  string neededPassword;
-
-  /*! The provided password is correct.  */
-  bool authenticated;
- 
-  /*! The obtained mask if password were correct.  */
-  int providedMask;
-
-  /*! Stored values.  */
-	HashMap<string,string*> values;
-
-  /*! If it is true the security manager will use the cached values.  */
-  bool done;
-
-  /*! Server instance.  */
-  Server* server;
-
-  /*! VHost.  */
-  Vhost* vhost;
-
-
-  ///////OLD NOT USED////////////
-  char* requiredPassword;
-  const char* filename;
-  struct HttpThreadContext* td;
-  char* authType;
-  int authTypeLen;
-  int throttlingRate;
-};
-
 class SecurityManager
 {
 public:

Added: branches/myserver_sec_new/include/conf/security/security_token.h
===================================================================
--- branches/myserver_sec_new/include/conf/security/security_token.h	                        (rev 0)
+++ branches/myserver_sec_new/include/conf/security/security_token.h	2008-10-03 22:08:55 UTC (rev 2862)
@@ -0,0 +1,104 @@
+/* -*- mode: c++ -*- */
+/*
+MyServer
+Copyright (C) 2002, 2003, 2004, 2008 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
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program.  If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef SECURITY_TOKEN_H
+#define SECURITY_TOKEN_H
+
+#include "stdafx.h"
+#include <include/base/hash_map/hash_map.h>
+
+#include <string>
+
+using namespace std;
+
+class Server;
+class Vhost;
+
+enum SECURITY_RING
+{
+  /*! Security file configuration.  */
+  MYSERVER_SECURITY_CONF     =	(1<<0),
+
+  /*! Virtual host configuration.  */
+  MYSERVER_VHOST_CONF	  = (1<<1),
+
+  /*! Global server configuration. */
+  MYSERVER_SERVER_CONF  = (1<<2),
+};
+
+struct SecurityToken
+{
+  SecurityToken();
+  void reset();
+  const char* getHashedData(const char* name, int domains);
+
+
+  /*! User to check for.  */
+  string user;
+
+  /*! Password provided by the user.  */
+  string password;
+
+  /*! Directory that the user is in.  */
+  string *directory;
+
+  /*! System directory for the host.  */
+  string *sysdirectory;
+
+  /*! Resource that the user tried to access.  */
+  string *resource;
+
+  /*! Permission mask.  */
+  int mask;
+
+  /*!
+   *Password that the user should provide to have access. 
+   *This is used in authorization schemes like the HTTP digest,
+   *where the password is not sent in clear on the network.
+   */
+  string neededPassword;
+
+  /*! The provided password is correct.  */
+  bool authenticated;
+ 
+  /*! The obtained mask if password were correct.  */
+  int providedMask;
+
+  /*! Stored values.  */
+	HashMap<string,string*> values;
+
+  /*! If it is true the security manager will use the cached values.  */
+  bool done;
+
+  /*! Server instance.  */
+  Server* server;
+
+  /*! VHost.  */
+  Vhost* vhost;
+
+
+  ///////OLD NOT USED////////////
+  char* requiredPassword;
+  const char* filename;
+  struct HttpThreadContext* td;
+  char* authType;
+  int authTypeLen;
+  int throttlingRate;
+};
+
+#endif

Modified: branches/myserver_sec_new/src/conf/security/Makefile.am
===================================================================
--- branches/myserver_sec_new/src/conf/security/Makefile.am	2008-10-03 12:53:13 UTC (rev 2861)
+++ branches/myserver_sec_new/src/conf/security/Makefile.am	2008-10-03 22:08:55 UTC (rev 2862)
@@ -1,4 +1,4 @@
 lib_LIBRARIES = libsecurity.a
-libsecurity_a_SOURCES = auth_domain.cpp auth_method.cpp auth_method_factory.cpp security_cache.cpp security_domain.cpp security_manager.cpp validator.cpp validator_factory.cpp xml_validator.cpp
+libsecurity_a_SOURCES = auth_domain.cpp auth_method.cpp auth_method_factory.cpp security_cache.cpp security_domain.cpp security_manager.cpp security_token.cpp validator.cpp validator_factory.cpp xml_validator.cpp
 SUBDIRS =
 INCLUDES = $(all_includes)

Modified: branches/myserver_sec_new/src/conf/security/security_manager.cpp
===================================================================
--- branches/myserver_sec_new/src/conf/security/security_manager.cpp	2008-10-03 12:53:13 UTC (rev 2861)
+++ branches/myserver_sec_new/src/conf/security/security_manager.cpp	2008-10-03 22:08:55 UTC (rev 2862)
@@ -28,39 +28,8 @@
 
 using namespace std;
 
-/*!
- *Create the object.
- */
-SecurityToken::SecurityToken ()
-{
-  reset ();
-}
-
-/*!
- *Reset every structure member.
- */
-void SecurityToken::reset ()
-{
-  mask = 0;
-  done = false;
-  server = NULL;
-  vhost = NULL;
-
-  directory = NULL;
-  sysdirectory = NULL;
-  resource = NULL;
-
-}
-
 SecurityManager::SecurityManager (ValidatorFactory* vf, AuthMethodFactory* amf)
 {
-  /*
-  HashMap<string, Validator*>::Iterator it = validators.begin ();
-  
-  for (;it != validators.end (); it++)
-  {
-    delete *it;
-  }*/
   validatorFactory = vf;
   authMethodFactory = amf;
 }

Added: branches/myserver_sec_new/src/conf/security/security_token.cpp
===================================================================
--- branches/myserver_sec_new/src/conf/security/security_token.cpp	                        (rev 0)
+++ branches/myserver_sec_new/src/conf/security/security_token.cpp	2008-10-03 22:08:55 UTC (rev 2862)
@@ -0,0 +1,91 @@
+/*
+MyServer
+Copyright (C) 2002-2008 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
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program.  If not, see <http://www.gnu.org/licenses/>.
+*/
+
+
+#include <include/conf/security/security_token.h>
+#include <include/conf/vhost/vhost.h>
+#include <include/server/server.h>
+
+#include <string>
+#include <sstream>
+#include <memory>
+
+using namespace std;
+
+/*!
+ *Create the object.
+ */
+SecurityToken::SecurityToken ()
+{
+  reset ();
+}
+
+/*!
+ *Reset every structure member.
+ */
+void SecurityToken::reset ()
+{
+  mask = 0;
+  done = false;
+  server = NULL;
+  vhost = NULL;
+
+  directory = NULL;
+  sysdirectory = NULL;
+  resource = NULL;
+
+}
+
+/*!
+ *Get the value for the variable using the specified domains.
+ *\param name Variable name.
+ *\param domains Domains where to look.  They are looked in this order: 
+ *\li Security configuration file.
+ *\li Virtual host configuration file.
+ *\li Global security file.
+ */
+const char* SecurityToken::getHashedData (const char* name, int domains)
+{
+  if (domains & MYSERVER_SECURITY_CONF)
+  {
+    string strName (name);
+    string *ret = values.get (strName);
+
+    if (ret)
+      return ret->c_str ();
+
+  }
+
+  if (vhost && (domains & MYSERVER_VHOST_CONF))
+  {
+    const char* ret = vhost->getHashedData (name);
+
+    if (ret)
+      return ret;
+  }
+
+  if (server && (domains & MYSERVER_SERVER_CONF))
+  {
+    const char* ret = server->getHashedData (name);
+
+    if (ret)
+      return ret;
+  }
+
+  
+  return NULL;
+}





From MAILER-DAEMON Sat Oct 04 08:46:53 2008
Received: from mailman by lists.gnu.org with archive (Exim 4.43)
	id 1Km6X7-0004tl-ET
	for mharc-myserver-commit@gnu.org; Sat, 04 Oct 2008 08:46:53 -0400
Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43)
	id 1Km6X5-0004tQ-4q
	for myserver-commit@gnu.org; Sat, 04 Oct 2008 08:46:51 -0400
Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43)
	id 1Km6X4-0004t6-1w
	for myserver-commit@gnu.org; Sat, 04 Oct 2008 08:46:50 -0400
Received: from [199.232.76.173] (port=47141 helo=monty-python.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.43) id 1Km6X3-0004t3-ST
	for myserver-commit@gnu.org; Sat, 04 Oct 2008 08:46:49 -0400
Received: from savannah.gnu.org ([199.232.41.3]:59455 helo=sv.gnu.org)
	by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32)
	(Exim 4.60) (envelope-from <INVALID.NOREPLY@gnu.org>)
	id 1Km6X3-0000mx-BH
	for myserver-commit@gnu.org; Sat, 04 Oct 2008 08:46:49 -0400
Received: from cvs.savannah.gnu.org ([199.232.41.69])
	by sv.gnu.org with esmtp (Exim 4.63)
	(envelope-from <INVALID.NOREPLY@gnu.org>) id 1Km6X2-0000zH-Lr
	for myserver-commit@gnu.org; Sat, 04 Oct 2008 12:46:48 +0000
Received: from gscrivano by cvs.savannah.gnu.org with local (Exim 4.63)
	(envelope-from <gscrivano@savannah.gnu.org>) id 1Km6X2-0000z9-3G
	for myserver-commit@gnu.org; Sat, 04 Oct 2008 12:46:48 +0000
MIME-Version: 1.0
Errors-To: gscrivano
To: myserver-commit@gnu.org
X-Mailer: SVN::Notify 2.64: http://search.cpan.org/dist/SVN-Notify/
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
From: Giuseppe Scrivano <gscrivano@gnu.org>
Message-Id: <E1Km6X2-0000z9-3G@cvs.savannah.gnu.org>
Date: Sat, 04 Oct 2008 12:46:48 +0000
X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 3)
Subject: [myserver-commit] [2863] Now `SecurityToken' is a class.
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/pipermail/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, 04 Oct 2008 12:46:51 -0000

Revision: 2863
          http://svn.sv.gnu.org/viewvc/?view=rev&root=myserver&revision=2863
Author:   gscrivano
Date:     2008-10-04 12:46:47 +0000 (Sat, 04 Oct 2008)

Log Message:
-----------
Now `SecurityToken' is a class.  Previously it was a struct.

Modified Paths:
--------------
    branches/myserver_sec_new/include/conf/security/security_token.h
    branches/myserver_sec_new/src/conf/security/auth_domain.cpp
    branches/myserver_sec_new/src/conf/security/security_manager.cpp
    branches/myserver_sec_new/src/conf/security/validator.cpp
    branches/myserver_sec_new/src/conf/security/xml_validator.cpp
    branches/myserver_sec_new/tests/Makefile.am

Added Paths:
-----------
    branches/myserver_sec_new/tests/test_security_token.cpp

Modified: branches/myserver_sec_new/include/conf/security/security_token.h
===================================================================
--- branches/myserver_sec_new/include/conf/security/security_token.h	2008-10-03 22:08:55 UTC (rev 2862)
+++ branches/myserver_sec_new/include/conf/security/security_token.h	2008-10-04 12:46:47 UTC (rev 2863)
@@ -41,13 +41,141 @@
   MYSERVER_SERVER_CONF  = (1<<2),
 };
 
-struct SecurityToken
+class SecurityToken
 {
+public:
   SecurityToken();
   void reset();
-  const char* getHashedData(const char* name, int domains);
 
+  const char* getHashedData (const char* name, int domains);
 
+  string& getUser ()
+  {
+    return user;
+  }
+
+  string& getPassword ()
+  {
+    return password;
+  }
+
+	HashMap<string,string*>* getValues ()
+  {
+    return &values;
+  }
+
+  string *getDirectory ()
+  {
+    return directory;
+  }
+
+  string *getSysDirectory ()
+  {
+    return sysdirectory;
+  }
+
+  string *getResource ()
+  {
+    return resource;
+  }
+
+  int getMask ()
+  {
+    return mask;
+  }
+
+  int getProvidedMask ()
+  {
+    return providedMask;
+  }
+  
+  string& getNeededPassword ()
+  {
+    return neededPassword;
+  }
+
+  bool isDone ()
+  {
+    return done;
+  }
+
+  bool isAuthenticated ()
+  {
+    return authenticated;
+  }
+
+
+  Server* getServer ()
+  {
+    return server;
+  }
+
+  Vhost* getVhost ()
+  {
+    return vhost;
+  }
+
+  void setUser (string& u)
+  {
+    user.assign (u);
+  }
+
+  void setPassword (string& pw)
+  {
+    password.assign (pw);
+  }
+
+  void setDirectory (string * d)
+  {
+    directory = d;
+  }
+
+  void setSysDirectory (string * sd)
+  {
+    sysdirectory = sd;
+  }
+
+  void setResource (string *r)
+  {
+    resource = r;
+  }
+
+  int setMask (int m)
+  {
+    mask = m;
+  }
+
+  void setProvidedMask (int p)
+  {
+    providedMask = p;
+  }
+  
+  void setNeededPassword (string& pw)
+  {
+    neededPassword.assign (pw);
+  }
+
+  bool setDone (bool d)
+  {
+    done = d;
+  }
+
+  bool setAuthenticated (bool a)
+  {
+    authenticated = a;
+  }
+
+  void setServer (Server* s)
+  {
+    server = s;
+  }
+
+  void  setVhost (Vhost* v)
+  {
+    vhost = v;
+  }
+
+private:
   /*! User to check for.  */
   string user;
 
@@ -93,6 +221,8 @@
 
 
   ///////OLD NOT USED////////////
+  friend class Http;
+  friend class Ftp;
   char* requiredPassword;
   const char* filename;
   struct HttpThreadContext* td;

Modified: branches/myserver_sec_new/src/conf/security/auth_domain.cpp
===================================================================
--- branches/myserver_sec_new/src/conf/security/auth_domain.cpp	2008-10-03 22:08:55 UTC (rev 2862)
+++ branches/myserver_sec_new/src/conf/security/auth_domain.cpp	2008-10-04 12:46:47 UTC (rev 2863)
@@ -37,16 +37,16 @@
 string *AuthDomain::getValue (string &name)
 {
   if (!name.compare ("user"))
-    return &(securityToken->user);
+    return &(securityToken->getUser ());
 
   if (!name.compare ("password"))
-    return &(securityToken->password);
+    return &(securityToken->getPassword ());
 
   if (!name.compare ("directory"))
-    return securityToken->directory;
+    return securityToken->getDirectory ();
 
   if (!name.compare ("sysdirectory"))
-    return securityToken->sysdirectory;
+    return securityToken->getSysDirectory ();
 
   return NULL;
 }

Modified: branches/myserver_sec_new/src/conf/security/security_manager.cpp
===================================================================
--- branches/myserver_sec_new/src/conf/security/security_manager.cpp	2008-10-03 22:08:55 UTC (rev 2862)
+++ branches/myserver_sec_new/src/conf/security/security_manager.cpp	2008-10-04 12:46:47 UTC (rev 2863)
@@ -21,6 +21,7 @@
 #include <include/conf/security/validator_factory.h>
 #include <include/conf/security/auth_method.h>
 #include <include/conf/security/auth_method_factory.h>
+#include <include/conf/security/security_token.h>
 
 #include <string>
 #include <sstream>

Modified: branches/myserver_sec_new/src/conf/security/validator.cpp
===================================================================
--- branches/myserver_sec_new/src/conf/security/validator.cpp	2008-10-03 22:08:55 UTC (rev 2862)
+++ branches/myserver_sec_new/src/conf/security/validator.cpp	2008-10-04 12:46:47 UTC (rev 2863)
@@ -40,8 +40,8 @@
 {
   HashMap<string, SecurityDomain*> hashedDomains;
 
-  if (st->done)
-    return st->mask;
+  if (st->isDone ())
+    return st->getMask ();
 
   if (domains)
   {
@@ -65,8 +65,8 @@
 {
   HashMap<string, SecurityDomain*> hashedDomains;
 
-  if (st->done)
-    return st->mask;
+  if (st->isDone ())
+    return st->getMask ();
 
   if (domains)
   {
@@ -97,7 +97,7 @@
   if (!getPermissionMaskImpl (st, hashedDomains, authMethod))
     ret = 0;
   
-  st->done = true;
+  st->setDone (true);
 
   return ret;
 }

Modified: branches/myserver_sec_new/src/conf/security/xml_validator.cpp
===================================================================
--- branches/myserver_sec_new/src/conf/security/xml_validator.cpp	2008-10-03 22:08:55 UTC (rev 2862)
+++ branches/myserver_sec_new/src/conf/security/xml_validator.cpp	2008-10-04 12:46:47 UTC (rev 2863)
@@ -60,20 +60,20 @@
 {
   const char *secName;
 
-  SecurityCache *cache = getCache (st->server);
+  SecurityCache *cache = getCache (st->getServer ());
 
   if (!cache)
     return NULL;
 
-  secName = st->vhost ? st->vhost->getHashedData ("SECURITY_FILE_NAME") : NULL;
+  secName = st->getVhost () ? st->getVhost ()->getHashedData ("SECURITY_FILE_NAME") : NULL;
 
   if (!secName)
-    secName = st->server ? st->server->getHashedData ("SECURITY_FILE_NAME") : NULL;
+    secName = st->getServer () ? st->getServer ()->getHashedData ("SECURITY_FILE_NAME") : NULL;
 
   if (!secName)
     secName = ".security.xml";
 
-  return cache->getParser (*st->resource, *st->sysdirectory, false, secName);
+  return cache->getParser (*(st->getResource ()), *(st->getSysDirectory ()), false, secName);
 }
 
 /*!
@@ -111,23 +111,23 @@
     int permissions =  getPermissions (attrs, &name, &password);
 
     if (!name || !password || 
-        xmlStrcmp (name, (const xmlChar *)st->user.c_str ()))
+        xmlStrcmp (name, (const xmlChar *)st->getUser ().c_str ()))
       continue;
 
-    st->providedMask = permissions;
+    st->setProvidedMask (permissions);
 
-    if (xmlStrcmp (password, (const xmlChar *)st->password.c_str ()))
+    if (xmlStrcmp (password, (const xmlChar *)st->getPassword ().c_str ()))
     {
-      st->authenticated = false;
-      st->mask = 0;
+      st->setAuthenticated (false);
+      st->setMask (0);
     }
     else
     {
-      st->authenticated = true;
-      st->mask = permissions;
+      st->setAuthenticated (true);
+      st->setMask (permissions);
     }
     
-    return st->mask;
+    return st->getMask ();
   }
 
   return 0;
@@ -295,10 +295,10 @@
   const xmlChar *value = (const xmlChar*)"";
   xmlAttr *attrs = node->properties;
 
-  st->providedMask =  getPermissions (attrs);
+  st->setProvidedMask (getPermissions (attrs));
 
-  if (st->authenticated)
-    st->mask = st->providedMask;
+  if (st->isAuthenticated ())
+    st->setMask (st->getProvidedMask ());
 }
 
 
@@ -329,7 +329,7 @@
 
   string *valStr = new string ((const char *)value);
 
-  string *old = st->values.put (name, valStr);
+  string *old = st->getValues ()->put (name, valStr);
 
   if (old)
     delete old;

Modified: branches/myserver_sec_new/tests/Makefile.am
===================================================================
--- branches/myserver_sec_new/tests/Makefile.am	2008-10-03 22:08:55 UTC (rev 2862)
+++ branches/myserver_sec_new/tests/Makefile.am	2008-10-04 12:46:47 UTC (rev 2863)
@@ -2,5 +2,5 @@
 #
 
 bin_PROGRAMS = tests_suite
-tests_suite_SOURCES = main.cpp test_connection.cpp test_ftp.cpp test_log_manager.cpp test_mutex.cpp test_security_domain.cpp test_validator.cpp test_auth_domain.cpp test_connections_scheduler.cpp test_gzip.cpp test_log_stream_factory.cpp test_pipe.cpp test_security_manager.cpp test_validator_factory.cpp test_base64.cpp test_file_stream.cpp test_hashmap.cpp test_md5.cpp test_recursive_mutex.cpp test_semaphore.cpp test_xml.cpp test_cached_file_buffer.cpp test_file_stream_creator.cpp test_homedir.cpp test_mem_buff.cpp test_regex.cpp test_socket_stream_creator.cpp test_cached_file.cpp test_files_utility.cpp test_http_request.cpp test_http_req_security_domain.cpp test_mem_stream.cpp test_safetime.cpp test_thread.cpp test_cached_file_factory.cpp test_filter_chain.cpp test_http_response.cpp test_multicast.cpp test_security_cache.cpp test_utility.cpp  test_xml_validator.cpp
+tests_suite_SOURCES = main.cpp test_connection.cpp test_ftp.cpp test_log_manager.cpp test_mutex.cpp test_security_domain.cpp test_validator.cpp test_auth_domain.cpp test_connections_scheduler.cpp test_gzip.cpp test_log_stream_factory.cpp test_pipe.cpp test_security_manager.cpp test_validator_factory.cpp test_base64.cpp test_file_stream.cpp test_hashmap.cpp test_md5.cpp test_recursive_mutex.cpp test_semaphore.cpp test_xml.cpp test_cached_file_buffer.cpp test_file_stream_creator.cpp test_homedir.cpp test_mem_buff.cpp test_regex.cpp test_socket_stream_creator.cpp test_cached_file.cpp test_files_utility.cpp test_http_request.cpp test_http_req_security_domain.cpp test_mem_stream.cpp test_safetime.cpp test_thread.cpp test_cached_file_factory.cpp test_filter_chain.cpp test_http_response.cpp test_multicast.cpp test_security_cache.cpp test_security_token.cpp test_utility.cpp  test_xml_validator.cpp
 tests_suite_LDADD = ../src/libmyserver.a $(CPPUNIT_LDFLAGS) $(PTHREAD_LIB) $(IDN_LIB) $(XNET_LIB) $(EVENT_LIB) $(DL_LIB) $(OPENSSL_LIB) $(ZLIB_LIB) $(XML_LIBS) $(LDFLAGS)

Added: branches/myserver_sec_new/tests/test_security_token.cpp
===================================================================
--- branches/myserver_sec_new/tests/test_security_token.cpp	                        (rev 0)
+++ branches/myserver_sec_new/tests/test_security_token.cpp	2008-10-04 12:46:47 UTC (rev 2863)
@@ -0,0 +1,163 @@
+/*
+ MyServer
+ Copyright (C) 2008 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
+ (at your option) any later version.
+ 
+ This program is distributed in the hope that it will be useful, 
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ GNU General Public License for more details.
+ 
+ You should have received a copy of the GNU General Public License
+ along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include <ctype.h>
+
+#include <cppunit/CompilerOutputter.h>
+#include <cppunit/extensions/TestFactoryRegistry.h>
+#include <cppunit/ui/text/TestRunner.h>
+#include <cppunit/extensions/HelperMacros.h>
+
+#include <include/conf/security/security_manager.h>
+#include <include/conf/security/security_token.h>
+#include <include/conf/vhost/vhost.h>
+#include <include/server/server.h>
+
+#include <string.h>
+
+#include <iostream>
+using namespace std;
+
+
+class TestSecurityToken : public CppUnit::TestFixture
+{
+  CPPUNIT_TEST_SUITE( TestSecurityToken );
+  CPPUNIT_TEST ( testUser);
+  CPPUNIT_TEST ( testPassword);
+	CPPUNIT_TEST ( testValues );
+  CPPUNIT_TEST ( testDirectory );
+  CPPUNIT_TEST ( testSysDirectory );
+  CPPUNIT_TEST ( testResource );
+  CPPUNIT_TEST ( testMask );
+  CPPUNIT_TEST ( testProvidedMask );
+  CPPUNIT_TEST ( testNeededPassword );
+  CPPUNIT_TEST ( testDone );
+  CPPUNIT_TEST ( testAuthenticated );
+  CPPUNIT_TEST ( testServer );
+  CPPUNIT_TEST ( testVhost );
+  CPPUNIT_TEST_SUITE_END();
+
+  SecurityToken* securityToken;
+public:
+  void setUp()
+  {
+    securityToken = new SecurityToken();
+  }
+
+  void tearDown()
+  {
+    delete securityToken;
+  }
+
+
+  void testUser()
+  {
+    string user ("foo");
+    securityToken->setUser (user);
+    CPPUNIT_ASSERT_EQUAL (securityToken->getUser ().compare (user), 0);
+  }
+
+  void testPassword()
+  {
+    string password ("foo");
+    securityToken->setPassword (password);
+    CPPUNIT_ASSERT_EQUAL (securityToken->getPassword ().compare (password), 0);
+  }
+
+	void testValues ()
+  {
+    CPPUNIT_ASSERT (securityToken->getValues ());
+  }
+
+  void testDirectory ()
+  {
+    string dir ("foo");
+    securityToken->setDirectory (&dir);
+    CPPUNIT_ASSERT_EQUAL (securityToken->getDirectory (), &dir);
+  }
+
+  void testSysDirectory ()
+  {
+    string sysDir ("foo");
+    securityToken->setSysDirectory (&sysDir);
+    CPPUNIT_ASSERT_EQUAL (securityToken->getSysDirectory (), &sysDir);
+  }
+
+  void testResource ()
+  {
+    string resource ("foo");
+    securityToken->setResource (&resource);
+    CPPUNIT_ASSERT_EQUAL (securityToken->getResource (), &resource);
+  }
+
+  void testMask ()
+  {
+    int mask = MYSERVER_PERMISSION_READ;
+    securityToken->setMask (mask);
+    CPPUNIT_ASSERT_EQUAL (securityToken->getMask (), mask);
+  }
+
+  void testProvidedMask ()
+  {
+    int mask = MYSERVER_PERMISSION_READ;
+    securityToken->setProvidedMask (mask);
+    CPPUNIT_ASSERT_EQUAL (securityToken->getProvidedMask (), mask);
+  }
+  
+  void testNeededPassword ()
+  {
+    string password ("foo");
+    securityToken->setNeededPassword (password);
+    CPPUNIT_ASSERT_EQUAL (securityToken->getNeededPassword ().compare (password), 0);
+  }
+
+  void testDone ()
+  {
+    securityToken->setDone (true);
+    CPPUNIT_ASSERT_EQUAL (securityToken->isDone (), true);
+
+    securityToken->setDone (false);
+    CPPUNIT_ASSERT_EQUAL (securityToken->isDone (), false);
+  }
+
+  void testAuthenticated ()
+  {
+    securityToken->setAuthenticated (true);
+    CPPUNIT_ASSERT_EQUAL (securityToken->isAuthenticated (), true);
+
+    securityToken->setAuthenticated (false);
+    CPPUNIT_ASSERT_EQUAL (securityToken->isAuthenticated (), false);
+  }
+
+  void testServer ()
+  {
+    Server *s = (Server*)0x10; //XXX: Dirty but it avoids to use the Singleton instance.
+    securityToken->setServer (s);
+    CPPUNIT_ASSERT_EQUAL (securityToken->getServer (), s);
+  }
+  
+  void testVhost ()
+  {
+    Vhost *v = (Vhost*)0x100; //XXX: Dirty.
+    securityToken->setVhost (v);
+    CPPUNIT_ASSERT_EQUAL (securityToken->getVhost (), v);
+  }
+
+};
+
+
+CPPUNIT_TEST_SUITE_REGISTRATION( TestSecurityToken );





From MAILER-DAEMON Sat Oct 04 15:43:05 2008
Received: from mailman by lists.gnu.org with archive (Exim 4.43)
	id 1KmD1t-0007Ne-Pr
	for mharc-myserver-commit@gnu.org; Sat, 04 Oct 2008 15:43:05 -0400
Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43)
	id 1KmD1s-0007NR-Dg
	for myserver-commit@gnu.org; Sat, 04 Oct 2008 15:43:04 -0400
Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43)
	id 1KmD1r-0007N7-CS
	for myserver-commit@gnu.org; Sat, 04 Oct 2008 15:43:04 -0400
Received: from [199.232.76.173] (port=54086 helo=monty-python.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.43) id 1KmD1r-0007N1-96
	for myserver-commit@gnu.org; Sat, 04 Oct 2008 15:43:03 -0400
Received: from savannah.gnu.org ([199.232.41.3]:56065 helo=sv.gnu.org)
	by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32)
	(Exim 4.60) (envelope-from <INVALID.NOREPLY@gnu.org>)
	id 1KmD1q-0003eF-Lk
	for myserver-commit@gnu.org; Sat, 04 Oct 2008 15:43:03 -0400
Received: from cvs.savannah.gnu.org ([199.232.41.69])
	by sv.gnu.org with esmtp (Exim 4.63)
	(envelope-from <INVALID.NOREPLY@gnu.org>) id 1KmD1q-000601-4L
	for myserver-commit@gnu.org; Sat, 04 Oct 2008 19:43:02 +0000
Received: from gscrivano by cvs.savannah.gnu.org with local (Exim 4.63)
	(envelope-from <gscrivano@savannah.gnu.org>) id 1KmD1p-0005zv-LB
	for myserver-commit@gnu.org; Sat, 04 Oct 2008 19:43:02 +0000
MIME-Version: 1.0
Errors-To: gscrivano
To: myserver-commit@gnu.org
X-Mailer: SVN::Notify 2.64: http://search.cpan.org/dist/SVN-Notify/
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
From: Giuseppe Scrivano <gscrivano@gnu.org>
Message-Id: <E1KmD1p-0005zv-LB@cvs.savannah.gnu.org>
Date: Sat, 04 Oct 2008 19:43:01 +0000
X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 3)
Subject: [myserver-commit] [2864] New security used in the HTTP and FTP
	protocols.
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/pipermail/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, 04 Oct 2008 19:43:04 -0000

Revision: 2864
          http://svn.sv.gnu.org/viewvc/?view=rev&root=myserver&revision=2864
Author:   gscrivano
Date:     2008-10-04 19:43:00 +0000 (Sat, 04 Oct 2008)

Log Message:
-----------
New security used in the HTTP and FTP protocols.

Modified Paths:
--------------
    branches/myserver_sec_new/binaries/system/Makefile.am
    branches/myserver_sec_new/include/conf/security/security_cache.h
    branches/myserver_sec_new/include/conf/security/security_manager.h
    branches/myserver_sec_new/include/conf/security/security_token.h
    branches/myserver_sec_new/include/protocol/ftp/ftp.h
    branches/myserver_sec_new/include/protocol/http/http.h
    branches/myserver_sec_new/include/server/server.h
    branches/myserver_sec_new/src/conf/security/security_cache.cpp
    branches/myserver_sec_new/src/conf/security/xml_validator.cpp
    branches/myserver_sec_new/src/protocol/ftp/ftp.cpp
    branches/myserver_sec_new/src/protocol/http/http.cpp
    branches/myserver_sec_new/src/server/server.cpp

Added Paths:
-----------
    branches/myserver_sec_new/binaries/system/.security.xml

Removed Paths:
-------------
    branches/myserver_sec_new/binaries/system/security

Added: branches/myserver_sec_new/binaries/system/.security.xml
===================================================================
--- branches/myserver_sec_new/binaries/system/.security.xml	                        (rev 0)
+++ branches/myserver_sec_new/binaries/system/.security.xml	2008-10-04 19:43:00 UTC (rev 2864)
@@ -0,0 +1,6 @@
+<?xml version="1.0"?>
+<SECURITY>
+
+  <USER name="Guest" password="" READ="YES" EXECUTE="YES" BROWSE="YES" WRITE="NO"/>
+
+</SECURITY>

Modified: branches/myserver_sec_new/binaries/system/Makefile.am
===================================================================
--- branches/myserver_sec_new/binaries/system/Makefile.am	2008-10-04 12:46:47 UTC (rev 2863)
+++ branches/myserver_sec_new/binaries/system/Makefile.am	2008-10-04 19:43:00 UTC (rev 2864)
@@ -1,6 +1,5 @@
 SUBDIRS = errors icons css
 myserverdatadir = $(datadir)/myserver/system
- 
 
-dist_myserverdata_DATA = security
+dist_myserverdata_DATA = .security.xml
 

Deleted: branches/myserver_sec_new/binaries/system/security
===================================================================
--- branches/myserver_sec_new/binaries/system/security	2008-10-04 12:46:47 UTC (rev 2863)
+++ branches/myserver_sec_new/binaries/system/security	2008-10-04 19:43:00 UTC (rev 2864)
@@ -1,8 +0,0 @@
-<?xml version="1.0"?>
-<SECURITY>
-
-
-<USER NAME="Guest" PASS="" READ="TRUE" EXECUTE="TRUE"  WRITE="FALSE" BROWSE="TRUE"/>
-
-</SECURITY>
-

Modified: branches/myserver_sec_new/include/conf/security/security_cache.h
===================================================================
--- branches/myserver_sec_new/include/conf/security/security_cache.h	2008-10-04 12:46:47 UTC (rev 2863)
+++ branches/myserver_sec_new/include/conf/security/security_cache.h	2008-10-04 19:43:00 UTC (rev 2864)
@@ -44,12 +44,7 @@
 	int getSecurityFile (const string &file, const string &sys, string &out, const char* secName = ".security.xml");
 
   /////////OLD NASTY AND DISGUSTING.  TEMPORARY SOLUTION TO DON'T BREAK APIs////////////////////////////////////
-  static class SecurityManager sm;
-  static class AuthMethodFactory authMethodFactory;
-  static class ValidatorFactory validatorFactory;
-
-  int getPermissionMask (SecurityToken* st);
-
+  int getPermissionMask (SecurityToken* st){return 0;}
   int getErrorFileName (const char *root, int error, 
                        const char* sysdirectory, string& out){return 0;}
 private:

Modified: branches/myserver_sec_new/include/conf/security/security_manager.h
===================================================================
--- branches/myserver_sec_new/include/conf/security/security_manager.h	2008-10-04 12:46:47 UTC (rev 2863)
+++ branches/myserver_sec_new/include/conf/security/security_manager.h	2008-10-04 19:43:00 UTC (rev 2864)
@@ -43,6 +43,9 @@
  */
 enum PERMISSION_MASK
 {
+ /*! No permissions.  */
+  MYSERVER_PERMISSION_NONE	  = 0,
+
   /*! Current user can read the file.  */
   MYSERVER_PERMISSION_READ     =	(1<<0),
 
@@ -55,8 +58,11 @@
   /*! Current user can remove the file.  */
   MYSERVER_PERMISSION_DELETE	  = (1<<3),
 
-/*! Current user can browse the directory content.  */
-  MYSERVER_PERMISSION_BROWSE	  = (1<<4)
+  /*! Current user can browse the directory content.  */
+  MYSERVER_PERMISSION_BROWSE	  = (1<<4),
+
+  /*! All permissions.  */
+  MYSERVER_PERMISSION_ALL	  = -1
 };
 
 class SecurityManager

Modified: branches/myserver_sec_new/include/conf/security/security_token.h
===================================================================
--- branches/myserver_sec_new/include/conf/security/security_token.h	2008-10-04 12:46:47 UTC (rev 2863)
+++ branches/myserver_sec_new/include/conf/security/security_token.h	2008-10-04 19:43:00 UTC (rev 2864)
@@ -218,17 +218,6 @@
 
   /*! VHost.  */
   Vhost* vhost;
-
-
-  ///////OLD NOT USED////////////
-  friend class Http;
-  friend class Ftp;
-  char* requiredPassword;
-  const char* filename;
-  struct HttpThreadContext* td;
-  char* authType;
-  int authTypeLen;
-  int throttlingRate;
 };
 
 #endif

Modified: branches/myserver_sec_new/include/protocol/ftp/ftp.h
===================================================================
--- branches/myserver_sec_new/include/protocol/ftp/ftp.h	2008-10-04 12:46:47 UTC (rev 2863)
+++ branches/myserver_sec_new/include/protocol/ftp/ftp.h	2008-10-04 19:43:00 UTC (rev 2864)
@@ -25,7 +25,6 @@
 #include <include/base/mem_buff/mem_buff.h>
 #include <include/base/xml/xml_parser.h>
 #include <include/protocol/ftp/ftp_common.h>
-#include <include/conf/security/security_cache.h>
 
 #include <include/protocol/ftp/ftp_parser.h>
 #include <include/protocol/ftp/ftp_lexer.h>
@@ -139,9 +138,6 @@
 	void RetrStor(bool bRetr, bool bAppend, const std::string &sPath);
 	void RemovePipelinedCmds(MemBuf &In, MemBuf &Out);
 
-	static Mutex secCacheMutex;
-	static SecurityCache secCache;
-
 public:
 	void EscapeTelnet(MemBuf &In, MemBuf &Out);
 

Modified: branches/myserver_sec_new/include/protocol/http/http.h
===================================================================
--- branches/myserver_sec_new/include/protocol/http/http.h	2008-10-04 12:46:47 UTC (rev 2863)
+++ branches/myserver_sec_new/include/protocol/http/http.h	2008-10-04 19:43:00 UTC (rev 2864)
@@ -22,6 +22,7 @@
 #include <include/protocol/http/http_thread_context.h>
 #include <include/protocol/protocol.h>
 #include <include/protocol/http/http_headers.h>
+#include <include/conf/security/security_token.h>
 #include <include/conf/security/security_cache.h>
 #include <include/base/xml/xml_parser.h>
 #include <include/base/thread/thread.h>
@@ -54,10 +55,6 @@
     clearMulticastRegistry();
   }
 
-
-  Mutex secCacheMutex;
-  SecurityCache secCache;
-
   DynHttpCommandManager dynCmdManager;
   DynHttpManagerList dynManagerList;
 
@@ -76,18 +73,22 @@
 public:
   /*! Realm string used by Digest authorization scheme.  */
   char realm[48];
+
   /*! Opaque string used by Digest authorization scheme.  */
   char opaque[48];
+
   /*! Nonce string used by Digest authorization scheme.  */
   char nonce[48];
+
   /*! Cnonce string used by Digest authorization scheme.  */
   char cnonce[48];
-  /*! Password string used by Digest authorization scheme.  */
-  char requiredPassword[32];
+
   /*! Nonce count used by Digest authorization scheme.  */
   u_long nc;
+
   /*! Nonzero if the user was authenticated trough the Digest scheme.  */
   int digest;
+
   /*! Nonzero if the digest was already checked.  */
   int digestChecked;
   HttpUserData();
@@ -187,7 +188,10 @@
 
   static HttpStaticData* getStaticData();
 
+  SecurityToken *getSecurityToken (){return &securityToken;}
+
 protected:
+  SecurityToken securityToken;
   HttpDataHandler* mscgi;
   HttpDataHandler* wincgi;
   HttpDataHandler* isapi;

Modified: branches/myserver_sec_new/include/server/server.h
===================================================================
--- branches/myserver_sec_new/include/server/server.h	2008-10-04 12:46:47 UTC (rev 2863)
+++ branches/myserver_sec_new/include/server/server.h	2008-10-04 19:43:00 UTC (rev 2864)
@@ -46,6 +46,11 @@
 #include <include/base/multicast/multicast.h>
 #include <include/connections_scheduler/connections_scheduler.h>
 
+
+#include <include/conf/security/security_manager.h>
+#include <include/conf/security/auth_method_factory.h>
+#include <include/conf/security/validator_factory.h>
+
 #include <string>
 #include <list>
 using namespace std;
@@ -153,6 +158,7 @@
   void increaseFreeThread();
   void decreaseFreeThread();
 
+  SecurityManager* getSecurityManager (){return &securityManager;}
 
 private:
   friend class ClientsThread;
@@ -251,6 +257,10 @@
   ProcessServerManager processServerManager;
   ConnectionsScheduler connectionsScheduler;
   bool endServer;
+
+  AuthMethodFactory authMethodFactory;
+  ValidatorFactory validatorFactory;
+  SecurityManager securityManager;
 };
 
 #endif

Modified: branches/myserver_sec_new/src/conf/security/security_cache.cpp
===================================================================
--- branches/myserver_sec_new/src/conf/security/security_cache.cpp	2008-10-04 12:46:47 UTC (rev 2863)
+++ branches/myserver_sec_new/src/conf/security/security_cache.cpp	2008-10-04 19:43:00 UTC (rev 2864)
@@ -24,28 +24,6 @@
 #include <string>
 
 using namespace std;
-
-
-AuthMethodFactory SecurityCache::authMethodFactory;
-ValidatorFactory SecurityCache::validatorFactory;
-SecurityManager SecurityCache::sm(&SecurityCache::validatorFactory, &SecurityCache::authMethodFactory);
-
-int SecurityCache::getPermissionMask (SecurityToken* st)
-{
-  string xml("xml"); 
-  if (!validatorFactory.isValidatorPresent (xml))
-  {
-    XmlValidator*xmlV = new XmlValidator ();
-    
-    validatorFactory.addValidator (xml, xmlV);
-    authMethodFactory.addAuthMethod (xml, (AuthMethod*) xmlV);
-  }
-
-  AuthDomain auth (st);
-  SecurityDomain* domains[] = {&auth, NULL};
-  return sm.getPermissionMask (st, domains, xml, xml);
-}
-/////////////////////////////////////////////////////////////////////////////////////
   
 /*!
  *Constructor for the SecurityCache object.
@@ -200,7 +178,6 @@
 
   parser = dictionary.get (file);
 
-
   /*!
    *If the parser is already present and satisfy XPath then use it.
    */

Modified: branches/myserver_sec_new/src/conf/security/xml_validator.cpp
===================================================================
--- branches/myserver_sec_new/src/conf/security/xml_validator.cpp	2008-10-04 12:46:47 UTC (rev 2863)
+++ branches/myserver_sec_new/src/conf/security/xml_validator.cpp	2008-10-04 19:43:00 UTC (rev 2864)
@@ -154,22 +154,22 @@
           attrs->children && attrs->children->content)
         *password = attrs->children->content;
 
-      else if (!xmlStrcmp (attrs->name, (const xmlChar *)"read") &&
+      else if (!xmlStrcmp (attrs->name, (const xmlChar *)"READ") &&
           attrs->children && attrs->children->content &&
           !xmlStrcmp(attrs->children->content, (const xmlChar *) "YES"))
         permissions |= MYSERVER_PERMISSION_READ;
 
-      else if (!xmlStrcmp (attrs->name, (const xmlChar *)"write") &&
+      else if (!xmlStrcmp (attrs->name, (const xmlChar *)"WRITE") &&
           attrs->children && attrs->children->content &&
           !xmlStrcmp(attrs->children->content, (const xmlChar *) "YES"))
         permissions |= MYSERVER_PERMISSION_WRITE;
 
-      else if (!xmlStrcmp (attrs->name, (const xmlChar *)"execute") &&
+      else if (!xmlStrcmp (attrs->name, (const xmlChar *)"EXECUTE") &&
           attrs->children && attrs->children->content &&
           !xmlStrcmp(attrs->children->content, (const xmlChar *) "YES"))
         permissions |= MYSERVER_PERMISSION_EXECUTE;
 
-      else if (!xmlStrcmp (attrs->name, (const xmlChar *)"browse") &&
+      else if (!xmlStrcmp (attrs->name, (const xmlChar *)"BROWSE") &&
           attrs->children && attrs->children->content &&
           !xmlStrcmp(attrs->children->content, (const xmlChar *) "YES"))
         permissions |= MYSERVER_PERMISSION_BROWSE;
@@ -196,11 +196,23 @@
   for (xmlNodePtr cur = xmlFile->getDoc ()->children; cur; cur = cur->next)
     if (cur->type == XML_ELEMENT_NODE)
     {
-      int cmd = 1;
+      int cmd = -1;
 
       computeXmlNode (cur, st, &cmd, hashedDomains);
 
-      return cmd;
+      /* By default return ALLOW.  */
+      if (cmd == -1)
+        return 1;
+
+      if (cmd == 0)
+        return 0;
+
+      if (cmd == 1)
+      {
+        st->setMask (MYSERVER_PERMISSION_ALL);
+        return 1;
+      }
+
     }
 
   return 0;

Modified: branches/myserver_sec_new/src/protocol/ftp/ftp.cpp
===================================================================
--- branches/myserver_sec_new/src/protocol/ftp/ftp.cpp	2008-10-04 12:46:47 UTC (rev 2863)
+++ branches/myserver_sec_new/src/protocol/ftp/ftp.cpp	2008-10-04 19:43:00 UTC (rev 2864)
@@ -28,6 +28,7 @@
 #include <include/base/find_data/find_data.h>
 #include <include/base/string/stringutils.h>
 #include <include/base/mem_buff/mem_buff.h>
+#include <include/conf/security/auth_domain.h>
 #include <assert.h>
 
 #ifndef WIN32
@@ -96,14 +97,6 @@
 }
 
 //////////////////////////////////////////////////////////////////////////////
-// Used at Ftp access control
-/*! Cache for security files. */
-SecurityCache Ftp::secCache;
-
-/*! Access the security cache safely. */
-Mutex Ftp::secCacheMutex;
-
-//////////////////////////////////////////////////////////////////////////////
 // FtpUserData class
 FtpUserData::FtpUserData()
 {
@@ -2389,34 +2382,34 @@
   FilesUtility::splitPath(sPath, sDir, sFileName);
 
   SecurityToken st;
+  string user;
+  string password;
   if ( strcmpi(sUser.c_str(), "anonymous") == 0 )
   {
-    st.user = "Guest";
-    st.password = "";
+    user.assign ("Guest");
+    password.assign("");
   }
   else
   {
-    st.user = sUser.c_str();
-    st.password = sPass.c_str();
+    user.assign (sUser);
+    password.assign (sPass);
   }
-  st.directory = &sDir;
-  st.sysdirectory = (string*)&(td.pConnection->host->getSystemRoot());//pFtpUserData->m_pDataConnection->host->getSystemRoot().c_str();
-  st.authType = 0;
-  st.filename = sFileName.c_str();
-  //st.providedMask = &mask;
-  int perm = 0;
-  secCacheMutex.lock();
-  try
-  {
-    perm = secCache.getPermissionMask (&st);
-            secCacheMutex.unlock();
-  }
-  catch ( ... )
-  {
-    secCacheMutex.unlock();
-    throw;
-  }
-  return (perm & mask);
+
+  st.setUser (user);
+  st.setPassword (password);
+
+
+  st.setDirectory (&sDir);
+  st.setSysDirectory ((string *)&(td.pConnection->host->getSystemRoot ()));
+  st.setResource (&sFileName);
+
+  AuthDomain auth (&st);
+  string xml ("xml");//FIXME: don't hardly-code "xml".
+  SecurityDomain* domains[] = {&auth, NULL};
+
+  Server::getInstance()->getSecurityManager ()->getPermissionMask (&st, domains, xml, xml);
+
+  return (st.getMask () & mask);
 }
 
 void Ftp::Size(const std::string &sPath)

Modified: branches/myserver_sec_new/src/protocol/http/http.cpp
===================================================================
--- branches/myserver_sec_new/src/protocol/http/http.cpp	2008-10-04 12:46:47 UTC (rev 2863)
+++ branches/myserver_sec_new/src/protocol/http/http.cpp	2008-10-04 19:43:00 UTC (rev 2864)
@@ -18,8 +18,10 @@
 
 #include <include/protocol/http/http.h>
 #include <include/protocol/http/http_headers.h>
+#include <include/protocol/http/http_req_security_domain.h>
 #include <include/server/server.h>
 #include <include/conf/security/security.h>
+#include <include/conf/security/auth_domain.h>
 #include <include/base/base64/mime_utils.h>
 #include <include/base/file/file.h>
 #include <include/base/file/files_utility.h>
@@ -348,23 +350,21 @@
 int Http::getFilePermissions(string& filename, string& directory, string& file, 
                              string &filenamePath, int yetmapped, int* permissions)
 {
-  SecurityToken st;
-  char authType[16];
   int providedMask;
 
-  st.server = Server::getInstance();
-  st.resource = &filenamePath;
-  st.directory = &directory;
-  st.sysdirectory = &(td->vhostSys);
+  securityToken.setServer (Server::getInstance());
+  securityToken.setSysDirectory (&(td->vhostSys));
 
-  st.vhost = td->connection->host;
+  securityToken.setVhost (td->connection->host);
 
   try
   {
-    st.authType = authType;
-    st.authTypeLen = 16;
-    st.td = td;
-    FilesUtility::splitPath(filename, directory, file);
+    FilesUtility::splitPath (filename, directory, file);
+    FilesUtility::completePath (directory);
+
+    securityToken.setResource (&filenamePath);
+    securityToken.setDirectory (&directory);
+
     /*!
      *td->filenamePath is the file system mapped path while filename
      *is the uri requested.
@@ -421,66 +421,53 @@
       ((HttpUserData*)(td->connection->protocolBuffer))->reset();
     }
 
+    string user;
+    string password;
+
     if(td->request.auth.length())
     {
-      st.user = td->connection->getLogin();
-      st.password = td->connection->getPassword();
-      st.filename = file.c_str();
-      st.requiredPassword =
-        ((HttpUserData*)td->connection->protocolBuffer)->requiredPassword;
-      staticHttp.secCacheMutex.lock();
-      try
-      {
-        *permissions = staticHttp.secCache.getPermissionMask(&st);
-        staticHttp.secCacheMutex.unlock();
-      }
-      catch(...)
-      {
-        staticHttp.secCacheMutex.unlock();
-        throw;
-      };
+      user.assign (td->connection->getLogin());
+      password.assign (td->connection->getPassword ());
     }
-    else/*! The default user is Guest with a null password. */
+    else
     {
-      st.user = "Guest";
-      st.password = "";
-      st.filename = file.c_str();
-      st.requiredPassword = 0;
-      st.providedMask = 0;
-      staticHttp.secCacheMutex.lock();
-      try
-      {
-        *permissions = staticHttp.secCache.getPermissionMask(&st);
-        staticHttp.secCacheMutex.unlock();
-      }
-      catch(...)
-      {
-        staticHttp.secCacheMutex.unlock();
-        throw;
-      };
+      /* The default user is Guest with a null password. */
+      user.assign ("Guest");
+      password.assign ("");
     }
-    if(*permissions == -1)
-    {
-      td->connection->host->warningsLogRequestAccess(td->id);
-      td->connection->host->warningsLogWrite(
-                                     "Http: Error reading security file");
-      td->connection->host->warningsLogTerminateAccess(td->id);
-      return 500;
-    }
+
+    securityToken.setUser (user);
+    securityToken.setPassword (password);
+
+    AuthDomain auth (&securityToken);
+    HttpReqSecurityDomain httpReqSecDom (&(td->request));
+
+    string xml ("xml");//FIXME: don't hardly-code "xml".
+    SecurityDomain* domains[] = {&auth, &httpReqSecDom, NULL};
+
+    Server::getInstance()->getSecurityManager ()->getPermissionMask (&securityToken, domains, xml, xml);
+
+    const char *authType = securityToken.getHashedData ("http.auth", MYSERVER_SECURITY_CONF |
+                                                        MYSERVER_VHOST_CONF |
+                                                        MYSERVER_SERVER_CONF);
+    *permissions = securityToken.getMask ();
+
     /*! Check if we have to use digest for the current directory. */
-    if(!strcmpi(authType, "Digest"))
+    if(authType && !strcmpi(authType, "Digest"))
     {
+      HttpUserData* hud = (HttpUserData*)td->connection->protocolBuffer;
+
       if(!td->request.auth.compare("Digest"))
       {
-        if(!((HttpUserData*)td->connection->protocolBuffer)->digestChecked)
-          ((HttpUserData*)td->connection->protocolBuffer)->digest =
-            checkDigest();
-        ((HttpUserData*)td->connection->protocolBuffer)->digestChecked = 1;
-        if(((HttpUserData*)td->connection->protocolBuffer)->digest == 1)
+        if(!hud->digestChecked)
+          hud->digest = checkDigest();
+
+        hud->digestChecked = 1;
+
+        if(hud->digest == 1)
         {
-          td->connection->setPassword(
-               ((HttpUserData*)td->connection->protocolBuffer)->requiredPassword);
-          *permissions = providedMask;
+          td->connection->setPassword (securityToken.getNeededPassword ().c_str ());
+          *permissions = securityToken.getProvidedMask ();
         }
       }
       td->authScheme = HTTP_AUTH_SCHEME_DIGEST;
@@ -490,44 +477,19 @@
     {
       td->authScheme = HTTP_AUTH_SCHEME_BASIC;
     }
-    /*! If there are no permissions, use the Guest permissions. */
-    if(td->request.auth.length() && (*permissions==0))
-    {
-      st.user = "Guest";
-      st.password = "";
-      st.filename = file.c_str();
-      st.requiredPassword = 0;
-      st.providedMask = 0;
-      staticHttp.secCacheMutex.lock();
-      try
-      {
-        *permissions = staticHttp.secCache.getPermissionMask(&st);
-        staticHttp.secCacheMutex.unlock();
-      }
-      catch(...)
-      {
-        staticHttp.secCacheMutex.unlock();
-        throw;
-      };
-    }
-    if(*permissions == -1)
-    {
-      td->connection->host->warningsLogRequestAccess(td->id);
-      td->connection->host->warningsLogWrite(
-                             "Http: Error reading security file");
-      td->connection->host->warningsLogTerminateAccess(td->id);
-      return 500;
-    }
   }
   catch(...)
   {
     return 500;
   }
 
+  const char *tr = securityToken.getHashedData ("connection.throttling", MYSERVER_SECURITY_CONF |
+                                                MYSERVER_VHOST_CONF |
+                                                MYSERVER_SERVER_CONF);
 
   /*! If a throttling rate was specifed use it.  */
-  if(st.throttlingRate != -1)
-    td->connection->socket->setThrottling(st.throttlingRate);
+  if(tr)
+    td->connection->socket->setThrottling( atoi (tr));
 
   return 200;
 }
@@ -543,6 +505,9 @@
 {
   string directory;
   string file;
+  int filenamePathLen;
+  string dirscan;
+
   try
   {
     if(td->request.isKeepAlive())
@@ -550,6 +515,73 @@
       td->response.connection.assign( "keep-alive");
     }
 
+    /*!
+     *Get the PATH_INFO value.
+     *Use dirscan as a buffer for put temporary directory scan.
+     *When an '/' character is present check if the path up to '/' character
+     *is a file. If it is a file send the rest of the uri as PATH_INFO.
+     */
+    td->pathInfo.assign("");
+    td->pathTranslated.assign("");
+    filenamePathLen = (int)td->filenamePath.length();
+    dirscan.assign("");
+
+    for(int i = 0, len = 0; i < filenamePathLen ; i++)
+    {
+      /*!
+       *http://host/pathtofile/filetosend.php/PATH_INFO_VALUE?QUERY_INFO_VALUE
+       *When a request has this form send the file filetosend.php with the
+       *environment string PATH_INFO equals to PATH_INFO_VALUE and QUERY_INFO
+       *to QUERY_INFO_VALUE.
+       *
+       *If there is the '/' character check if dirscan is a file.
+       */
+      if(i && (td->filenamePath[i] == '/'))
+      {
+        /*!
+         *If the token is a file.
+         */
+        if(!FilesUtility::isDirectory(dirscan.c_str()))
+        {
+          td->pathInfo.assign((char*) & (td->filenamePath[i]));
+          td->filenamePath.assign(dirscan);
+          break;
+        }
+      }
+
+      if(len + 1 < filenamePathLen)
+      {
+        char db[2];
+        db[0] = (td->filenamePath)[i];
+        db[1] = '\0';
+        dirscan.append(db);
+      }
+    }
+
+    /*!
+     *If there is a PATH_INFO value the get the PATH_TRANSLATED too.
+     *PATH_TRANSLATED is the local filesystem mapped version of PATH_INFO.
+     */
+    if(td->pathInfo.length() > 1)
+    {
+      int ret;
+      /*!
+       *Start from the second character because the first is a
+       *slash character.
+       */
+      ret = getPath(td->pathTranslated, &((td->pathInfo.c_str())[1]), 0);
+
+      if(ret != 200)
+        td->pathTranslated.assign("");
+      else
+        FilesUtility::completePath(td->pathTranslated);
+    }
+    else
+    {
+      td->pathTranslated.assign("");
+    }
+    FilesUtility::completePath(td->filenamePath);
+
     return getFilePermissions(filename, directory, file, 
                              td->filenamePath, yetmapped, permissions);
   }
@@ -632,7 +664,7 @@
   md5.init();
   td->buffer2->setLength(0);
   *td->buffer2 << td->request.digestUsername << ":" << td->request.digestRealm
-      << ":" << ((HttpUserData*)td->connection->protocolBuffer)->requiredPassword;
+               << ":" << securityToken.getNeededPassword();
 
   md5.update((unsigned char const*)td->buffer2->getBuffer(),
              (unsigned int)td->buffer2->getLength());
@@ -692,7 +724,6 @@
   nonce[0] = '\0';
   cnonce[0] = '\0';
   digestChecked = 0;
-  requiredPassword[0] = '\0';
   nc = 0;
   digest = 0;
 }
@@ -710,8 +741,6 @@
   string filename;
   int permissions;
   int providedMask;
-  string dirscan;
-  int filenamePathLen;
   string data;
   int mimecmd;
   time_t lastMT;
@@ -745,77 +774,7 @@
         return raiseHTTPError(ret);
     }
 
-    /* The security file doesn't exist in any case.  */
-    if(!strcmpi(file.c_str(), "security"))
-      return raiseHTTPError(404);
-
     /*!
-     *Get the PATH_INFO value.
-     *Use dirscan as a buffer for put temporary directory scan.
-     *When an '/' character is present check if the path up to '/' character
-     *is a file. If it is a file send the rest of the uri as PATH_INFO.
-     */
-    td->pathInfo.assign("");
-    td->pathTranslated.assign("");
-    filenamePathLen = (int)td->filenamePath.length();
-    dirscan.assign("");
-    for(int i = 0, len = 0; i < filenamePathLen ; i++)
-    {
-      /*!
-       *http://host/pathtofile/filetosend.php/PATH_INFO_VALUE?QUERY_INFO_VALUE
-       *When a request has this form send the file filetosend.php with the
-       *environment string PATH_INFO equals to PATH_INFO_VALUE and QUERY_INFO
-       *to QUERY_INFO_VALUE.
-       *
-       *If there is the '/' character check if dirscan is a file.
-       */
-      if(i && (td->filenamePath[i] == '/'))
-      {
-        /*!
-         *If the token is a file.
-         */
-        if(!FilesUtility::isDirectory(dirscan.c_str()))
-        {
-          td->pathInfo.assign((char*) & (td->filenamePath[i]));
-          td->filenamePath.assign(dirscan);
-          break;
-        }
-      }
-
-      if(len + 1 < filenamePathLen)
-      {
-        char db[2];
-        db[0] = (td->filenamePath)[i];
-        db[1] = '\0';
-        dirscan.append(db);
-      }
-    }
-
-    /*!
-     *If there is a PATH_INFO value the get the PATH_TRANSLATED too.
-     *PATH_TRANSLATED is the local filesystem mapped version of PATH_INFO.
-     */
-    if(td->pathInfo.length() > 1)
-    {
-      int ret;
-      /*!
-       *Start from the second character because the first is a
-       *slash character.
-       */
-      ret = getPath(td->pathTranslated, &((td->pathInfo.c_str())[1]), 0);
-
-      if(ret != 200)
-        td->pathTranslated.assign("");
-      else
-        FilesUtility::completePath(td->pathTranslated);
-    }
-    else
-    {
-      td->pathTranslated.assign("");
-    }
-    FilesUtility::completePath(td->filenamePath);
-
-    /*!
      *If there are not any extension then we do one of this in order:
      *1)We send the default files in the directory in order.
      *2)We send the directory content.
@@ -1969,7 +1928,6 @@
 {
   try
   {
-    string defFile;
     int ret = 0;
     string time;
     ostringstream errorFile;
@@ -2007,23 +1965,16 @@
     }
 
     td->response.httpStatus = ID;
-    staticHttp.secCacheMutex.lock();
 
-    /*!
-     *The specified error file name must be in the web directory
-     *of the virtual host.
-     */
-    if(td->connection->host)
-      ret = staticHttp.secCache.getErrorFileName(td->getVhostDir(), 
-                                                 ID,
-                                                 td->getVhostSys(), 
-                                                 defFile);
-    else
-      ret = -1;
 
-    staticHttp.secCacheMutex.unlock();
+    char errorName [32];
+    sprintf (errorName, "http.error.file.%i", ID);
 
-    if(ret > 0)
+    const char *defErrorFile = securityToken.getHashedData (errorName, MYSERVER_SECURITY_CONF |
+                                                            MYSERVER_VHOST_CONF |
+                                                            MYSERVER_SERVER_CONF);
+
+    if (defErrorFile)
     {
       ostringstream nURL;
       int isPortSpecified = 0;
@@ -2046,7 +1997,7 @@
       if(nURL.str()[nURL.str().length()-1] != '/')
         nURL << "/";
 
-      nURL << defFile;
+      nURL << defErrorFile;
 
       if(td->pathInfo.length())
         nURL << "/" << td->pathInfo;
@@ -2367,8 +2318,6 @@
   string pluginsResource(Server::getInstance()->getExternalPath());
   xmlDocPtr xmlDoc = configurationFileManager->getDoc();
 
-  staticHttp.secCacheMutex.init();
-
   /*
    *Store defaults value.
    *By default use GZIP with files bigger than a MB.
@@ -2488,10 +2437,6 @@
 
   HttpDir::unLoad();
 
-  staticHttp.secCache.free();
-
-  staticHttp.secCacheMutex.destroy();
-
   staticHttp.defaultFilename.clear();
   staticHttp.browseDirCSSpath.assign("");
 

Modified: branches/myserver_sec_new/src/server/server.cpp
===================================================================
--- branches/myserver_sec_new/src/server/server.cpp	2008-10-04 12:46:47 UTC (rev 2863)
+++ branches/myserver_sec_new/src/server/server.cpp	2008-10-04 19:43:00 UTC (rev 2864)
@@ -74,8 +74,11 @@
  */
 Server* Server::instance = 0;
 
-Server::Server() : connectionsScheduler(this),
-                   listenThreads(&connectionsScheduler, this)
+Server::Server() : connectionsScheduler (this),
+                   listenThreads (&connectionsScheduler, this),
+                   authMethodFactory (),
+                   validatorFactory (),
+                   securityManager (&validatorFactory, &authMethodFactory)
 {
   toReboot = false;
   autoRebootEnabled = true;
@@ -496,6 +499,13 @@
  */
 void Server::loadPlugins()
 {
+  string xml("xml"); 
+  //FIXME: xmlV is never freed.
+  XmlValidator *xmlV = new XmlValidator ();
+    
+  validatorFactory.addValidator (xml, xmlV);
+  authMethodFactory.addAuthMethod (xml, (AuthMethod*) xmlV);
+
   if(filtersFactory.insert("gzip", Gzip::factory))
   {
     ostringstream stream;





From MAILER-DAEMON Sat Oct 04 16:35:27 2008
Received: from mailman by lists.gnu.org with archive (Exim 4.43)
	id 1KmDqZ-0003PW-9h
	for mharc-myserver-commit@gnu.org; Sat, 04 Oct 2008 16:35:27 -0400
Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43)
	id 1KmDqV-0003Ol-NK
	for myserver-commit@gnu.org; Sat, 04 Oct 2008 16:35:23 -0400
Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43)
	id 1KmDqT-0003NI-2B
	for myserver-commit@gnu.org; Sat, 04 Oct 2008 16:35:23 -0400
Received: from [199.232.76.173] (port=38414 helo=monty-python.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.43) id 1KmDqS-0003NF-Ro
	for myserver-commit@gnu.org; Sat, 04 Oct 2008 16:35:20 -0400
Received: from savannah.gnu.org ([199.232.41.3]:38793 helo=sv.gnu.org)
	by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32)
	(Exim 4.60) (envelope-from <INVALID.NOREPLY@gnu.org>)
	id 1KmDqR-0007yl-87
	for myserver-commit@gnu.org; Sat, 04 Oct 2008 16:35:20 -0400
Received: from cvs.savannah.gnu.org ([199.232.41.69])
	by sv.gnu.org with esmtp (Exim 4.63)
	(envelope-from <INVALID.NOREPLY@gnu.org>) id 1KmDqP-0006vP-Ci
	for myserver-commit@gnu.org; Sat, 04 Oct 2008 20:35:18 +0000
Received: from gscrivano by cvs.savannah.gnu.org with local (Exim 4.63)
	(envelope-from <gscrivano@savannah.gnu.org>) id 1KmDqI-0006v7-0h
	for myserver-commit@gnu.org; Sat, 04 Oct 2008 20:35:12 +0000
MIME-Version: 1.0
Errors-To: gscrivano
To: myserver-commit@gnu.org
X-Mailer: SVN::Notify 2.64: http://search.cpan.org/dist/SVN-Notify/
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
From: Giuseppe Scrivano <gscrivano@gnu.org>
Message-Id: <E1KmDqI-0006v7-0h@cvs.savannah.gnu.org>
Date: Sat, 04 Oct 2008 20:35:10 +0000
X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 3)
Subject: [myserver-commit] [2865]
 New security implementation merged to trunk from the `myserver_sec_new'
 branch.
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/pipermail/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, 04 Oct 2008 20:35:24 -0000

Revision: 2865
          http://svn.sv.gnu.org/viewvc/?view=rev&root=myserver&revision=2865
Author:   gscrivano
Date:     2008-10-04 20:35:08 +0000 (Sat, 04 Oct 2008)

Log Message:
-----------
New security implementation merged to trunk from the `myserver_sec_new' branch.

Modified Paths:
--------------
    trunk/myserver/binaries/system/Makefile.am
    trunk/myserver/include/base/xml/xml_parser.h
    trunk/myserver/include/conf/security/Makefile.am
    trunk/myserver/include/conf/security/security_cache.h
    trunk/myserver/include/protocol/ftp/ftp.h
    trunk/myserver/include/protocol/http/Makefile.am
    trunk/myserver/include/protocol/http/http.h
    trunk/myserver/include/server/server.h
    trunk/myserver/src/conf/security/Makefile.am
    trunk/myserver/src/conf/security/security_cache.cpp
    trunk/myserver/src/http_handler/http_dir/http_dir.cpp
    trunk/myserver/src/protocol/ftp/ftp.cpp
    trunk/myserver/src/protocol/http/Makefile.am
    trunk/myserver/src/protocol/http/http.cpp
    trunk/myserver/src/server/server.cpp
    trunk/myserver/tests/Makefile.am

Added Paths:
-----------
    trunk/myserver/binaries/system/.security.xml
    trunk/myserver/include/conf/security/auth_domain.h
    trunk/myserver/include/conf/security/auth_method.h
    trunk/myserver/include/conf/security/auth_method_factory.h
    trunk/myserver/include/conf/security/security.h
    trunk/myserver/include/conf/security/security_domain.h
    trunk/myserver/include/conf/security/security_manager.h
    trunk/myserver/include/conf/security/security_token.h
    trunk/myserver/include/conf/security/validator.h
    trunk/myserver/include/conf/security/validator_factory.h
    trunk/myserver/include/conf/security/xml_validator.h
    trunk/myserver/include/protocol/http/http_req_security_domain.h
    trunk/myserver/src/conf/security/auth_domain.cpp
    trunk/myserver/src/conf/security/auth_method.cpp
    trunk/myserver/src/conf/security/auth_method_factory.cpp
    trunk/myserver/src/conf/security/security_domain.cpp
    trunk/myserver/src/conf/security/security_manager.cpp
    trunk/myserver/src/conf/security/security_token.cpp
    trunk/myserver/src/conf/security/validator.cpp
    trunk/myserver/src/conf/security/validator_factory.cpp
    trunk/myserver/src/conf/security/xml_validator.cpp
    trunk/myserver/src/protocol/http/http_req_security_domain.cpp
    trunk/myserver/tests/test_auth_domain.cpp
    trunk/myserver/tests/test_http_req_security_domain.cpp
    trunk/myserver/tests/test_security_cache.cpp
    trunk/myserver/tests/test_security_domain.cpp
    trunk/myserver/tests/test_security_manager.cpp
    trunk/myserver/tests/test_security_token.cpp
    trunk/myserver/tests/test_validator.cpp
    trunk/myserver/tests/test_validator_factory.cpp
    trunk/myserver/tests/test_xml_validator.cpp

Removed Paths:
-------------
    trunk/myserver/binaries/system/security
    trunk/myserver/include/conf/security/security.h
    trunk/myserver/src/conf/security/security.cpp

Copied: trunk/myserver/binaries/system/.security.xml (from rev 2864, branches/myserver_sec_new/binaries/system/.security.xml)
===================================================================
--- trunk/myserver/binaries/system/.security.xml	                        (rev 0)
+++ trunk/myserver/binaries/system/.security.xml	2008-10-04 20:35:08 UTC (rev 2865)
@@ -0,0 +1,6 @@
+<?xml version="1.0"?>
+<SECURITY>
+
+  <USER name="Guest" password="" READ="YES" EXECUTE="YES" BROWSE="YES" WRITE="NO"/>
+
+</SECURITY>

Modified: trunk/myserver/binaries/system/Makefile.am
===================================================================
--- trunk/myserver/binaries/system/Makefile.am	2008-10-04 19:43:00 UTC (rev 2864)
+++ trunk/myserver/binaries/system/Makefile.am	2008-10-04 20:35:08 UTC (rev 2865)
@@ -1,6 +1,5 @@
 SUBDIRS = errors icons css
 myserverdatadir = $(datadir)/myserver/system
- 
 
-dist_myserverdata_DATA = security
+dist_myserverdata_DATA = .security.xml
 

Deleted: trunk/myserver/binaries/system/security
===================================================================
--- trunk/myserver/binaries/system/security	2008-10-04 19:43:00 UTC (rev 2864)
+++ trunk/myserver/binaries/system/security	2008-10-04 20:35:08 UTC (rev 2865)
@@ -1,8 +0,0 @@
-<?xml version="1.0"?>
-<SECURITY>
-
-
-<USER NAME="Guest" PASS="" READ="TRUE" EXECUTE="TRUE"  WRITE="FALSE" BROWSE="TRUE"/>
-
-</SECURITY>
-

Modified: trunk/myserver/include/base/xml/xml_parser.h
===================================================================
--- trunk/myserver/include/base/xml/xml_parser.h	2008-10-04 19:43:00 UTC (rev 2864)
+++ trunk/myserver/include/base/xml/xml_parser.h	2008-10-04 20:35:08 UTC (rev 2865)
@@ -54,58 +54,58 @@
 class XmlParser
 {
 public:
-	static bool startXML();
+  static bool startXML();
   static bool cleanXML();
-	XmlParser();
-	~XmlParser();
-	xmlDocPtr getDoc();
-	int open(const char* filename, bool useXpath = 0);
-	int open(string const &filename, bool useXpath = 0){return open(filename.c_str(), useXpath);};
-	int openMemBuf(MemBuf &, bool useXpath = 0);
+  XmlParser();
+  ~XmlParser();
+  xmlDocPtr getDoc();
+  int open(const char* filename, bool useXpath = 0);
+  int open(string const &filename, bool useXpath = 0){return open(filename.c_str(), useXpath);};
+  int openMemBuf(MemBuf &, bool useXpath = 0);
 
-	char *getValue(const char* field);
-	char *getValue(string const &field){return getValue(field.c_str());};
-	char *getAttr(const char* field, const char *attr);
-	int setValue(const char* field, const char *value);
-	int close();
+  char *getValue(const char* field);
+  char *getValue(string const &field){return getValue(field.c_str());};
+  char *getAttr(const char* field, const char *attr);
+  int setValue(const char* field, const char *value);
+  int close();
 
-	int save(const char *filename,int *nbytes = 0);
-	int save(string const &filename,int *nbytes = 0){return save(filename.c_str(), nbytes);};
-	int saveMemBuf(MemBuf &,int *nbytes = 0);
+  int save(const char *filename, int *nbytes = 0);
+  int save(string const &filename, int *nbytes = 0){return save(filename.c_str(), nbytes);};
+  int saveMemBuf(MemBuf &, int *nbytes = 0);
 
-	void newfile(const char * root);
-	void newfile(string const &root){newfile(root.c_str());};
-	void addChild(const char * name, const char * value);
-	void addChild(string const &name, string& value)
+  void newfile(const char * root);
+  void newfile(string const &root){newfile(root.c_str());};
+  void addChild(const char * name, const char * value);
+  void addChild(string const &name, string& value)
   {addChild(name.c_str(), value.c_str());};
-	void addGroup(const char * name);
-	void addGroup(string const &name)
+  void addGroup(const char * name);
+  void addGroup(string const &name)
   {addGroup(name.c_str());};
-	void endGroup();
+  void endGroup();
 
-	void setAttr(const char * name, const char * value);
+  void setAttr(const char * name, const char * value);
 
-	void setAttr(string& name, string& value)
-	{
-		setAttr(name.c_str(), value.c_str());
-	};
+  void setAttr(string& name, string& value)
+  {
+    setAttr(name.c_str(), value.c_str());
+  };
     
-	void addLineFeed();
-	time_t getLastModTime();
-	
+  void addLineFeed();
+  time_t getLastModTime();
+  
   XmlXPathResult* evaluateXpath(string & path){return evaluateXpath(path.c_str());}
   XmlXPathResult* evaluateXpath(const char*);
   bool isXpathEnabled(){return useXpath;}
+
 private:
   xmlXPathContextPtr xpathCtx;
   bool useXpath;
-	xmlDocPtr doc;
-	string buffer;
-	xmlNodePtr cur;
-	xmlNodePtr prevCur;
-	xmlNodePtr lastNode;
-	time_t mtime;
-
+  xmlDocPtr doc;
+  string buffer;
+  xmlNodePtr cur;
+  xmlNodePtr prevCur;
+  xmlNodePtr lastNode;
+  time_t mtime;
 };
 
 #endif

Modified: trunk/myserver/include/conf/security/Makefile.am
===================================================================
--- trunk/myserver/include/conf/security/Makefile.am	2008-10-04 19:43:00 UTC (rev 2864)
+++ trunk/myserver/include/conf/security/Makefile.am	2008-10-04 20:35:08 UTC (rev 2865)
@@ -1,4 +1,4 @@
 securityincludedir=$(includedir)/myserver/include/conf/security
-securityinclude_HEADERS = security_cache.h security.h
+securityinclude_HEADERS = auth_domain.h auth_method.h auth_method_factory.h security_cache.h security_domain.h security_manager.h security_token.h validator.h validator_factory.h xml_validator.h
 SUBDIRS =
 

Copied: trunk/myserver/include/conf/security/auth_domain.h (from rev 2864, branches/myserver_sec_new/include/conf/security/auth_domain.h)
===================================================================
--- trunk/myserver/include/conf/security/auth_domain.h	                        (rev 0)
+++ trunk/myserver/include/conf/security/auth_domain.h	2008-10-04 20:35:08 UTC (rev 2865)
@@ -0,0 +1,42 @@
+/* -*- mode: c++ -*- */
+/*
+MyServer
+Copyright (C) 2008 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
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program.  If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef AUTH_DOMAIN_H
+#define AUTH_DOMAIN_H
+
+#include "stdafx.h"
+#include <include/conf/security/security_domain.h>
+
+#include <string>
+
+using namespace std;
+
+struct SecurityToken;
+
+class AuthDomain : public SecurityDomain
+{
+public:
+  AuthDomain (SecurityToken*);
+  virtual ~AuthDomain ();
+  virtual string *getValue (string &name);
+protected:
+  string name;
+  SecurityToken *securityToken;
+};
+
+#endif

Copied: trunk/myserver/include/conf/security/auth_method.h (from rev 2864, branches/myserver_sec_new/include/conf/security/auth_method.h)
===================================================================
--- trunk/myserver/include/conf/security/auth_method.h	                        (rev 0)
+++ trunk/myserver/include/conf/security/auth_method.h	2008-10-04 20:35:08 UTC (rev 2865)
@@ -0,0 +1,36 @@
+/* -*- mode: c++ -*- */
+/*
+MyServer
+Copyright (C) 2002, 2003, 2004, 2008 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
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program.  If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef AUTH_METHOD_H
+#define AUTH_METHOD_H
+
+#include "stdafx.h"
+#include <include/conf/security/security_manager.h>
+
+using namespace std;
+
+class AuthMethod
+{
+public:
+  AuthMethod ();
+  virtual ~AuthMethod();
+
+  virtual int getPermissionMask (SecurityToken* st);
+};
+
+#endif

Copied: trunk/myserver/include/conf/security/auth_method_factory.h (from rev 2864, branches/myserver_sec_new/include/conf/security/auth_method_factory.h)
===================================================================
--- trunk/myserver/include/conf/security/auth_method_factory.h	                        (rev 0)
+++ trunk/myserver/include/conf/security/auth_method_factory.h	2008-10-04 20:35:08 UTC (rev 2865)
@@ -0,0 +1,41 @@
+/*
+MyServer
+Copyright (C) 2008 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
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program.  If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef AUTH_METHOD_FACTORY_H
+#define AUTH_METHOD_FACTORY_H
+
+#include "stdafx.h"
+#include <include/base/hash_map/hash_map.h>
+#include <string>
+
+using namespace std;
+
+class AuthMethod;
+
+
+class AuthMethodFactory
+{
+public:
+  AuthMethodFactory ();
+  virtual ~AuthMethodFactory ();
+  AuthMethod* getAuthMethod (string &name);
+  AuthMethod* addAuthMethod (string &name, AuthMethod* authMethod);
+  bool isAuthMethodPresent (string &name);
+private:
+	HashMap<string, AuthMethod*> authMethods;
+};
+#endif

Deleted: trunk/myserver/include/conf/security/security.h
===================================================================
--- trunk/myserver/include/conf/security/security.h	2008-10-04 19:43:00 UTC (rev 2864)
+++ trunk/myserver/include/conf/security/security.h	2008-10-04 20:35:08 UTC (rev 2865)
@@ -1,121 +0,0 @@
-/* -*- mode: c++ -*- */
-/*
-MyServer
-Copyright (C) 2002, 2003, 2004, 2008 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
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program.  If not, see <http://www.gnu.org/licenses/>.
-*/
-
-#ifndef SECURITY_H
-#define SECURITY_H
-
-#include "stdafx.h"
-#include <include/connection/connection.h>
-#include <include/base/xml/xml_parser.h>
-#include <include/base/hash_map/hash_map.h>
-#include <include/protocol/http/http_headers.h>
-
-#ifndef DO_NOT_USE_SSL
-#include<openssl/ssl.h>
-#include<openssl/crypto.h>
-#include<openssl/lhash.h>
-#include<openssl/err.h>
-#include<openssl/bn.h>
-#include<openssl/pem.h>
-#include<openssl/x509.h>
-#include<openssl/rand.h>
-#include<openssl/pem.h>
-#include<openssl/err.h>
-#include<openssl/rsa.h>
-#endif
-
-#include <string>
-
-using namespace std;
-
-/*!
- *Various permissions flags.
- */
-
-/*! Current user can read the file. */
-const u_long MYSERVER_PERMISSION_READ     =	(1<<0);
-
-/*! Current user can write to the file. */
-const u_long MYSERVER_PERMISSION_WRITE	  = (1<<1);
-
-/*! Current user can execute the file. */
-const u_long MYSERVER_PERMISSION_EXECUTE  = (1<<2);
-
-/*! Current user can remove the file. */
-const u_long MYSERVER_PERMISSION_DELETE	  = (1<<3);
-
-/*! Current user can browse the directory content. */
-const u_long MYSERVER_PERMISSION_BROWSE	  = (1<<4);
-
-struct SecurityToken
-{
-  /*! User to check for. */
-  const char* user;
-
-  /*! Password provided by the user. */
-  const char* password;
-
-  /*! Directory that the user is in. */
-  const char* directory;
-
-  /*! System directory for the host. */
-  const char* sysdirectory;
-
-  /*! File that the user tried to access. */
-  const char* filename;
-
-  /*! 
-   *Password that the user should provide to have access. 
-   *This is used in authorization schemes like the HTTP digest,
-   *where the password is not sent in clear on the network.
-   */
-  char *requiredPassword;
-
-  /*! Permission mask that the user will have providing [neededPassword]. */
-  int *providedMask;
-
-  struct HttpThreadContext* td;
-
-  /*! Authorization scheme to use. */
-  char* authType;
-
-  /*! Length for the [authType] allocated string. */
-  int authTypeLen;
-
-  /*! Throttling rate to use with specified user. */
-  int throttlingRate;
-
-	HashMap<string,string*> *otherValues;
-
-  SecurityToken();
-  void reset();
-};
-
-class SecurityManager
-{
-public:
-  SecurityManager();
-  ~SecurityManager();
-  int getErrorFileName(const char *sysDir, int error, string& out, 
-                       XmlParser* parser = 0);
-  int getPermissionMask(SecurityToken* st, XmlParser* parser = 0);
-private:
-  XmlParser* getParser(const char *sysDir);
-  bool checkActions(HttpThreadContext* td,  xmlNode *root);
-};
-#endif

Copied: trunk/myserver/include/conf/security/security.h (from rev 2864, branches/myserver_sec_new/include/conf/security/security.h)
===================================================================
--- trunk/myserver/include/conf/security/security.h	                        (rev 0)
+++ trunk/myserver/include/conf/security/security.h	2008-10-04 20:35:08 UTC (rev 2865)
@@ -0,0 +1,2 @@
+//////KEEP THIS FILE TO DON'T BREAK OLD APIs
+#include <include/conf/security/security_manager.h>

Modified: trunk/myserver/include/conf/security/security_cache.h
===================================================================
--- trunk/myserver/include/conf/security/security_cache.h	2008-10-04 19:43:00 UTC (rev 2864)
+++ trunk/myserver/include/conf/security/security_cache.h	2008-10-04 20:35:08 UTC (rev 2865)
@@ -18,29 +18,38 @@
 #ifndef SECURITY_CACHE_H
 #define SECURITY_CACHE_H
 #include <include/base/hash_map/hash_map.h>
-#include <include/conf/security/security.h>
+#include <include/conf/security/security_manager.h>
 
+#include <include/conf/security/auth_method_factory.h>
+#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 <string>
 
 using namespace std;
 
 class SecurityCache
 {
+
 public:
-  SecurityCache();
-  ~SecurityCache();
-  void free();
-  void setMaxNodes(int);
-  int getMaxNodes();
-  XmlParser* getParser(const char* dir, const char* sys, bool useXpath = true);
-	int getSecurityFile(const char* file, const char* sys, string& out);
-  int getPermissionMask(SecurityToken* st);
-  int getErrorFileName(const char *root, int error, 
-                       const char* sysdirectory, string& out);
+  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");
+	int getSecurityFile (const string &file, const string &sys, string &out, const char* secName = ".security.xml");
+
+  /////////OLD NASTY AND DISGUSTING.  TEMPORARY SOLUTION TO DON'T BREAK APIs////////////////////////////////////
+  int getPermissionMask (SecurityToken* st){return 0;}
+  int getErrorFileName (const char *root, int error, 
+                       const char* sysdirectory, string& out){return 0;}
 private:
-  /*! Object used to handle security on the server. */
-  SecurityManager sm;
-  /*! Store a list of opened files using a hash dictionary. */
+
+  /*! Store a list of opened files using a hash dictionary.  */
   HashMap<string, XmlParser*> dictionary;
   int limit;
 };

Copied: trunk/myserver/include/conf/security/security_domain.h (from rev 2864, branches/myserver_sec_new/include/conf/security/security_domain.h)
===================================================================
--- trunk/myserver/include/conf/security/security_domain.h	                        (rev 0)
+++ trunk/myserver/include/conf/security/security_domain.h	2008-10-04 20:35:08 UTC (rev 2865)
@@ -0,0 +1,41 @@
+/* -*- mode: c++ -*- */
+/*
+MyServer
+Copyright (C) 2008 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
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program.  If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef SECURITY_DOMAIN_H
+#define SECURITY_DOMAIN_H
+
+#include "stdafx.h"
+
+#include <string>
+
+using namespace std;
+
+class SecurityDomain
+{
+public:
+  SecurityDomain ();
+  SecurityDomain (const char* name);
+  SecurityDomain (string &name);
+  virtual ~SecurityDomain ();
+  virtual string *getValue (string &name);
+  string& getName(){return name;}
+protected:
+  string name;
+};
+
+#endif

Copied: trunk/myserver/include/conf/security/security_manager.h (from rev 2864, branches/myserver_sec_new/include/conf/security/security_manager.h)
===================================================================
--- trunk/myserver/include/conf/security/security_manager.h	                        (rev 0)
+++ trunk/myserver/include/conf/security/security_manager.h	2008-10-04 20:35:08 UTC (rev 2865)
@@ -0,0 +1,94 @@
+/* -*- mode: c++ -*- */
+/*
+MyServer
+Copyright (C) 2002, 2003, 2004, 2008 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
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program.  If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef SECURITY_MANAGER_H
+#define SECURITY_MANAGER_H
+
+#include "stdafx.h"
+#include <include/conf/security/security_token.h>
+#include <include/connection/connection.h>
+#include <include/base/xml/xml_parser.h>
+#include <include/protocol/http/http_headers.h>
+#include <include/base/hash_map/hash_map.h>
+
+#include <string>
+
+using namespace std;
+
+class AuthMethod;
+class Validator;
+class SecurityDomain;
+class AuthMethodFactory;
+class ValidatorFactory;
+class Vhost;
+class Server;
+
+/*!
+ *Define permissions flags.
+ */
+enum PERMISSION_MASK
+{
+ /*! No permissions.  */
+  MYSERVER_PERMISSION_NONE	  = 0,
+
+  /*! Current user can read the file.  */
+  MYSERVER_PERMISSION_READ     =	(1<<0),
+
+  /*! Current user can write to the file.  */
+  MYSERVER_PERMISSION_WRITE	  = (1<<1),
+
+  /*! Current user can execute the file.  */
+  MYSERVER_PERMISSION_EXECUTE  = (1<<2),
+
+  /*! Current user can remove the file.  */
+  MYSERVER_PERMISSION_DELETE	  = (1<<3),
+
+  /*! Current user can browse the directory content.  */
+  MYSERVER_PERMISSION_BROWSE	  = (1<<4),
+
+  /*! All permissions.  */
+  MYSERVER_PERMISSION_ALL	  = -1
+};
+
+class SecurityManager
+{
+public:
+  SecurityManager(ValidatorFactory*, AuthMethodFactory*);
+  ~SecurityManager();
+
+  int getPermissionMask (SecurityToken* st, 
+                         SecurityDomain **domains, 
+                         string& validator,
+                         string& authMethod);
+
+  int getPermissionMask (SecurityToken* st, 
+                         list<SecurityDomain*> *domains, 
+                         string& validator,
+                         string& authMethod);
+
+private:
+  int getValidatorAndAuthMethod (string &validatorName,
+                                 string &authMethodName,
+                                 Validator **validator,
+                                 AuthMethod **authMethod);
+
+  ValidatorFactory *validatorFactory;
+  AuthMethodFactory *authMethodFactory;
+};
+
+#endif

Copied: trunk/myserver/include/conf/security/security_token.h (from rev 2864, branches/myserver_sec_new/include/conf/security/security_token.h)
===================================================================
--- trunk/myserver/include/conf/security/security_token.h	                        (rev 0)
+++ trunk/myserver/include/conf/security/security_token.h	2008-10-04 20:35:08 UTC (rev 2865)
@@ -0,0 +1,223 @@
+/* -*- mode: c++ -*- */
+/*
+MyServer
+Copyright (C) 2002, 2003, 2004, 2008 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
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program.  If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef SECURITY_TOKEN_H
+#define SECURITY_TOKEN_H
+
+#include "stdafx.h"
+#include <include/base/hash_map/hash_map.h>
+
+#include <string>
+
+using namespace std;
+
+class Server;
+class Vhost;
+
+enum SECURITY_RING
+{
+  /*! Security file configuration.  */
+  MYSERVER_SECURITY_CONF     =	(1<<0),
+
+  /*! Virtual host configuration.  */
+  MYSERVER_VHOST_CONF	  = (1<<1),
+
+  /*! Global server configuration. */
+  MYSERVER_SERVER_CONF  = (1<<2),
+};
+
+class SecurityToken
+{
+public:
+  SecurityToken();
+  void reset();
+
+  const char* getHashedData (const char* name, int domains);
+
+  string& getUser ()
+  {
+    return user;
+  }
+
+  string& getPassword ()
+  {
+    return password;
+  }
+
+	HashMap<string,string*>* getValues ()
+  {
+    return &values;
+  }
+
+  string *getDirectory ()
+  {
+    return directory;
+  }
+
+  string *getSysDirectory ()
+  {
+    return sysdirectory;
+  }
+
+  string *getResource ()
+  {
+    return resource;
+  }
+
+  int getMask ()
+  {
+    return mask;
+  }
+
+  int getProvidedMask ()
+  {
+    return providedMask;
+  }
+  
+  string& getNeededPassword ()
+  {
+    return neededPassword;
+  }
+
+  bool isDone ()
+  {
+    return done;
+  }
+
+  bool isAuthenticated ()
+  {
+    return authenticated;
+  }
+
+
+  Server* getServer ()
+  {
+    return server;
+  }
+
+  Vhost* getVhost ()
+  {
+    return vhost;
+  }
+
+  void setUser (string& u)
+  {
+    user.assign (u);
+  }
+
+  void setPassword (string& pw)
+  {
+    password.assign (pw);
+  }
+
+  void setDirectory (string * d)
+  {
+    directory = d;
+  }
+
+  void setSysDirectory (string * sd)
+  {
+    sysdirectory = sd;
+  }
+
+  void setResource (string *r)
+  {
+    resource = r;
+  }
+
+  int setMask (int m)
+  {
+    mask = m;
+  }
+
+  void setProvidedMask (int p)
+  {
+    providedMask = p;
+  }
+  
+  void setNeededPassword (string& pw)
+  {
+    neededPassword.assign (pw);
+  }
+
+  bool setDone (bool d)
+  {
+    done = d;
+  }
+
+  bool setAuthenticated (bool a)
+  {
+    authenticated = a;
+  }
+
+  void setServer (Server* s)
+  {
+    server = s;
+  }
+
+  void  setVhost (Vhost* v)
+  {
+    vhost = v;
+  }
+
+private:
+  /*! User to check for.  */
+  string user;
+
+  /*! Password provided by the user.  */
+  string password;
+
+  /*! Directory that the user is in.  */
+  string *directory;
+
+  /*! System directory for the host.  */
+  string *sysdirectory;
+
+  /*! Resource that the user tried to access.  */
+  string *resource;
+
+  /*! Permission mask.  */
+  int mask;
+
+  /*!
+   *Password that the user should provide to have access. 
+   *This is used in authorization schemes like the HTTP digest,
+   *where the password is not sent in clear on the network.
+   */
+  string neededPassword;
+
+  /*! The provided password is correct.  */
+  bool authenticated;
+ 
+  /*! The obtained mask if password were correct.  */
+  int providedMask;
+
+  /*! Stored values.  */
+	HashMap<string,string*> values;
+
+  /*! If it is true the security manager will use the cached values.  */
+  bool done;
+
+  /*! Server instance.  */
+  Server* server;
+
+  /*! VHost.  */
+  Vhost* vhost;
+};
+
+#endif

Copied: trunk/myserver/include/conf/security/validator.h (from rev 2864, branches/myserver_sec_new/include/conf/security/validator.h)
===================================================================
--- trunk/myserver/include/conf/security/validator.h	                        (rev 0)
+++ trunk/myserver/include/conf/security/validator.h	2008-10-04 20:35:08 UTC (rev 2865)
@@ -0,0 +1,67 @@
+/* -*- mode: c++ -*- */
+/*
+MyServer
+Copyright (C) 2008 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
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program.  If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef VALIDATOR_H
+#define VALIDATOR_H
+
+#include "stdafx.h"
+#include <include/base/hash_map/hash_map.h>
+
+#include <include/conf/security/auth_method.h>
+#include <include/conf/security/security_domain.h>
+#include <include/conf/security/security_manager.h>
+
+#include <list>
+using namespace std;
+
+
+class Validator
+{
+public:
+  Validator ();
+  virtual ~Validator ();
+
+  int getPermissionMask (SecurityToken* st, 
+                         SecurityDomain **domains,
+                         AuthMethod* authMethod);
+
+  int getPermissionMask (SecurityToken* st, 
+                         list<SecurityDomain*> *domains,
+                         AuthMethod* authMethod);
+
+  virtual int getPermissionMaskImpl (SecurityToken* st,
+                                     HashMap<string, SecurityDomain*> *hashedDomains,
+                                     AuthMethod* authMethod);
+
+
+  string *getValue (HashMap<string, SecurityDomain*> *hashedDomains,
+                    string &name);
+protected:
+  inline void addDomain (HashMap<string, SecurityDomain*> *hashedDomains,
+                         SecurityDomain *domain)
+                        {
+                          string &name = domain->getName ();
+                          hashedDomains->put (name, domain);
+                        }
+
+  int getPermissionMaskInt (SecurityToken* st, 
+                            HashMap<string, SecurityDomain*> *hashedDomains,
+                            AuthMethod* authMethod);
+};
+
+#endif

Copied: trunk/myserver/include/conf/security/validator_factory.h (from rev 2864, branches/myserver_sec_new/include/conf/security/validator_factory.h)
===================================================================
--- trunk/myserver/include/conf/security/validator_factory.h	                        (rev 0)
+++ trunk/myserver/include/conf/security/validator_factory.h	2008-10-04 20:35:08 UTC (rev 2865)
@@ -0,0 +1,41 @@
+/*
+MyServer
+Copyright (C) 2008 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
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program.  If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef VALIDATOR_FACTORY_H
+#define VALIDATOR_FACTORY_H
+
+#include "stdafx.h"
+#include <include/base/hash_map/hash_map.h>
+#include <string>
+
+using namespace std;
+
+class Validator;
+
+
+class ValidatorFactory
+{
+public:
+  ValidatorFactory ();
+  virtual ~ValidatorFactory ();
+  Validator* getValidator (string &name);
+  Validator* addValidator (string &name, Validator* validator);
+  bool isValidatorPresent (string &name);
+private:
+	HashMap<string, Validator*> validators;
+};
+#endif

Copied: trunk/myserver/include/conf/security/xml_validator.h (from rev 2864, branches/myserver_sec_new/include/conf/security/xml_validator.h)
===================================================================
--- trunk/myserver/include/conf/security/xml_validator.h	                        (rev 0)
+++ trunk/myserver/include/conf/security/xml_validator.h	2008-10-04 20:35:08 UTC (rev 2865)
@@ -0,0 +1,77 @@
+/* -*- mode: c++ -*- */
+/*
+MyServer
+Copyright (C) 2008 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
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program.  If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef XML_VALIDATOR_H
+#define XML_VALIDATOR_H
+
+#include "stdafx.h"
+#include <include/base/hash_map/hash_map.h>
+
+#include <include/conf/security/security_domain.h>
+#include <include/conf/security/security_manager.h>
+#include <include/server/server.h>
+#include <include/base/sync/mutex.h>
+#include <include/conf/security/validator.h>
+#include <include/base/xml/xml_parser.h>
+
+class SecurityCache;
+
+class XmlValidator : public Validator, public AuthMethod
+{
+public:
+  XmlValidator ();
+  virtual ~XmlValidator ();
+
+  using Validator::getPermissionMask;
+
+  virtual int getPermissionMask (SecurityToken* st);
+
+  virtual int getPermissionMaskImpl (SecurityToken* st,
+                                     HashMap<string, SecurityDomain*> *hashedDomains,
+                                     AuthMethod* authMethod);
+
+private:
+  XmlParser* getParser(SecurityToken* st);
+  bool doCondition (xmlNodePtr node, 
+                    HashMap<string, SecurityDomain*> *hashedDomains);
+
+  void doReturn (xmlNodePtr node, 
+                 int *cmd, 
+                 HashMap<string, SecurityDomain*> *hashedDomains);
+
+  void doDefine (xmlNodePtr node,
+                 SecurityToken *st, 
+                 HashMap<string, SecurityDomain*> *hashedDomains);
+
+  void doPermission (xmlNodePtr node,
+                     SecurityToken *st, 
+                     HashMap<string, SecurityDomain*> *hashedDomains);
+
+  int computeXmlNode (xmlNodePtr node, 
+                      SecurityToken *st, 
+                      int *cmd, 
+                      HashMap<string, SecurityDomain*> *hashedDomains);
+
+  int getPermissions (xmlAttr* attrs, xmlChar** user = NULL, xmlChar** password = NULL);
+
+  SecurityCache *getCache(Server*);
+  SecurityCache *secCache;
+  Mutex cacheMutex;
+};
+
+#endif

Modified: trunk/myserver/include/protocol/ftp/ftp.h
===================================================================
--- trunk/myserver/include/protocol/ftp/ftp.h	2008-10-04 19:43:00 UTC (rev 2864)
+++ trunk/myserver/include/protocol/ftp/ftp.h	2008-10-04 20:35:08 UTC (rev 2865)
@@ -25,7 +25,6 @@
 #include <include/base/mem_buff/mem_buff.h>
 #include <include/base/xml/xml_parser.h>
 #include <include/protocol/ftp/ftp_common.h>
-#include <include/conf/security/security_cache.h>
 
 #include <include/protocol/ftp/ftp_parser.h>
 #include <include/protocol/ftp/ftp_lexer.h>
@@ -139,9 +138,6 @@
 	void RetrStor(bool bRetr, bool bAppend, const std::string &sPath);
 	void RemovePipelinedCmds(MemBuf &In, MemBuf &Out);
 
-	static Mutex secCacheMutex;
-	static SecurityCache secCache;
-
 public:
 	void EscapeTelnet(MemBuf &In, MemBuf &Out);
 

Modified: trunk/myserver/include/protocol/http/Makefile.am
===================================================================
--- trunk/myserver/include/protocol/http/Makefile.am	2008-10-04 19:43:00 UTC (rev 2864)
+++ trunk/myserver/include/protocol/http/Makefile.am	2008-10-04 20:35:08 UTC (rev 2865)
@@ -1,4 +1,4 @@
 httpincludedir=$(includedir)/myserver/include/protocol/http
-httpinclude_HEADERS = http_data_handler.h http_data_read.h http_errors.h http.h http_header_checker.h http_header.h http_headers.h http_request.h http_response.h http_thread_context.h
+httpinclude_HEADERS = http_data_handler.h http_data_read.h http_errors.h http.h http_header_checker.h http_header.h http_headers.h http_request.h http_req_security_domain.h http_response.h http_thread_context.h
 SUBDIRS = env
 

Modified: trunk/myserver/include/protocol/http/http.h
===================================================================
--- trunk/myserver/include/protocol/http/http.h	2008-10-04 19:43:00 UTC (rev 2864)
+++ trunk/myserver/include/protocol/http/http.h	2008-10-04 20:35:08 UTC (rev 2865)
@@ -22,6 +22,7 @@
 #include <include/protocol/http/http_thread_context.h>
 #include <include/protocol/protocol.h>
 #include <include/protocol/http/http_headers.h>
+#include <include/conf/security/security_token.h>
 #include <include/conf/security/security_cache.h>
 #include <include/base/xml/xml_parser.h>
 #include <include/base/thread/thread.h>
@@ -54,10 +55,6 @@
     clearMulticastRegistry();
   }
 
-
-  Mutex secCacheMutex;
-  SecurityCache secCache;
-
   DynHttpCommandManager dynCmdManager;
   DynHttpManagerList dynManagerList;
 
@@ -76,18 +73,22 @@
 public:
   /*! Realm string used by Digest authorization scheme.  */
   char realm[48];
+
   /*! Opaque string used by Digest authorization scheme.  */
   char opaque[48];
+
   /*! Nonce string used by Digest authorization scheme.  */
   char nonce[48];
+
   /*! Cnonce string used by Digest authorization scheme.  */
   char cnonce[48];
-  /*! Password string used by Digest authorization scheme.  */
-  char requiredPassword[32];
+
   /*! Nonce count used by Digest authorization scheme.  */
   u_long nc;
+
   /*! Nonzero if the user was authenticated trough the Digest scheme.  */
   int digest;
+
   /*! Nonzero if the digest was already checked.  */
   int digestChecked;
   HttpUserData();
@@ -187,7 +188,10 @@
 
   static HttpStaticData* getStaticData();
 
+  SecurityToken *getSecurityToken (){return &securityToken;}
+
 protected:
+  SecurityToken securityToken;
   HttpDataHandler* mscgi;
   HttpDataHandler* wincgi;
   HttpDataHandler* isapi;

Copied: trunk/myserver/include/protocol/http/http_req_security_domain.h (from rev 2864, branches/myserver_sec_new/include/protocol/http/http_req_security_domain.h)
===================================================================
--- trunk/myserver/include/protocol/http/http_req_security_domain.h	                        (rev 0)
+++ trunk/myserver/include/protocol/http/http_req_security_domain.h	2008-10-04 20:35:08 UTC (rev 2865)
@@ -0,0 +1,42 @@
+/* -*- mode: c++ -*- */
+/*
+MyServer
+Copyright (C) 2008 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
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program.  If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef HTTP_REQ_SECURITY_DOMAIN_H
+#define HTTP_REQ_SECURITY_DOMAIN_H
+
+#include "stdafx.h"
+
+#include <include/conf/security/security_domain.h>
+#include <include/protocol/http/http_request.h>
+#include <string>
+
+using namespace std;
+
+class HttpReqSecurityDomain : public SecurityDomain
+{
+public:
+  HttpReqSecurityDomain (HttpRequestHeader *request);
+  virtual ~HttpReqSecurityDomain ();
+  virtual string *getValue (string &name);
+  HttpRequestHeader *getRequest () {return request;}
+protected:
+  HttpRequestHeader *request;
+  string name;
+};
+
+#endif

Modified: trunk/myserver/include/server/server.h
===================================================================
--- trunk/myserver/include/server/server.h	2008-10-04 19:43:00 UTC (rev 2864)
+++ trunk/myserver/include/server/server.h	2008-10-04 20:35:08 UTC (rev 2865)
@@ -46,6 +46,11 @@
 #include <include/base/multicast/multicast.h>
 #include <include/connections_scheduler/connections_scheduler.h>
 
+
+#include <include/conf/security/security_manager.h>
+#include <include/conf/security/auth_method_factory.h>
+#include <include/conf/security/validator_factory.h>
+
 #include <string>
 #include <list>
 using namespace std;
@@ -155,6 +160,7 @@
   void increaseFreeThread();
   void decreaseFreeThread();
 
+  SecurityManager* getSecurityManager (){return &securityManager;}
 
 private:
   friend class ClientsThread;
@@ -253,6 +259,10 @@
   ConnectionsScheduler connectionsScheduler;
   ListenThreads listenThreads;
   bool endServer;
+
+  AuthMethodFactory authMethodFactory;
+  ValidatorFactory validatorFactory;
+  SecurityManager securityManager;
 };
 
 #endif

Modified: trunk/myserver/src/conf/security/Makefile.am
===================================================================
--- trunk/myserver/src/conf/security/Makefile.am	2008-10-04 19:43:00 UTC (rev 2864)
+++ trunk/myserver/src/conf/security/Makefile.am	2008-10-04 20:35:08 UTC (rev 2865)
@@ -1,5 +1,4 @@
 lib_LIBRARIES = libsecurity.a
-libsecurity_a_SOURCES = security_cache.cpp security.cpp
+libsecurity_a_SOURCES = auth_domain.cpp auth_method.cpp auth_method_factory.cpp security_cache.cpp security_domain.cpp security_manager.cpp security_token.cpp validator.cpp validator_factory.cpp xml_validator.cpp
 SUBDIRS =
 INCLUDES = $(all_includes)
-

Copied: trunk/myserver/src/conf/security/auth_domain.cpp (from rev 2864, branches/myserver_sec_new/src/conf/security/auth_domain.cpp)
===================================================================
--- trunk/myserver/src/conf/security/auth_domain.cpp	                        (rev 0)
+++ trunk/myserver/src/conf/security/auth_domain.cpp	2008-10-04 20:35:08 UTC (rev 2865)
@@ -0,0 +1,52 @@
+/*
+MyServer
+Copyright (C) 2002-2008 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
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program.  If not, see <http://www.gnu.org/licenses/>.
+*/
+
+
+#include <include/conf/security/auth_domain.h>
+#include <include/conf/security/security_manager.h>
+
+
+AuthDomain::AuthDomain (SecurityToken *st)
+{
+  this->name.assign ("auth");
+  securityToken = st;
+}
+
+AuthDomain::~AuthDomain()
+{
+
+}
+
+/*!
+ *\see SecurityDomain::getValue.
+ */
+string *AuthDomain::getValue (string &name)
+{
+  if (!name.compare ("user"))
+    return &(securityToken->getUser ());
+
+  if (!name.compare ("password"))
+    return &(securityToken->getPassword ());
+
+  if (!name.compare ("directory"))
+    return securityToken->getDirectory ();
+
+  if (!name.compare ("sysdirectory"))
+    return securityToken->getSysDirectory ();
+
+  return NULL;
+}

Copied: trunk/myserver/src/conf/security/auth_method.cpp (from rev 2864, branches/myserver_sec_new/src/conf/security/auth_method.cpp)
===================================================================
--- trunk/myserver/src/conf/security/auth_method.cpp	                        (rev 0)
+++ trunk/myserver/src/conf/security/auth_method.cpp	2008-10-04 20:35:08 UTC (rev 2865)
@@ -0,0 +1,38 @@
+/*
+MyServer
+Copyright (C) 2002-2008 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
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program.  If not, see <http://www.gnu.org/licenses/>.
+*/
+
+
+#include <include/conf/security/auth_method.h>
+
+
+AuthMethod::AuthMethod ()
+{
+
+}
+
+AuthMethod::~AuthMethod()
+{
+
+}
+
+/*!
+ *Get the permission mask for the specified user/password.
+ */
+int AuthMethod::getPermissionMask (SecurityToken* st)
+{
+  return 0;
+}

Copied: trunk/myserver/src/conf/security/auth_method_factory.cpp (from rev 2864, branches/myserver_sec_new/src/conf/security/auth_method_factory.cpp)
===================================================================
--- trunk/myserver/src/conf/security/auth_method_factory.cpp	                        (rev 0)
+++ trunk/myserver/src/conf/security/auth_method_factory.cpp	2008-10-04 20:35:08 UTC (rev 2865)
@@ -0,0 +1,66 @@
+/*
+MyServer
+Copyright (C) 2002-2008 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
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program.  If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#include <include/conf/security/auth_method_factory.h>
+#include <include/conf/security/auth_method.h>
+
+#include <string>
+
+using namespace std;
+
+AuthMethodFactory::AuthMethodFactory ()
+{
+  //  XmlAuthMethod* xmlAuthMethod = new XmlAuthMethod;
+  //  string xml ("xml");
+
+  //  authMethods.put (xml, xmlAuthMethod);
+}
+
+AuthMethodFactory::~AuthMethodFactory ()
+{
+  authMethods.clear ();
+}
+
+/*!
+ *Return an AuthMethod given its name.
+ */
+AuthMethod* AuthMethodFactory::getAuthMethod(string &name)
+{
+  return authMethods.get (name);
+}
+
+/*!
+ *Add a new AuthMethod to the factory.
+ *\param name AuthMethod name.
+ *\param authMethod The authMethod to add.
+ *\return The old authMethod registered with [name], in any.
+ */
+AuthMethod* AuthMethodFactory::addAuthMethod(string &name, AuthMethod* authMethod)
+{
+  return authMethods.put (name, authMethod);
+  
+}
+
+/*!
+ *Check if the specified authMethod is present in the factory.
+ *\param name The authMethod name.
+ *\return a bool value to indicate if it is present or not.
+ */
+bool AuthMethodFactory::isAuthMethodPresent (string &name)
+{
+  return getAuthMethod (name) != NULL;
+}

Deleted: trunk/myserver/src/conf/security/security.cpp
===================================================================
--- trunk/myserver/src/conf/security/security.cpp	2008-10-04 19:43:00 UTC (rev 2864)
+++ trunk/myserver/src/conf/security/security.cpp	2008-10-04 20:35:08 UTC (rev 2865)
@@ -1,284 +0,0 @@
-/*
-MyServer
-Copyright (C) 2002-2008 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
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program.  If not, see <http://www.gnu.org/licenses/>.
-*/
-
-
-#include <include/conf/security/security.h>
-#include <include/base/utility.h>
-#include <include/base/xml/xml_parser.h>
-#include <include/connection/connection.h>
-#include <include/base/string/securestr.h>
-#include <include/base/regex/myserver_regex.h>
-#include <include/base/file/files_utility.h>
-#include <include/protocol/http/http_thread_context.h>
-
-#include <string>
-#include <sstream>
-#include <memory>
-
-using namespace std;
-
-/*!
- *Create the object.
- */
-SecurityToken::SecurityToken()
-{
-  reset();
-}
-
-/*!
- *Reset every structure member.
- */
-void SecurityToken::reset()
-{
-  user           = 0;
-  password       = 0;
-  directory      = 0;
-  filename       = 0;
-  requiredPassword = 0;
-  providedMask    = 0;
-  authType      = 0;
-  authTypeLen       = 0;
-  throttlingRate = (int)-1;
-}
-
-
-/*!
- *Get the error file for a page using the specified parser. 
- *Return 0 to use the default one.
- *Return -1 on errors.
- *Return other valus on success.
- */
-int SecurityManager::getErrorFileName(const char* sysDir, 
-                                      int error, 
-                                      string &out, 
-                                      XmlParser* parser)
-{
-  string evalString;
-  XmlXPathResult* xpathRes;
-  xmlNodeSetPtr nodes;
-  int ret;
-
-  out.assign("");
-
-  if(parser == NULL || !parser->isXpathEnabled())
-    return -1;
-
-  evalString = "/SECURITY/ERROR[@ID=\'";
-  evalString += error;
-  evalString += "']/@FILE";
-
-  xpathRes = parser->evaluateXpath(evalString);
-  nodes = xpathRes->getNodeSet();
-
-  if(nodes && nodes->nodeNr)
-    out.assign((const char*)nodes->nodeTab[0]->children->content);
-
-  /* Return 1 if both it was found and well configured.  */
-  ret = nodes && nodes->nodeNr && out.length() ? 1 : 0;
-
-  delete xpathRes;
-  return ret;
-
-}
-
-
-/*!
- *Get the permissions mask for the file FILENAME using the XML parser PARSER.
- *The file DIRECTORY/security will be parsed.
- *PROVIDEDMASK is the permission mask that the USER will have providing the
- *REQUIREDPASSWORD password.
- *Returns -1 on errors.
- */
-int SecurityManager::getPermissionMask(SecurityToken *st, XmlParser* parser)
-{
-  xmlNodeSetPtr nodes;
-  xmlAttr* attr;
-  string evalString;
-  int permissions = 0;
-  const char* requiredPassword;
-  bool rightPassword = false;
-  auto_ptr<XmlXPathResult> itemRes;
-  auto_ptr<XmlXPathResult> userRes;
-
-  if(parser == NULL || !parser->isXpathEnabled())
-    return -1;
-
-
-  evalString = "/SECURITY/AUTH/@TYPE";
-
-  auto_ptr<XmlXPathResult>authRes(parser->evaluateXpath(evalString));
-  nodes = authRes.get()->getNodeSet();
-
-  if(nodes && nodes->nodeNr)
-    strncpy(st->authType,(const char*)nodes->nodeTab[0]->children->content, 
-            st->authTypeLen);
-
-  evalString = "/SECURITY/ITEM[@FILE=\'";
-  evalString += st->filename;
-  evalString += "\']/USER[@NAME=\'";
-  evalString += st->user;
-  evalString += "\']/.";
-
-  auto_ptr<XmlXPathResult> itemUserRes(parser->evaluateXpath(evalString));
-
-  nodes = itemUserRes.get()->getNodeSet();
-
-  if(!nodes || !nodes->nodeNr)
-  {
-    evalString = "/SECURITY/ITEM[@FILE=\'";
-    evalString += st->filename;
-    evalString += "\']/.";
-
-    itemRes.reset(parser->evaluateXpath(evalString));
-
-    nodes = itemRes.get()->getNodeSet();
-
-    if(!nodes || !nodes->nodeNr)
-    {
-      evalString = "/SECURITY/USER[@NAME=\'";
-      evalString += st->user;
-      evalString += "\']/.";
-
-      userRes.reset(parser->evaluateXpath(evalString));
-
-      nodes = userRes.get()->getNodeSet();
-    }
-
-  }
-
-  if(!nodes || !nodes->nodeNr)
-    return 0;
-
-  for(attr = nodes->nodeTab[0]->properties; attr; attr = attr->next)
-  {
-    if(!strcmpi((const char*)attr->name, "READ") && 
-       !strcmpi((const char*)attr->children->content, "TRUE"))
-      permissions |= MYSERVER_PERMISSION_READ;
-
-    if(!strcmpi((const char*)attr->name, "WRITE") && 
-       !strcmpi((const char*)attr->children->content, "TRUE"))
-      permissions |= MYSERVER_PERMISSION_WRITE;
-
-    if(!strcmpi((const char*)attr->name, "EXECUTE") && 
-       !strcmpi((const char*)attr->children->content, "TRUE"))
-      permissions |= MYSERVER_PERMISSION_EXECUTE;
-
-    if(!strcmpi((const char*)attr->name, "BROWSE") && 
-       !strcmpi((const char*)attr->children->content, "TRUE"))
-      permissions |= MYSERVER_PERMISSION_BROWSE;
-
-    if(!strcmpi((const char*)attr->name, "PASS"))
-    {
-      requiredPassword = (const char*)attr->children->content;
-      rightPassword = !strcmp(st->password, requiredPassword);
-    }
-  }
-
-  if(rightPassword)
-  {
-    for(attr = nodes->nodeTab[0]->properties; attr; attr = attr->next)
-    {
-      if(!strcmpi((const char*)attr->name, "THROTTLING_RATE"))
-        st->throttlingRate = atoi((const char*)attr->children->content);
-    }
-  }
-
-  if(st->requiredPassword)
-    myserver_strlcpy(st->requiredPassword, requiredPassword, 32);
-
-  if(st->providedMask)
-    *(st->providedMask) = permissions;
-
-  if(!SecurityManager::checkActions(st->td, nodes->nodeTab[0] ))
-    return 0;
-
-  
-  return rightPassword ? permissions : 0;
-}
-
-/*!
- *Check if the specified actions deny the access to the resource.
- *\param td The Thread Context.
- *\param root The root node with actions.
- *\return true if the action allows the access to the resource.
- *\return false if the action denies the access to the resource.
- */
-bool SecurityManager::checkActions(HttpThreadContext* td,  xmlNode *root)
-{
-  xmlNode* actionsNode = root;
-
-  for( ; td && actionsNode; actionsNode = actionsNode->next)
-  {
-    xmlAttr *attr = actionsNode->properties;
-    int deny = 0;
-    regmatch_t pm;
-    const char* name = 0;
-    Regex value;
-    string* headerVal = 0;
-
-    if(strcmpi((const char*)actionsNode->name, "ACTION"))
-      continue;
-
-    if(actionsNode->children && actionsNode->children->content 
-       && !strcmpi((const char*)actionsNode->children->content, "DENY"))
-         deny = 1;
-
-    if(!deny)
-      continue;
-
-    for( ; attr; attr = attr->next)
-    {
-      if(!strcmpi((const char*)attr->name, "NAME"))
-        name = (const char*) attr->children->content;
-      if(!strcmpi((const char*)attr->name, "VALUE"))
-        value.compile((const char*)attr->children->content, REG_EXTENDED);         
-    }
-
-    if(name)
-      headerVal = td->request.getValue(name, 0);
-
-    if(!headerVal)
-      continue;
-
-    /*
-     *If the regular expression matches the header value then deny the 
-     *access. 
-     */
-    if(value.isCompiled() && !value.exec(headerVal->c_str(), 1,&pm, 
-                                         REG_NOTEOL))
-      return false;
-  }
-
-  return true;
-
-}
-
-/*!
- *Create the object.
- */
-SecurityManager::SecurityManager()
-{
-
-}
-
-/*!
- *Destroy the SecurityManager object.
- */
-SecurityManager::~SecurityManager()
-{
-
-}

Modified: trunk/myserver/src/conf/security/security_cache.cpp
===================================================================
--- trunk/myserver/src/conf/security/security_cache.cpp	2008-10-04 19:43:00 UTC (rev 2864)
+++ trunk/myserver/src/conf/security/security_cache.cpp	2008-10-04 20:35:08 UTC (rev 2865)
@@ -16,30 +16,30 @@
 */
 
 #include <include/conf/security/security_cache.h>
-#include <include/conf/security/security.h>
+#include <include/conf/security/security_manager.h>
+#include <include/conf/security/auth_domain.h>
 #include <include/base/file/file.h>
 #include <include/base/file/files_utility.h>
 
 #include <string>
 
 using namespace std;
-
+  
 /*!
  *Constructor for the SecurityCache object.
  */
-SecurityCache::SecurityCache()
+SecurityCache::SecurityCache ()
 {
   /*!
    *By default do not store more than 25 nodes.
    */
   limit = 25;
-
 }
 
 /*!
  *Destroy the security cache object.
  */
-SecurityCache::~SecurityCache()
+SecurityCache::~SecurityCache ()
 {
   free();
 }
@@ -47,11 +47,11 @@
 /*!
  *free the memory used by the SecurityCache object.
  */
-void SecurityCache::free()
+void SecurityCache::free ()
 {
   HashMap<string, XmlParser*>::Iterator it = dictionary.begin();
 
-  for (;it != dictionary.end(); it++)
+  for (;it != dictionary.end (); it++)
   {
     delete (*it);
   }
@@ -61,11 +61,15 @@
 
 /*!
  *Set a new limit on the nodes to keep in memory.
+ *\param newLimit Number of files to cache.  it is adjusted 
+ *to be >= 1.
  */
-void SecurityCache::setMaxNodes(int newLimit)
+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());
@@ -81,20 +85,25 @@
  *\param dir The directory we need a security parser for.
  *\param sys The system directory.
  *\param out Output string where put the security file path. 
+ *\param secFileName The security file name.
  */
-int SecurityCache::getSecurityFile(const char* dir, const char* sys, 
-                                   string& out)
+int SecurityCache::getSecurityFile (const string& dir, 
+                                    const string& sys, 
+                                    string& out,
+                                    const char* secFileName)
 {
   int found = 0;
-  string file(dir);
   string secFile;
+  string file(dir);
+
   int i = file.length() - 1;
 
-  while(i && file[i] == '/')
+  while(i && dir[i] == '/')
     file.erase(i--, 1);
 
-  secFile.assign(file);
-  secFile.append("/security");
+  secFile.assign(dir);
+  secFile.append("/");
+  secFile.append(secFileName);
 
   /* The security file exists in the directory.  */
   if(FilesUtility::fileExists(secFile))
@@ -103,18 +112,11 @@
     return 0;
   }
 
-  if(file.length() == 0)
-  {
-    out.assign(sys);
-    out.append("/security");
-    return !FilesUtility::fileExists(out);
-  }
-
-  
+ 
   /* Go upper in the tree till we find a security file.  */
-  do
+  for(;;)
   {
-    if(!file.length())
+    if(found || !file.length())
       break;
 
     for(i = file.length() - 1; i; i--)
@@ -124,22 +126,24 @@
         break;
       }
 
-
     /* 
      *Top of the tree, check if the security file is present in the 
-     *system directory, returns an error if it is not.
+     *system directory.  Return an error if it is not.
      */
     if(i == 0)
     {
       out.assign(sys);
-      out.append("/security");
+      out.append("/");
+      out.append(secFileName);
       return !FilesUtility::fileExists(out);
     }
+
     secFile.assign(file);
-    secFile.append("/security");
+    secFile.append("/");
+    secFile.append(secFileName);
 
+    found = FilesUtility::fileExists(secFile);
   }
-  while(!(found = FilesUtility::fileExists(secFile)));
 
   out.assign(secFile);
   return 0;
@@ -159,33 +163,36 @@
  *\param dir The path where start looking.
  *\param sys The system directory.
  *\param useXpath Specify if XPath will be used on the file.
+ *\param secFileName The security file name.
  */
-XmlParser* SecurityCache::getParser(const char* dir, const char* sys, bool useXpath)
+XmlParser* SecurityCache::getParser (const string &dir, 
+                                     const string &sys, 
+                                     bool useXpath,
+                                     const char* secFileName)
 {
   XmlParser* parser;
   string file;
 
-  if(getSecurityFile(dir, sys, file))
+  if (getSecurityFile (dir, sys, file, secFileName))
     return NULL;
 
-  parser = dictionary.get(file);
+  parser = dictionary.get (file);
 
-
   /*!
    *If the parser is already present and satisfy XPath then use it.
    */
-  if(parser && (!useXpath || parser->isXpathEnabled()))
+  if (parser && (!useXpath || parser->isXpathEnabled ()))
   {
     time_t fileModTime;
     /*! If the file was modified reload it. */
-    fileModTime = FilesUtility::getLastModTime(file.c_str());
-    if((fileModTime != static_cast<time_t>(-1))  && 
-       (parser->getLastModTime() != fileModTime))
+    fileModTime = FilesUtility::getLastModTime (file.c_str ());
+    if ((fileModTime != static_cast<time_t>(-1))  && 
+       (parser->getLastModTime () != fileModTime))
     {
-      parser->close();
-      if(parser->open(file.c_str(), useXpath) == -1)
+      parser->close ();
+      if(parser->open (file.c_str (), useXpath) == -1)
       {
-        dictionary.remove(file.c_str());
+        dictionary.remove (file.c_str ());
         return NULL;
       }
 
@@ -193,77 +200,31 @@
   }
   else
   {
-    /*! 
-     *Create the parser and append at the dictionary.
+    /*!
+     *Create the parser and add it to the dictionary.
      */
     XmlParser* old;
-    parser = new XmlParser();
-    if(parser == NULL)
+    parser = new XmlParser ();
+
+    if (parser == NULL)
     {  
       return NULL;
     }
 
-    if(dictionary.size() >= limit)
+    if (dictionary.size () >= limit)
     {
-      XmlParser* toremove = dictionary.remove(dictionary.begin());
-      if(toremove)
+      XmlParser* toremove = dictionary.remove (dictionary.begin ());
+      if (toremove)
         delete toremove;
     }
 
-    if(parser->open(file.c_str(), useXpath) == -1)
+    if (parser->open (file.c_str (), useXpath) == -1)
       return NULL;
 
-    old = dictionary.put(file, parser);
-    if(old)
-    {
+    old = dictionary.put (file, parser);
+    if (old)
       delete old;
-    }
   }
 
   return parser;
 }
-
-
-/*!
- *Get the permission mask for the specified file and user. If the security file to use
- *is not loaded it will be loaded and added to the cache dictionary for faster future 
- *accesses.
- */
-int SecurityCache::getPermissionMask(SecurityToken* st)
-{
-  XmlParser *parser;
-
-  if(st->directory == 0)
-    return -1;
-
-  if(st->filename == 0)
-    return -1;
-
-  parser = getParser(st->directory, st->sysdirectory);
-
-  if(parser == NULL)
-    return -1;
-
-  return sm.getPermissionMask(st, parser);
-}
-
-/*!
- *Get the error file name from the security file.
- */
-int SecurityCache::getErrorFileName(const char *directory, int error, 
-                                    const char* sysdirectory, string& out)
-{
-  XmlParser *parser;
-
-  out.assign("");
-
-  if(directory == 0)
-    return -1;
-
-  parser = getParser(directory, sysdirectory);
-
-  if(parser == NULL)
-    return -1;
- 
-  return sm.getErrorFileName(directory, error, out, parser);
-}

Copied: trunk/myserver/src/conf/security/security_domain.cpp (from rev 2864, branches/myserver_sec_new/src/conf/security/security_domain.cpp)
===================================================================
--- trunk/myserver/src/conf/security/security_domain.cpp	                        (rev 0)
+++ trunk/myserver/src/conf/security/security_domain.cpp	2008-10-04 20:35:08 UTC (rev 2865)
@@ -0,0 +1,48 @@
+/*
+MyServer
+Copyright (C) 2002-2008 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
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program.  If not, see <http://www.gnu.org/licenses/>.
+*/
+
+
+#include <include/conf/security/security_domain.h>
+
+
+SecurityDomain::SecurityDomain ()
+{
+  this->name.assign ("");
+}
+
+SecurityDomain::SecurityDomain (string& name)
+{
+  this->name.assign (name);
+}
+SecurityDomain::SecurityDomain (const char* name)
+{
+  this->name.assign (name);
+}
+
+
+SecurityDomain::~SecurityDomain ()
+{
+
+}
+
+/*!
+ *Get the stored value for [name].
+ */
+string *SecurityDomain::getValue (string &name)
+{
+  return NULL;
+}

Copied: trunk/myserver/src/conf/security/security_manager.cpp (from rev 2864, branches/myserver_sec_new/src/conf/security/security_manager.cpp)
===================================================================
--- trunk/myserver/src/conf/security/security_manager.cpp	                        (rev 0)
+++ trunk/myserver/src/conf/security/security_manager.cpp	2008-10-04 20:35:08 UTC (rev 2865)
@@ -0,0 +1,107 @@
+/*
+MyServer
+Copyright (C) 2002-2008 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
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program.  If not, see <http://www.gnu.org/licenses/>.
+*/
+
+
+#include <include/conf/security/security_manager.h>
+#include <include/conf/security/validator.h>
+#include <include/conf/security/validator_factory.h>
+#include <include/conf/security/auth_method.h>
+#include <include/conf/security/auth_method_factory.h>
+#include <include/conf/security/security_token.h>
+
+#include <string>
+#include <sstream>
+#include <memory>
+
+using namespace std;
+
+SecurityManager::SecurityManager (ValidatorFactory* vf, AuthMethodFactory* amf)
+{
+  validatorFactory = vf;
+  authMethodFactory = amf;
+}
+
+SecurityManager::~SecurityManager ()
+{
+
+}
+
+/*!
+ *Get the permission mask for the requested resource.
+ */
+int SecurityManager::getPermissionMask (SecurityToken* st, 
+                                        SecurityDomain **domains, 
+                                        string &validator,
+                                        string &authMethod)
+{
+  Validator *v;
+  AuthMethod *am;
+
+  if (getValidatorAndAuthMethod (validator, authMethod, &v, &am))
+    return 0;
+
+  return v->getPermissionMask (st, domains, am);
+}
+
+/*!
+ *Get the permission mask for the requested resource.
+ */
+int SecurityManager::getPermissionMask (SecurityToken* st, 
+                                        list<SecurityDomain*> *domains, 
+                                        string &validator,
+                                        string &authMethod)
+{
+  Validator *v;
+  AuthMethod *am;
+
+  if (getValidatorAndAuthMethod (validator, authMethod, &v, &am))
+    return 0;
+
+  return v->getPermissionMask (st, domains, am);
+}
+
+
+/*!
+ *Initialize the pointers to the specified Validator and AuthMethod.
+ *\param validatorName The validator name to find.
+ *\param authMethodName The auth method name to find.
+ *\param validator Pointer to the Validator to initialize. 
+ *\param validator Pointer to the AuthMethod initialize.
+ *\return 0 if the pointers were successfully initialized.
+ */
+int SecurityManager::getValidatorAndAuthMethod (string &validatorName,
+                                                string &authMethodName,
+                                                Validator **validator,
+                                                AuthMethod **authMethod)
+{
+
+  string xml ("xml");
+
+  *validator = validatorFactory->getValidator (validatorName);
+  *authMethod = authMethodFactory->getAuthMethod (authMethodName);
+
+  if (!(*validator))
+    *validator = validatorFactory->getValidator (xml);
+
+  if (!(*authMethod))
+    *authMethod = authMethodFactory->getAuthMethod (xml);
+
+  if (*validator && *authMethod)
+    return 0;
+
+  return 1;
+}

Copied: trunk/myserver/src/conf/security/security_token.cpp (from rev 2864, branches/myserver_sec_new/src/conf/security/security_token.cpp)
===================================================================
--- trunk/myserver/src/conf/security/security_token.cpp	                        (rev 0)
+++ trunk/myserver/src/conf/security/security_token.cpp	2008-10-04 20:35:08 UTC (rev 2865)
@@ -0,0 +1,91 @@
+/*
+MyServer
+Copyright (C) 2002-2008 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
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program.  If not, see <http://www.gnu.org/licenses/>.
+*/
+
+
+#include <include/conf/security/security_token.h>
+#include <include/conf/vhost/vhost.h>
+#include <include/server/server.h>
+
+#include <string>
+#include <sstream>
+#include <memory>
+
+using namespace std;
+
+/*!
+ *Create the object.
+ */
+SecurityToken::SecurityToken ()
+{
+  reset ();
+}
+
+/*!
+ *Reset every structure member.
+ */
+void SecurityToken::reset ()
+{
+  mask = 0;
+  done = false;
+  server = NULL;
+  vhost = NULL;
+
+  directory = NULL;
+  sysdirectory = NULL;
+  resource = NULL;
+
+}
+
+/*!
+ *Get the value for the variable using the specified domains.
+ *\param name Variable name.
+ *\param domains Domains where to look.  They are looked in this order: 
+ *\li Security configuration file.
+ *\li Virtual host configuration file.
+ *\li Global security file.
+ */
+const char* SecurityToken::getHashedData (const char* name, int domains)
+{
+  if (domains & MYSERVER_SECURITY_CONF)
+  {
+    string strName (name);
+    string *ret = values.get (strName);
+
+    if (ret)
+      return ret->c_str ();
+
+  }
+
+  if (vhost && (domains & MYSERVER_VHOST_CONF))
+  {
+    const char* ret = vhost->getHashedData (name);
+
+    if (ret)
+      return ret;
+  }
+
+  if (server && (domains & MYSERVER_SERVER_CONF))
+  {
+    const char* ret = server->getHashedData (name);
+
+    if (ret)
+      return ret;
+  }
+
+  
+  return NULL;
+}

Copied: trunk/myserver/src/conf/security/validator.cpp (from rev 2864, branches/myserver_sec_new/src/conf/security/validator.cpp)
===================================================================
--- trunk/myserver/src/conf/security/validator.cpp	                        (rev 0)
+++ trunk/myserver/src/conf/security/validator.cpp	2008-10-04 20:35:08 UTC (rev 2865)
@@ -0,0 +1,146 @@
+/*
+MyServer
+Copyright (C) 2008 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
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program.  If not, see <http://www.gnu.org/licenses/>.
+*/
+
+
+#include <include/conf/security/validator.h>
+#include <include/conf/security/auth_domain.h>
+
+Validator::Validator ()
+{
+
+}
+
+Validator::~Validator ()
+{
+
+}
+
+
+/*!
+ *Get the permission mask for the requested resource.
+ *Delegate the problem to getPermissionMaskInt.
+ */
+int Validator::getPermissionMask (SecurityToken* st, 
+                                  list<SecurityDomain*> *domains,
+                                  AuthMethod* authMethod)
+{
+  HashMap<string, SecurityDomain*> hashedDomains;
+
+  if (st->isDone ())
+    return st->getMask ();
+
+  if (domains)
+  {
+    for (list<SecurityDomain*>::iterator it = domains->begin (); 
+         it != domains->end (); it++)
+    {
+      addDomain (&hashedDomains, *it);
+    }
+  }
+
+  return getPermissionMaskInt (st, &hashedDomains, authMethod);
+}
+
+/*!
+ *Get the permission mask for the requested resource.
+ *Delegate the problem to getPermissionMaskInt.
+ */
+int Validator::getPermissionMask (SecurityToken* st, 
+                                  SecurityDomain **domains,
+                                  AuthMethod* authMethod)
+{
+  HashMap<string, SecurityDomain*> hashedDomains;
+
+  if (st->isDone ())
+    return st->getMask ();
+
+  if (domains)
+  {
+    for (u_int i = 0; domains[i]; i++)
+    {
+      addDomain (&hashedDomains, domains[i]);
+    }
+  }
+
+  return getPermissionMaskInt (st, &hashedDomains, authMethod);
+}
+
+
+
+/*!
+ *Get the permission mask for the requested resource.
+ *Decorate getPermissionMaskImpl.
+ */
+int Validator::getPermissionMaskInt (SecurityToken* st, 
+                                     HashMap<string, SecurityDomain*> *hashedDomains,
+                                     AuthMethod* authMethod)
+{
+  int ret = 0;
+
+  if (authMethod)
+    ret = authMethod->getPermissionMask (st);
+  
+  if (!getPermissionMaskImpl (st, hashedDomains, authMethod))
+    ret = 0;
+  
+  st->setDone (true);
+
+  return ret;
+}
+
+
+/*!
+ *Get the permission mask for the requested resource.
+ */
+int Validator::getPermissionMaskImpl (SecurityToken* st,
+                                      HashMap<string, SecurityDomain*> *hashedDomains,
+                                      AuthMethod* authMethod)
+{
+  return 0;
+}
+
+/*!
+ *Get the value for [name] in the form domain.variable.
+ *\param hashedDomains Registered security domains.
+ *\param name Variable name.
+ *\return The value of the requested variable.
+ */
+string *Validator::getValue (HashMap<string, SecurityDomain*> *hashedDomains, string &name)
+{
+  string domain;
+  string var;
+  size_t pos = name.find ('.');
+  SecurityDomain *securityDomain = NULL;
+
+  if (pos != string::npos)
+  {
+    domain = name.substr (0, pos);
+    var = name.substr (pos + 1, string::npos);
+  }
+  else
+  {
+    domain.assign("");
+    var = name;
+  }
+
+  securityDomain = hashedDomains->get (domain);
+
+  if (securityDomain)
+    return securityDomain->getValue (var);
+  
+  return NULL;
+}

Copied: trunk/myserver/src/conf/security/validator_factory.cpp (from rev 2864, branches/myserver_sec_new/src/conf/security/validator_factory.cpp)
===================================================================
--- trunk/myserver/src/conf/security/validator_factory.cpp	                        (rev 0)
+++ trunk/myserver/src/conf/security/validator_factory.cpp	2008-10-04 20:35:08 UTC (rev 2865)
@@ -0,0 +1,68 @@
+/*
+MyServer
+Copyright (C) 2002-2008 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
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program.  If not, see <http://www.gnu.org/licenses/>.
+*/
+
+
+#include <include/conf/security/validator.h>
+#include <include/conf/security/validator_factory.h>
+#include <include/conf/security/xml_validator.h>
+
+#include <string>
+
+using namespace std;
+
+ValidatorFactory::ValidatorFactory ()
+{
+  XmlValidator* xmlValidator = new XmlValidator;
+  string xml ("xml");
+
+  validators.put (xml, xmlValidator);
+
+}
+
+ValidatorFactory::~ValidatorFactory ()
+{
+  validators.clear ();
+}
+
+/*!
+ *Return a validator given its name.
+ */
+Validator* ValidatorFactory::getValidator(string &name)
+{
+  return validators.get (name);
+}
+
+/*!
+ *Add a new validator to the factory.
+ *\param name Validator name.
+ *\param validator The validator to add.
+ *\return The old validator registered with [name], in any.
+ */
+Validator* ValidatorFactory::addValidator(string &name, Validator* validator)
+{
+  return validators.put (name, validator);
+}
+
+/*!
+ *Check if the specified validator is present in the factory.
+ *\param name The validator name.
+ *\return a bool value to indicate if it is present or not.
+ */
+bool ValidatorFactory::isValidatorPresent (string &name)
+{
+  return getValidator (name) != NULL;
+}

Copied: trunk/myserver/src/conf/security/xml_validator.cpp (from rev 2864, branches/myserver_sec_new/src/conf/security/xml_validator.cpp)
===================================================================
--- trunk/myserver/src/conf/security/xml_validator.cpp	                        (rev 0)
+++ trunk/myserver/src/conf/security/xml_validator.cpp	2008-10-04 20:35:08 UTC (rev 2865)
@@ -0,0 +1,372 @@
+/*
+MyServer
+Copyright (C) 2008 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
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program.  If not, see <http://www.gnu.org/licenses/>.
+*/
+
+
+#include <include/conf/security/xml_validator.h>
+#include <include/conf/security/auth_domain.h>
+#include <include/conf/security/security_cache.h>
+
+XmlValidator::XmlValidator ()
+{
+  secCache = NULL;
+}
+
+XmlValidator::~XmlValidator ()
+{
+  if (secCache != NULL)
+  {
+    secCache->free ();
+    delete secCache;
+  }
+}
+
+/*!
+ *Get the security files cache.
+ */
+SecurityCache* XmlValidator::getCache (Server *server)
+{
+  if (!secCache && server)
+  {
+    const char *data = server->getHashedData ("SECURITY_CACHE_NODES");
+    secCache = new SecurityCache ();
+    if (data)
+    {
+      int nodes = atoi (data);
+      secCache->setMaxNodes (nodes);
+    }
+  }
+
+  return secCache;
+}
+
+/*!
+ *Get the XML parser to use.
+ */
+XmlParser* XmlValidator::getParser (SecurityToken* st)
+{
+  const char *secName;
+
+  SecurityCache *cache = getCache (st->getServer ());
+
+  if (!cache)
+    return NULL;
+
+  secName = st->getVhost () ? st->getVhost ()->getHashedData ("SECURITY_FILE_NAME") : NULL;
+
+  if (!secName)
+    secName = st->getServer () ? st->getServer ()->getHashedData ("SECURITY_FILE_NAME") : NULL;
+
+  if (!secName)
+    secName = ".security.xml";
+
+  return cache->getParser (*(st->getResource ()), *(st->getSysDirectory ()), false, secName);
+}
+
+/*!
+ *\see AuthMethod#getPermissionMask.
+ */
+int XmlValidator::getPermissionMask (SecurityToken* st)
+{
+  xmlNodePtr root;
+  XmlParser* xmlFile = getParser (st);
+
+  if (!xmlFile)
+    return 0;
+
+  for (xmlNodePtr cur = xmlFile->getDoc ()->children; cur; cur = cur->next)
+    if (cur->type == XML_ELEMENT_NODE)
+    {
+      for (xmlNodePtr curChild = cur->children; curChild; curChild = curChild->next)
+        if (curChild->type == XML_ELEMENT_NODE)
+        {
+          root = curChild;
+          break;
+        }
+    }
+
+  for (xmlNodePtr cur = root; cur; cur = cur->next)
+  {
+    if (xmlStrcmp (cur->name, (const xmlChar *) "USER"))
+      continue;
+     
+    xmlAttr *attrs = cur->properties;
+  
+    xmlChar* name = NULL;
+    xmlChar* password = NULL;
+
+    int permissions =  getPermissions (attrs, &name, &password);
+
+    if (!name || !password || 
+        xmlStrcmp (name, (const xmlChar *)st->getUser ().c_str ()))
+      continue;
+
+    st->setProvidedMask (permissions);
+
+    if (xmlStrcmp (password, (const xmlChar *)st->getPassword ().c_str ()))
+    {
+      st->setAuthenticated (false);
+      st->setMask (0);
+    }
+    else
+    {
+      st->setAuthenticated (true);
+      st->setMask (permissions);
+    }
+    
+    return st->getMask ();
+  }
+
+  return 0;
+}
+
+/*!
+ *Get a permission mask from the attributes.
+ *\param attrs Attributes list.
+ *\param user The found user name.
+ *\param password The found password.
+ *\return the permissions mask.
+ */
+int XmlValidator::getPermissions (xmlAttr* attrs, xmlChar** user, xmlChar** password )
+{
+    int permissions = 0;
+
+    while (attrs)
+    {
+      if (user && !xmlStrcmp (attrs->name, (const xmlChar *)"name") &&
+          attrs->children && attrs->children->content)
+        *user = attrs->children->content;
+    
+      else if (password && !xmlStrcmp (attrs->name, (const xmlChar *)"password") &&
+          attrs->children && attrs->children->content)
+        *password = attrs->children->content;
+
+      else if (!xmlStrcmp (attrs->name, (const xmlChar *)"READ") &&
+          attrs->children && attrs->children->content &&
+          !xmlStrcmp(attrs->children->content, (const xmlChar *) "YES"))
+        permissions |= MYSERVER_PERMISSION_READ;
+
+      else if (!xmlStrcmp (attrs->name, (const xmlChar *)"WRITE") &&
+          attrs->children && attrs->children->content &&
+          !xmlStrcmp(attrs->children->content, (const xmlChar *) "YES"))
+        permissions |= MYSERVER_PERMISSION_WRITE;
+
+      else if (!xmlStrcmp (attrs->name, (const xmlChar *)"EXECUTE") &&
+          attrs->children && attrs->children->content &&
+          !xmlStrcmp(attrs->children->content, (const xmlChar *) "YES"))
+        permissions |= MYSERVER_PERMISSION_EXECUTE;
+
+      else if (!xmlStrcmp (attrs->name, (const xmlChar *)"BROWSE") &&
+          attrs->children && attrs->children->content &&
+          !xmlStrcmp(attrs->children->content, (const xmlChar *) "YES"))
+        permissions |= MYSERVER_PERMISSION_BROWSE;
+      
+      attrs = attrs->next;
+    }
+
+    return permissions;
+}
+
+
+/*!
+ *\see XmlValidator#getPermissionMaskImpl.
+ */
+int XmlValidator::getPermissionMaskImpl (SecurityToken* st,
+                                         HashMap<string, SecurityDomain*> *hashedDomains,
+                                         AuthMethod* authMethod)
+{
+  XmlParser* xmlFile = getParser (st);
+
+  if (!xmlFile)
+    return 0;
+
+  for (xmlNodePtr cur = xmlFile->getDoc ()->children; cur; cur = cur->next)
+    if (cur->type == XML_ELEMENT_NODE)
+    {
+      int cmd = -1;
+
+      computeXmlNode (cur, st, &cmd, hashedDomains);
+
+      /* By default return ALLOW.  */
+      if (cmd == -1)
+        return 1;
+
+      if (cmd == 0)
+        return 0;
+
+      if (cmd == 1)
+      {
+        st->setMask (MYSERVER_PERMISSION_ALL);
+        return 1;
+      }
+
+    }
+
+  return 0;
+}
+
+/*!
+ *Compute the current XML node.
+ */
+int XmlValidator::computeXmlNode (xmlNodePtr node, 
+                                  SecurityToken *st, 
+                                  int *cmd, 
+                                  HashMap<string, SecurityDomain*> *hashedDomains)
+{
+  if (!node)
+    return 0;
+
+  for (xmlNodePtr cur = node->children; cur; cur = cur->next)
+  {
+    if (cur->type != XML_ELEMENT_NODE)
+      continue;
+    
+    if (!xmlStrcmp (cur->name, (const xmlChar *) "CONDITION"))
+    {
+      if (doCondition (cur, hashedDomains) && computeXmlNode (cur, st, cmd, hashedDomains))
+          return 1;
+    }
+    else if (!xmlStrcmp (cur->name, (const xmlChar *) "RETURN"))
+    {
+      doReturn (cur, cmd, hashedDomains);
+      return 1;
+    }
+    else if (!xmlStrcmp (cur->name, (const xmlChar *) "DEFINE"))
+    {
+      doDefine (cur, st, hashedDomains);
+    }
+    else if (!xmlStrcmp (cur->name, (const xmlChar *) "PERMISSION"))
+    {
+      doPermission (cur, st, hashedDomains);
+    }
+  }
+
+  return 0;
+}
+
+/*!
+ *Handle a CONDITION.
+ */
+bool XmlValidator::doCondition (xmlNodePtr node, HashMap<string, SecurityDomain*> *hashedDomains)
+{
+  string name;
+  const xmlChar *isNot = (const xmlChar*)"";
+  const xmlChar *value = (const xmlChar*)"";
+  xmlAttr *attrs = node->properties;
+  
+  while (attrs)
+  {
+    if(!xmlStrcmp (attrs->name, (const xmlChar *)"name") &&
+       attrs->children && attrs->children->content)
+      name.assign ((const char*)attrs->children->content);
+    
+    if(!xmlStrcmp (attrs->name, (const xmlChar *)"value") &&
+       attrs->children && attrs->children->content)
+      value = attrs->children->content;
+
+    if(!xmlStrcmp (attrs->name, (const xmlChar *)"not") &&
+       attrs->children && attrs->children->content)
+      isNot = attrs->children->content;
+    
+    attrs = attrs->next;
+  }
+      
+  string *storedValue = getValue (hashedDomains, name);
+      
+  if (!storedValue)
+    return false;
+
+  bool eq = storedValue->compare ((const char*)value) == 0;
+  
+  if (!xmlStrcmp (isNot, (const xmlChar *) "yes"))
+    return !eq;
+  
+  return eq;
+}
+
+/*!
+ *Handle a PERMISSION.
+ */
+void XmlValidator::doPermission (xmlNodePtr node, SecurityToken *st, HashMap<string, SecurityDomain*> *hashedDomains)
+{
+  string name;
+  const xmlChar *isNot = (const xmlChar*)"";
+  const xmlChar *value = (const xmlChar*)"";
+  xmlAttr *attrs = node->properties;
+
+  st->setProvidedMask (getPermissions (attrs));
+
+  if (st->isAuthenticated ())
+    st->setMask (st->getProvidedMask ());
+}
+
+
+/*!
+ *Handle a DEFINE.
+ */
+void XmlValidator::doDefine (xmlNodePtr node, SecurityToken *st, HashMap<string, SecurityDomain*> *hashedDomains)
+{
+  string name;
+  const xmlChar *value = (const xmlChar*)"";
+  xmlAttr *attrs = node->properties;
+  
+  while (attrs)
+  {
+    if(!xmlStrcmp (attrs->name, (const xmlChar *)"name") &&
+       attrs->children && attrs->children->content)
+      name.assign ((const char*)attrs->children->content);
+    
+    if(!xmlStrcmp (attrs->name, (const xmlChar *)"value") &&
+       attrs->children && attrs->children->content)
+      value = attrs->children->content;
+
+    attrs = attrs->next;
+  }
+
+  if (!value)
+    return;
+
+  string *valStr = new string ((const char *)value);
+
+  string *old = st->getValues ()->put (name, valStr);
+
+  if (old)
+    delete old;
+}
+
+/*!
+ *Handle a RETURN.
+ */
+void XmlValidator::doReturn (xmlNodePtr node, int *cmd, HashMap<string, SecurityDomain*> *hashedDomains)
+{
+  xmlAttr *attrs = node->properties;
+
+  xmlChar *value = NULL;
+
+  while (attrs)
+  {
+    if (!xmlStrcmp (attrs->name, (const xmlChar *)"value") &&
+        attrs->children && attrs->children->content)
+      value = attrs->children->content;
+    
+    attrs = attrs->next;
+  }
+
+  if (value && !xmlStrcmp (value, (const xmlChar *) "ALLOW"))
+    *cmd = 1;
+  else
+    *cmd = 0;
+}

Modified: trunk/myserver/src/http_handler/http_dir/http_dir.cpp
===================================================================
--- trunk/myserver/src/http_handler/http_dir/http_dir.cpp	2008-10-04 19:43:00 UTC (rev 2864)
+++ trunk/myserver/src/http_handler/http_dir/http_dir.cpp	2008-10-04 20:35:08 UTC (rev 2865)
@@ -398,9 +398,6 @@
   {
     if(fd.name[0] == '.')
       continue;
-    /* Do not show the security file.  */
-    if(!strcmp(fd.name, "security"))
-      continue;
 
     FileStruct file;
     file.name.assign(fd.name);
@@ -408,7 +405,6 @@
     file.attrib = fd.attrib;
     file.size = fd.size;
     files.push_back(file);
-
   }
   while(!fd.findnext());
 

Modified: trunk/myserver/src/protocol/ftp/ftp.cpp
===================================================================
--- trunk/myserver/src/protocol/ftp/ftp.cpp	2008-10-04 19:43:00 UTC (rev 2864)
+++ trunk/myserver/src/protocol/ftp/ftp.cpp	2008-10-04 20:35:08 UTC (rev 2865)
@@ -28,6 +28,7 @@
 #include <include/base/find_data/find_data.h>
 #include <include/base/string/stringutils.h>
 #include <include/base/mem_buff/mem_buff.h>
+#include <include/conf/security/auth_domain.h>
 #include <assert.h>
 
 #ifndef WIN32
@@ -96,14 +97,6 @@
 }
 
 //////////////////////////////////////////////////////////////////////////////
-// Used at Ftp access control
-/*! Cache for security files. */
-SecurityCache Ftp::secCache;
-
-/*! Access the security cache safely. */
-Mutex Ftp::secCacheMutex;
-
-//////////////////////////////////////////////////////////////////////////////
 // FtpUserData class
 FtpUserData::FtpUserData()
 {
@@ -2389,34 +2382,34 @@
   FilesUtility::splitPath(sPath, sDir, sFileName);
 
   SecurityToken st;
+  string user;
+  string password;
   if ( strcmpi(sUser.c_str(), "anonymous") == 0 )
   {
-    st.user = "Guest";
-    st.password = "";
+    user.assign ("Guest");
+    password.assign("");
   }
   else
   {
-    st.user = sUser.c_str();
-    st.password = sPass.c_str();
+    user.assign (sUser);
+    password.assign (sPass);
   }
-  st.directory = sDir.c_str();
-  st.sysdirectory = td.pConnection->host->getSystemRoot().c_str();//pFtpUserData->m_pDataConnection->host->getSystemRoot().c_str();
-  st.authType = 0;
-  st.filename = sFileName.c_str();
-  //st.providedMask = &mask;
-  int perm = 0;
-  secCacheMutex.lock();
-  try
-  {
-    perm = secCache.getPermissionMask (&st);
-            secCacheMutex.unlock();
-  }
-  catch ( ... )
-  {
-    secCacheMutex.unlock();
-    throw;
-  }
-  return (perm & mask);
+
+  st.setUser (user);
+  st.setPassword (password);
+
+
+  st.setDirectory (&sDir);
+  st.setSysDirectory ((string *)&(td.pConnection->host->getSystemRoot ()));
+  st.setResource (&sFileName);
+
+  AuthDomain auth (&st);
+  string xml ("xml");//FIXME: don't hardly-code "xml".
+  SecurityDomain* domains[] = {&auth, NULL};
+
+  Server::getInstance()->getSecurityManager ()->getPermissionMask (&st, domains, xml, xml);
+
+  return (st.getMask () & mask);
 }
 
 void Ftp::Size(const std::string &sPath)

Modified: trunk/myserver/src/protocol/http/Makefile.am
===================================================================
--- trunk/myserver/src/protocol/http/Makefile.am	2008-10-04 19:43:00 UTC (rev 2864)
+++ trunk/myserver/src/protocol/http/Makefile.am	2008-10-04 20:35:08 UTC (rev 2865)
@@ -1,5 +1,5 @@
 lib_LIBRARIES = libhttp.a
-libhttp_a_SOURCES = http.cpp http_data_handler.cpp http_data_read.cpp http_errors.cpp http_header_checker.cpp http_headers.cpp http_request.cpp http_response.cpp http_thread_context.cpp
+libhttp_a_SOURCES = http.cpp http_data_handler.cpp http_data_read.cpp http_errors.cpp http_header_checker.cpp http_headers.cpp http_request.cpp http_req_security_domain.cpp http_response.cpp http_thread_context.cpp
 SUBDIRS = env
 INCLUDES = $(all_includes)
 

Modified: trunk/myserver/src/protocol/http/http.cpp
===================================================================
--- trunk/myserver/src/protocol/http/http.cpp	2008-10-04 19:43:00 UTC (rev 2864)
+++ trunk/myserver/src/protocol/http/http.cpp	2008-10-04 20:35:08 UTC (rev 2865)
@@ -18,8 +18,10 @@
 
 #include <include/protocol/http/http.h>
 #include <include/protocol/http/http_headers.h>
+#include <include/protocol/http/http_req_security_domain.h>
 #include <include/server/server.h>
 #include <include/conf/security/security.h>
+#include <include/conf/security/auth_domain.h>
 #include <include/base/base64/mime_utils.h>
 #include <include/base/file/file.h>
 #include <include/base/file/files_utility.h>
@@ -348,16 +350,21 @@
 int Http::getFilePermissions(string& filename, string& directory, string& file, 
                              string &filenamePath, int yetmapped, int* permissions)
 {
-  SecurityToken st;
-  char authType[16];
   int providedMask;
 
+  securityToken.setServer (Server::getInstance ());
+  securityToken.setSysDirectory ((string*)&(td->connection->host->getSystemRoot ()));
+
+  securityToken.setVhost (td->connection->host);
+
   try
   {
-    st.authType = authType;
-    st.authTypeLen = 16;
-    st.td = td;
-    FilesUtility::splitPath(filename, directory, file);
+    FilesUtility::splitPath (filename, directory, file);
+    FilesUtility::completePath (directory);
+
+    securityToken.setResource (&filenamePath);
+    securityToken.setDirectory (&directory);
+
     /*!
      *td->filenamePath is the file system mapped path while filename
      *is the uri requested.
@@ -414,71 +421,53 @@
       ((HttpUserData*)(td->connection->protocolBuffer))->reset();
     }
 
+    string user;
+    string password;
+
     if(td->request.auth.length())
     {
-      st.user = td->connection->getLogin();
-      st.password = td->connection->getPassword();
-      st.directory = directory.c_str();
-      st.sysdirectory = td->getVhostSys();
-      st.filename = file.c_str();
-      st.requiredPassword =
-        ((HttpUserData*)td->connection->protocolBuffer)->requiredPassword;
-      st.providedMask = &providedMask;
-      staticHttp.secCacheMutex.lock();
-      try
-      {
-        *permissions = staticHttp.secCache.getPermissionMask(&st);
-        staticHttp.secCacheMutex.unlock();
-      }
-      catch(...)
-      {
-        staticHttp.secCacheMutex.unlock();
-        throw;
-      };
+      user.assign (td->connection->getLogin());
+      password.assign (td->connection->getPassword ());
     }
-    else/*! The default user is Guest with a null password. */
+    else
     {
-      st.user = "Guest";
-      st.password = "";
-      st.directory = directory.c_str();
-      st.sysdirectory = td->getVhostSys();
-      st.filename = file.c_str();
-      st.requiredPassword = 0;
-      st.providedMask = 0;
-      staticHttp.secCacheMutex.lock();
-      try
-      {
-        *permissions = staticHttp.secCache.getPermissionMask(&st);
-        staticHttp.secCacheMutex.unlock();
-      }
-      catch(...)
-      {
-        staticHttp.secCacheMutex.unlock();
-        throw;
-      };
+      /* The default user is Guest with a null password. */
+      user.assign ("Guest");
+      password.assign ("");
     }
-    if(*permissions == -1)
-    {
-      td->connection->host->warningsLogRequestAccess(td->id);
-      td->connection->host->warningsLogWrite(
-                                     "Http: Error reading security file");
-      td->connection->host->warningsLogTerminateAccess(td->id);
-      return 500;
-    }
+
+    securityToken.setUser (user);
+    securityToken.setPassword (password);
+
+    AuthDomain auth (&securityToken);
+    HttpReqSecurityDomain httpReqSecDom (&(td->request));
+
+    string xml ("xml");//FIXME: don't hardly-code "xml".
+    SecurityDomain* domains[] = {&auth, &httpReqSecDom, NULL};
+
+    Server::getInstance()->getSecurityManager ()->getPermissionMask (&securityToken, domains, xml, xml);
+
+    const char *authType = securityToken.getHashedData ("http.auth", MYSERVER_SECURITY_CONF |
+                                                        MYSERVER_VHOST_CONF |
+                                                        MYSERVER_SERVER_CONF);
+    *permissions = securityToken.getMask ();
+
     /*! Check if we have to use digest for the current directory. */
-    if(!strcmpi(authType, "Digest"))
+    if(authType && !strcmpi(authType, "Digest"))
     {
+      HttpUserData* hud = (HttpUserData*)td->connection->protocolBuffer;
+
       if(!td->request.auth.compare("Digest"))
       {
-        if(!((HttpUserData*)td->connection->protocolBuffer)->digestChecked)
-          ((HttpUserData*)td->connection->protocolBuffer)->digest =
-            checkDigest();
-        ((HttpUserData*)td->connection->protocolBuffer)->digestChecked = 1;
-        if(((HttpUserData*)td->connection->protocolBuffer)->digest == 1)
+        if(!hud->digestChecked)
+          hud->digest = checkDigest();
+
+        hud->digestChecked = 1;
+
+        if(hud->digest == 1)
         {
-          td->connection->setPassword(
-               ((HttpUserData*)td->connection->protocolBuffer)->requiredPassword);
-          *permissions = providedMask;
+          td->connection->setPassword (securityToken.getNeededPassword ().c_str ());
+          *permissions = securityToken.getProvidedMask ();
         }
       }
       td->authScheme = HTTP_AUTH_SCHEME_DIGEST;
@@ -488,46 +477,19 @@
     {
       td->authScheme = HTTP_AUTH_SCHEME_BASIC;
     }
-    /*! If there are no permissions, use the Guest permissions. */
-    if(td->request.auth.length() && (*permissions==0))
-    {
-      st.user = "Guest";
-      st.password = "";
-      st.directory = directory.c_str();
-      st.sysdirectory = td->getVhostSys();
-      st.filename = file.c_str();
-      st.requiredPassword = 0;
-      st.providedMask = 0;
-      staticHttp.secCacheMutex.lock();
-      try
-      {
-        *permissions = staticHttp.secCache.getPermissionMask(&st);
-        staticHttp.secCacheMutex.unlock();
-      }
-      catch(...)
-      {
-        staticHttp.secCacheMutex.unlock();
-        throw;
-      };
-    }
-    if(*permissions == -1)
-    {
-      td->connection->host->warningsLogRequestAccess(td->id);
-      td->connection->host->warningsLogWrite(
-                             "Http: Error reading security file");
-      td->connection->host->warningsLogTerminateAccess(td->id);
-      return 500;
-    }
   }
   catch(...)
   {
     return 500;
   }
 
+  const char *tr = securityToken.getHashedData ("connection.throttling", MYSERVER_SECURITY_CONF |
+                                                MYSERVER_VHOST_CONF |
+                                                MYSERVER_SERVER_CONF);
 
   /*! If a throttling rate was specifed use it.  */
-  if(st.throttlingRate != -1)
-    td->connection->socket->setThrottling(st.throttlingRate);
+  if(tr)
+    td->connection->socket->setThrottling( atoi (tr));
 
   return 200;
 }
@@ -543,6 +505,9 @@
 {
   string directory;
   string file;
+  int filenamePathLen;
+  string dirscan;
+
   try
   {
     if(td->request.isKeepAlive())
@@ -550,6 +515,73 @@
       td->response.connection.assign( "keep-alive");
     }
 
+    /*!
+     *Get the PATH_INFO value.
+     *Use dirscan as a buffer for put temporary directory scan.
+     *When an '/' character is present check if the path up to '/' character
+     *is a file. If it is a file send the rest of the uri as PATH_INFO.
+     */
+    td->pathInfo.assign("");
+    td->pathTranslated.assign("");
+    filenamePathLen = (int)td->filenamePath.length();
+    dirscan.assign("");
+
+    for(int i = 0, len = 0; i < filenamePathLen ; i++)
+    {
+      /*!
+       *http://host/pathtofile/filetosend.php/PATH_INFO_VALUE?QUERY_INFO_VALUE
+       *When a request has this form send the file filetosend.php with the
+       *environment string PATH_INFO equals to PATH_INFO_VALUE and QUERY_INFO
+       *to QUERY_INFO_VALUE.
+       *
+       *If there is the '/' character check if dirscan is a file.
+       */
+      if(i && (td->filenamePath[i] == '/'))
+      {
+        /*!
+         *If the token is a file.
+         */
+        if(!FilesUtility::isDirectory(dirscan.c_str()))
+        {
+          td->pathInfo.assign((char*) & (td->filenamePath[i]));
+          td->filenamePath.assign(dirscan);
+          break;
+        }
+      }
+
+      if(len + 1 < filenamePathLen)
+      {
+        char db[2];
+        db[0] = (td->filenamePath)[i];
+        db[1] = '\0';
+        dirscan.append(db);
+      }
+    }
+
+    /*!
+     *If there is a PATH_INFO value the get the PATH_TRANSLATED too.
+     *PATH_TRANSLATED is the local filesystem mapped version of PATH_INFO.
+     */
+    if(td->pathInfo.length() > 1)
+    {
+      int ret;
+      /*!
+       *Start from the second character because the first is a
+       *slash character.
+       */
+      ret = getPath(td->pathTranslated, &((td->pathInfo.c_str())[1]), 0);
+
+      if(ret != 200)
+        td->pathTranslated.assign("");
+      else
+        FilesUtility::completePath(td->pathTranslated);
+    }
+    else
+    {
+      td->pathTranslated.assign("");
+    }
+    FilesUtility::completePath(td->filenamePath);
+
     return getFilePermissions(filename, directory, file, 
                              td->filenamePath, yetmapped, permissions);
   }
@@ -632,7 +664,7 @@
   md5.init();
   td->buffer2->setLength(0);
   *td->buffer2 << td->request.digestUsername << ":" << td->request.digestRealm
-      << ":" << ((HttpUserData*)td->connection->protocolBuffer)->requiredPassword;
+               << ":" << securityToken.getNeededPassword();
 
   md5.update((unsigned char const*)td->buffer2->getBuffer(),
              (unsigned int)td->buffer2->getLength());
@@ -692,7 +724,6 @@
   nonce[0] = '\0';
   cnonce[0] = '\0';
   digestChecked = 0;
-  requiredPassword[0] = '\0';
   nc = 0;
   digest = 0;
 }
@@ -709,8 +740,6 @@
    */
   string filename;
   int permissions;
-  string dirscan;
-  int filenamePathLen;
   string data;
   int mimecmd;
   time_t lastMT;
@@ -743,77 +772,7 @@
         return raiseHTTPError(ret);
     }
 
-    /* The security file doesn't exist in any case.  */
-    if(!strcmpi(file.c_str(), "security"))
-      return raiseHTTPError(404);
-
     /*!
-     *Get the PATH_INFO value.
-     *Use dirscan as a buffer for put temporary directory scan.
-     *When an '/' character is present check if the path up to '/' character
-     *is a file. If it is a file send the rest of the uri as PATH_INFO.
-     */
-    td->pathInfo.assign("");
-    td->pathTranslated.assign("");
-    filenamePathLen = (int)td->filenamePath.length();
-    dirscan.assign("");
-    for(int i = 0, len = 0; i < filenamePathLen ; i++)
-    {
-      /*!
-       *http://host/pathtofile/filetosend.php/PATH_INFO_VALUE?QUERY_INFO_VALUE
-       *When a request has this form send the file filetosend.php with the
-       *environment string PATH_INFO equals to PATH_INFO_VALUE and QUERY_INFO
-       *to QUERY_INFO_VALUE.
-       *
-       *If there is the '/' character check if dirscan is a file.
-       */
-      if(i && (td->filenamePath[i] == '/'))
-      {
-        /*!
-         *If the token is a file.
-         */
-        if(!FilesUtility::isDirectory(dirscan.c_str()))
-        {
-          td->pathInfo.assign((char*) & (td->filenamePath[i]));
-          td->filenamePath.assign(dirscan);
-          break;
-        }
-      }
-
-      if(len + 1 < filenamePathLen)
-      {
-        char db[2];
-        db[0] = (td->filenamePath)[i];
-        db[1] = '\0';
-        dirscan.append(db);
-      }
-    }
-
-    /*!
-     *If there is a PATH_INFO value the get the PATH_TRANSLATED too.
-     *PATH_TRANSLATED is the local filesystem mapped version of PATH_INFO.
-     */
-    if(td->pathInfo.length() > 1)
-    {
-      int ret;
-      /*!
-       *Start from the second character because the first is a
-       *slash character.
-       */
-      ret = getPath(td->pathTranslated, &((td->pathInfo.c_str())[1]), 0);
-
-      if(ret != 200)
-        td->pathTranslated.assign("");
-      else
-        FilesUtility::completePath(td->pathTranslated);
-    }
-    else
-    {
-      td->pathTranslated.assign("");
-    }
-    FilesUtility::completePath(td->filenamePath);
-
-    /*!
      *If there are not any extension then we do one of this in order:
      *1)We send the default files in the directory in order.
      *2)We send the directory content.
@@ -1967,7 +1926,6 @@
 {
   try
   {
-    string defFile;
     int ret = 0;
     string time;
     ostringstream errorFile;
@@ -2005,23 +1963,16 @@
     }
 
     td->response.httpStatus = ID;
-    staticHttp.secCacheMutex.lock();
 
-    /*!
-     *The specified error file name must be in the web directory
-     *of the virtual host.
-     */
-    if(td->connection->host)
-      ret = staticHttp.secCache.getErrorFileName(td->getVhostDir(), 
-                                                 ID,
-                                                 td->getVhostSys(), 
-                                                 defFile);
-    else
-      ret = -1;
 
-    staticHttp.secCacheMutex.unlock();
+    char errorName [32];
+    sprintf (errorName, "http.error.file.%i", ID);
 
-    if(ret > 0)
+    const char *defErrorFile = securityToken.getHashedData (errorName, MYSERVER_SECURITY_CONF |
+                                                            MYSERVER_VHOST_CONF |
+                                                            MYSERVER_SERVER_CONF);
+
+    if (defErrorFile)
     {
       ostringstream nURL;
       int isPortSpecified = 0;
@@ -2044,7 +1995,7 @@
       if(nURL.str()[nURL.str().length()-1] != '/')
         nURL << "/";
 
-      nURL << defFile;
+      nURL << defErrorFile;
 
       if(td->pathInfo.length())
         nURL << "/" << td->pathInfo;
@@ -2365,8 +2316,6 @@
   string pluginsResource(Server::getInstance()->getExternalPath());
   xmlDocPtr xmlDoc = configurationFileManager->getDoc();
 
-  staticHttp.secCacheMutex.init();
-
   /*
    *Store defaults value.
    *By default use GZIP with files bigger than a MB.
@@ -2486,10 +2435,6 @@
 
   HttpDir::unLoad();
 
-  staticHttp.secCache.free();
-
-  staticHttp.secCacheMutex.destroy();
-
   staticHttp.defaultFilename.clear();
   staticHttp.browseDirCSSpath.assign("");
 

Added: trunk/myserver/src/protocol/http/http_req_security_domain.cpp
===================================================================
--- trunk/myserver/src/protocol/http/http_req_security_domain.cpp	                        (rev 0)
+++ trunk/myserver/src/protocol/http/http_req_security_domain.cpp	2008-10-04 20:35:08 UTC (rev 2865)
@@ -0,0 +1,42 @@
+/*
+MyServer
+Copyright (C) 2002-2008 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
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program.  If not, see <http://www.gnu.org/licenses/>.
+*/
+
+
+#include <include/protocol/http/http_req_security_domain.h>
+#include <include/conf/security/security_domain.h>
+
+/*!
+ *C'tor.
+ *\param request The HTTP Request object to use.
+ */
+HttpReqSecurityDomain::HttpReqSecurityDomain (HttpRequestHeader *request) : SecurityDomain ("http_request")
+{
+  this->request = request;
+}
+
+HttpReqSecurityDomain::~HttpReqSecurityDomain ()
+{
+
+}
+
+/*!
+ *\see SecurityDomain#getValue.
+ */
+string *HttpReqSecurityDomain::getValue (string &name)
+{
+  return request->getValue (name.c_str (), NULL);
+}

Modified: trunk/myserver/src/server/server.cpp
===================================================================
--- trunk/myserver/src/server/server.cpp	2008-10-04 19:43:00 UTC (rev 2864)
+++ trunk/myserver/src/server/server.cpp	2008-10-04 20:35:08 UTC (rev 2865)
@@ -74,8 +74,11 @@
  */
 Server* Server::instance = 0;
 
-Server::Server() : connectionsScheduler(this),
-                   listenThreads(&connectionsScheduler, this)
+Server::Server() : connectionsScheduler (this),
+                   listenThreads (&connectionsScheduler, this),
+                   authMethodFactory (),
+                   validatorFactory (),
+                   securityManager (&validatorFactory, &authMethodFactory)
 {
   toReboot = false;
   autoRebootEnabled = true;
@@ -495,6 +498,13 @@
  */
 void Server::loadPlugins()
 {
+  string xml("xml"); 
+  //FIXME: xmlV is never freed.
+  XmlValidator *xmlV = new XmlValidator ();
+    
+  validatorFactory.addValidator (xml, xmlV);
+  authMethodFactory.addAuthMethod (xml, (AuthMethod*) xmlV);
+
   if(filtersFactory.insert("gzip", Gzip::factory))
   {
     ostringstream stream;

Modified: trunk/myserver/tests/Makefile.am
===================================================================
--- trunk/myserver/tests/Makefile.am	2008-10-04 19:43:00 UTC (rev 2864)
+++ trunk/myserver/tests/Makefile.am	2008-10-04 20:35:08 UTC (rev 2865)
@@ -2,5 +2,5 @@
 #
 
 bin_PROGRAMS = tests_suite
-tests_suite_SOURCES = main.cpp test_base64.cpp test_cached_file.cpp test_cached_file_buffer.cpp test_cached_file_factory.cpp test_connection.cpp test_connections_scheduler.cpp test_files_utility.cpp test_filter_chain.cpp test_ftp.cpp test_gzip.cpp test_hashmap.cpp test_homedir.cpp test_http_request.cpp test_http_response.cpp test_md5.cpp test_mem_buff.cpp test_mem_stream.cpp test_multicast.cpp test_mutex.cpp test_recursive_mutex.cpp test_regex.cpp test_pipe.cpp test_safetime.cpp test_semaphore.cpp test_thread.cpp test_utility.cpp test_log_manager.cpp test_log_stream_factory.cpp test_socket_stream_creator.cpp test_file_stream_creator.cpp test_file_stream.cpp
+tests_suite_SOURCES = main.cpp test_connection.cpp test_ftp.cpp test_log_manager.cpp test_mutex.cpp test_security_domain.cpp test_validator.cpp test_auth_domain.cpp test_connections_scheduler.cpp test_gzip.cpp test_log_stream_factory.cpp test_pipe.cpp test_security_manager.cpp test_validator_factory.cpp test_base64.cpp test_file_stream.cpp test_hashmap.cpp test_md5.cpp test_recursive_mutex.cpp test_semaphore.cpp test_xml.cpp test_cached_file_buffer.cpp test_file_stream_creator.cpp test_homedir.cpp test_mem_buff.cpp test_regex.cpp test_socket_stream_creator.cpp test_cached_file.cpp test_files_utility.cpp test_http_request.cpp test_http_req_security_domain.cpp test_mem_stream.cpp test_safetime.cpp test_thread.cpp test_cached_file_factory.cpp test_filter_chain.cpp test_http_response.cpp test_multicast.cpp test_security_cache.cpp test_security_token.cpp test_utility.cpp  test_xml_validator.cpp
 tests_suite_LDADD = ../src/libmyserver.a $(CPPUNIT_LDFLAGS) $(PTHREAD_LIB) $(IDN_LIB) $(XNET_LIB) $(EVENT_LIB) $(DL_LIB) $(OPENSSL_LIB) $(ZLIB_LIB) $(XML_LIBS) $(LDFLAGS)

Copied: trunk/myserver/tests/test_auth_domain.cpp (from rev 2864, branches/myserver_sec_new/tests/test_auth_domain.cpp)
===================================================================
--- trunk/myserver/tests/test_auth_domain.cpp	                        (rev 0)
+++ trunk/myserver/tests/test_auth_domain.cpp	2008-10-04 20:35:08 UTC (rev 2865)
@@ -0,0 +1,61 @@
+/*
+ MyServer
+ Copyright (C) 2008 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
+ (at your option) any later version.
+ 
+ This program is distributed in the hope that it will be useful, 
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ GNU General Public License for more details.
+ 
+ You should have received a copy of the GNU General Public License
+ along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include <ctype.h>
+
+#include <cppunit/CompilerOutputter.h>
+#include <cppunit/extensions/TestFactoryRegistry.h>
+#include <cppunit/ui/text/TestRunner.h>
+#include <cppunit/extensions/HelperMacros.h>
+#include <include/conf/security/security_manager.h>
+#include <include/conf/security/auth_domain.h>
+
+#include <string.h>
+
+#include <iostream>
+using namespace std;
+
+class TestAuthDomain : public CppUnit::TestFixture
+{
+  CPPUNIT_TEST_SUITE( TestAuthDomain );
+  CPPUNIT_TEST( testGetName );
+  CPPUNIT_TEST_SUITE_END();
+  
+  SecurityToken *secToken;
+  AuthDomain* authDomain;
+public:
+  void setUp()
+  {
+    secToken = new SecurityToken();
+    authDomain = new AuthDomain(secToken);
+  }
+
+  void tearDown()
+  {
+    delete authDomain;
+    delete secToken;
+  }
+
+  void testGetName()
+  {
+    CPPUNIT_ASSERT_EQUAL(authDomain->getName().compare(""), 0);
+  }
+
+};
+
+
+CPPUNIT_TEST_SUITE_REGISTRATION( TestAuthDomain );

Copied: trunk/myserver/tests/test_http_req_security_domain.cpp (from rev 2864, branches/myserver_sec_new/tests/test_http_req_security_domain.cpp)
===================================================================
--- trunk/myserver/tests/test_http_req_security_domain.cpp	                        (rev 0)
+++ trunk/myserver/tests/test_http_req_security_domain.cpp	2008-10-04 20:35:08 UTC (rev 2865)
@@ -0,0 +1,82 @@
+/*
+ MyServer
+ Copyright (C) 2008 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
+ (at your option) any later version.
+ 
+ This program is distributed in the hope that it will be useful, 
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ GNU General Public License for more details.
+ 
+ You should have received a copy of the GNU General Public License
+ along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include <ctype.h>
+
+#include <string.h>
+
+#include <cppunit/CompilerOutputter.h>
+#include <cppunit/extensions/TestFactoryRegistry.h>
+#include <cppunit/ui/text/TestRunner.h>
+#include <cppunit/extensions/HelperMacros.h>
+
+#include <include/protocol/http/http_req_security_domain.h>
+
+#include <iostream>
+using namespace std;
+
+class TestHttpReqSecurityDomain : public CppUnit::TestFixture
+{
+  CPPUNIT_TEST_SUITE( TestHttpReqSecurityDomain );
+  CPPUNIT_TEST( testConstructor );
+  CPPUNIT_TEST( testGetValue );
+  CPPUNIT_TEST_SUITE_END();
+
+public:
+  void setUp()
+  {
+
+  }
+
+  void tearDown()
+  {
+
+  }
+
+
+  void testConstructor ()
+  {
+    HttpRequestHeader req;
+    HttpReqSecurityDomain *dom = new  HttpReqSecurityDomain (&req);
+
+    CPPUNIT_ASSERT_EQUAL (&req, dom->getRequest ());
+
+    delete dom;
+  }
+
+
+  void testGetValue ()
+  {
+    HttpRequestHeader req;
+    const char *name = "My-Header";
+    const char *value = "foo-bar";
+    string nameStr (name);
+    HttpReqSecurityDomain *dom = new  HttpReqSecurityDomain (&req);
+
+    req.setValue (name, value);
+
+    string *ret = dom->getValue (nameStr);
+
+    CPPUNIT_ASSERT_EQUAL (ret->compare (value), 0);
+
+    delete dom;
+  }
+
+};
+
+
+CPPUNIT_TEST_SUITE_REGISTRATION( TestHttpReqSecurityDomain );

Copied: trunk/myserver/tests/test_security_cache.cpp (from rev 2864, branches/myserver_sec_new/tests/test_security_cache.cpp)
===================================================================
--- trunk/myserver/tests/test_security_cache.cpp	                        (rev 0)
+++ trunk/myserver/tests/test_security_cache.cpp	2008-10-04 20:35:08 UTC (rev 2865)
@@ -0,0 +1,90 @@
+/*
+ MyServer
+ Copyright (C) 2008 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
+ (at your option) any later version.
+ 
+ This program is distributed in the hope that it will be useful, 
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ GNU General Public License for more details.
+ 
+ You should have received a copy of the GNU General Public License
+ along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include <ctype.h>
+
+#include <cppunit/CompilerOutputter.h>
+#include <cppunit/extensions/TestFactoryRegistry.h>
+#include <cppunit/ui/text/TestRunner.h>
+#include <cppunit/extensions/HelperMacros.h>
+#include <include/conf/security/security_manager.h>
+#include <include/conf/security/security_cache.h>
+
+#include <string.h>
+
+#include <iostream>
+using namespace std;
+
+class TestSecurityCache : public CppUnit::TestFixture
+{
+  CPPUNIT_TEST_SUITE ( TestSecurityCache );
+  CPPUNIT_TEST ( testMaxNodes );
+  CPPUNIT_TEST ( testGetParser );
+  CPPUNIT_TEST ( testGetSecurityFile );
+  CPPUNIT_TEST_SUITE_END ();
+  
+  SecurityCache *secCache;
+public:
+  void setUp ()
+  {
+    secCache = new SecurityCache ();
+  }
+
+  void tearDown ()
+  {
+    delete secCache;
+  }
+
+  void testMaxNodes ()
+  {
+    secCache->setMaxNodes (-10);
+    CPPUNIT_ASSERT_EQUAL (secCache->getMaxNodes (), 1);
+
+    secCache->setMaxNodes (0);
+    CPPUNIT_ASSERT_EQUAL (secCache->getMaxNodes (), 1);
+
+    secCache->setMaxNodes (1);
+    CPPUNIT_ASSERT_EQUAL (secCache->getMaxNodes (), 1);
+
+    secCache->setMaxNodes (10);
+    CPPUNIT_ASSERT_EQUAL (secCache->getMaxNodes (), 10);
+
+    secCache->setMaxNodes (100);
+    CPPUNIT_ASSERT_EQUAL (secCache->getMaxNodes (), 100);
+  }
+
+  void testGetSecurityFile ()
+  {
+    string file("foo/bar/not/exist/in/reality");
+    string out;
+
+    CPPUNIT_ASSERT(secCache->getSecurityFile (file, file, out));
+  }
+
+
+  void testGetParser ()
+  {
+    string dir("foo/bar/not/exist/in/reality");
+    string file("baz");
+    CPPUNIT_ASSERT_EQUAL(secCache->getParser (dir, dir, false), (XmlParser*)NULL);
+  }
+
+
+};
+
+
+CPPUNIT_TEST_SUITE_REGISTRATION ( TestSecurityCache );

Copied: trunk/myserver/tests/test_security_domain.cpp (from rev 2864, branches/myserver_sec_new/tests/test_security_domain.cpp)
===================================================================
--- trunk/myserver/tests/test_security_domain.cpp	                        (rev 0)
+++ trunk/myserver/tests/test_security_domain.cpp	2008-10-04 20:35:08 UTC (rev 2865)
@@ -0,0 +1,67 @@
+/*
+ MyServer
+ Copyright (C) 2008 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
+ (at your option) any later version.
+ 
+ This program is distributed in the hope that it will be useful, 
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ GNU General Public License for more details.
+ 
+ You should have received a copy of the GNU General Public License
+ along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include <ctype.h>
+
+#include <cppunit/CompilerOutputter.h>
+#include <cppunit/extensions/TestFactoryRegistry.h>
+#include <cppunit/ui/text/TestRunner.h>
+#include <cppunit/extensions/HelperMacros.h>
+#include <include/conf/security/security_manager.h>
+#include <include/conf/security/security_domain.h>
+
+#include <string.h>
+
+#include <iostream>
+using namespace std;
+
+
+class TestSecurityDomain : public CppUnit::TestFixture
+{
+  CPPUNIT_TEST_SUITE( TestSecurityDomain );
+  CPPUNIT_TEST( testGetValue );
+  CPPUNIT_TEST( testGetName );
+  CPPUNIT_TEST_SUITE_END();
+  
+  SecurityDomain* securityDomain;
+public:
+  void setUp()
+  {
+    securityDomain = new SecurityDomain();
+  }
+
+  void tearDown()
+  {
+    delete securityDomain;
+  }
+
+  void testGetName()
+  {
+    string val("value");
+    CPPUNIT_ASSERT_EQUAL(securityDomain->getName().compare(""), 0);
+  }
+
+  void testGetValue()
+  {
+    string val("value");
+    CPPUNIT_ASSERT_EQUAL(securityDomain->getValue(val), (string*)NULL);
+  }
+
+};
+
+
+CPPUNIT_TEST_SUITE_REGISTRATION( TestSecurityDomain );

Copied: trunk/myserver/tests/test_security_manager.cpp (from rev 2864, branches/myserver_sec_new/tests/test_security_manager.cpp)
===================================================================
--- trunk/myserver/tests/test_security_manager.cpp	                        (rev 0)
+++ trunk/myserver/tests/test_security_manager.cpp	2008-10-04 20:35:08 UTC (rev 2865)
@@ -0,0 +1,64 @@
+/*
+ MyServer
+ Copyright (C) 2008 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
+ (at your option) any later version.
+ 
+ This program is distributed in the hope that it will be useful, 
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ GNU General Public License for more details.
+ 
+ You should have received a copy of the GNU General Public License
+ along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include <ctype.h>
+
+#include <cppunit/CompilerOutputter.h>
+#include <cppunit/extensions/TestFactoryRegistry.h>
+#include <cppunit/ui/text/TestRunner.h>
+#include <cppunit/extensions/HelperMacros.h>
+
+#include <include/conf/security/security_manager.h>
+#include <include/conf/security/validator_factory.h>
+#include <include/conf/security/auth_method_factory.h>
+
+#include <string.h>
+
+#include <iostream>
+using namespace std;
+
+class TestSecurityManager : public CppUnit::TestFixture
+{
+  CPPUNIT_TEST_SUITE( TestSecurityManager );
+  CPPUNIT_TEST( testGetPermissionMask );
+  CPPUNIT_TEST_SUITE_END();
+  
+  AuthMethodFactory authMethodFactory;
+  ValidatorFactory validatorFactory;
+  SecurityManager* securityManager;
+public:
+  void setUp()
+  {
+    securityManager = new SecurityManager(&validatorFactory, &authMethodFactory);
+  }
+
+  void tearDown()
+  {
+    delete securityManager;
+  }
+
+  void testGetPermissionMask()
+  {
+    SecurityToken secToken;
+    string xml("xml");
+    CPPUNIT_ASSERT_EQUAL(securityManager->getPermissionMask(&secToken, (list<SecurityDomain*>*)NULL, xml, xml), 0);
+    CPPUNIT_ASSERT_EQUAL(securityManager->getPermissionMask(&secToken, (SecurityDomain**)NULL, xml, xml), 0);
+  }
+};
+
+
+CPPUNIT_TEST_SUITE_REGISTRATION( TestSecurityManager );

Copied: trunk/myserver/tests/test_security_token.cpp (from rev 2864, branches/myserver_sec_new/tests/test_security_token.cpp)
===================================================================
--- trunk/myserver/tests/test_security_token.cpp	                        (rev 0)
+++ trunk/myserver/tests/test_security_token.cpp	2008-10-04 20:35:08 UTC (rev 2865)
@@ -0,0 +1,163 @@
+/*
+ MyServer
+ Copyright (C) 2008 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
+ (at your option) any later version.
+ 
+ This program is distributed in the hope that it will be useful, 
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ GNU General Public License for more details.
+ 
+ You should have received a copy of the GNU General Public License
+ along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include <ctype.h>
+
+#include <cppunit/CompilerOutputter.h>
+#include <cppunit/extensions/TestFactoryRegistry.h>
+#include <cppunit/ui/text/TestRunner.h>
+#include <cppunit/extensions/HelperMacros.h>
+
+#include <include/conf/security/security_manager.h>
+#include <include/conf/security/security_token.h>
+#include <include/conf/vhost/vhost.h>
+#include <include/server/server.h>
+
+#include <string.h>
+
+#include <iostream>
+using namespace std;
+
+
+class TestSecurityToken : public CppUnit::TestFixture
+{
+  CPPUNIT_TEST_SUITE( TestSecurityToken );
+  CPPUNIT_TEST ( testUser);
+  CPPUNIT_TEST ( testPassword);
+	CPPUNIT_TEST ( testValues );
+  CPPUNIT_TEST ( testDirectory );
+  CPPUNIT_TEST ( testSysDirectory );
+  CPPUNIT_TEST ( testResource );
+  CPPUNIT_TEST ( testMask );
+  CPPUNIT_TEST ( testProvidedMask );
+  CPPUNIT_TEST ( testNeededPassword );
+  CPPUNIT_TEST ( testDone );
+  CPPUNIT_TEST ( testAuthenticated );
+  CPPUNIT_TEST ( testServer );
+  CPPUNIT_TEST ( testVhost );
+  CPPUNIT_TEST_SUITE_END();
+
+  SecurityToken* securityToken;
+public:
+  void setUp()
+  {
+    securityToken = new SecurityToken();
+  }
+
+  void tearDown()
+  {
+    delete securityToken;
+  }
+
+
+  void testUser()
+  {
+    string user ("foo");
+    securityToken->setUser (user);
+    CPPUNIT_ASSERT_EQUAL (securityToken->getUser ().compare (user), 0);
+  }
+
+  void testPassword()
+  {
+    string password ("foo");
+    securityToken->setPassword (password);
+    CPPUNIT_ASSERT_EQUAL (securityToken->getPassword ().compare (password), 0);
+  }
+
+	void testValues ()
+  {
+    CPPUNIT_ASSERT (securityToken->getValues ());
+  }
+
+  void testDirectory ()
+  {
+    string dir ("foo");
+    securityToken->setDirectory (&dir);
+    CPPUNIT_ASSERT_EQUAL (securityToken->getDirectory (), &dir);
+  }
+
+  void testSysDirectory ()
+  {
+    string sysDir ("foo");
+    securityToken->setSysDirectory (&sysDir);
+    CPPUNIT_ASSERT_EQUAL (securityToken->getSysDirectory (), &sysDir);
+  }
+
+  void testResource ()
+  {
+    string resource ("foo");
+    securityToken->setResource (&resource);
+    CPPUNIT_ASSERT_EQUAL (securityToken->getResource (), &resource);
+  }
+
+  void testMask ()
+  {
+    int mask = MYSERVER_PERMISSION_READ;
+    securityToken->setMask (mask);
+    CPPUNIT_ASSERT_EQUAL (securityToken->getMask (), mask);
+  }
+
+  void testProvidedMask ()
+  {
+    int mask = MYSERVER_PERMISSION_READ;
+    securityToken->setProvidedMask (mask);
+    CPPUNIT_ASSERT_EQUAL (securityToken->getProvidedMask (), mask);
+  }
+  
+  void testNeededPassword ()
+  {
+    string password ("foo");
+    securityToken->setNeededPassword (password);
+    CPPUNIT_ASSERT_EQUAL (securityToken->getNeededPassword ().compare (password), 0);
+  }
+
+  void testDone ()
+  {
+    securityToken->setDone (true);
+    CPPUNIT_ASSERT_EQUAL (securityToken->isDone (), true);
+
+    securityToken->setDone (false);
+    CPPUNIT_ASSERT_EQUAL (securityToken->isDone (), false);
+  }
+
+  void testAuthenticated ()
+  {
+    securityToken->setAuthenticated (true);
+    CPPUNIT_ASSERT_EQUAL (securityToken->isAuthenticated (), true);
+
+    securityToken->setAuthenticated (false);
+    CPPUNIT_ASSERT_EQUAL (securityToken->isAuthenticated (), false);
+  }
+
+  void testServer ()
+  {
+    Server *s = (Server*)0x10; //XXX: Dirty but it avoids to use the Singleton instance.
+    securityToken->setServer (s);
+    CPPUNIT_ASSERT_EQUAL (securityToken->getServer (), s);
+  }
+  
+  void testVhost ()
+  {
+    Vhost *v = (Vhost*)0x100; //XXX: Dirty.
+    securityToken->setVhost (v);
+    CPPUNIT_ASSERT_EQUAL (securityToken->getVhost (), v);
+  }
+
+};
+
+
+CPPUNIT_TEST_SUITE_REGISTRATION( TestSecurityToken );

Copied: trunk/myserver/tests/test_validator.cpp (from rev 2864, branches/myserver_sec_new/tests/test_validator.cpp)
===================================================================
--- trunk/myserver/tests/test_validator.cpp	                        (rev 0)
+++ trunk/myserver/tests/test_validator.cpp	2008-10-04 20:35:08 UTC (rev 2865)
@@ -0,0 +1,61 @@
+#include <ctype.h>
+
+#include <cppunit/CompilerOutputter.h>
+#include <cppunit/extensions/TestFactoryRegistry.h>
+#include <cppunit/ui/text/TestRunner.h>
+#include <cppunit/extensions/HelperMacros.h>
+
+#include <include/conf/security/security_manager.h>
+#include <include/conf/security/validator.h>
+
+#include <string.h>
+
+#include <iostream>
+using namespace std;
+
+class TestValidator : public CppUnit::TestFixture
+{
+  CPPUNIT_TEST_SUITE( TestValidator );
+  CPPUNIT_TEST( testGetPermissionMask );
+  CPPUNIT_TEST( testGetPermissionMaskImpl );
+  CPPUNIT_TEST( testGetValue );
+  CPPUNIT_TEST_SUITE_END();
+  
+  Validator* validator;
+public:
+  void setUp()
+  {
+    validator = new Validator ();
+  }
+
+  void tearDown()
+  {
+    delete validator;
+  }
+
+  void testGetValue ()
+  {
+    string val ("value");
+    HashMap<string, SecurityDomain*> hashedDomains;
+    CPPUNIT_ASSERT_EQUAL (validator->getValue (&hashedDomains, val), (string*)NULL);
+  }
+ 
+  void testGetPermissionMaskImpl ()
+  {
+    string val ("value");
+    SecurityToken secToken;
+    CPPUNIT_ASSERT_EQUAL (validator->getPermissionMaskImpl (&secToken, NULL, NULL), 0);
+ 
+  }
+
+  void testGetPermissionMask ()
+  {
+    string val ("value");
+    SecurityToken secToken;
+    CPPUNIT_ASSERT_EQUAL (validator->getPermissionMask (&secToken, (SecurityDomain**) NULL, NULL), 0);
+    CPPUNIT_ASSERT_EQUAL (validator->getPermissionMask (&secToken, (list<SecurityDomain*>*) NULL, NULL), 0);
+   }
+};
+
+
+CPPUNIT_TEST_SUITE_REGISTRATION( TestValidator );

Copied: trunk/myserver/tests/test_validator_factory.cpp (from rev 2864, branches/myserver_sec_new/tests/test_validator_factory.cpp)
===================================================================
--- trunk/myserver/tests/test_validator_factory.cpp	                        (rev 0)
+++ trunk/myserver/tests/test_validator_factory.cpp	2008-10-04 20:35:08 UTC (rev 2865)
@@ -0,0 +1,71 @@
+#include <ctype.h>
+
+#include <cppunit/CompilerOutputter.h>
+#include <cppunit/extensions/TestFactoryRegistry.h>
+#include <cppunit/ui/text/TestRunner.h>
+#include <cppunit/extensions/HelperMacros.h>
+
+#include <include/conf/security/security_manager.h>
+#include <include/conf/security/validator_factory.h>
+#include <include/conf/security/validator.h>
+
+#include <string.h>
+
+#include <iostream>
+using namespace std;
+
+
+class TestValidatorFactory : public CppUnit::TestFixture
+{
+  CPPUNIT_TEST_SUITE( TestValidatorFactory );
+  CPPUNIT_TEST( testGetValidator );
+  CPPUNIT_TEST( testAddValidator );
+  CPPUNIT_TEST( testIsValidatorPresent );
+  CPPUNIT_TEST_SUITE_END();
+  
+  ValidatorFactory* factory;
+public:
+  void setUp()
+  {
+    factory = new ValidatorFactory();
+  }
+
+  void tearDown()
+  {
+    delete factory;
+  }
+
+  void testGetValidator()
+  {
+    string val("foo");
+    CPPUNIT_ASSERT_EQUAL(factory->getValidator(val), (Validator*)NULL);
+ 
+  }
+ 
+  void testAddValidator()
+  {
+    string val("bar");
+    Validator *validator = new Validator;
+   
+    Validator* old = factory->addValidator(val, validator);
+
+    CPPUNIT_ASSERT_EQUAL(old, (Validator*)NULL);
+    CPPUNIT_ASSERT(factory->getValidator(val));
+  }
+
+  void testIsValidatorPresent()
+  {
+    string val("bar");
+    Validator *validator = new Validator;
+
+ 
+    CPPUNIT_ASSERT_EQUAL(factory->isValidatorPresent(val), false);
+   
+    factory->addValidator(val, validator);
+ 
+    CPPUNIT_ASSERT_EQUAL(factory->isValidatorPresent(val), true);
+  }
+};
+
+
+CPPUNIT_TEST_SUITE_REGISTRATION( TestValidatorFactory );

Copied: trunk/myserver/tests/test_xml_validator.cpp (from rev 2864, branches/myserver_sec_new/tests/test_xml_validator.cpp)
===================================================================
--- trunk/myserver/tests/test_xml_validator.cpp	                        (rev 0)
+++ trunk/myserver/tests/test_xml_validator.cpp	2008-10-04 20:35:08 UTC (rev 2865)
@@ -0,0 +1,62 @@
+#include <ctype.h>
+
+#include <cppunit/CompilerOutputter.h>
+#include <cppunit/extensions/TestFactoryRegistry.h>
+#include <cppunit/ui/text/TestRunner.h>
+#include <cppunit/extensions/HelperMacros.h>
+
+#include <include/conf/security/security_manager.h>
+#include <include/conf/security/xml_validator.h>
+
+#include <string.h>
+
+#include <iostream>
+using namespace std;
+
+class TestXmlValidator : public CppUnit::TestFixture
+{
+  CPPUNIT_TEST_SUITE( TestXmlValidator );
+  CPPUNIT_TEST( testGetPermissionMask );
+  CPPUNIT_TEST( testGetPermissionMaskImpl );
+  CPPUNIT_TEST( testGetValue );
+  CPPUNIT_TEST_SUITE_END();
+  
+  XmlValidator* xmlValidator;
+public:
+  void setUp()
+  {
+    xmlValidator = new XmlValidator();
+  }
+
+  void tearDown()
+  {
+    delete xmlValidator;
+  }
+
+  void testGetValue()
+  {
+    string val("value");
+    HashMap<string, SecurityDomain*> hashedDomains;
+
+    CPPUNIT_ASSERT_EQUAL(xmlValidator->getValue(&hashedDomains, val), (string*)NULL);
+ 
+  }
+ 
+  void testGetPermissionMaskImpl()
+  {
+    string val("value");
+    SecurityToken secToken;
+    CPPUNIT_ASSERT_EQUAL(xmlValidator->getPermissionMaskImpl(&secToken, NULL, NULL), 0);
+ 
+  }
+
+  void testGetPermissionMask()
+  {
+    SecurityToken secToken;
+    CPPUNIT_ASSERT_EQUAL (xmlValidator->getPermissionMask (&secToken, (SecurityDomain**) NULL, NULL), 0);
+    CPPUNIT_ASSERT_EQUAL (xmlValidator->getPermissionMask (&secToken, (list<SecurityDomain*>*) NULL, NULL), 0);
+  }
+};
+
+
+CPPUNIT_TEST_SUITE_REGISTRATION( TestXmlValidator );





From MAILER-DAEMON Sat Oct 04 16:57:20 2008
Received: from mailman by lists.gnu.org with archive (Exim 4.43)
	id 1KmEBj-0003So-RJ
	for mharc-myserver-commit@gnu.org; Sat, 04 Oct 2008 16:57:19 -0400
Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43)
	id 1KmEBh-0003Q1-PI
	for myserver-commit@gnu.org; Sat, 04 Oct 2008 16:57:17 -0400
Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43)
	id 1KmEBh-0003PX-88
	for myserver-commit@gnu.org; Sat, 04 Oct 2008 16:57:17 -0400
Received: from [199.232.76.173] (port=45009 helo=monty-python.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.43) id 1KmEBg-0003PU-ME
	for myserver-commit@gnu.org; Sat, 04 Oct 2008 16:57:17 -0400
Received: from savannah.gnu.org ([199.232.41.3]:40674 helo=sv.gnu.org)
	by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32)
	(Exim 4.60) (envelope-from <INVALID.NOREPLY@gnu.org>)
	id 1KmEBf-0008QC-Kp
	for myserver-commit@gnu.org; Sat, 04 Oct 2008 16:57:16 -0400
Received: from cvs.savannah.gnu.org ([199.232.41.69])
	by sv.gnu.org with esmtp (Exim 4.63)
	(envelope-from <INVALID.NOREPLY@gnu.org>) id 1KmEBd-0007v7-9c
	for myserver-commit@gnu.org; Sat, 04 Oct 2008 20:57:13 +0000
Received: from gscrivano by cvs.savannah.gnu.org with local (Exim 4.63)
	(envelope-from <gscrivano@savannah.gnu.org>) id 1KmEBc-0007v3-Qp
	for myserver-commit@gnu.org; Sat, 04 Oct 2008 20:57:12 +0000
MIME-Version: 1.0
Errors-To: gscrivano
To: myserver-commit@gnu.org
X-Mailer: SVN::Notify 2.64: http://search.cpan.org/dist/SVN-Notify/
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
From: Giuseppe Scrivano <gscrivano@gnu.org>
Message-Id: <E1KmEBc-0007v3-Qp@cvs.savannah.gnu.org>
Date: Sat, 04 Oct 2008 20:57:12 +0000
X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 3)
Subject: [myserver-commit] [2866] Don't use the `MYSERVER_HEADERS' configure
	time variable.
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/pipermail/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, 04 Oct 2008 20:57:18 -0000

Revision: 2866
          http://svn.sv.gnu.org/viewvc/?view=rev&root=myserver&revision=2866
Author:   gscrivano
Date:     2008-10-04 20:57:12 +0000 (Sat, 04 Oct 2008)

Log Message:
-----------
Don't use the `MYSERVER_HEADERS' configure time variable.

Modified Paths:
--------------
    trunk/myserver/binaries/plugins/Makefile.am
    trunk/myserver/binaries/web/cgi-src/math_sum/Makefile.am
    trunk/myserver/binaries/web/cgi-src/post/Makefile.am

Modified: trunk/myserver/binaries/plugins/Makefile.am
===================================================================
--- trunk/myserver/binaries/plugins/Makefile.am	2008-10-04 20:35:08 UTC (rev 2865)
+++ trunk/myserver/binaries/plugins/Makefile.am	2008-10-04 20:57:12 UTC (rev 2866)
@@ -1,21 +1 @@
 all:
-	@echo "CXX=$(CXX)" > modules.template
-	@echo "CFLAGS=$(CFLAGS)" >> modules.template
-	@echo "CXXFLAGS=$(CXXFLAGS)" >> modules.template
-	@echo "LDFLAGS=$(LDFLAGS)" >> modules.template
-	@echo "XML_CFLAGS=$(XML_CFLAGS)" >> modules.template
-	@echo "PTHREAD_LIB=$(PTHREAD_LIB)" >> modules.template
-	@echo "AM_CPPFLAGS=$(AM_CPPFLAGS)" >> modules.template
-	@echo "CPPFLAGS=$(CPPFLAGS)" >> modules.template
-	@echo "AM_CXXFLAGS=$(AM_CXXFLAGS)" >> modules.template
-	@echo "IDN_LIB=$(IDN_LIB)" >> modules.template
-	@echo "XNET_LIB=$(XNET_LIB)" >> modules.template
-	@echo "DL_LIB=$(DL_LIB)" >> modules.template
-	@echo "OPENSSL_LIB=$(OPENSSL_LIB)" >> modules.template
-	@echo "ZLIB_LIB=$(ZLIB_LIB)" >> modules.template
-	@echo "XML_LIBS=$(XML_LIBS)" >> modules.template
-	@echo "LIBPNG_LIBS=$(LIBPNG_LIBS)" >> modules.template
-	@echo "LIBPNG_CFLAGS=$(LIBPNG_CFLAGS)" >> modules.template
-	@echo "MYSERVER_HEADERS=$(MYSERVER_HEADERS)" >> modules.template
-
-

Modified: trunk/myserver/binaries/web/cgi-src/math_sum/Makefile.am
===================================================================
--- trunk/myserver/binaries/web/cgi-src/math_sum/Makefile.am	2008-10-04 20:35:08 UTC (rev 2865)
+++ trunk/myserver/binaries/web/cgi-src/math_sum/Makefile.am	2008-10-04 20:57:12 UTC (rev 2866)
@@ -2,8 +2,6 @@
 lib_LIBRARIES = libmath_sum.a
 libmath_sum_a_SOURCES = math_sum.cpp
 
-libmath_sum_a_CXXFLAGS = $(CXXFLAGS) $(XML_CFLAGS) -I$(MYSERVER_HEADERS)
-
 all : all-am math_sum.mscgi
 	cp math_sum.mscgi ../../cgi-bin/
 
@@ -11,7 +9,7 @@
 
 math_sum.mscgi : $(libmath_sum_a_OBJECTS) $(libmath_sum_a_DEPENDENCIES)
 	-rm -f math_sum.mscgi
-	$(CXX) $(libmath_sum_a_OBJECTS) ../../../../src/libmyserver.a $(libmath_sum_a_LIBADD)  $(PTHREAD_LIB) $(IDN_LIB) $(XNET_LIB) $(EVENT_LIB) $(DL_LIB) $(OPENSSL_LIB) $(ZLIB_LIB) $(XML_LIBS) $(LDFLAGS) -o math_sum.mscgi -shared
+	$(CXX) $(libmath_sum_a_OBJECTS) ../../../../src/libmyserver.a $(libmath_sum_a_LIBADD)  $(PTHREAD_LIB) $(IDN_LIB) $(XNET_LIB) $(EVENT_LIB) $(DL_LIB) $(OPENSSL_LIB) $(ZLIB_LIB) $(XML_LIBS) $(LDFLAGS) -o math_sum.mscgi -shared $(CXXFLAGS) $(XML_CFLAGS)
 
 install : math_sum.mscgi
 	$(INSTALL) -D 'math_sum.mscgi' '$(root_prefix)/var/web/cgi-bin/math_sum.mscgi'

Modified: trunk/myserver/binaries/web/cgi-src/post/Makefile.am
===================================================================
--- trunk/myserver/binaries/web/cgi-src/post/Makefile.am	2008-10-04 20:35:08 UTC (rev 2865)
+++ trunk/myserver/binaries/web/cgi-src/post/Makefile.am	2008-10-04 20:57:12 UTC (rev 2866)
@@ -2,8 +2,6 @@
 lib_LIBRARIES = libpost.a
 libpost_a_SOURCES = post.cpp
 
-libpost_a_CXXFLAGS = $(CXXFLAGS) $(XML_CFLAGS) -I$(MYSERVER_HEADERS)
-
 all : all-am post.mscgi
 	cp post.mscgi ../../cgi-bin/
 
@@ -12,7 +10,7 @@
 
 post.mscgi : $(libpost_a_OBJECTS) $(libpost_a_DEPENDENCIES)
 	-rm -f post.mscgi
-	$(CXX) $(libpost_a_OBJECTS) ../../../../src/libmyserver.a $(libpost_a_LIBADD)  $(PTHREAD_LIB) $(IDN_LIB) $(XNET_LIB) $(EVENT_LIB) $(DL_LIB) $(OPENSSL_LIB) $(ZLIB_LIB) $(XML_LIBS) $(LDFLAGS) -o post.mscgi -shared
+	$(CXX) $(libpost_a_OBJECTS) ../../../../src/libmyserver.a $(libpost_a_LIBADD)  $(PTHREAD_LIB) $(IDN_LIB) $(XNET_LIB) $(EVENT_LIB) $(DL_LIB) $(OPENSSL_LIB) $(ZLIB_LIB) $(XML_LIBS) $(LDFLAGS) -o post.mscgi -shared $(CXXFLAGS) $(XML_CFLAGS)
 
 install : post.mscgi
 	$(INSTALL) -D 'post.mscgi' '$(root_prefix)/var/web/cgi-bin/post.mscgi'





From MAILER-DAEMON Sat Oct 04 18:21:23 2008
Received: from mailman by lists.gnu.org with archive (Exim 4.43)
	id 1KmFV5-0005S1-Ek
	for mharc-myserver-commit@gnu.org; Sat, 04 Oct 2008 18:21:23 -0400
Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43)
	id 1KmFV3-0005R4-H5
	for myserver-commit@gnu.org; Sat, 04 Oct 2008 18:21:21 -0400
Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43)
	id 1KmFV2-0005Qs-4r
	for myserver-commit@gnu.org; Sat, 04 Oct 2008 18:21:20 -0400
Received: from [199.232.76.173] (port=42770 helo=monty-python.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.43) id 1KmFV1-0005Qp-Vr
	for myserver-commit@gnu.org; Sat, 04 Oct 2008 18:21:20 -0400
Received: from savannah.gnu.org ([199.232.41.3]:36009 helo=sv.gnu.org)
	by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32)
	(Exim 4.60) (envelope-from <INVALID.NOREPLY@gnu.org>)
	id 1KmFV1-0007Ff-Tb
	for myserver-commit@gnu.org; Sat, 04 Oct 2008 18:21:20 -0400
Received: from cvs.savannah.gnu.org ([199.232.41.69])
	by sv.gnu.org with esmtp (Exim 4.63)
	(envelope-from <INVALID.NOREPLY@gnu.org>) id 1KmFUz-0001sS-Pt
	for myserver-commit@gnu.org; Sat, 04 Oct 2008 22:21:18 +0000
Received: from gscrivano by cvs.savannah.gnu.org with local (Exim 4.63)
	(envelope-from <gscrivano@savannah.gnu.org>) id 1KmFUy-0001sO-Rq
	for myserver-commit@gnu.org; Sat, 04 Oct 2008 22:21:17 +0000
MIME-Version: 1.0
Errors-To: gscrivano
To: myserver-commit@gnu.org
X-Mailer: SVN::Notify 2.64: http://search.cpan.org/dist/SVN-Notify/
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
From: Giuseppe Scrivano <gscrivano@gnu.org>
Message-Id: <E1KmFUy-0001sO-Rq@cvs.savannah.gnu.org>
Date: Sat, 04 Oct 2008 22:21:16 +0000
X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 3)
Subject: [myserver-commit] [2867] Fixed test case.
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/pipermail/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, 04 Oct 2008 22:21:22 -0000

Revision: 2867
          http://svn.sv.gnu.org/viewvc/?view=rev&root=myserver&revision=2867
Author:   gscrivano
Date:     2008-10-04 22:21:15 +0000 (Sat, 04 Oct 2008)

Log Message:
-----------
Fixed test case.

Modified Paths:
--------------
    trunk/myserver/src/protocol/http/http_headers.cpp
    trunk/myserver/tests/test_http_response.cpp

Modified: trunk/myserver/src/protocol/http/http_headers.cpp
===================================================================
--- trunk/myserver/src/protocol/http/http_headers.cpp	2008-10-04 20:57:12 UTC (rev 2866)
+++ trunk/myserver/src/protocol/http/http_headers.cpp	2008-10-04 22:21:15 UTC (rev 2867)
@@ -362,7 +362,7 @@
   /*
    *Count the number of lines in the header.
    */
-  for(i = 0;; i++)
+  for(i = 0; res[i]; i++)
   {
     if(res[i]=='\n')
     {
@@ -1242,7 +1242,7 @@
   if(req == 0)
     return 400;
   
-  for(;(i < MYSERVER_KB(8)); i++)
+  for(;i < MYSERVER_KB(8); i++)
   {
     if(req[i] == '\n')
     {

Modified: trunk/myserver/tests/test_http_response.cpp
===================================================================
--- trunk/myserver/tests/test_http_response.cpp	2008-10-04 20:57:12 UTC (rev 2866)
+++ trunk/myserver/tests/test_http_response.cpp	2008-10-04 22:21:15 UTC (rev 2867)
@@ -92,14 +92,14 @@
                                          &nLinesptr,
                                          &ncharsptr);
 
-    CPPUNIT_ASSERT(ret == 0);
+    CPPUNIT_ASSERT_EQUAL(ret, 0);
 
 
     ret = HttpHeaders::validHTTPResponse(NULL,
                                          &nLinesptr,
                                          &ncharsptr);
 
-    CPPUNIT_ASSERT(ret == 0);
+    CPPUNIT_ASSERT_EQUAL(ret, 0);
   }
 
   void testReset()





From MAILER-DAEMON Sun Oct 05 05:47:56 2008
Received: from mailman by lists.gnu.org with archive (Exim 4.43)
	id 1KmQDT-0001qb-W8
	for mharc-myserver-commit@gnu.org; Sun, 05 Oct 2008 05:47:56 -0400
Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43)
	id 1KmQDS-0001qG-K9
	for myserver-commit@gnu.org; Sun, 05 Oct 2008 05:47:54 -0400
Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43)
	id 1KmQDR-0001pv-8i
	for myserver-commit@gnu.org; Sun, 05 Oct 2008 05:47:53 -0400
Received: from [199.232.76.173] (port=34637 helo=monty-python.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.43) id 1KmQDQ-0001pl-W7
	for myserver-commit@gnu.org; Sun, 05 Oct 2008 05:47:53 -0400
Received: from savannah.gnu.org ([199.232.41.3]:51930 helo=sv.gnu.org)
	by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32)
	(Exim 4.60) (envelope-from <INVALID.NOREPLY@gnu.org>)
	id 1KmQDQ-0004wM-FP
	for myserver-commit@gnu.org; Sun, 05 Oct 2008 05:47:52 -0400
Received: from cvs.savannah.gnu.org ([199.232.41.69])
	by sv.gnu.org with esmtp (Exim 4.63)
	(envelope-from <INVALID.NOREPLY@gnu.org>) id 1KmQDP-0007uu-QP
	for myserver-commit@gnu.org; Sun, 05 Oct 2008 09:47:51 +0000
Received: from ignacy by cvs.savannah.gnu.org with local (Exim 4.63)
	(envelope-from <ignacy@savannah.gnu.org>) id 1KmQDP-0007uq-Gu
	for myserver-commit@gnu.org; Sun, 05 Oct 2008 09:47:51 +0000
MIME-Version: 1.0
Errors-To: ignacy
To: myserver-commit@gnu.org
X-Mailer: SVN::Notify 2.64: http://search.cpan.org/dist/SVN-Notify/
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
From: Ignacy Moryc <imoryc@gmail.com>
Message-Id: <E1KmQDP-0007uq-Gu@cvs.savannah.gnu.org>
Date: Sun, 05 Oct 2008 09:47:51 +0000
X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 3)
Subject: [myserver-commit] [2868] Finishing MIME types selection.
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/pipermail/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, 05 Oct 2008 09:47:54 -0000

Revision: 2868
          http://svn.sv.gnu.org/viewvc/?view=rev&root=myserver&revision=2868
Author:   ignacy
Date:     2008-10-05 09:47:50 +0000 (Sun, 05 Oct 2008)

Log Message:
-----------
Finishing MIME types selection. Design updates

Modified Paths:
--------------
    trunk/misc/PyGTK_Control/ConfigGUI.py
    trunk/misc/PyGTK_Control/XMLGui.glade

Modified: trunk/misc/PyGTK_Control/ConfigGUI.py
===================================================================
--- trunk/misc/PyGTK_Control/ConfigGUI.py	2008-10-04 22:21:15 UTC (rev 2867)
+++ trunk/misc/PyGTK_Control/ConfigGUI.py	2008-10-05 09:47:50 UTC (rev 2868)
@@ -4,12 +4,12 @@
 # it under the terms of the GNU General Public License as published by
 # the Free Software Foundation; either version 3 of the License, or
 # (at your option) any later version.
-# 
+#
 # This program is distributed in the hope that it will be useful,
 # but WITHOUT ANY WARRANTY; without even the implied warranty of
 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 # GNU General Public License for more details.
-# 
+#
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
@@ -37,7 +37,7 @@
         # Connect the Glade file
         self.gladefile = "XMLGui.glade"
         self.wTree = gtk.glade.XML(self.gladefile)
-        
+
         # Bind main window
         self.window = self.wTree.get_widget("ConfigUI")
         # Bind "destroy" event
@@ -55,7 +55,7 @@
         column.set_resizable(True)
         self.treeview.append_column(column)
         renderer=gtk.CellRendererText()
-        
+
         # Add list items to tree view
         self.insert_row(self.treemodel,None,'default.html')
         self.insert_row(self.treemodel,None,'default.htm')
@@ -63,9 +63,38 @@
         self.insert_row(self.treemodel,None,'index.html')
         self.insert_row(self.treemodel,None,'index.htm')
         self.insert_row(self.treemodel,None,'index.php')
-        
+
         self.treeview.show()
 
+        self.store2 = gtk.ListStore(gobject.TYPE_STRING)
+        #populate
+        self.store2.append(["Every HTTP connection"])
+        self.store2.append(["FTP connection"])
+        self.cbHost=self.wTree.get_widget("combobox5")
+        self.cbHost.set_model(self.store2)
+        cell = gtk.CellRendererText()
+        self.cbHost.pack_start(cell, True)
+        self.cbHost.add_attribute(cell, 'text',0)
+
+        # Add list items to tree view
+        # this types are parsed from xml file using helper class MIMEtpe
+        # the result is used to poulate the treeview and the combobox
+
+        from MIMEtypes import MIMEtype, ParseTypes
+        TYPES = ParseTypes("MIMEtypes.xml")
+
+        #Create combobox to select MIME type
+        # http://faq.pygtk.org/index.py?req=show&file=faq16.008.htp
+        self.comboboxMIME = self.wTree.get_widget("combobox3")
+        self.store = gtk.ListStore(gobject.TYPE_STRING)
+        #populate
+        for element in TYPES:
+            self.store.append([str(element.MIME)])
+        self.comboboxMIME.set_model(self.store)
+        cell = gtk.CellRendererText()
+        self.comboboxMIME.pack_start(cell, True)
+        self.comboboxMIME.add_attribute(cell, 'text',0)
+
         # Crete treeview widget with file extensions
         self.treeviewEXT=self.wTree.get_widget("treeview2")
         self.treemodelEXT=gtk.TreeStore(gobject.TYPE_STRING)
@@ -77,18 +106,13 @@
         column.set_resizable(True)
         self.treeviewEXT.append_column(column)
         renderer=gtk.CellRendererText()
-        
-        # Add list items to tree view
-        # this types are parsed from xml file using helper class MIMEtpe
-        from MIMEtypes import MIMEtype, ParseTypes
-        TYPES = ParseTypes("MIMEtypes.xml")
-        
+
         #populate
         for element in TYPES:
             self.insert_row(self.treemodelEXT,None,element.ext)
         self.treeviewEXT.show()
 
-    
+
         # dic - dictionary with pairs:
         #        "signal name" : event
         dic = { "on_btnAddFileName_clicked" : \
@@ -97,12 +121,18 @@
                     self.buttonRemoveDefultFileName_clicked,
                 "on_btnAddMIMEExtenesion_clicked" : \
                     self.buttonAddMIMEExtension_clicked,
+                "on_btnAddMIMEType_clicked" : \
+                    self.buttonAddMIMEType_clicked,
                 "on_filechooserbutton2_file_set" : \
                     self.filechooserbutton2_file_set,
                 "on_filechooserbutton1_file_set" : \
                     self.filechooserbutton1_file_set,
                 "on_btnRemoveMIMEExtension_clicked" : \
-                    self.buttonRemoveMIMEExtension_clicked
+                    self.buttonRemoveMIMEExtension_clicked,
+                "on_btnAddHostName_clicked" : \
+                    self.buttonAddHostName_clicked,
+                "on_btnRemoveHostName_clicked" : \
+                    self.buttonRemoveHostName_clicked
                 }
         # Connect signals
         self.wTree.signal_autoconnect (dic)
@@ -126,30 +156,45 @@
         model, selected = selection.get_selected()
         model.remove(selected)
 
+    def buttonAddMIMEType_clicked(self, button):
+        """ Add new MIME type to list """
+        self.store.append([self.ShowDialogBox("Add new MIME type")])
+
+    def buttonAddHostName_clicked(self, button):
+        """ Add new Host name to combobox """
+        self.store2.append([self.ShowDialogBox("Add new host")])
+
+    def buttonRemoveHostName_clicked(self, button):
+        """ Removes host name from combobox """
+        self.store2.remove(self.cbHost.get_active_iter())
+
     def buttonAddefaultFileName_clicked(self, button):
         """ Adds new entry, with default file name to tree view"""
-        dia = gtk.Dialog("Add new file name")
-        dia.show()
-        entry = gtk.Entry()
-        entry.show()
-        entry.set_activates_default(True)
-        dia.vbox.pack_start(entry)
-        dia.add_button(gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL)
-        dia.add_button(gtk.STOCK_OK, gtk.RESPONSE_OK)
-        dia.set_default_response(gtk.RESPONSE_OK)
-        response = dia.run()
-        if response == gtk.RESPONSE_OK:
-            name = entry.get_text()
-        dia.destroy()
-        self.insert_row(self.treemodel,None, name)
-        
+        self.insert_row(self.treemodel,None, self.ShowDialogBox("Add new file name"))
+
     def buttonRemoveDefultFileName_clicked(self, button):
         """ Removes selected file name """
         self.delete_rows(self.treeview)
-        
+
     def buttonAddMIMEExtension_clicked(self, button):
         """ Add new extension """
-        dia = gtk.Dialog("Add new extension")
+        self.insert_row(self.treemodelEXT,None, self.ShowDialogBox("Add new extension"))
+
+    def buttonRemoveMIMEExtension_clicked(self, widget):
+        """ Remove selected extension name """
+        self.delete_rows(self.treeviewEXT)
+
+    def filechooserbutton2_file_set(self, widget):
+        """ Place file path in entry field """
+        self.wTree.get_widget("enManager").set_text(self.wTree.get_widget("filechooserbutton2").get_filename())
+
+    def filechooserbutton1_file_set(self, widget):
+        """ Place file path in entry field """
+        self.wTree.get_widget("enStylesheet").set_text(self.wTree.get_widget("filechooserbutton1").get_filename())
+
+    def ShowDialogBox(self, title):
+        """ Shows a typical dilog box with single text box entry field """
+        dia = gtk.Dialog(title)
         dia.show()
         entry = gtk.Entry()
         entry.show()
@@ -162,21 +207,8 @@
         if response == gtk.RESPONSE_OK:
             name = entry.get_text()
         dia.destroy()
-        self.insert_row(self.treemodelEXT,None, name)
+        return name
 
-    def buttonRemoveMIMEExtension_clicked(self, widget):
-        """ Remove selected extension name """
-        self.delete_rows(self.treeviewEXT)
-
-
-    def filechooserbutton2_file_set(self, widget):
-        """ Place file path in entry field """
-        self.wTree.get_widget("enManager").set_text(self.wTree.get_widget("filechooserbutton2").get_filename())
-        
-    def filechooserbutton1_file_set(self, widget):
-        """ Place file path in entry field """
-        self.wTree.get_widget("enStylesheet").set_text(self.wTree.get_widget("filechooserbutton1").get_filename())
-
 if __name__ == "__main__":
     ConfigUI = ConfigGUIGTK()
     gtk.main()

Modified: trunk/misc/PyGTK_Control/XMLGui.glade
===================================================================
--- trunk/misc/PyGTK_Control/XMLGui.glade	2008-10-04 22:21:15 UTC (rev 2867)
+++ trunk/misc/PyGTK_Control/XMLGui.glade	2008-10-05 09:47:50 UTC (rev 2868)
@@ -784,6 +784,7 @@
                         <child>
                           <widget class="GtkComboBox" id="combobox3">
                             <property name="visible">True</property>
+                            <property name="active">0</property>
                           </widget>
                           <packing>
                             <property name="left_attach">1</property>
@@ -876,68 +877,102 @@
                     <property name="visible">True</property>
                     <child>
                       <widget class="GtkHBox" id="hbox4">
-                        <property name="height_request">20</property>
+                        <property name="height_request">30</property>
                         <property name="visible">True</property>
                         <child>
-                          <widget class="GtkLabel" id="label23">
-                            <property name="width_request">100</property>
-                            <property name="height_request">20</property>
+                          <widget class="GtkVBox" id="vbox13">
                             <property name="visible">True</property>
-                            <property name="label" translatable="yes">Name:</property>
-                            <property name="single_line_mode">True</property>
+                            <child>
+                              <widget class="GtkLabel" id="label23">
+                                <property name="width_request">100</property>
+                                <property name="height_request">20</property>
+                                <property name="visible">True</property>
+                                <property name="xpad">1</property>
+                                <property name="ypad">5</property>
+                                <property name="label" translatable="yes">Name:</property>
+                                <property name="single_line_mode">True</property>
+                              </widget>
+                            </child>
+                            <child>
+                              <placeholder/>
+                            </child>
                           </widget>
-                          <packing>
-                            <property name="expand">False</property>
-                            <property name="fill">False</property>
-                          </packing>
                         </child>
                         <child>
-                          <widget class="GtkComboBox" id="combobox5">
-                            <property name="height_request">20</property>
+                          <placeholder/>
+                        </child>
+                        <child>
+                          <widget class="GtkVBox" id="vbox11">
                             <property name="visible">True</property>
-                            <property name="has_frame">False</property>
-                            <property name="items" translatable="yes">Every HTTP connection
-FTP connection</property>
+                            <property name="spacing">3</property>
+                            <property name="homogeneous">True</property>
+                            <child>
+                              <widget class="GtkComboBox" id="combobox5">
+                                <property name="height_request">20</property>
+                                <property name="visible">True</property>
+                                <property name="has_frame">False</property>
+                              </widget>
+                            </child>
+                            <child>
+                              <placeholder/>
+                            </child>
                           </widget>
                           <packing>
                             <property name="expand">False</property>
-                            <property name="fill">False</property>
-                            <property name="position">1</property>
+                            <property name="padding">3</property>
+                            <property name="position">2</property>
                           </packing>
                         </child>
                         <child>
-                          <widget class="GtkButton" id="btnAddHostName">
-                            <property name="height_request">20</property>
+                          <widget class="GtkVBox" id="vbox14">
                             <property name="visible">True</property>
-                            <property name="can_focus">True</property>
-                            <property name="label">gtk-add</property>
-                            <property name="use_stock">True</property>
-                            <property name="response_id">0</property>
-                            <signal name="clicked" handler="on_btnAddHostName_clicked"/>
+                            <child>
+                              <widget class="GtkButton" id="btnAddHostName">
+                                <property name="height_request">20</property>
+                                <property name="visible">True</property>
+                                <property name="can_focus">True</property>
+                                <property name="label">gtk-add</property>
+                                <property name="use_stock">True</property>
+                                <property name="response_id">0</property>
+                                <signal name="clicked" handler="on_btnAddHostName_clicked"/>
+                              </widget>
+                            </child>
+                            <child>
+                              <placeholder/>
+                            </child>
                           </widget>
                           <packing>
-                            <property name="expand">False</property>
-                            <property name="fill">False</property>
-                            <property name="position">2</property>
+                            <property name="position">3</property>
                           </packing>
                         </child>
                         <child>
-                          <widget class="GtkButton" id="btnRemoveHostName">
-                            <property name="height_request">20</property>
+                          <widget class="GtkVBox" id="vbox10">
                             <property name="visible">True</property>
-                            <property name="can_focus">True</property>
-                            <property name="label">gtk-remove</property>
-                            <property name="use_stock">True</property>
-                            <property name="response_id">0</property>
-                            <signal name="clicked" handler="on_btnRemoveHostName_clicked"/>
+                            <property name="homogeneous">True</property>
+                            <child>
+                              <widget class="GtkButton" id="btnRemoveHostName">
+                                <property name="height_request">20</property>
+                                <property name="visible">True</property>
+                                <property name="can_focus">True</property>
+                                <property name="label">gtk-remove</property>
+                                <property name="use_stock">True</property>
+                                <property name="response_id">0</property>
+                                <signal name="clicked" handler="on_btnRemoveHostName_clicked"/>
+                              </widget>
+                            </child>
+                            <child>
+                              <placeholder/>
+                            </child>
                           </widget>
                           <packing>
                             <property name="expand">False</property>
-                            <property name="fill">False</property>
-                            <property name="position">3</property>
+                            <property name="position">4</property>
                           </packing>
                         </child>
                       </widget>
+                      <packing>
+                        <property name="fill">False</property>
+                      </packing>
                     </child>
                     <child>
                       <widget class="GtkNotebook" id="notebook2">





From MAILER-DAEMON Sun Oct 05 06:35:07 2008
Received: from mailman by lists.gnu.org with archive (Exim 4.43)
	id 1KmQx8-0004UI-OW
	for mharc-myserver-commit@gnu.org; Sun, 05 Oct 2008 06:35:06 -0400
Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43)
	id 1KmQx6-0004S5-HZ
	for myserver-commit@gnu.org; Sun, 05 Oct 2008 06:35:04 -0400
Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43)
	id 1KmQx4-0004QD-Ty
	for myserver-commit@gnu.org; Sun, 05 Oct 2008 06:35:03 -0400
Received: from [199.232.76.173] (port=57767 helo=monty-python.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.43) id 1KmQx4-0004Pv-DM
	for myserver-commit@gnu.org; Sun, 05 Oct 2008 06:35:02 -0400
Received: from savannah.gnu.org ([199.232.41.3]:60450 helo=sv.gnu.org)
	by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32)
	(Exim 4.60) (envelope-from <INVALID.NOREPLY@gnu.org>)
	id 1KmQx3-00077I-2G
	for myserver-commit@gnu.org; Sun, 05 Oct 2008 06:35:01 -0400
Received: from cvs.savannah.gnu.org ([199.232.41.69])
	by sv.gnu.org with esmtp (Exim 4.63)
	(envelope-from <INVALID.NOREPLY@gnu.org>) id 1KmQvI-0000sN-HY
	for myserver-commit@gnu.org; Sun, 05 Oct 2008 10:33:12 +0000
Received: from gscrivano by cvs.savannah.gnu.org with local (Exim 4.63)
	(envelope-from <gscrivano@savannah.gnu.org>) id 1KmQvI-0000sI-6S
	for myserver-commit@gnu.org; Sun, 05 Oct 2008 10:33:12 +0000
MIME-Version: 1.0
Errors-To: gscrivano
To: myserver-commit@gnu.org
X-Mailer: SVN::Notify 2.64: http://search.cpan.org/dist/SVN-Notify/
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
From: Giuseppe Scrivano <gscrivano@gnu.org>
Message-Id: <E1KmQvI-0000sI-6S@cvs.savannah.gnu.org>
Date: Sun, 05 Oct 2008 10:33:12 +0000
X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 3)
Subject: [myserver-commit] [2869] Don't hardly code `xml' as security
	validator and auth method.
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/pipermail/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, 05 Oct 2008 10:35:05 -0000

Revision: 2869
          http://svn.sv.gnu.org/viewvc/?view=rev&root=myserver&revision=2869
Author:   gscrivano
Date:     2008-10-05 10:33:11 +0000 (Sun, 05 Oct 2008)

Log Message:
-----------
Don't hardly code `xml' as security validator and auth method.

Modified Paths:
--------------
    trunk/myserver/include/conf/security/security_token.h
    trunk/myserver/src/conf/security/security_token.cpp
    trunk/myserver/src/conf/vhost/vhost.cpp
    trunk/myserver/src/protocol/ftp/ftp.cpp
    trunk/myserver/src/protocol/http/http.cpp

Modified: trunk/myserver/include/conf/security/security_token.h
===================================================================
--- trunk/myserver/include/conf/security/security_token.h	2008-10-05 09:47:50 UTC (rev 2868)
+++ trunk/myserver/include/conf/security/security_token.h	2008-10-05 10:33:11 UTC (rev 2869)
@@ -47,7 +47,7 @@
   SecurityToken();
   void reset();
 
-  const char* getHashedData (const char* name, int domains);
+  const char* getHashedData (const char* name, int domains, const char *def = NULL);
 
   string& getUser ()
   {

Modified: trunk/myserver/src/conf/security/security_token.cpp
===================================================================
--- trunk/myserver/src/conf/security/security_token.cpp	2008-10-05 09:47:50 UTC (rev 2868)
+++ trunk/myserver/src/conf/security/security_token.cpp	2008-10-05 10:33:11 UTC (rev 2869)
@@ -53,12 +53,14 @@
 /*!
  *Get the value for the variable using the specified domains.
  *\param name Variable name.
+ *\param def Default value.
  *\param domains Domains where to look.  They are looked in this order: 
  *\li Security configuration file.
  *\li Virtual host configuration file.
  *\li Global security file.
+ *\li Default value.
  */
-const char* SecurityToken::getHashedData (const char* name, int domains)
+const char* SecurityToken::getHashedData (const char* name, int domains, const char *def)
 {
   if (domains & MYSERVER_SECURITY_CONF)
   {
@@ -87,5 +89,5 @@
   }
 
   
-  return NULL;
+  return def;
 }

Modified: trunk/myserver/src/conf/vhost/vhost.cpp
===================================================================
--- trunk/myserver/src/conf/vhost/vhost.cpp	2008-10-05 09:47:50 UTC (rev 2868)
+++ trunk/myserver/src/conf/vhost/vhost.cpp	2008-10-05 10:33:11 UTC (rev 2869)
@@ -583,22 +583,23 @@
 }
 
 /*! 
- *Get the value for name in the hash dictionary. If the data is not present
- *it tries to get it from the Server class.
- *\param name The key of the hashed entry.
+ *Get the value for name in the hash dictionary.
+ *\param name The hashed entry key.
  */
 const char* Vhost::getHashedData(const char* name)
 {
   
   string *s;
-  if(name == 0)
-    return 0;
+
+  if(!name)
+    return NULL;
+
   s = hashedData.get(name);
+
   if(s)
     return s->c_str();
 
-  return Server::getInstance() ? Server::getInstance()->getHashedData(name) 
-    : 0 ;
+  return NULL;
 }
   
 /*!

Modified: trunk/myserver/src/protocol/ftp/ftp.cpp
===================================================================
--- trunk/myserver/src/protocol/ftp/ftp.cpp	2008-10-05 09:47:50 UTC (rev 2868)
+++ trunk/myserver/src/protocol/ftp/ftp.cpp	2008-10-05 10:33:11 UTC (rev 2869)
@@ -2404,10 +2404,15 @@
   st.setResource (&sFileName);
 
   AuthDomain auth (&st);
-  string xml ("xml");//FIXME: don't hardly-code "xml".
+  string validator (st.getHashedData ("sec.validator", MYSERVER_VHOST_CONF |
+                                      MYSERVER_SERVER_CONF, "xml"));
+  string authMethod (st.getHashedData ("sec.auth_method", MYSERVER_VHOST_CONF |
+                                       MYSERVER_SERVER_CONF, "xml"));
+
   SecurityDomain* domains[] = {&auth, NULL};
 
-  Server::getInstance()->getSecurityManager ()->getPermissionMask (&st, domains, xml, xml);
+  Server::getInstance()->getSecurityManager ()->getPermissionMask (&st, domains,
+                                                                   validator, authMethod);
 
   return (st.getMask () & mask);
 }

Modified: trunk/myserver/src/protocol/http/http.cpp
===================================================================
--- trunk/myserver/src/protocol/http/http.cpp	2008-10-05 09:47:50 UTC (rev 2868)
+++ trunk/myserver/src/protocol/http/http.cpp	2008-10-05 10:33:11 UTC (rev 2869)
@@ -442,10 +442,16 @@
     AuthDomain auth (&securityToken);
     HttpReqSecurityDomain httpReqSecDom (&(td->request));
 
-    string xml ("xml");//FIXME: don't hardly-code "xml".
+    string validator (securityToken.getHashedData ("sec.validator", MYSERVER_VHOST_CONF |
+                                                   MYSERVER_SERVER_CONF, "xml"));
+    string authMethod (securityToken.getHashedData ("sec.auth_method", MYSERVER_VHOST_CONF |
+                                                    MYSERVER_SERVER_CONF, "xml"));
+
+
     SecurityDomain* domains[] = {&auth, &httpReqSecDom, NULL};
 
-    Server::getInstance()->getSecurityManager ()->getPermissionMask (&securityToken, domains, xml, xml);
+    Server::getInstance()->getSecurityManager ()->getPermissionMask (&securityToken, domains, 
+                                                                     validator, authMethod);
 
     const char *authType = securityToken.getHashedData ("http.auth", MYSERVER_SECURITY_CONF |
                                                         MYSERVER_VHOST_CONF |





From MAILER-DAEMON Sun Oct 05 14:19:50 2008
Received: from mailman by lists.gnu.org with archive (Exim 4.43)
	id 1KmYCr-00026b-T2
	for mharc-myserver-commit@gnu.org; Sun, 05 Oct 2008 14:19:49 -0400
Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43)
	id 1KmYCp-00025e-Lc
	for myserver-commit@gnu.org; Sun, 05 Oct 2008 14:19:47 -0400
Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43)
	id 1KmYCo-00025N-8o
	for myserver-commit@gnu.org; Sun, 05 Oct 2008 14:19:46 -0400
Received: from [199.232.76.173] (port=45794 helo=monty-python.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.43) id 1KmYCo-00025K-2K
	for myserver-commit@gnu.org; Sun, 05 Oct 2008 14:19:46 -0400
Received: from savannah.gnu.org ([199.232.41.3]:59115 helo=sv.gnu.org)
	by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32)
	(Exim 4.60) (envelope-from <INVALID.NOREPLY@gnu.org>)
	id 1KmYCl-0002L7-En
	for myserver-commit@gnu.org; Sun, 05 Oct 2008 14:19:44 -0400
Received: from cvs.savannah.gnu.org ([199.232.41.69])
	by sv.gnu.org with esmtp (Exim 4.63)
	(envelope-from <INVALID.NOREPLY@gnu.org>) id 1KmYCk-0008CN-Gx
	for myserver-commit@gnu.org; Sun, 05 Oct 2008 18:19:42 +0000
Received: from gscrivano by cvs.savannah.gnu.org with local (Exim 4.63)
	(envelope-from <gscrivano@savannah.gnu.org>) id 1KmYCk-0008CJ-5b
	for myserver-commit@gnu.org; Sun, 05 Oct 2008 18:19:42 +0000
MIME-Version: 1.0
Errors-To: gscrivano
To: myserver-commit@gnu.org
X-Mailer: SVN::Notify 2.64: http://search.cpan.org/dist/SVN-Notify/
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
From: Giuseppe Scrivano <gscrivano@gnu.org>
Message-Id: <E1KmYCk-0008CJ-5b@cvs.savannah.gnu.org>
Date: Sun, 05 Oct 2008 18:19:42 +0000
X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 3)
Subject: [myserver-commit] [2870] HTTP TRACE command allowed using the new
	security APIs.
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/pipermail/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, 05 Oct 2008 18:19:48 -0000

Revision: 2870
          http://svn.sv.gnu.org/viewvc/?view=rev&root=myserver&revision=2870
Author:   gscrivano
Date:     2008-10-05 18:19:41 +0000 (Sun, 05 Oct 2008)

Log Message:
-----------
HTTP TRACE command allowed using the new security APIs.

Modified Paths:
--------------
    trunk/myserver/include/protocol/http/http.h
    trunk/myserver/src/protocol/http/http.cpp

Modified: trunk/myserver/include/protocol/http/http.h
===================================================================
--- trunk/myserver/include/protocol/http/http.h	2008-10-05 10:33:11 UTC (rev 2869)
+++ trunk/myserver/include/protocol/http/http.h	2008-10-05 18:19:41 UTC (rev 2870)
@@ -113,7 +113,7 @@
                       int onlyHeader = 0,
                       int yetMapped = 0);
 
-  int allowHTTPTRACE();
+  bool allowHTTPTRACE();
 
 
   int optionsHTTPRESOURCE(string &filename,

Modified: trunk/myserver/src/protocol/http/http.cpp
===================================================================
--- trunk/myserver/src/protocol/http/http.cpp	2008-10-05 10:33:11 UTC (rev 2869)
+++ trunk/myserver/src/protocol/http/http.cpp	2008-10-05 18:19:41 UTC (rev 2870)
@@ -75,10 +75,12 @@
 /*!
  *Build a response for an OPTIONS request.
  */
-int Http::optionsHTTPRESOURCE(string& /*filename*/, int /*yetmapped*/)
+int Http::optionsHTTPRESOURCE(string& filename, int yetmapped)
 {
   int ret;
   string time;
+  int permissions;
+
   try
   {
     HttpRequestHeader::Entry *connection = td->request.other.get("Connection");
@@ -91,7 +93,12 @@
       methods.append((*it)->getName(0, 0));
       it++;
     }
-    
+
+    ret = Http::preprocessHttpRequest(filename, yetmapped, &permissions);
+
+    if (ret != 200)
+      return raiseHTTPError (ret);
+   
     getRFC822GMTTime(time, HTTP_RESPONSE_DATE_DIM);
     td->buffer2->setLength(0);
     *td->buffer2 <<  "HTTP/1.1 200 OK\r\n";
@@ -105,7 +112,7 @@
     /*!
      *Check if the TRACE command is allowed on the virtual host.
      */
-    if(allowHTTPTRACE())
+    if (allowHTTPTRACE ())
       *td->buffer2 << ", TRACE\r\n";
 
     *td->buffer2 << "r\n";
@@ -128,21 +135,29 @@
 /*!
  *Handle the HTTP TRACE command.
  */
-int Http::traceHTTPRESOURCE(string& /*filename*/, int /*yetmapped*/)
+int Http::traceHTTPRESOURCE(string& filename, int yetmapped)
 {
   int ret;
   char tmpStr[12];
   int contentLength = (int)td->nHeaderChars;
   string time;
+  int permissions;
   try
   {
     MemBuf tmp;
     HttpRequestHeader::Entry *connection;
 
+    ret = Http::preprocessHttpRequest(filename, yetmapped, &permissions);
+
+    if(ret != 200)
+      return raiseHTTPError(ret);
+
     tmp.intToStr(contentLength, tmpStr, 12);
     getRFC822GMTTime(time, HTTP_RESPONSE_DATE_DIM);
-    if(!allowHTTPTRACE())
-      return raiseHTTPError(401);
+
+    if (!allowHTTPTRACE ())
+      return raiseHTTPError (401);
+
     td->buffer2->setLength(0);
     *td->buffer2 << "HTTP/1.1 200 OK\r\n";
     *td->buffer2 << "Date: " << time << "\r\n";
@@ -178,34 +193,17 @@
 }
 
 /*!
- *Check if the host allows the HTTP TRACE command
+ *Check if the host allows the HTTP TRACE command.
  */
-int Http::allowHTTPTRACE()
+bool Http::allowHTTPTRACE()
 {
-  int ret;
-  /*! Check if the host allows HTTP trace. */
-  ostringstream filename;
-  char *httpTraceValue;
-  XmlParser parser;
+  const char *allowTrace = securityToken.getHashedData ("http.allow_trace", MYSERVER_VHOST_CONF |
+                                                        MYSERVER_SERVER_CONF, "NO");
 
-  filename << td->getVhostDir() << "/security" ;
-  if(parser.open(filename.str().c_str()))
-  {
-    return 0;
-  }
-  httpTraceValue = parser.getAttr("HTTP", "TRACE");
-
-  /*!
-   *If the returned value is equal to ON so the
-   *HTTP TRACE is active for this vhost.
-   *By default don't allow the trace.
-   */
-  if(httpTraceValue && !strcmpi(httpTraceValue, "ON"))
-    ret = 1;
+  if (!strcmpi (allowTrace, "YES"))
+    return true;
   else
-    ret = 0;
-  parser.close();
-  return ret;
+    return false;
 }
 
 /*!





From MAILER-DAEMON Sun Oct 05 14:37:54 2008
Received: from mailman by lists.gnu.org with archive (Exim 4.43)
	id 1KmYUM-0001Ho-8A
	for mharc-myserver-commit@gnu.org; Sun, 05 Oct 2008 14:37:54 -0400
Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43)
	id 1KmYUK-0001Fm-SZ
	for myserver-commit@gnu.org; Sun, 05 Oct 2008 14:37:52 -0400
Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43)
	id 1KmYUK-0001FG-GG
	for myserver-commit@gnu.org; Sun, 05 Oct 2008 14:37:52 -0400
Received: from [199.232.76.173] (port=36284 helo=monty-python.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.43) id 1KmYUK-0001F6-4d
	for myserver-commit@gnu.org; Sun, 05 Oct 2008 14:37:52 -0400
Received: from savannah.gnu.org ([199.232.41.3]:39694 helo=sv.gnu.org)
	by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32)
	(Exim 4.60) (envelope-from <INVALID.NOREPLY@gnu.org>)
	id 1KmYUJ-0001rr-KK
	for myserver-commit@gnu.org; Sun, 05 Oct 2008 14:37:51 -0400
Received: from cvs.savannah.gnu.org ([199.232.41.69])
	by sv.gnu.org with esmtp (Exim 4.63)
	(envelope-from <INVALID.NOREPLY@gnu.org>) id 1KmYUI-0000DH-RO
	for myserver-commit@gnu.org; Sun, 05 Oct 2008 18:37:50 +0000
Received: from gscrivano by cvs.savannah.gnu.org with local (Exim 4.63)
	(envelope-from <gscrivano@savannah.gnu.org>) id 1KmYUI-0000DD-L1
	for myserver-commit@gnu.org; Sun, 05 Oct 2008 18:37:50 +0000
MIME-Version: 1.0
Errors-To: gscrivano
To: myserver-commit@gnu.org
X-Mailer: SVN::Notify 2.64: http://search.cpan.org/dist/SVN-Notify/
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
From: Giuseppe Scrivano <gscrivano@gnu.org>
Message-Id: <E1KmYUI-0000DD-L1@cvs.savannah.gnu.org>
Date: Sun, 05 Oct 2008 18:37:50 +0000
X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 3)
Subject: [myserver-commit] [2871] Fixed problem with the Server autoreboot
	feature.
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/pipermail/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, 05 Oct 2008 18:37:53 -0000

Revision: 2871
          http://svn.sv.gnu.org/viewvc/?view=rev&root=myserver&revision=2871
Author:   gscrivano
Date:     2008-10-05 18:37:50 +0000 (Sun, 05 Oct 2008)

Log Message:
-----------
Fixed problem with the Server autoreboot feature.

Modified Paths:
--------------
    trunk/myserver/src/server/server.cpp

Modified: trunk/myserver/src/server/server.cpp
===================================================================
--- trunk/myserver/src/server/server.cpp	2008-10-05 18:19:41 UTC (rev 2870)
+++ trunk/myserver/src/server/server.cpp	2008-10-05 18:37:50 UTC (rev 2871)
@@ -549,7 +549,6 @@
   time_t hostsConfTime;
   time_t mimeConfTime;
 
-  u_long configsCheck = 0;
   u_long purgeThreadsCounter = 0;
 
   mainConfTime =
@@ -566,10 +565,10 @@
    */
   while(!endServer)
   {
-    Thread::wait(100000);
+    Thread::wait(1000000);
 
     /* Check threads.  */
-    if(purgeThreadsCounter++ >= 100)
+    if(purgeThreadsCounter++ >= 10)
     {
       purgeThreadsCounter = 0;
       purgeThreads();
@@ -577,114 +576,100 @@
 
     if(autoRebootEnabled)
     {
-      configsCheck++;
-      /* Do not check for modified configuration files every cycle.  */
-      if(configsCheck > 10)
+      time_t mainConfTimeNow =
+        FilesUtility::getLastModTime(mainConfigurationFile->c_str());
+      time_t hostsConfTimeNow =
+        FilesUtility::getLastModTime(vhostConfigurationFile->c_str());
+      time_t mimeConfNow =
+        FilesUtility::getLastModTime(mimeConfigurationFile->c_str());
+      
+      /* If a configuration file was modified reboot the server. */
+      if(((mainConfTimeNow != -1) && (hostsConfTimeNow != -1)  &&
+          (mimeConfNow != -1)) || toReboot)
       {
-        time_t mainConfTimeNow =
-          FilesUtility::getLastModTime(mainConfigurationFile->c_str());
-        time_t hostsConfTimeNow =
-          FilesUtility::getLastModTime(vhostConfigurationFile->c_str());
-        time_t mimeConfNow =
-          FilesUtility::getLastModTime(mimeConfigurationFile->c_str());
+        if( (mainConfTimeNow  != mainConfTime) || toReboot)
+        {
+          string msg("main-conf-changed");
+          notifyMulticast(msg, 0);
 
-        /* If a configuration file was modified reboot the server. */
-        if(((mainConfTimeNow!=-1) && (hostsConfTimeNow!=-1)  &&
-            (mimeConfNow!=-1)) || toReboot)
+          reboot();
+          /* Store new mtime values.  */
+          mainConfTime = mainConfTimeNow;
+          mimeConfTime = mimeConfNow;
+        }
+        else if(mimeConfNow != mimeConfTime)
         {
-          if( (mainConfTimeNow  != mainConfTime) || toReboot)
-          {
-            string msg("main-conf-changed");
-            notifyMulticast(msg, 0);
+          string msg("mime-conf-changed");
+          notifyMulticast(msg, 0);
 
-            reboot();
-            /* Store new mtime values.  */
-            mainConfTime = mainConfTimeNow;
-            mimeConfTime = mimeConfNow;
-          }
-          else if(mimeConfNow != mimeConfTime)
+          if(logManager.getType() == LogManager::TYPE_CONSOLE)
           {
-            string msg("mime-conf-changed");
-            notifyMulticast(msg, 0);
+            char beep[]={static_cast<char>(0x7), '\0'};
+            logManager.write(beep);
+          }
 
-            if(logManager.getType() == LogManager::TYPE_CONSOLE)
-            {
-              char beep[]={static_cast<char>(0x7), '\0'};
-              logManager.write(beep);
-            }
+          logWriteln("Reloading MIMEtypes.xml");
+          
+          getMimeManager()->loadXML(getMIMEConfFile());
 
-            logWriteln("Reloading MIMEtypes.xml");
+          logWriteln("Reloaded");
 
-            getMimeManager()->loadXML(getMIMEConfFile());
+          mimeConfTime = mimeConfNow;
+        }
+        else if(hostsConfTimeNow != hostsConfTime)
+        {
+          VhostManager* oldvhost = vhostList;
+          string msg("vhosts-conf-changed");
+          notifyMulticast(msg, 0);
 
-            logWriteln("Reloaded");
-
-            mimeConfTime = mimeConfNow;
-          }
-          else if(hostsConfTimeNow != hostsConfTime)
+          /* Do a beep if outputting to console.  */
+          if(logManager.getType() == LogManager::TYPE_CONSOLE)
           {
-            VhostManager* oldvhost = vhostList;
-            string msg("vhosts-conf-changed");
-            notifyMulticast(msg, 0);
+            char beep[]={static_cast<char>(0x7), '\0'};
+            logManager.write(beep);
+          }
 
-            /* Do a beep if outputting to console.  */
-            if(logManager.getType() == LogManager::TYPE_CONSOLE)
-            {
-              char beep[]={static_cast<char>(0x7), '\0'};
-              logManager.write(beep);
-            }
+          logWriteln("Rebooting...");
 
-            logWriteln("Rebooting...");
+          connectionsScheduler.release();
 
-            connectionsScheduler.release();
+          Socket::stopBlockingOperations(true);
 
-            Socket::stopBlockingOperations(true);
+          listenThreads.beginFastReboot();
 
-            listenThreads.beginFastReboot();
+          listenThreads.terminate();
 
-            listenThreads.terminate();
+          clearAllConnections();
 
-            clearAllConnections();
+          Socket::stopBlockingOperations(false);
 
-            Socket::stopBlockingOperations(false);
+          connectionsScheduler.restart();
+          listenThreads.initialize(&languageParser);
+            
+          vhostList = new VhostManager(&listenThreads);
 
-            connectionsScheduler.restart();
-            listenThreads.initialize(&languageParser);
+          if(vhostList == 0)
+            continue;
 
-            vhostList = new VhostManager(&listenThreads);
+          delete oldvhost;
 
-            if(vhostList == 0)
-              continue;
-
-            delete oldvhost;
-
             /* Load the virtual hosts configuration from the xml file.  */
-            if(vhostList->loadXMLConfigurationFile(vhostConfigurationFile->c_str(),
-                                                   getMaxLogFileSize()))
-            {
-              listenThreads.rollbackFastReboot();
-            }
-            else
-            {
-              listenThreads.commitFastReboot();
-            }
-
-            hostsConfTime = hostsConfTimeNow;
-            logWriteln("Reloaded");
+          if(vhostList->loadXMLConfigurationFile(vhostConfigurationFile->c_str(),
+                                                 getMaxLogFileSize()))
+          {
+            listenThreads.rollbackFastReboot();
           }
+          else
+          {
+            listenThreads.commitFastReboot();
+          }
 
-          configsCheck = 0;
+          hostsConfTime = hostsConfTimeNow;
+          logWriteln("Reloaded");
         }
-        else
-        {
-          /*
-           *If there are problems in loading mtimes
-           *check again after a bit.
-           */
-          configsCheck = 7;
-        }
       }
     }//end  if(autoRebootEnabled)
+
   }
 }
 
@@ -1029,7 +1014,6 @@
   if(serverAdmin)
     delete serverAdmin;
   serverAdmin = 0;
-  autoRebootEnabled = false;
 
   if(configurationFileManager.open(mainConfigurationFile->c_str()))
     return -1;
@@ -1756,6 +1740,7 @@
   /* Do nothing if the reboot is disabled.  */
   if(!autoRebootEnabled)
     return 0;
+
   /* Do a beep if outputting to console.  */
   if(logManager.getType() == LogManager::TYPE_CONSOLE)
   {





From MAILER-DAEMON Sun Oct 05 14:46:28 2008
Received: from mailman by lists.gnu.org with archive (Exim 4.43)
	id 1KmYce-0005fj-A7
	for mharc-myserver-commit@gnu.org; Sun, 05 Oct 2008 14:46:28 -0400
Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43)
	id 1KmYcc-0005fb-95
	for myserver-commit@gnu.org; Sun, 05 Oct 2008 14:46:26 -0400
Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43)
	id 1KmYca-0005fP-Qy
	for myserver-commit@gnu.org; Sun, 05 Oct 2008 14:46:24 -0400
Received: from [199.232.76.173] (port=36981 helo=monty-python.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.43) id 1KmYca-0005fM-MD
	for myserver-commit@gnu.org; Sun, 05 Oct 2008 14:46:24 -0400
Received: from savannah.gnu.org ([199.232.41.3]:35445 helo=sv.gnu.org)
	by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32)
	(Exim 4.60) (envelope-from <INVALID.NOREPLY@gnu.org>)
	id 1KmYca-0005bO-9X
	for myserver-commit@gnu.org; Sun, 05 Oct 2008 14:46:24 -0400
Received: from cvs.savannah.gnu.org ([199.232.41.69])
	by sv.gnu.org with esmtp (Exim 4.63)
	(envelope-from <INVALID.NOREPLY@gnu.org>) id 1KmYcZ-0000UM-QL
	for myserver-commit@gnu.org; Sun, 05 Oct 2008 18:46:23 +0000
Received: from gscrivano by cvs.savannah.gnu.org with local (Exim 4.63)
	(envelope-from <gscrivano@savannah.gnu.org>) id 1KmYcZ-0000UI-J4
	for myserver-commit@gnu.org; Sun, 05 Oct 2008 18:46:23 +0000
MIME-Version: 1.0
Errors-To: gscrivano
To: myserver-commit@gnu.org
X-Mailer: SVN::Notify 2.64: http://search.cpan.org/dist/SVN-Notify/
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
From: Giuseppe Scrivano <gscrivano@gnu.org>
Message-Id: <E1KmYcZ-0000UI-J4@cvs.savannah.gnu.org>
Date: Sun, 05 Oct 2008 18:46:23 +0000
X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 3)
Subject: [myserver-commit] [2872] Added getters for `authMethodFactory' and
	`validatorFactory'.
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/pipermail/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, 05 Oct 2008 18:46:26 -0000

Revision: 2872
          http://svn.sv.gnu.org/viewvc/?view=rev&root=myserver&revision=2872
Author:   gscrivano
Date:     2008-10-05 18:46:23 +0000 (Sun, 05 Oct 2008)

Log Message:
-----------
Added getters for `authMethodFactory' and `validatorFactory'.

Modified Paths:
--------------
    trunk/myserver/include/server/server.h

Modified: trunk/myserver/include/server/server.h
===================================================================
--- trunk/myserver/include/server/server.h	2008-10-05 18:37:50 UTC (rev 2871)
+++ trunk/myserver/include/server/server.h	2008-10-05 18:46:23 UTC (rev 2872)
@@ -160,8 +160,11 @@
   void increaseFreeThread();
   void decreaseFreeThread();
 
-  SecurityManager* getSecurityManager (){return &securityManager;}
+  SecurityManager *getSecurityManager (){return &securityManager;}
+  AuthMethodFactory *getAuthMethodFactory () {return &authMethodFactory;}
+  ValidatorFactory *getValidatorFactory (){return &validatorFactory;}
 
+
 private:
   friend class ClientsThread;
 #ifdef WIN32





From MAILER-DAEMON Wed Oct 08 15:28:13 2008
Received: from mailman by lists.gnu.org with archive (Exim 4.43)
	id 1Knehh-00083e-3b
	for mharc-myserver-commit@gnu.org; Wed, 08 Oct 2008 15:28:13 -0400
Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43)
	id 1Knehf-00080o-63
	for myserver-commit@gnu.org; Wed, 08 Oct 2008 15:28:11 -0400
Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43)
	id 1Knehe-0007zg-6s
	for myserver-commit@gnu.org; Wed, 08 Oct 2008 15:28:10 -0400
Received: from [199.232.76.173] (port=53172 helo=monty-python.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.43) id 1Knehd-0007zD-UO
	for myserver-commit@gnu.org; Wed, 08 Oct 2008 15:28:09 -0400
Received: from savannah.gnu.org ([199.232.41.3]:38791 helo=sv.gnu.org)
	by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32)
	(Exim 4.60) (envelope-from <INVALID.NOREPLY@gnu.org>)
	id 1Knehd-00031e-L3
	for myserver-commit@gnu.org; Wed, 08 Oct 2008 15:28:09 -0400
Received: from cvs.savannah.gnu.org ([199.232.41.69])
	by sv.gnu.org with esmtp (Exim 4.63)
	(envelope-from <INVALID.NOREPLY@gnu.org>) id 1Knehc-00056U-G4
	for myserver-commit@gnu.org; Wed, 08 Oct 2008 19:28:08 +0000
Received: from gscrivano by cvs.savannah.gnu.org with local (Exim 4.63)
	(envelope-from <gscrivano@savannah.gnu.org>) id 1Knehb-00056Q-Vv
	for myserver-commit@gnu.org; Wed, 08 Oct 2008 19:28:08 +0000
MIME-Version: 1.0
Errors-To: gscrivano
To: myserver-commit@gnu.org
X-Mailer: SVN::Notify 2.64: http://search.cpan.org/dist/SVN-Notify/
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
From: Giuseppe Scrivano <gscrivano@gnu.org>
Message-Id: <E1Knehb-00056Q-Vv@cvs.savannah.gnu.org>
Date: Wed, 08 Oct 2008 19:28:08 +0000
X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 3)
Subject: [myserver-commit] [2873] Removed unused file.
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/pipermail/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, 08 Oct 2008 19:28:11 -0000

Revision: 2873
          http://svn.sv.gnu.org/viewvc/?view=rev&root=myserver&revision=2873
Author:   gscrivano
Date:     2008-10-08 19:28:07 +0000 (Wed, 08 Oct 2008)

Log Message:
-----------
Removed unused file.

Modified Paths:
--------------
    trunk/myserver/include/http_handler/wincgi/wincgi.h
    trunk/myserver/include/server/clients_thread.h
    trunk/myserver/src/http_handler/cgi/cgi.cpp
    trunk/myserver/src/http_handler/mscgi/mscgi.cpp
    trunk/myserver/src/http_handler/wincgi/wincgi.cpp
    trunk/myserver/src/myserver.cpp
    trunk/myserver/src/protocol/http/http.cpp
    trunk/myserver/src/protocol/http/http_headers.cpp
    trunk/myserver/src/server/clients_thread.cpp
    trunk/myserver/src/server/server.cpp

Removed Paths:
-------------
    trunk/myserver/include/conf/security/security.h

Deleted: trunk/myserver/include/conf/security/security.h
===================================================================
--- trunk/myserver/include/conf/security/security.h	2008-10-05 18:46:23 UTC (rev 2872)
+++ trunk/myserver/include/conf/security/security.h	2008-10-08 19:28:07 UTC (rev 2873)
@@ -1,2 +0,0 @@
-//////KEEP THIS FILE TO DON'T BREAK OLD APIs
-#include <include/conf/security/security_manager.h>

Modified: trunk/myserver/include/http_handler/wincgi/wincgi.h
===================================================================
--- trunk/myserver/include/http_handler/wincgi/wincgi.h	2008-10-05 18:46:23 UTC (rev 2872)
+++ trunk/myserver/include/http_handler/wincgi/wincgi.h	2008-10-08 19:28:07 UTC (rev 2873)
@@ -22,7 +22,6 @@
 #include <include/protocol/http/http_request.h>
 #include <include/protocol/http/http_response.h>
 #include <include/conf/mime/mime_manager.h>
-#include <include/conf/security/security.h>
 #include <include/protocol/http/http_headers.h>
 #include <include/protocol/http/http_data_handler.h>
 

Modified: trunk/myserver/include/server/clients_thread.h
===================================================================
--- trunk/myserver/include/server/clients_thread.h	2008-10-05 18:46:23 UTC (rev 2872)
+++ trunk/myserver/include/server/clients_thread.h	2008-10-08 19:28:07 UTC (rev 2873)
@@ -21,7 +21,6 @@
 #include "stdafx.h"
 #include <include/base/utility.h>
 #include <include/connection/connection.h>
-#include <include/conf/security/security.h>
 #include <include/base/mem_buff/mem_buff.h>
 
 

Modified: trunk/myserver/src/http_handler/cgi/cgi.cpp
===================================================================
--- trunk/myserver/src/http_handler/cgi/cgi.cpp	2008-10-05 18:46:23 UTC (rev 2872)
+++ trunk/myserver/src/http_handler/cgi/cgi.cpp	2008-10-08 19:28:07 UTC (rev 2873)
@@ -21,7 +21,6 @@
 #include <include/protocol/http/http.h>
 #include <include/protocol/http/http_errors.h>
 #include <include/server/server.h>
-#include <include/conf/security/security.h>
 #include <include/base/base64/mime_utils.h>
 #include <include/base/file/file.h>
 #include <include/base/file/files_utility.h>

Modified: trunk/myserver/src/http_handler/mscgi/mscgi.cpp
===================================================================
--- trunk/myserver/src/http_handler/mscgi/mscgi.cpp	2008-10-05 18:46:23 UTC (rev 2872)
+++ trunk/myserver/src/http_handler/mscgi/mscgi.cpp	2008-10-08 19:28:07 UTC (rev 2873)
@@ -15,10 +15,10 @@
 along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
 
+#include "stdafx.h"
 #include <include/http_handler/mscgi/mscgi.h>
 #include <include/protocol/http/http.h>
 #include <include/server/server.h>
-#include <include/conf/security/security.h>
 #include <include/protocol/http/env/env.h>
 #include <include/base/base64/mime_utils.h>
 #include <include/base/file/file.h>

Modified: trunk/myserver/src/http_handler/wincgi/wincgi.cpp
===================================================================
--- trunk/myserver/src/http_handler/wincgi/wincgi.cpp	2008-10-05 18:46:23 UTC (rev 2872)
+++ trunk/myserver/src/http_handler/wincgi/wincgi.cpp	2008-10-08 19:28:07 UTC (rev 2873)
@@ -15,7 +15,8 @@
 along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
 
-#include <include/conf/security/security.h>
+#include "stdafx.h"
+#include <include/http_handler/wincgi/wincgi.h>
 #include <include/base/base64/mime_utils.h>
 #include <include/base/file/file.h>
 #include <include/base/file/files_utility.h>
@@ -23,7 +24,6 @@
 #include <include/protocol/http/http_headers.h>
 #include <include/protocol/http/http.h>
 #include <include/base/utility.h>
-#include <include/http_handler/wincgi/wincgi.h>
 #include <include/base/string/stringutils.h>
 #include <include/filter/filters_chain.h>
 #include <include/base/safetime/safetime.h>

Modified: trunk/myserver/src/myserver.cpp
===================================================================
--- trunk/myserver/src/myserver.cpp	2008-10-05 18:46:23 UTC (rev 2872)
+++ trunk/myserver/src/myserver.cpp	2008-10-08 19:28:07 UTC (rev 2873)
@@ -19,7 +19,7 @@
 #include <include/server/server.h>
 #include <include/base/file/files_utility.h>
 #include <include/base/string/stringutils.h>
-#include <include/conf/security/security.h>
+
 extern "C" {
 #ifdef WIN32
 #include <direct.h>

Modified: trunk/myserver/src/protocol/http/http.cpp
===================================================================
--- trunk/myserver/src/protocol/http/http.cpp	2008-10-05 18:46:23 UTC (rev 2872)
+++ trunk/myserver/src/protocol/http/http.cpp	2008-10-08 19:28:07 UTC (rev 2873)
@@ -20,7 +20,7 @@
 #include <include/protocol/http/http_headers.h>
 #include <include/protocol/http/http_req_security_domain.h>
 #include <include/server/server.h>
-#include <include/conf/security/security.h>
+#include <include/conf/security/security_manager.h>
 #include <include/conf/security/auth_domain.h>
 #include <include/base/base64/mime_utils.h>
 #include <include/base/file/file.h>

Modified: trunk/myserver/src/protocol/http/http_headers.cpp
===================================================================
--- trunk/myserver/src/protocol/http/http_headers.cpp	2008-10-05 18:46:23 UTC (rev 2872)
+++ trunk/myserver/src/protocol/http/http_headers.cpp	2008-10-08 19:28:07 UTC (rev 2873)
@@ -18,7 +18,6 @@
 #include "stdafx.h"
 #include <sstream>
 #include <include/protocol/http/http_headers.h>
-#include <include/conf/security/security.h>
 #include <include/protocol/http/http.h>
 #include <include/base/base64/mime_utils.h>
 #include <include/base/file/file.h>

Modified: trunk/myserver/src/server/clients_thread.cpp
===================================================================
--- trunk/myserver/src/server/clients_thread.cpp	2008-10-05 18:46:23 UTC (rev 2872)
+++ trunk/myserver/src/server/clients_thread.cpp	2008-10-08 19:28:07 UTC (rev 2873)
@@ -20,7 +20,6 @@
 
 #include <include/base/thread/thread.h>
 #include <include/server/server.h>
-#include <include/conf/security/security.h>
 #include <include/base/socket/socket.h>
 #include <include/base/string/stringutils.h>
 

Modified: trunk/myserver/src/server/server.cpp
===================================================================
--- trunk/myserver/src/server/server.cpp	2008-10-05 18:46:23 UTC (rev 2872)
+++ trunk/myserver/src/server/server.cpp	2008-10-08 19:28:07 UTC (rev 2873)
@@ -25,8 +25,6 @@
 #include <include/protocol/https/https.h> /*Include the HTTPS protocol.  */
 #include <include/protocol/control/control_protocol.h> /*Include the control protocol.  */
 #include <include/protocol/ftp/ftp.h>
-
-#include <include/conf/security/security.h>
 #include <include/base/string/stringutils.h>
 #include <include/base/socket/socket.h>
 #include <include/filter/gzip/gzip.h>





From MAILER-DAEMON Wed Oct 08 18:21:29 2008
Received: from mailman by lists.gnu.org with archive (Exim 4.43)
	id 1KnhPN-0000uw-8J
	for mharc-myserver-commit@gnu.org; Wed, 08 Oct 2008 18:21:29 -0400
Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43)
	id 1KnhPL-0000tF-1w
	for myserver-commit@gnu.org; Wed, 08 Oct 2008 18:21:27 -0400
Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43)
	id 1KnhPG-0000rG-Sj
	for myserver-commit@gnu.org; Wed, 08 Oct 2008 18:21:26 -0400
Received: from [199.232.76.173] (port=42914 helo=monty-python.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.43) id 1KnhPG-0000qV-Mx
	for myserver-commit@gnu.org; Wed, 08 Oct 2008 18:21:22 -0400
Received: from savannah.gnu.org ([199.232.41.3]:57388 helo=sv.gnu.org)
	by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32)
	(Exim 4.60) (envelope-from <INVALID.NOREPLY@gnu.org>)
	id 1KnhPB-00079j-R6
	for myserver-commit@gnu.org; Wed, 08 Oct 2008 18:21:22 -0400
Received: from cvs.savannah.gnu.org ([199.232.41.69])
	by sv.gnu.org with esmtp (Exim 4.63)
	(envelope-from <INVALID.NOREPLY@gnu.org>) id 1KnhP7-0005FW-Cr
	for myserver-commit@gnu.org; Wed, 08 Oct 2008 22:21:13 +0000
Received: from francesco_pipita by cvs.savannah.gnu.org with local (Exim 4.63)
	(envelope-from <francesco_pipita@savannah.gnu.org>)
	id 1KnhP6-0005FS-5x
	for myserver-commit@gnu.org; Wed, 08 Oct 2008 22:21:12 +0000
MIME-Version: 1.0
Errors-To: francesco_pipita
To: myserver-commit@gnu.org
X-Mailer: SVN::Notify 2.64: http://search.cpan.org/dist/SVN-Notify/
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
From: Francesco Pipita <francesco.pipita@gmail.com>
Message-Id: <E1KnhP6-0005FS-5x@cvs.savannah.gnu.org>
Date: Wed, 08 Oct 2008 22:21:12 +0000
X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 3)
Subject: [myserver-commit] [2874] Use the new LogManager interface in its
	dependent classes.
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/pipermail/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, 08 Oct 2008 22:21:27 -0000

Revision: 2874
          http://svn.sv.gnu.org/viewvc/?view=rev&root=myserver&revision=2874
Author:   francesco_pipita
Date:     2008-10-08 22:21:10 +0000 (Wed, 08 Oct 2008)

Log Message:
-----------
Use the new LogManager interface in its dependent classes.

Modified Paths:
--------------
    trunk/myserver/binaries/virtualhosts.xml.default
    trunk/myserver/binaries/virtualhosts.xml.unix.default
    trunk/myserver/documentation/log_management.texi
    trunk/myserver/include/conf/vhost/vhost.h
    trunk/myserver/include/conf/vhost/vhost_manager.h
    trunk/myserver/include/filter/console.h
    trunk/myserver/include/log/log_manager.h
    trunk/myserver/include/log/stream/console_stream.h
    trunk/myserver/include/log/stream/console_stream_creator.h
    trunk/myserver/include/log/stream/file_stream.h
    trunk/myserver/include/log/stream/file_stream_creator.h
    trunk/myserver/include/log/stream/log_stream.h
    trunk/myserver/include/log/stream/log_stream_creator.h
    trunk/myserver/include/log/stream/log_stream_factory.h
    trunk/myserver/include/log/stream/socket_stream.h
    trunk/myserver/include/log/stream/socket_stream_creator.h
    trunk/myserver/include/server/server.h
    trunk/myserver/src/base/process/process_server_manager.cpp
    trunk/myserver/src/conf/mime/mime_manager.cpp
    trunk/myserver/src/conf/vhost/vhost.cpp
    trunk/myserver/src/conf/vhost/vhost_manager.cpp
    trunk/myserver/src/connections_scheduler/connections_scheduler.cpp
    trunk/myserver/src/connections_scheduler/listen_threads.cpp
    trunk/myserver/src/filter/console.cpp
    trunk/myserver/src/http_handler/cgi/cgi.cpp
    trunk/myserver/src/http_handler/fastcgi/fastcgi.cpp
    trunk/myserver/src/http_handler/http_dir/http_dir.cpp
    trunk/myserver/src/http_handler/http_file/http_file.cpp
    trunk/myserver/src/http_handler/isapi/isapi.cpp
    trunk/myserver/src/http_handler/mscgi/mscgi.cpp
    trunk/myserver/src/http_handler/scgi/scgi.cpp
    trunk/myserver/src/http_handler/wincgi/wincgi.cpp
    trunk/myserver/src/log/log_manager.cpp
    trunk/myserver/src/log/stream/console_stream.cpp
    trunk/myserver/src/log/stream/console_stream_creator.cpp
    trunk/myserver/src/log/stream/file_stream.cpp
    trunk/myserver/src/log/stream/file_stream_creator.cpp
    trunk/myserver/src/log/stream/log_stream.cpp
    trunk/myserver/src/log/stream/log_stream_creator.cpp
    trunk/myserver/src/log/stream/log_stream_factory.cpp
    trunk/myserver/src/log/stream/socket_stream.cpp
    trunk/myserver/src/log/stream/socket_stream_creator.cpp
    trunk/myserver/src/myserver.cpp
    trunk/myserver/src/plugin/plugins_manager.cpp
    trunk/myserver/src/protocol/control/control_protocol.cpp
    trunk/myserver/src/protocol/http/http.cpp
    trunk/myserver/src/server/clients_thread.cpp
    trunk/myserver/src/server/server.cpp
    trunk/myserver/tests/test_log_manager.cpp
    trunk/myserver/tests/test_log_stream_factory.cpp

Modified: trunk/myserver/binaries/virtualhosts.xml.default
===================================================================
--- trunk/myserver/binaries/virtualhosts.xml.default	2008-10-08 19:28:07 UTC (rev 2873)
+++ trunk/myserver/binaries/virtualhosts.xml.default	2008-10-08 22:21:10 UTC (rev 2874)
@@ -11,8 +11,22 @@
 		<DOCROOT>web</DOCROOT>
 		<SYSFOLDER>system</SYSFOLDER>
 		
-		<ACCESSLOG>logs/MyServerHTTP.log</ACCESSLOG>
-		<WARNINGLOG>logs/MyServerHTTP.err</WARNINGLOG>
+		<ACCESSLOG>
+                  <STREAMS>
+                    <STREAM>
+                      <LOCATION>file://logs/MyServerHTTP.log</LOCATION>
+                      <CYCLE>1048576</CYCLE>
+                    </STREAM>
+                  </STREAMS>
+                </ACCESSLOG>
+		<WARNINGLOG>
+                  <STREAMS>
+                    <STREAM>
+                      <LOCATION>file://logs/MyServerHTTP.err</LOCATION>
+                      <CYCLE>1048576</CYCLE>                      
+                    </STREAM>
+                  </STREAMS>
+                </WARNINGLOG>
 	</VHOST>
 
 	<VHOST>
@@ -24,7 +38,21 @@
 		<DOCROOT>web</DOCROOT>
 		<SYSFOLDER>system</SYSFOLDER>
 		
-		<ACCESSLOG>logs/MyServerFTP.log</ACCESSLOG>
-		<WARNINGLOG>logs/MyServerFTP.err</WARNINGLOG>
+		<ACCESSLOG>
+                  <STREAMS>
+                    <STREAM>
+                      <LOCATION>file://logs/MyServerFTP.log</LOCATION>
+                      <CYCLE>1048576</CYCLE>
+                    </STREAM>
+                  </STREAMS>
+                </ACCESSLOG>
+		<WARNINGLOG>
+                  <STREAMS>
+                    <STREAM>
+                      <LOCATION>file://logs/MyServerFTP.err</LOCATION>
+                      <CYCLE>1048576</CYCLE>
+                    </STREAM>
+                  </STREAMS>
+                </WARNINGLOG>
 	</VHOST>
 </VHOSTS>

Modified: trunk/myserver/binaries/virtualhosts.xml.unix.default
===================================================================
--- trunk/myserver/binaries/virtualhosts.xml.unix.default	2008-10-08 19:28:07 UTC (rev 2873)
+++ trunk/myserver/binaries/virtualhosts.xml.unix.default	2008-10-08 22:21:10 UTC (rev 2874)
@@ -11,8 +11,22 @@
 		<DOCROOT>/var/web/</DOCROOT>
 		<SYSFOLDER>/usr/local/share/myserver/system/</SYSFOLDER>
 
-		<ACCESSLOG>/var/log/myserver/MyServerHTTP.log</ACCESSLOG>
-		<WARNINGLOG>/var/log/myserver/MyServerHTTP.err</WARNINGLOG>
+		<ACCESSLOG>
+		  <STREAMS>
+		    <STREAM>
+		      <LOCATION>file:///var/log/myserver/MyServerHTTP.log</LOCATION>
+		      <CYCLE>1048576</CYCLE>
+		    </STREAM>
+		  </STREAMS>
+		</ACCESSLOG>
+		<WARNINGLOG>
+		  <STREAMS>
+		    <STREAM>
+		      <LOCATION>file:///var/log/myserver/MyServerHTTP.err</LOCATION>
+		      <CYCLE>1048576</CYCLE>
+		    </STREAM>
+		  </STREAMS>
+		</WARNINGLOG>
 	</VHOST>
 
 	<VHOST>
@@ -24,7 +38,21 @@
 		<DOCROOT>/var/web/</DOCROOT>
 		<SYSFOLDER>/usr/local/share/myserver/system/</SYSFOLDER>
 
-		<ACCESSLOG>/var/log/myserver/MyServerFTP.log</ACCESSLOG>
-		<WARNINGLOG>/var/log/myserver/MyServerFTP.err</WARNINGLOG>
+		<ACCESSLOG>
+		  <STREAMS>
+		    <STREAM>
+		      <LOCATION>file:///var/log/myserver/MyServerFTP.log</LOCATION>
+		      <CYCLE>1048576</CYCLE>
+		    </STREAM>
+		  </STREAMS>
+		</ACCESSLOG>
+		<WARNINGLOG>
+		  <STREAMS>
+		    <STREAM>
+		      <LOCATION>file:///var/log/myserver/MyServerFTP.err</LOCATION>
+		      <CYCLE>1048576</CYCLE>
+		    </STREAM>
+		  </STREAMS>
+		</WARNINGLOG>
 	</VHOST>
 </VHOSTS>

Modified: trunk/myserver/documentation/log_management.texi
===================================================================
--- trunk/myserver/documentation/log_management.texi	2008-10-08 19:28:07 UTC (rev 2873)
+++ trunk/myserver/documentation/log_management.texi	2008-10-08 22:21:10 UTC (rev 2874)
@@ -2,114 +2,103 @@
 
 @section Overview of the log management features
 The MyServer's log management system was designed to support logging
-over different targets. By default, log messages can be sent to a file,
-to a socket and of course to the console. The main class which achieves
-logging tasks is still the @code{LogManager} class. One single instance
-of it can now handle multiple targets. These targets are called
-@code{LogStream} objects. In addition, it is possible to provide a list
-of filters (e.g. the Gzip filter) to each @code{LogStream} object. This
-offers interesting possibilities, like logging over a TCP Socket while
-taking advantage of the Gzip compression. The new @code{LogManager} also
-ensures that all the operations that modify its internal data
-structures, through its interface, are atomics.
+over different targets. At the moment, these targets are made out of
+files, sockets and, of course, consoles. Each target, must be referred
+through its @b{location string}. In addition, it is possible to provide
+a list of filters (e.g. the Gzip filter) to improve the logging
+capabilities.
 
-@section Use of the new LogManager interface
-This section introduces the use of the new @code{LogManager}'s
-interface.
+@section Use of the log manager
+This section will introduce you to the use of the log management
+features.
 
-@subsection Construction
-The @code{LogManager} constructor, requires an instance of
-@code{FiltersFactory}, an instance of @code{LogStreamFactory} and a
-logging level, choosen between @code{INFO, WARNING, ERROR}. The third
-parameter is optional. 
+@subsection Location strings
+A location string must be provided in the form
+@code{protocol://resource}, where @code{protocol} can ben choosen
+between :
+@enumerate
+@item @code{console}
+@item @code{file}
+@item @code{socket}
+@end enumerate
+while @code{resource} must be a valid filename or URL according to its
+@code{protocol}. The @code{console} protocol, can take as its
+@code{resource} argument, either @code{stdout} or @code{stderr}. 
+
+@subsubsection Location string examples
+@enumerate
+@item Send log messages to a host whose ip address is 192.168.1.18, on
+port 12345 :
 @example
-LogManager (FiltersFactory* filtersFactory,
-            LogStreamFactory* logStreamFactory,
-            LoggingLevel level = WARNING);
+socket://192.168.1.18:12345
 @end example
-
-
-@subsection Adding a new LogStream target
-The adding of a new @code{LogStream} target can be done calling the
-@code{addLogStream} method over an instance of the
-@code{LogManager}. Below, we can look at the method signature :
+@item Send log messages to the file /var/log/myserver/MyServerHTTP.log :
 @example
-int addLogStream (string location, 
-                  list<string>& filters, 
-                  u_long cycleLog);
+file:///var/log/myserver/MyServerHTTP.log
 @end example
-The @code{location} string holds the location where the @code{LogStream}
-will point to as well as the protocol it will use. That string must
-follow a special syntax, that will be covered in next section. The
-@code{filters} parameter holds a list of filter names that will be added
-to the @code{LogStream}. Finally, the @code{cycleLog} parameter holds
-the max size, in bytes, that the new @code{LogStream} can reach. Over
-that limit, the @code{LogStream} will be cycled, that is, its content
-will be saved somewhere else. The current @code{LogStream} will be
-emptied and the location name of its saved content, will be available
-looking at the latest element of a FIFO queue returned by the
-@code{getCycledStreams} method. The @code{addLogStream} method returns a
-zero value if the new @code{LogStream} was successful added, a non-zero
-value otherwise, according to the MyServer standard.
-
-@subsubsection Location strings
-A location string must be provided in the form
-`@code{protocol://path/to/resource}'. The `@code{protocol://}' part is
-used by the @code{LogStreamFactory} to fetch the proper constructor for
-the new object that it will create. The `@code{path/to/resource}' part,
-instead, is used within the @code{LogStreamCreator}. The
-@code{LogStream} creation process, must ensure, through checks at
-increasing depth levels, that only valid @code{LogStream} objects can
-be returned. For example, syntactically a location string like
-`@code{socket://foo_host:-1}' is correct, but of course, the
-`@code{path/to/resource}' part doesn't represent any valid host:port 
-pair for a socket. So giving a such location string, the
-@code{addLogStream} method, must fail.
-
-@subsection Removing an existing LogStream
-The interface provides also a method that can detach a @code{LogStream}
-from the @code{LogManager}. Here is the method signature :
+Note the extra '/' needed to refer an absolute path.
+@item Send log messages to the standard error
 @example
-int removeLogStream (string location);
+console://stderr
 @end example
-It will remove the @code{LogStream} that points to @code{location}. If
-the provided location doesn't belong to the @code{LogManager}, the
-method doesn't nothing and it simply returns a non-zero value.
+@end enumerate
 
-@subsection Adding new LogStream classes
-To add new targets which can be used within the @code{LogManager}, you
-have to subclass the @code{LogStream} class. Then, if needed, override
-the following virtual methods :
+@subsection Setting the MyServer's main log
+You can set the MyServer's main log location through the switch
 @example
-virtual u_long streamSize ();
-virtual int streamCycle ();
+--loglocation=protocol://resource
 @end example
-The first one should return the size of the @code{Stream} owned by the
-@code{LogStream} while the second should manage its cycling process. The
-return value for the latter method must conform with the MyServer
-standard. The next step is to subclass @code{LogStreamCreator},
-overriding the @code{create} abstract method. Finally, you have to add
-the new @code{LogStreamCreator} to the @code{LogStreamFactory}, merely
-adding a line to its constructor, something that looks like :
+where the @code{--loglocation} argument is a valid location string.
+
+@subsection Setting the logging resources for virtual hosts
+Each virtual host needs two main log targets, one for the access
+messages and the other one for the error messages, whose entries in the
+configuration file, are respectively @code{ACCESSLOG} and
+@code{WARNINGLOG}. Each of these  targets, can in turn write its
+messages over different streams. To tell MyServer about all that, you
+can edit the @file{virtualhosts.xml} file, and apply the informations
+found in this section, to each @code{VHOST} entry of that file. As we
+can see in the following example, the @code{ACCESSLOG} root entry for
+the accesses log configuration, contains some @code{STREAMS}, and each
+@code{STREAM} is made out of a @code{LOCATION}, a @code{CYCLE} and some
+@code{FILTERS}.
 @example
-logStreamCreators["foo://"] = new FooStreamCreator ();
+<ACCESSLOG type="combined">
+  <STREAMS>
+    <STREAM>
+      <LOCATION>file://logs/MyServerHTTP.log</LOCATION>
+      <CYCLE>1048576</CYCLE>
+      <FILTERS>
+         <FILTER>gzip</FILTER>
+      </FILTERS>
+    </STREAM>
+    <STREAM>
+      <LOCATION>console://stderr</LOCATION>
+    </STREAM>
+  </STREAMS>
+</ACCESSLOG>
 @end example
-
-@subsection Writing log messages on the LogStream objects
-To log messages, simply call the method @code{log} on a
-@code{LogManager} object. That method takes three parameters, but only
-the first one is needed.
+Above we have two streams attached to the @code{ACCESSLOG} entry. The
+first one, is a file. This file will grow up to 1048576 bytes, over that
+limit it will be cycled. Also, this target will take advantage of the
+gzip compression, since it will write to the file through the gzip
+filter. The second one is the standard error stream over the console.
+The next example, shows instead the @code{WARNINGLOG} entry. In that
+example, we still have two streams where warning messages will be
+sent. The first one is a socket, while the second one is a file that
+will grow with no limit over its size. No filters will be applied to
+that stream.
 @example
-int log (string message, 
-         LoggingLevel level = WARNING, 
-         string location = "all");
+<WARNINGLOG>
+  <STREAMS>
+    <STREAM>
+      <LOCATION>socket://192.168.1.13:8080</LOCATION>
+    </STREAM>
+    <STREAM>
+      <LOCATION>file://MyServerHTTP.err</LOCATION>
+    </STREAM>
+  </STREAMS>
+</WARNINGLOG>
 @end example
-The first parameter represent a message to output on the log. The
-@code{level} parameter represent the @code{LoggingLevel} of the incoming
-message. If it is lesser than the @code{LogManager}'s logging level, the
-@code{LogManager} discards the message. The @code{location} parameter
-tells the @code{LogManager} to output the message only to the specified
-location. By default, if no @code{location} is provided, the
-@code{LogManager} will log the message on all its
-@code{LogStream} objects. If a non-valid or non-existent location is
-provided, the @code{LogManager} simply discards the message.
+It is important to notice that no duplicate location strings are
+admitted. If any, only the first one will be added.

Modified: trunk/myserver/include/conf/vhost/vhost.h
===================================================================
--- trunk/myserver/include/conf/vhost/vhost.h	2008-10-08 19:28:07 UTC (rev 2873)
+++ trunk/myserver/include/conf/vhost/vhost.h	2008-10-08 22:21:10 UTC (rev 2874)
@@ -1,24 +1,27 @@
 /* -*- mode: c++ -*- */
 /*
-MyServer
-Copyright (C) 2002, 2003, 2004, 2006, 2007, 2008 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
-(at your option) any later version.
+  MyServer
+  Copyright (C) 2002, 2003, 2004, 2006, 2007, 2008 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
+  (at your option) any later version.
 
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-GNU General Public License for more details.
+  This program is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+  GNU General Public License for more details.
 
-You should have received a copy of the GNU General Public License
-along with this program.  If not, see <http://www.gnu.org/licenses/>.
+  You should have received a copy of the GNU General Public License
+  along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
 
 #ifndef VHOST_H
 #define VHOST_H
 
+#include <list>
+#include <string>
+
 #include "stdafx.h"
 #include <include/base/xml/xml_parser.h>
 #include <include/base/file/file.h>
@@ -31,18 +34,15 @@
 #include <include/base/sync/mutex.h>
 #include <include/base/ssl/ssl.h>
 #include <include/connections_scheduler/listen_threads.h>
-#include <string>
-#include <list>
 
-
 using namespace std;
 typedef int (*NULL_REFERENCECB)(class Vhost*); 
 
 class VhostProtocolData
 {
 public:
-	VhostProtocolData(){}
-	virtual ~VhostProtocolData(){}
+  VhostProtocolData(){}
+  virtual ~VhostProtocolData(){}
 };
 
 class Vhost
@@ -50,143 +50,109 @@
 public:
   friend class VhostManager;
   
-	struct StringRegex
-	{
-		string name;
+  struct StringRegex
+  {
+    string name;
     Regex regex;
     StringRegex() : regex()
-      {}
+    {}
     ~StringRegex()
-      {}
-	};
+    {}
+  };
 	
   /*! Get the host name. */
   const char* getName()
-    {return name.c_str();}
+  {return name.c_str();}
   
   /*! Set the host name. */
   void setName(const char* c)
-    {name.assign(c);}
-    
-  /*! Get the accesses log file name. */
-  const char* getAccessesLogFileName()
-    {return accessesLogFileName.c_str();}
-
-  /*! Set the accesses log file name. */
-  void setAccessesLogFileName(const char* n)
-    {accessesLogFileName.assign(n);}
-
-  /*! Get the warnings log file name. */
-  const char* getWarningsLogFileName()
-    {return warningsLogFileName.c_str();}
-
-  /*! Set the warnings log file name. */
-  void setWarningsLogFileName(const char* n)
-    {warningsLogFileName.assign(n);}
-
+  {name.assign(c);}
+  
   /*! Get the system root. */
   const string& getSystemRoot()
-    {return systemRoot;}
+  {return systemRoot;}
 
   /*! Set the system root. */
   void setSystemRoot(const char* n)
-    {systemRoot.assign(n);}
+  {systemRoot.assign(n);}
 
   /*! Get the document root. */
   const string& getDocumentRoot()
-    {return documentRoot;}
+  {return documentRoot;}
 
   /*! Set the document root. */
   void setDocumentRoot(const char* n)
-    {documentRoot.assign(n);}
+  {documentRoot.assign(n);}
 
-  /*! Get the access log file options. */
-  const char* getAccessLogOpt()
-    {return accessLogOpt.c_str();}
-
-  /*! Get the warnings log file options. */
-	const char* getWarningLogOpt()
-    {return warningLogOpt.c_str(); }
-
-  /*! Set the access log file options. */
-  void setAccessLogOpt(const char* c)
-    {accessLogOpt.assign(c);}
-
-  /*! Set the warnings log file options. */
-  void setWarningLogOpt(const char* c)
-    {warningLogOpt.assign(c); }
-
   /*! Get a pointer to the vhost SSL context. */
   SslContext *getVhostSSLContext()
-    {return &sslContext;}
+  {return &sslContext;}
 
-	/*! Initialize SSL things. */
-	int initializeSSL();
+  /*! Initialize SSL things. */
+  int initializeSSL();
 	
-	/*! Clear SSL things. */
-	int freeSSL();
+  /*! Clear SSL things. */
+  int freeSSL();
 
-	/*! Clear the data dictionary. */
-	int freeHashedData();
+  /*! Clear the data dictionary. */
+  int freeHashedData();
 	
-	/*! Generate the RSA key for the SSL context. */
-	void generateRsaKey();
+  /*! Generate the RSA key for the SSL context. */
+  void generateRsaKey();
 
-	SSL_CTX* getSSLContext();
+  SSL_CTX* getSSLContext();
 
 
   /*! Get the list of hosts allowed.*/
-	list<StringRegex*>* getHostList()
-    {return &hostList;}
+  list<StringRegex*>* getHostList()
+  {return &hostList;}
 	
-	/*! List of IPs allowed by the vhost. */
-	list<StringRegex*>* getIpList()
-    {return &ipList;}
+  /*! List of IPs allowed by the vhost. */
+  list<StringRegex*>* getIpList()
+  {return &ipList;}
 
   /*! Return the port used by the host. */
-	u_short getPort()
-    {return port;}
+  u_short getPort()
+  {return port;}
 
   /*! Set the port used by the host. */
-	void setPort(u_short p)
-    {port = p;}
+  void setPort(u_short p)
+  {port = p;}
 
   /*! Get the protocol name for the virtual host. */
-	const char* getProtocolName()
-    {return protocolName.c_str();}
+  const char* getProtocolName()
+  {return protocolName.c_str();}
 
   /*! Set the protocol name for the virtual host. */
-	void setProtocolName(const char *name)
-    {protocolName.assign(name);}
+  void setProtocolName(const char *name)
+  {protocolName.assign(name);}
 
   /*! Get the throttling rate for the virtual host. */
   u_long getThrottlingRate()
-    {return throttlingRate;}
+  {return throttlingRate;}
 
   /*! Set the throttling rate for the virtual host. */
   void setThrottlingRate(u_long tr)
-    {throttlingRate = tr;}
+  {throttlingRate = tr;}
 
-	Vhost();
-	~Vhost();
+  Vhost(LogManager* lm);
+  ~Vhost();
 
   const char* getHashedData(const char* name);
-	void addIP(const char *, int);
-	void addHost(const char *, int);
-	void removeIP(const char *);
-	void removeHost(const char *);
-	int areAllHostAllowed();
-	int areAllIPAllowed();
+  void addIP(const char *, int);
+  void addHost(const char *, int);
+  void removeIP(const char *);
+  void removeHost(const char *);
+  int areAllHostAllowed();
+  int areAllIPAllowed();
   void addRef();
   void removeRef();
   int getRef();
   void setRef(int);
-	void clearIPList();
-	void clearHostList();
-	int isHostAllowed(const char*);
-	int isIPAllowed(const char*);
-	void setMaxLogSize(int);
-	int getMaxLogSize();
+  void clearIPList();
+  void clearHostList();
+  int isHostAllowed(const char*);
+  int isIPAllowed(const char*);
   int isMIME();
   int getDefaultPriority(){return defaultPriority;}
   void setDefaultPriority(int priority){defaultPriority = priority;}
@@ -195,34 +161,44 @@
 
   MimeManager* getMIME();
 
-	int openLogFiles(u_long maxlogSize = 0);
+  /*!
+   * \return 0 if the LogManager contains at least one valid entry where
+   * this Vhost can output both its warning and access messages.
+   */
+  int openLogFiles ();
 
-	LogManager* getWarningsLog();
-	LogManager* getAccessesLog();
+  int openAccessLog (string, list<string>&, u_long);
+  int openWarningLog (string, list<string>&, u_long);
 
-	u_long accessesLogRequestAccess(int id);
-	u_long warningsLogRequestAccess(int id);
-	u_long accessesLogTerminateAccess(int id);
-	u_long warningsLogTerminateAccess(int id);
+  /*! Set the access log options. */
+  void setAccessLogOpt (const char* c) { accessLogOpt.assign (c); }
+  
+  /*! Set the warnings log options. */
+  void setWarningLogOpt (const char* c)  { warningLogOpt.assign (c); }
 
-	int accessesLogWrite(const char*);
-	File* getAccessesLogFile();
+  /*! Get the access log options. */
+  const char* getAccessLogOpt ()  { return accessLogOpt.c_str (); }
 
-  int warningsLogWrite(const char*);
-	File* getWarningsLogFile();
+  /*! Get the warnings log options. */
+  const char* getWarningLogOpt () { return warningLogOpt.c_str (); }
 
-	/*! Get the protocol data. */
-	VhostProtocolData* getProtocolData(){return protocolData;}
+  /*! Write a message on the accesses log. */
+  int accessesLogWrite (const char*);
+  
+  /*! Write a message on the warnings log. */
+  int warningsLogWrite (const char*);
 
-	/*! Set the protocol data. */
-	void setProtocolData(VhostProtocolData* data){protocolData = data;}
+  /*! Get the protocol data. */
+  VhostProtocolData* getProtocolData(){return protocolData;}
+
+  /*! Set the protocol data. */
+  void setProtocolData(VhostProtocolData* data){protocolData = data;}
 private:
-	VhostProtocolData*  protocolData;
+  VhostProtocolData*  protocolData;
   HashMap<string, string*> hashedData;
   NULL_REFERENCECB nullReferenceCb;
   Mutex refMutex;
-	LogManager *warningsLogFile;
-	LogManager *accessesLogFile;
+  LogManager* logManager;
 
   MimeManager mimeManager;
 
@@ -232,43 +208,36 @@
   /*! How many connections are using this virtual host? */
   int refCount;
 
-	/*! SSL context. */
-	SslContext sslContext;
+  /*! SSL context. */
+  SslContext sslContext;
 
-	/*! List of hosts allowed by the vhost. */
-	list<StringRegex*> hostList;
+  /*! List of hosts allowed by the vhost. */
+  list<StringRegex*> hostList;
 
-	/*! List of IPs allowed by the vhost. */
-	list<StringRegex*> ipList;
+  /*! List of IPs allowed by the vhost. */
+  list<StringRegex*> ipList;
 
-	/*! TCP port used to listen on. */
-	u_short port;
+  /*! TCP port used to listen on. */
+  u_short port;
 
   /*! Throttling rate to use with the virtual host. */
-	u_long throttlingRate;
+  u_long throttlingRate;
 
-	/*! Protocol used by the vhost. */
-	string protocolName;
+  /*! Protocol used by the vhost. */
+  string protocolName;
 
-  /*! Additional data for log files. Defined in configuration files. */
-	string accessLogOpt;
-	string warningLogOpt;
+  /*! Path to the document root. */
+  string documentRoot;
 	
-	/*! Path to the document root. */
-	string documentRoot;
+  /*! Path to the system root. */
+  string systemRoot;
 	
-	/*! Path to the system root. */
-	string systemRoot;
-	
-	/*! Path to the accesses log file. */
-	string accessesLogFileName;
-	
-	/*! Path to the warnings log file. */
-	string warningsLogFileName;
-	
-	/*! Description or name of the virtual host. */
-	string name;
+  /*! Description or name of the virtual host. */
+  string name;
+
+  /*! Additional data for logs. Defined in configuration files. */
+  string accessLogOpt;
+  string warningLogOpt;
 };
 
-
 #endif

Modified: trunk/myserver/include/conf/vhost/vhost_manager.h
===================================================================
--- trunk/myserver/include/conf/vhost/vhost_manager.h	2008-10-08 19:28:07 UTC (rev 2873)
+++ trunk/myserver/include/conf/vhost/vhost_manager.h	2008-10-08 22:21:10 UTC (rev 2874)
@@ -1,19 +1,19 @@
 /* -*- mode: c++ -*- */
 /*
-MyServer
-Copyright (C) 2007 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
-(at your option) any later version.
+  MyServer
+  Copyright (C) 2007 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
+  (at your option) any later version.
 
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-GNU General Public License for more details.
+  This program is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+  GNU General Public License for more details.
 
-You should have received a copy of the GNU General Public License
-along with this program.  If not, see <http://www.gnu.org/licenses/>.
+  You should have received a copy of the GNU General Public License
+  along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
 
 #ifndef VHOST_MANAGER_H
@@ -21,57 +21,60 @@
 
 #include "stdafx.h"
 #include <include/conf/vhost/vhost.h>
+#include <include/log/log_manager.h>
 
-
 class VhostSource
 {
 public:
   VhostSource();
   ~VhostSource();
   int load();
-	int save();
+  int save();
   int free();
   Vhost* getVHost(const char*, const char*, u_short);
-	Vhost* getVHostByNumber(int n);
-	int addVHost(Vhost*);
+  Vhost* getVHostByNumber(int n);
+  int addVHost(Vhost*);
 private:
-	list<Vhost*> *hostList;
+  list<Vhost*> *hostList;
 };
 
 class VhostManager
 {
 public:
   void setExternalSource(VhostSource* extSource);
-	VhostManager(ListenThreads* lt);
-	~VhostManager();
-	int getHostsNumber();
-	Vhost* getVHostByNumber(int n);
-	void clean();
-	int removeVHost(int n);
-	int switchVhosts(int n1,int n2);
-	list<Vhost*>* getVHostList();
+  VhostManager(ListenThreads* lt, LogManager* lm);
+  ~VhostManager();
+  int getHostsNumber();
+  Vhost* getVHostByNumber(int n);
+  void clean();
+  int removeVHost(int n);
+  int switchVhosts(int n1,int n2);
+  list<Vhost*>* getVHostList();
 	
-	/*! Get a pointer to a vhost.  */
-	Vhost* getVHost(const char*,const char*,u_short);
+  /*! Get a pointer to a vhost.  */
+  Vhost* getVHost(const char*,const char*,u_short);
 	
-	/*! Add an element to the vhost list.  */
-	int addVHost(Vhost*);
+  /*! Add an element to the vhost list.  */
+  int addVHost(Vhost*);
 	
-	/*! Load the virtual hosts list from a xml configuration file.  */
-	int loadXMLConfigurationFile(const char *,int maxlogSize = 0);
+  /*! Load the virtual hosts list from a xml configuration file.  */
+  int loadXMLConfigurationFile(const char *);
 	
-	/*! Save the virtual hosts list to a xml configuration file.  */
-	int saveXMLConfigurationFile(const char *);
+  /*! Save the virtual hosts list to a xml configuration file.  */
+  int saveXMLConfigurationFile(const char *);
 	
-	/*! Set the right owner for the log files.  */
-	void changeFilesOwner();
+  /*! Set the right owner for the log locations.  */
+  void changeLocationsOwner ();
 private:
-	ListenThreads* listenThreads;
+  void loadXMLlogData (string, Vhost*, xmlNode*);
+  string saveXMLlogData (string, Vhost*);
+  ListenThreads* listenThreads;
   Mutex mutex;
-	VhostSource* extSource;
+  VhostSource* extSource;
 
-	/*! List of virtual hosts. */
-	list<Vhost*> hostList;
+  /*! List of virtual hosts. */
+  list<Vhost*> hostList;
+  LogManager* logManager;
 };
 
 

Modified: trunk/myserver/include/filter/console.h
===================================================================
--- trunk/myserver/include/filter/console.h	2008-10-08 19:28:07 UTC (rev 2873)
+++ trunk/myserver/include/filter/console.h	2008-10-08 22:21:10 UTC (rev 2874)
@@ -1,18 +1,19 @@
+/* -*- mode: c++ -*- */
 /*
-MyServer
-Copyright (C) 2006, 2008 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
-(at your option) any later version.
+  MyServer
+  Copyright (C) 2006, 2008 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
+  (at your option) any later version.
 
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-GNU General Public License for more details.
+  This program is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+  GNU General Public License for more details.
 
-You should have received a copy of the GNU General Public License
-along with this program.  If not, see <http://www.gnu.org/licenses/>.
+  You should have received a copy of the GNU General Public License
+  along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
 
 #ifndef CONSOLE_H
@@ -26,12 +27,17 @@
 
 class Console : public Stream
 {
- public:
+public:
   Console();
   virtual ~Console();
   virtual int flush (u_long* nbw);
   virtual int read (char* buffer, u_long len, u_long* nbr);
   virtual int write (const char* buffer, u_long len, u_long* nbw);
+  virtual int enterErrorMode ();
+  virtual int exitErrorMode ();
+  virtual int openConsole (string fd);
+protected:
+  ostream* fd;
 };
 
 #endif

Modified: trunk/myserver/include/log/log_manager.h
===================================================================
--- trunk/myserver/include/log/log_manager.h	2008-10-08 19:28:07 UTC (rev 2873)
+++ trunk/myserver/include/log/log_manager.h	2008-10-08 22:21:10 UTC (rev 2874)
@@ -1,19 +1,19 @@
 /* -*- mode: c++ -*- */
 /*
-MyServer
-Copyright (C) 2006, 2008 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
-(at your option) any later version.
+  MyServer
+  Copyright (C) 2006, 2008 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
+  (at your option) any later version.
 
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-GNU General Public License for more details.
+  This program is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+  GNU General Public License for more details.
 
-You should have received a copy of the GNU General Public License
-along with this program.  If not, see <http://www.gnu.org/licenses/>.
+  You should have received a copy of the GNU General Public License
+  along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
 
 #ifndef LOG_MANAGER_H
@@ -26,14 +26,15 @@
 #include <include/filter/filters_factory.h>
 #include <include/log/stream/log_stream.h>
 #include <include/log/stream/log_stream_factory.h>
-#include <include/filter/gzip/gzip.h>
 
 using namespace std;
 
+#ifdef WIN32
+#define NL "\r\n"
+#else
+#define NL "\n"
+#endif
 
-/*!
- * Defines different types of logging level.
- */
 enum LoggingLevel
   {
     INFO,
@@ -41,208 +42,63 @@
     ERROR
   };
 
-
 class LogManager
 {
 public:
-
-
-  /*!
-   * Default constructor. It is only used to support the old
-   * interface.
-   */
-  LogManager ();
-  
-
-  LogManager (FiltersFactory* filtersFactory,
-              LogStreamFactory* logStreamFactory,
-              LoggingLevel level = WARNING);
-
-
-  /*!
-   * Deallocates all LogStream owned by the LogManager and
-   * the objects (like the Mutex) allocated by the LogManager.
-   * Other objects, like the FiltersFactory and the 
-   * LogStreamFactory should be destroied from the outside.
-   */
+  LogManager (FiltersFactory* ff, LoggingLevel level = WARNING);
   ~LogManager ();
-
-
-  /*!
-   * Add a new LogStream to the LogManager. Prevents duplicate
-   * LogStream being added.
-   * \param location The location where the new LogStream will point.
-   * \param filters A list of filters used within the new LogStream.
-   * \param cycleLog A non-zero value establishes the threshold for
-   * the LogStream's growth before cycling it.
-   * \return 0 on success.
-   */
-  int addLogStream (string location, 
-                    list<string>& filters, 
-                    u_long cycleLog);
-
-
-  /*!
-   * Remove the LogStream that point to location if it exists.
-   * \param location The location where the LogStream which has to
-   * be removed points to.
-   * \return 0 on success.
-   */
-  int removeLogStream (string location);
-
-
-  LogStream* getLogStream (string location);
-  
-
-  /*!
-   * Write `message' to the LogStream that points to `location'. If
-   * no location is provided, it writes the message on all LogStreams
-   * owned by this LogManager.
-   * \param message The message string to write.
-   * \param level The message logging level. If it is lower than the
-   * LogManager's logging level, the LogManager discards it.
-   * \param location The location where `message' will be written.
-   * \return 0 on success.
-   */
-  int log (string message, 
-           LoggingLevel level = WARNING,
-           string location = "all");
-
-
-  /*!
-   * Close the LogStream that points to `location'. If no location
-   * is provided, it closes all LogStreams owned by this LogManager.
-   * \return 0 on success.
-   */
-  int close (string location = "all");
-
-
-  /*!
-   * \return The cycleLog value for the LogStream that points to
-   * location.
-   */
-  u_long getCycleLog (string location);
-
-
-  /*!
-   * Set the cycleLog field for the LogStream that points to `location'.
-   * If no location is provided, it will set the cycleLog to the same value
-   * for all LogStreams.
-   * \param cycleLog The new cycleLog value.
-   * \param location The LogStream whose cycleLog will be changed.
-   */
-  void setCycleLog (u_long cycleLog, 
-                    string location);
-
-
-  /*!
-   * Set the default logging level.
-   * \param level The new logging level value.
-   * \return The old logging level.
-   */
-  LoggingLevel setLoggingLevel (LoggingLevel level);
-
-
-  LoggingLevel getLoggingLevel ();
-
-
-  void setLogStreamFactory (LogStreamFactory* logStreamFactory);
-
-
-  LogStreamFactory* getLogStreamFactory ();
-
-
-  void setFiltersFactory (FiltersFactory* filtersFactory);
-
-  
+  int add (void* owner, string type, string location, 
+           list<string>& filters, u_long cycle);
+  int remove (void* owner);
+  int log (void* owner, string message, bool appendNL = false,
+           LoggingLevel level = WARNING);
+  int log (void* owner, string type, string message, bool appendNL = false,
+           LoggingLevel level = WARNING);
+  int log (void* owner, string type, string location, string message, 
+           bool appendNL = false, LoggingLevel level = WARNING);
+  int close (void* owner);
+  int close (void* owner, string type);
+  int close (void* owner, string type, string location);
+  int chown (void* owner, int uid, int gid);
+  int chown (void* owner, string type, int uid, int gid);
+  int chown (void* owner, string type, string location, int uid, int gid);
+  int get (void* owner, list<string>* l);
+  int get (void* owner, string type, list<string>* l);
+  int get (void* owner, string type, string location, LogStream** ls);
+  int setCycle (void* owner, u_long cycle);
+  int setCycle (void* owner, string type, u_long cycle);
+  int setCycle (void* owner, string type, string location, u_long cycle);
+  int getCycle (string location, u_long* cycle);
+  int getFilters (string location, list<string>* l);
+  LoggingLevel setLevel (LoggingLevel level);
+  LoggingLevel getLevel ();
+  void setFiltersFactory (FiltersFactory* ff);
   FiltersFactory* getFiltersFactory ();
-
-
-  int size ();
-
-
   bool empty ();
-
-
   bool contains (string location);
-
-  
-  /*!
-   * Delete all LogStream objects owned by this LogManager.
-   */
-  void clear ();
-
-
-  /*!
-   * Deprecated methods and fields.
-   */
-  int getLogSize ();
-  int storeFile ();
-  int load (char const*);
-  void setGzip (int);
-  int write (string message, int len = 0);
-  int writeln (string message);
-  File* getFile ();
-  u_long setMaxSize (u_long);
-  u_long getMaxSize ();
-  int getType ();
-  int getGzip ();
-  void setType (int);
-  int preparePrintError ();
-  int endPrintError ();
-  int requestAccess ();
-  int terminateAccess ();
-  void setCycleLog (u_long);
-  int const static TYPE_CONSOLE;
-  int const static TYPE_FILE;
-  int type;
-  int gzipLog;
-  int cycleLog;
-  u_long maxSize;
+  bool contains (void* owner);
+  bool contains (void* owner, string type);
+  bool contains (void* owner, string type, string location);
+  int count (void* owner);
+  int count (void* owner, string type);
+  int count (void* owner, string type, string location);
+  int clear ();
 protected:
-
-
-  /*!
-   * Send events to LogStreams.
-   * \param evt The event that should be notified to LogStreams.
-   * \param message The message to deliver.
-   * \param reply The receiver will put its data here.
-   * \return 0 on success.
-   */
-  int notifyLogStreams (LogStreamEvent evt,
-                        void* message = 0,
-                        void* reply = 0);
+  int notify (void* owner, string type, string location, LogStreamEvent evt, 
+              void* msg = 0, void* reply = 0);
+  int notify (void* owner, string type, LogStreamEvent evt, void* msg = 0, 
+              void* reply = 0);
+  int notify (void* owner, LogStreamEvent evt, void* msg = 0, void* reply = 0);
+  int add (void* owner);
+  int add (void* owner, string type);
+  int add (void* owner, string type, string location, LogStream* ls);
 private:
-
-
-  /*!
-   * Hold the default logging level for the LogManager.
-   */
   LoggingLevel level;
-
-
-  /*!
-   * Ensure atomic operations to prevent interleaving.
-   */
   Mutex* mutex;
-
-
-  /*!
-   * The LogStream creator.
-   */
-  LogStreamFactory* logStreamFactory;
-
-
-  /*!
-   * The Filter creator.
-   */
-  FiltersFactory* filtersFactory;
-
-
-  /*!
-   * Hold all LogStream owned by this LogManager.
-   */
+  LogStreamFactory* lsf;
+  FiltersFactory* ff;
   map<string, LogStream*> logStreams;
+  map<void*, map<string, map<string, LogStream*> > > owners;
 };
 
 #endif

Modified: trunk/myserver/include/log/stream/console_stream.h
===================================================================
--- trunk/myserver/include/log/stream/console_stream.h	2008-10-08 19:28:07 UTC (rev 2873)
+++ trunk/myserver/include/log/stream/console_stream.h	2008-10-08 22:21:10 UTC (rev 2874)
@@ -1,19 +1,19 @@
 /* -*- mode: c++ -*- */
 /*
-MyServer
-Copyright (C) 2006, 2008 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
-(at your option) any later version.
+  MyServer
+  Copyright (C) 2006, 2008 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
+  (at your option) any later version.
 
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-GNU General Public License for more details.
+  This program is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+  GNU General Public License for more details.
 
-You should have received a copy of the GNU General Public License
-along with this program.  If not, see <http://www.gnu.org/licenses/>.
+  You should have received a copy of the GNU General Public License
+  along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
 
 #ifndef CONSOLE_STREAM_H
@@ -27,11 +27,10 @@
 
 class ConsoleStream : public LogStream
 {
- public:
-  ConsoleStream (FiltersFactory* filtersFactory, 
-                 u_long cycleLog,
-                 Stream* outStream,
-                 FiltersChain* filtersChain);
+public:
+  ConsoleStream (FiltersFactory*, u_long, Stream*, FiltersChain*);
+  virtual int enterErrorMode ();
+  virtual int exitErrorMode ();
 };
 
 #endif

Modified: trunk/myserver/include/log/stream/console_stream_creator.h
===================================================================
--- trunk/myserver/include/log/stream/console_stream_creator.h	2008-10-08 19:28:07 UTC (rev 2873)
+++ trunk/myserver/include/log/stream/console_stream_creator.h	2008-10-08 22:21:10 UTC (rev 2874)
@@ -1,19 +1,19 @@
 /* -*- mode: c++ -*- */
 /*
-MyServer
-Copyright (C) 2006, 2008 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
-(at your option) any later version.
+  MyServer
+  Copyright (C) 2006, 2008 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
+  (at your option) any later version.
 
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-GNU General Public License for more details.
+  This program is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+  GNU General Public License for more details.
 
-You should have received a copy of the GNU General Public License
-along with this program.  If not, see <http://www.gnu.org/licenses/>.
+  You should have received a copy of the GNU General Public License
+  along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
 
 #ifndef CONSOLE_STREAM_CREATOR_H
@@ -24,11 +24,8 @@
 
 class ConsoleStreamCreator : public LogStreamCreator
 {
- public:
-  virtual LogStream* create (FiltersFactory* filtersFactory, 
-                             string location, 
-                             list<string>& filters,
-                             u_long cycleLog);
+public:
+  virtual LogStream* create (FiltersFactory*, string, list<string>&, u_long);
 };
 
 #endif

Modified: trunk/myserver/include/log/stream/file_stream.h
===================================================================
--- trunk/myserver/include/log/stream/file_stream.h	2008-10-08 19:28:07 UTC (rev 2873)
+++ trunk/myserver/include/log/stream/file_stream.h	2008-10-08 22:21:10 UTC (rev 2874)
@@ -1,19 +1,19 @@
 /* -*- mode: c++ -*- */
 /*
-MyServer
-Copyright (C) 2006, 2008 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
-(at your option) any later version.
+  MyServer
+  Copyright (C) 2006, 2008 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
+  (at your option) any later version.
 
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-GNU General Public License for more details.
+  This program is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+  GNU General Public License for more details.
 
-You should have received a copy of the GNU General Public License
-along with this program.  If not, see <http://www.gnu.org/licenses/>.
+  You should have received a copy of the GNU General Public License
+  along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
 
 #ifndef FILE_STREAM_H
@@ -31,30 +31,13 @@
 
 class FileStream : public LogStream
 {
- public:
-
-
-  FileStream (FiltersFactory* filtersFactory, 
-              u_long cycleLog,
-              Stream* outStream,
-              FiltersChain* filtersChain);
-
-
-  /*!
-   * The default file mask used to create a log file.
-   */
-  int const static defaultFileMask;
-
-
-  virtual u_long streamSize ();
-
-
+public:
+  FileStream (FiltersFactory*, u_long, Stream*, FiltersChain*);
   string makeNewFileName (string oldFileName);
-
-
- protected:
-
-
+  virtual u_long streamSize ();
+  virtual int chown (int uid, int gid);
+  int const static defaultFileMask;
+protected:
   virtual int streamCycle ();
 };
 

Modified: trunk/myserver/include/log/stream/file_stream_creator.h
===================================================================
--- trunk/myserver/include/log/stream/file_stream_creator.h	2008-10-08 19:28:07 UTC (rev 2873)
+++ trunk/myserver/include/log/stream/file_stream_creator.h	2008-10-08 22:21:10 UTC (rev 2874)
@@ -1,19 +1,19 @@
 /* -*- mode: c++ -*- */
 /*
-MyServer
-Copyright (C) 2006, 2008 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
-(at your option) any later version.
+  MyServer
+  Copyright (C) 2006, 2008 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
+  (at your option) any later version.
 
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-GNU General Public License for more details.
+  This program is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+  GNU General Public License for more details.
 
-You should have received a copy of the GNU General Public License
-along with this program.  If not, see <http://www.gnu.org/licenses/>.
+  You should have received a copy of the GNU General Public License
+  along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
 
 #ifndef FILE_STREAM_CREATOR_H
@@ -24,11 +24,8 @@
 
 class FileStreamCreator : public LogStreamCreator
 {
- public:
-  virtual LogStream* create (FiltersFactory* filtersFactory, 
-                             string location, 
-                             list<string>& filters,
-                             u_long cycleLog);
+public:
+  virtual LogStream* create (FiltersFactory*, string, list<string>&, u_long);
 };
 
 #endif

Modified: trunk/myserver/include/log/stream/log_stream.h
===================================================================
--- trunk/myserver/include/log/stream/log_stream.h	2008-10-08 19:28:07 UTC (rev 2873)
+++ trunk/myserver/include/log/stream/log_stream.h	2008-10-08 22:21:10 UTC (rev 2874)
@@ -1,19 +1,19 @@
 /* -*- mode: c++ -*- */
 /*
-MyServer
-Copyright (C) 2006, 2008 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
-(at your option) any later version.
+  MyServer
+  Copyright (C) 2006, 2008 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
+  (at your option) any later version.
 
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-GNU General Public License for more details.
+  This program is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+  GNU General Public License for more details.
 
-You should have received a copy of the GNU General Public License
-along with this program.  If not, see <http://www.gnu.org/licenses/>.
+  You should have received a copy of the GNU General Public License
+  along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
 
 #ifndef LOG_STREAM_H
@@ -25,172 +25,57 @@
 #include <include/filter/filters_chain.h>
 #include <include/filter/filters_factory.h>
 #include <include/filter/stream.h>
+#include <include/base/sync/mutex.h>
 
+using namespace std;
 
-/*!
- * Defines some events of interest for LogStream objects.
- */
 enum LogStreamEvent
-{
-  EVT_SET_CYCLE_LOG,
-  EVT_LOG,
-  EVT_CLOSE,
-  EVT_ADD_FILTER
-};
+  {
+    EVT_SET_CYCLE,
+    EVT_LOG,
+    EVT_CLOSE,
+    EVT_ADD_FILTER,
+    EVT_CHOWN,
+    EVT_ENTER_ERROR_MODE,
+    EVT_EXIT_ERROR_MODE
+  };
 
-
-using namespace std;
-
-
 class LogStream
 {
- public:
-  
-
-  /*!
-   * The constructor.
-   * \param filtersFactory An instance of FiltersFactory.
-   * \param cycleLog The cycleLog value.
-   * \param outStream The Stream where this LogStream will
-   * write the log messages.
-   * \param filtersChain The messages will pass through a 
-   * FiltersChain before being written to the Stream.
-   */
-  LogStream (FiltersFactory* filtersFactory,
-             u_long cycleLog, 
-             Stream* outStream,
-             FiltersChain* filtersChain);
-
-
-  /*!
-   * \return 0 on success.
-   */
+public:
+  LogStream (FiltersFactory* ff, u_long cycle, Stream* out, FiltersChain* fc);
   int addFilter (Filter* filter);
-  
-
-  /*!
-   * \return 0 on success.
-   */
   int removeFilter (Filter* filter);
-
-
-  /*!
-   * \return 0 on success.
-   */
   int update (LogStreamEvent evt, void* message = 0, void* reply = 0);
-
-
-  /*!
-   * \return 0 on success.
-   */
   int close ();
-
-
-  /*!
-   * \return 0 the close method was called.
-   */
   int getIsOpened ();
-
-
   u_long getLatestWrittenBytes ();
-
-
-  virtual u_long streamSize ();
-
-
-  u_long getCycleLog ();
-
-
+  u_long getCycle ();
   Stream* getOutStream ();
-
-
   FiltersFactory const* getFiltersFactory ();
-
-
   FiltersChain* getFiltersChain ();
-
-
-  void setCycleLog (u_long cycleLog);
-
-
-  /*!
-   * Check if we have reached the max allowed size for the log.
-   * \return 0 if there is no need to cycle the log yet.
-   */
+  int setCycle (u_long cycle);
   int needToCycle ();
-  
-
-  /*!
-   * \return 0 on success.
-   */
+  list<string>& getCycledStreams ();
   virtual int log (string message);
-
-
+  virtual u_long streamSize ();
+  virtual int chown (int uid, int gid);
+  virtual int enterErrorMode ();
+  virtual int exitErrorMode ();
   virtual ~LogStream ();
-
-
-  list<string>& getCycledStreams ();
-
-
- protected:
-
-
-  /*!
-   * \return 0 on success.
-   */
+protected:
   virtual int streamCycle ();
-
-
-  /*!
-   * Flushes any remaining data in the FiltersChain, cycle the stream
-   * and recreates all filters.
-   * \return 0 on success.
-   */
   int doCycle ();
-  
-
-  /*!
-   * \return 0 on success.
-   */
   int write (string message);
-
-
-  /*!
-   * \return 0 on success.
-   */
   int resetFilters ();
-
-
-  /*!
-   * The latest number of bytes written to the Stream.
-   */
   u_long nbw;
-  
-
-  /*!
-   * A zero value means `never cycle'. A non-zero value establishes
-   * the maximum size allowed for the LogStream's growth before 
-   * cycling it.
-   */
-  u_long cycleLog;
-
-
-  /*!
-   * Will be zero after a successful call to the close method.
-   */
+  u_long cycle;
   int isOpened;
-  
-
-  FiltersChain* filtersChain;
-
-
-  Stream* outStream;
-
-
-  FiltersFactory* filtersFactory;
-
-
+  FiltersChain* fc;
+  Stream* out;
+  FiltersFactory* ff;
   list<string> cycledStreams;
+  Mutex* mutex;
 };
 
 #endif

Modified: trunk/myserver/include/log/stream/log_stream_creator.h
===================================================================
--- trunk/myserver/include/log/stream/log_stream_creator.h	2008-10-08 19:28:07 UTC (rev 2873)
+++ trunk/myserver/include/log/stream/log_stream_creator.h	2008-10-08 22:21:10 UTC (rev 2874)
@@ -1,19 +1,19 @@
 /* -*- mode: c++ -*- */
 /*
-MyServer
-Copyright (C) 2006, 2008 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
-(at your option) any later version.
+  MyServer
+  Copyright (C) 2006, 2008 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
+  (at your option) any later version.
 
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-GNU General Public License for more details.
+  This program is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+  GNU General Public License for more details.
 
-You should have received a copy of the GNU General Public License
-along with this program.  If not, see <http://www.gnu.org/licenses/>.
+  You should have received a copy of the GNU General Public License
+  along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
 
 #ifndef LOG_STREAM_CREATOR_H
@@ -27,17 +27,8 @@
 
 class LogStreamCreator
 {
- public:
-  
-
-  /*!
-   * Create a new instance of a concrete LogStream. If something
-   * of wrong happens, it must return 0.
-   */
-  virtual LogStream* create (FiltersFactory* filtersFactory, 
-                             string location, 
-                             list<string>& filters,
-                             u_long cycleLog) = 0;
+public:
+  virtual LogStream* create (FiltersFactory*, string, list<string>&, u_long) = 0;
 };
 
 #endif

Modified: trunk/myserver/include/log/stream/log_stream_factory.h
===================================================================
--- trunk/myserver/include/log/stream/log_stream_factory.h	2008-10-08 19:28:07 UTC (rev 2873)
+++ trunk/myserver/include/log/stream/log_stream_factory.h	2008-10-08 22:21:10 UTC (rev 2874)
@@ -1,19 +1,19 @@
 /* -*- mode: c++ -*- */
 /*
-MyServer
-Copyright (C) 2006, 2008 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
-(at your option) any later version.
+  MyServer
+  Copyright (C) 2006, 2008 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
+  (at your option) any later version.
 
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-GNU General Public License for more details.
+  This program is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+  GNU General Public License for more details.
 
-You should have received a copy of the GNU General Public License
-along with this program.  If not, see <http://www.gnu.org/licenses/>.
+  You should have received a copy of the GNU General Public License
+  along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
 
 #ifndef LOG_STREAM_FACTORY_H
@@ -34,80 +34,14 @@
 class LogStreamFactory
 {
 public:
-
-
-  /*!
-   * This constructor initializes the logStreamCreators map. To
-   * add more LogStreams, you have to create a new class implementing
-   * the LogStreamCreator interface and then add it here providing
-   * a valid protocol string (in the form protocol://) as key.
-   */
   LogStreamFactory ();
-
-  
-  /*!
-   * The destructor. Ensures that the memory allocated for
-   * all the LogStreamCreator objects gets freed.
-   */
   ~LogStreamFactory ();
-
-
-  /*!
-   * Factory method. Creates a new concrete LogStream.
-   * \param filtersFactory Self explicating.
-   * \param location This is the path where the LogStream will point to.
-   * The location string must follow the syntax `protocol://path/to/log'.
-   * The protocol:// part can't be missing, since it is required to get
-   * the proper constructor for the new object that will be created.
-   * \param filters A list of strings representing filters to be used within
-   * the new LogStream.
-   * \param cycleLog Whether the log should be cycled or not. 0 means never
-   * cycle.
-   * \return A new instance of one of LogStream subclasses or 0 if 
-   * the location string does not contain a protocol known by the
-   * LogStreamFactory or if something of wrong happened during the LogStream
-   * creation.
-   */
-  LogStream* createLogStream (FiltersFactory* filtersFactory, 
-                              string location, 
-                              list<string>& filters,
-                              u_long cycleLog);
-
-
-  /*!
-   * Get the protocol part of a location string.
-   * \param location The string representing a valid location as explained
-   * in createLogStream method description.
-   * \return A new string with the protocol part of the location, an empty
-   * string if an invalid protocol was detected.
-   */
+  LogStream* create (FiltersFactory*, string, list<string>&, u_long);
   string getProtocol (string location);
-
-
-  /*!
-   * Get the path part of a location string.
-   * \param location The string representing a valid location as explained
-   * in createLogStream method description.
-   * \return A new string with the path part of the location, an empty
-   * string is an invalid protocol was detected.
-   */
   string getPath (string location);
-
-  
-  /*!
-   * Checks whether `protocol' is between those known by the LogStreamFactory.
-   * \return true If it is.
-   */
-   bool protocolCheck (string protocol);
-
-
+  bool protocolCheck (string protocol);
 private:
-
-
-  /*!
-   * Holds all the constructors known by the LogStreamFactory.
-   */
-  map<string, LogStreamCreator*> logStreamCreators;
+  map<string, LogStreamCreator*> creators;;
 };
 
 #endif

Modified: trunk/myserver/include/log/stream/socket_stream.h
===================================================================
--- trunk/myserver/include/log/stream/socket_stream.h	2008-10-08 19:28:07 UTC (rev 2873)
+++ trunk/myserver/include/log/stream/socket_stream.h	2008-10-08 22:21:10 UTC (rev 2874)
@@ -1,19 +1,19 @@
 /* -*- mode: c++ -*- */
 /*
-MyServer
-Copyright (C) 2006, 2008 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
-(at your option) any later version.
+  MyServer
+  Copyright (C) 2006, 2008 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
+  (at your option) any later version.
 
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-GNU General Public License for more details.
+  This program is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+  GNU General Public License for more details.
 
-You should have received a copy of the GNU General Public License
-along with this program.  If not, see <http://www.gnu.org/licenses/>.
+  You should have received a copy of the GNU General Public License
+  along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
 
 #ifndef SOCKET_STREAM_H
@@ -27,7 +27,7 @@
 
 class SocketStream : public LogStream
 {
- public:
+public:
 
   SocketStream (FiltersFactory* filtersFactory, 
                 u_long cycleLog,

Modified: trunk/myserver/include/log/stream/socket_stream_creator.h
===================================================================
--- trunk/myserver/include/log/stream/socket_stream_creator.h	2008-10-08 19:28:07 UTC (rev 2873)
+++ trunk/myserver/include/log/stream/socket_stream_creator.h	2008-10-08 22:21:10 UTC (rev 2874)
@@ -1,19 +1,19 @@
 /* -*- mode: c++ -*- */
 /*
-MyServer
-Copyright (C) 2006, 2008 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
-(at your option) any later version.
+  MyServer
+  Copyright (C) 2006, 2008 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
+  (at your option) any later version.
 
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-GNU General Public License for more details.
+  This program is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+  GNU General Public License for more details.
 
-You should have received a copy of the GNU General Public License
-along with this program.  If not, see <http://www.gnu.org/licenses/>.
+  You should have received a copy of the GNU General Public License
+  along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
 
 #ifndef SOCKET_STREAM_CREATOR_H
@@ -26,22 +26,9 @@
 
 class SocketStreamCreator : public LogStreamCreator
 {
- public:
-  virtual LogStream* create (FiltersFactory* filtersFactory, 
-                             string location, 
-                             list<string>& filters,
-                             u_long cycleLog);
-
-
-  /*!
-   * A helper method to get the port part of an URL.
-   */
+public:
+  virtual LogStream* create (FiltersFactory*, string, list<string>&, u_long);
   u_short getPort (string location);
-
-
-  /*!
-   * A helper method to get the host part of an URL.
-   */
   string getHost (string location);
 };
 

Modified: trunk/myserver/include/server/server.h
===================================================================
--- trunk/myserver/include/server/server.h	2008-10-08 19:28:07 UTC (rev 2873)
+++ trunk/myserver/include/server/server.h	2008-10-08 22:21:10 UTC (rev 2874)
@@ -53,6 +53,7 @@
 
 #include <string>
 #include <list>
+
 using namespace std;
 
 /*!
@@ -61,7 +62,7 @@
 #ifdef WIN32
 unsigned int __stdcall listenServer(void* pParam);
 #endif
-#ifdef NOT_WIN
+#ifdef NO_WIN
 void* listenServer(void* pParam);
 #endif
 
@@ -132,14 +133,14 @@
   void stop();
   void finalCleanup();
   int terminate();
-  int logWriteln(const char*);
+  int logWriteln(char const*, LoggingLevel level = WARNING);
   int logWriteln(string const &str)
     {return logWriteln(str.c_str());};
   int logPreparePrintError();
   int logEndPrintError();
   int logLockAccess();
   int logUnlockAccess();
-  int setLogFile(char*);
+  int setLogLocation(string);
   u_long getBuffersize();
   u_long getBuffersize2();
   u_long getThrottlingRate();
@@ -189,6 +190,7 @@
   void loadPlugins();
   void displayBoot();
   int postLoad();
+  void initLogManager ();
 
   CachedFileFactory cachedFiles;
 
@@ -212,7 +214,7 @@
   bool toReboot;
   bool rebooting;
 
-  LogManager logManager;
+  LogManager* logManager;
   bool serverReady;
   u_long verbosity;
   u_long throttlingRate;
@@ -236,7 +238,7 @@
   u_long connectionTimeout;
   u_long maxLogFileSize;
   int copyConfigurationFromDefault(const char *);
-  void logWriteNTimes(const char *, unsigned);
+  void logWriteNTimes(string, unsigned);
   int checkConfigurationPaths();
   bool resetConfigurationPaths(string &, string &, string &, string &, string &);
   Mutex* connectionsMutex;
@@ -262,7 +264,7 @@
   ConnectionsScheduler connectionsScheduler;
   ListenThreads listenThreads;
   bool endServer;
-
+  string logLocation;
   AuthMethodFactory authMethodFactory;
   ValidatorFactory validatorFactory;
   SecurityManager securityManager;

Modified: trunk/myserver/src/base/process/process_server_manager.cpp
===================================================================
--- trunk/myserver/src/base/process/process_server_manager.cpp	2008-10-08 19:28:07 UTC (rev 2873)
+++ trunk/myserver/src/base/process/process_server_manager.cpp	2008-10-08 22:21:10 UTC (rev 2874)
@@ -102,12 +102,7 @@
           ostringstream msg;
           msg << "Error: incomplete remote PROCESS_SERVER block, " 
               << domain  << ":" << name << " needs a port";
-          ::Server::getInstance()->logLockAccess();
-          ::Server::getInstance()->logPreparePrintError();
-          ::Server::getInstance()->logWriteln(msg.str().c_str());
-          ::Server::getInstance()->logEndPrintError();
-          ::Server::getInstance()->logUnlockAccess();
-
+          ::Server::getInstance()->logWriteln(msg.str().c_str(), ERROR);
         }
       }
 
@@ -115,11 +110,7 @@
     else
     {
       const char *msg = "Error: incomplete PROCESS_SERVER block";
-      ::Server::getInstance()->logLockAccess();
-      ::Server::getInstance()->logPreparePrintError();
-      ::Server::getInstance()->logWriteln(msg);
-      ::Server::getInstance()->logEndPrintError();
-      ::Server::getInstance()->logUnlockAccess();
+      ::Server::getInstance()->logWriteln(msg, ERROR);
     }
 
   }
@@ -391,11 +382,7 @@
     ostringstream stream;
     stream << "Cannot run process " << path 
            << ": Reached max number of servers";
-    ::Server::getInstance()->logLockAccess();
-    ::Server::getInstance()->logPreparePrintError();
-    ::Server::getInstance()->logWriteln(stream.str().c_str());
-    ::Server::getInstance()->logEndPrintError();
-    ::Server::getInstance()->logUnlockAccess();
+    ::Server::getInstance()->logWriteln(stream.str().c_str(), ERROR);
     return 1;
   }
 

Modified: trunk/myserver/src/conf/mime/mime_manager.cpp
===================================================================
--- trunk/myserver/src/conf/mime/mime_manager.cpp	2008-10-08 19:28:07 UTC (rev 2873)
+++ trunk/myserver/src/conf/mime/mime_manager.cpp	2008-10-08 22:21:10 UTC (rev 2874)
@@ -650,11 +650,7 @@
       error.assign("Warning: multiple MIME types registered for the extension " );
       error.append(nmr->extension);
 
-      Server::getInstance()->logLockAccess();
-      Server::getInstance()->logPreparePrintError();
-      Server::getInstance()->logWriteln(error.c_str());     
-      Server::getInstance()->logEndPrintError();
-      Server::getInstance()->logUnlockAccess();      
+      Server::getInstance()->logWriteln(error.c_str(), ERROR);
       delete old;
     }
   }

Modified: trunk/myserver/src/conf/vhost/vhost.cpp
===================================================================
--- trunk/myserver/src/conf/vhost/vhost.cpp	2008-10-08 19:28:07 UTC (rev 2873)
+++ trunk/myserver/src/conf/vhost/vhost.cpp	2008-10-08 22:21:10 UTC (rev 2874)
@@ -1,18 +1,18 @@
 /*
-MyServer
-Copyright (C) 2002, 2003, 2004, 2006, 2007, 2008 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
-(at your option) any later version.
+  MyServer
+  Copyright (C) 2002, 2003, 2004, 2006, 2007, 2008 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
+  (at your option) any later version.
 
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-GNU General Public License for more details.
+  This program is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+  GNU General Public License for more details.
 
-You should have received a copy of the GNU General Public License
-along with this program.  If not, see <http://www.gnu.org/licenses/>.
+  You should have received a copy of the GNU General Public License
+  along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
 
 #include <include/conf/vhost/vhost.h>
@@ -33,15 +33,13 @@
 /*!
  *vhost costructor
  */
-Vhost::Vhost()
+Vhost::Vhost(LogManager* lm)
 {
   ipList.clear();
   hostList.clear();
   refMutex.init();
   documentRoot.assign("");
   systemRoot.assign("");
-  accessesLogFileName.assign("");
-  warningsLogFileName.assign("");
   hashedData.clear();
   protocolData = 0;
 
@@ -54,6 +52,7 @@
   refCount = 0;
   nullReferenceCb = 0;
   defaultPriority = 0;
+  logManager = lm;
 }
 
 
@@ -69,20 +68,10 @@
   freeSSL();
   freeHashedData();
   refMutex.destroy();
-  accessesLogFileName.assign("");
-  
-  warningsLogFileName.assign("");
- 
-  warningsLogFile->close();
-  accessesLogFile->close();
-
-  delete warningsLogFile;
-  delete accessesLogFile;
-  
   documentRoot.assign("");
   systemRoot.assign("");
-
   mimeManager.clean();
+  logManager->remove (this);
 }
 
 /*! 
@@ -92,18 +81,18 @@
 int Vhost::freeHashedData()
 {
   try
-  {
-    HashMap<string, string*>::Iterator it = hashedData.begin();
-    for (;it != hashedData.end(); it++)
     {
-      delete (*it);
+      HashMap<string, string*>::Iterator it = hashedData.begin();
+      for (;it != hashedData.end(); it++)
+        {
+          delete (*it);
+        }
+      hashedData.clear();
     }
-    hashedData.clear();
-  }
   catch(...)
-  {
-    return 1;
-  }
+    {
+      return 1;
+    }
   return 0;
 }
 
@@ -130,11 +119,11 @@
 {
   list<StringRegex*>::iterator i = hostList.begin();
   while(i != hostList.end())
-  {
-    StringRegex* sr = *i;
-    delete sr;
-    i++;
-  }
+    {
+      StringRegex* sr = *i;
+      delete sr;
+      i++;
+    }
   hostList.clear();
 }
 
@@ -145,66 +134,31 @@
 {
   list<StringRegex*>::iterator i = ipList.begin();
   while(i != ipList.end())
-  {
-    StringRegex* sr = *i;
-    delete sr;
-    i++;
-  }
+    {
+      StringRegex* sr = *i;
+      delete sr;
+      i++;
+    }
   hostList.clear();
 }
 
+int
+Vhost::openAccessLog (string location, list<string>& filters, u_long cycle)
+{
+  return logManager->add (this, "ACCESSLOG", location, filters, cycle);
+}
 
-/*!
- *Open the log files for the virtual hosts.
- *\param maxLogSize Define a max log size for the opened files.
- */
-int Vhost::openLogFiles(u_long maxlogSize)
+int
+Vhost::openWarningLog (string location, list<string>& filters, u_long cycle)
 {
-  const char* accessesLogFileName = getAccessesLogFileName();
-  const char* warningsLogFileName = getWarningsLogFileName();
+  return logManager->add (this, "WARNINGLOG", location, filters, cycle);
+}
 
-  accessesLogFile = new LogManager();
-  warningsLogFile = new LogManager();
-
-  if(accessesLogFileName)
-  {
-    accessesLogFile->load(accessesLogFileName);
-    
-    if(strstr(getAccessLogOpt(), "cycle=yes"))
-    {
-      accessesLogFile->setCycleLog(1);
-    }
-    if(strstr(getAccessLogOpt(), "cycle_gzip=no"))
-    {
-      accessesLogFile->setGzip(0);
-    }
-    else
-    {
-      accessesLogFile->setGzip(1);
-    }  
-  }
-
-  if(warningsLogFileName)
-  {
-    warningsLogFile->load(warningsLogFileName);
-    if(strstr(getWarningLogOpt(), "cycle=yes"))
-    {
-      warningsLogFile->setCycleLog(1);
-    }
-  
-    if(strstr(getWarningLogOpt(), "cycle_gzip=no"))
-    {
-      warningsLogFile->setGzip(0);
-    }
-    else
-    {
-      warningsLogFile->setGzip(1);
-    }
-  }
-
-  setMaxLogSize(maxlogSize);
-
-  return 0;
+int
+Vhost::openLogFiles ()
+{ 
+  return logManager->count (this, "ACCESSLOG") == 0 ||
+    logManager->count (this, "WARNINGLOG") == 0;
 }
 
 /*!
@@ -231,19 +185,19 @@
   list<StringRegex*>::iterator i = ipList.begin();
 
   while(i != ipList.end())
-  {
-    StringRegex* sr = *i;
-    /*
-     *If this is the virtual host with the right IP.
-     */
-    if(!stringcmp(sr->name,ip))
     {
-      ipList.erase(i);
-      return;
-    }
+      StringRegex* sr = *i;
+      /*
+       *If this is the virtual host with the right IP.
+       */
+      if(!stringcmp(sr->name,ip))
+        {
+          ipList.erase(i);
+          return;
+        }
     
-    i++;
-  }
+      i++;
+    }
 }
 
 /*!
@@ -255,19 +209,19 @@
   list<StringRegex*>::iterator i = hostList.begin();
 
   while(i != hostList.end())
-  {
-    StringRegex* sr = *i;
-    /*
-     *If this is the virtual host with the right IP.
-     */
-    if(!stringcmp(sr->name, host))
     {
-      hostList.erase(i);
-      return;
-    }
+      StringRegex* sr = *i;
+      /*
+       *If this is the virtual host with the right IP.
+       */
+      if(!stringcmp(sr->name, host))
+        {
+          hostList.erase(i);
+          return;
+        }
     
-    i++;
-  }
+      i++;
+    }
 }
 /*!
  *Check if an host is allowed to the connection
@@ -281,22 +235,22 @@
     
   list<StringRegex*>::iterator i = hostList.begin();
   while(i != hostList.end())
-  {
-    StringRegex* sr = *i;
-    regmatch_t pm;
-    if(sr->regex.isCompiled())
     {
-      if (!sr->regex.exec(host, 1, &pm, REG_NOTBOL))
-      {
-        return 1;
-      }
-    }
+      StringRegex* sr = *i;
+      regmatch_t pm;
+      if(sr->regex.isCompiled())
+        {
+          if (!sr->regex.exec(host, 1, &pm, REG_NOTBOL))
+            {
+              return 1;
+            }
+        }
     
-    if(!stringcmp(sr->name, host))
-      return 1;
+      if(!stringcmp(sr->name, host))
+        return 1;
       
-    i++;
-  }
+      i++;
+    }
   return 0;
 }
 
@@ -327,28 +281,28 @@
  */
 int Vhost::isIPAllowed(const char* ip)
 {
- /* If no IPs are specified then every host is allowed to connect here.  */
+  /* If no IPs are specified then every host is allowed to connect here.  */
   if(!ipList.size() || !ip)
     return 1;
     
   list<StringRegex*>::iterator i = ipList.begin();
   while(i != ipList.end())
-  {
-    StringRegex* sr = *i;
-    regmatch_t pm;
-    if(sr->regex.isCompiled())
     {
-      if (!sr->regex.exec(ip ,1, &pm, REG_NOTBOL))
-      {
-        return 1;
-      }
-    }
+      StringRegex* sr = *i;
+      regmatch_t pm;
+      if(sr->regex.isCompiled())
+        {
+          if (!sr->regex.exec(ip ,1, &pm, REG_NOTBOL))
+            {
+              return 1;
+            }
+        }
     
-    if(!stringcmp(sr->name, ip))
-      return 1;
+      if(!stringcmp(sr->name, ip))
+        return 1;
       
-    i++;
-  }
+      i++;
+    }
   return 0;
 }
 
@@ -370,20 +324,20 @@
   uint32_t* ucs4 = stringprep_utf8_to_ucs4 (host, -1, &len);
 
   if(!ucs4)
-  {
-    delete hl;
-    return;
-  }
+    {
+      delete hl;
+      return;
+    }
 
   ret = idna_to_ascii_4z (ucs4, &ascii, 0);
 
   free(ucs4);
   
   if (ret != IDNA_SUCCESS)
-  {   
-    delete hl;
-    return;
-  }
+    {   
+      delete hl;
+      return;
+    }
 
   host = ascii;
 #endif
@@ -401,127 +355,30 @@
 }
 
 /*!
- *Here threads get the permission to use the access log file.
- *\param id The caller thread ID.
+ * Write to the accesses log.
+ * \param str The line to log.
  */
-u_long Vhost::accessesLogRequestAccess(int id)
+int 
+Vhost::accessesLogWrite (const char* str)
 {
-  accessesLogFile->requestAccess();
-  return 0;
+  return logManager->log (this, "ACCESSLOG", string (str));
 }
 
 /*!
- *Here threads get the permission to use the warnings log file.
- *\param id The caller thread ID.
+ * Write a line to the warnings log.
+ * \param str The line to log.
  */
-u_long Vhost::warningsLogRequestAccess(int id)
+int
+Vhost::warningsLogWrite (const char* str)
 {
-  warningsLogFile->requestAccess();
-  return 0;
-}
-
-/*!
- *Here threads release the permission to use the access log file.
- *\param id The caller thread ID.
- */
-u_long Vhost::accessesLogTerminateAccess(int id)
-{
-  accessesLogFile->terminateAccess();
-  return 0;
-}
-
-/*!
- *Here threads release the permission to use the warnings log file.
- *\param id The caller thread ID.
- */
-u_long Vhost::warningsLogTerminateAccess(int id)
-{
-  warningsLogFile->terminateAccess();
-  return 0;
-}
-
-/*!
- *Write to the accesses log file.
- *\param str The line to log.
- */
-int Vhost::accessesLogWrite(const char* str)
-{
-  return accessesLogFile->write(str);
-}
-
-/*!
- *Return a pointer to the file used by the accesses log.
- */
-File* Vhost::getAccessesLogFile()
-{
-  return accessesLogFile->getFile();
-}
-
-/*!
- *Get the log object for the warnings.
- */
-LogManager* Vhost::getWarningsLog()
-{
-  return warningsLogFile;
-}
-
-/*!
- *Get the log object for the accesses.
- */
-LogManager* Vhost::getAccessesLog()
-{
-  return accessesLogFile;
-}
-
-/*!
- *Write a line to the warnings log file.
- *\param str The line to log.
- */
-int Vhost::warningsLogWrite(const char* str)
-{
   string msg;
-  getLocalLogFormatDate(msg, 100);
-  msg.append(" -- ");
-  msg.append(str);
-#ifdef WIN32
-  msg.append("\r\n");
-#else
-  msg.append("\n");
-#endif  
-  return warningsLogFile->write(msg.c_str());
+  getLocalLogFormatDate (msg, 100);
+  msg.append (" -- ");
+  msg.append (str);
+  return logManager->log (this, "WARNINGLOG", string (str), true);
 }
 
 /*!
- *Return a pointer to the file used by the warnings log.
- */
-File* Vhost::getWarningsLogFile()
-{
-  return warningsLogFile->getFile();
-}
-
-/*!
- *Set the max size of the log files.
- *\param newSize The new max dimension to use for the warning log files.
- */
-void Vhost::setMaxLogSize(int newSize)
-{
-  warningsLogFile->setMaxSize(newSize);
-  accessesLogFile->setMaxSize(newSize);  
-}
-
-/*!
- *Get the max size of the log files. Return 0 on success.
- */
-int Vhost::getMaxLogSize()
-{
-  /*
-   *warningsLogFile max log size is equal to the  
-   *accessesLogFile one.
-   */
-  return warningsLogFile->getMaxSize( );
-}
-
-/*!
  *Set the null reference callback function. It is called when the reference
  *counter for the virtual host is zero. 
  *\param cb The null references callback function.

Modified: trunk/myserver/src/conf/vhost/vhost_manager.cpp
===================================================================
--- trunk/myserver/src/conf/vhost/vhost_manager.cpp	2008-10-08 19:28:07 UTC (rev 2873)
+++ trunk/myserver/src/conf/vhost/vhost_manager.cpp	2008-10-08 22:21:10 UTC (rev 2874)
@@ -1,18 +1,18 @@
 /*
-MyServer
-Copyright (C) 2007, 2008 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
-(at your option) any later version.
+  MyServer
+  Copyright (C) 2007, 2008 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
+  (at your option) any later version.
 
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-GNU General Public License for more details.
+  This program is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+  GNU General Public License for more details.
 
-You should have received a copy of the GNU General Public License
-along with this program.  If not, see <http://www.gnu.org/licenses/>.
+  You should have received a copy of the GNU General Public License
+  along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
 #include <include/conf/vhost/vhost_manager.h>
 #include <include/conf/vhost/vhost.h>
@@ -35,80 +35,34 @@
   listenThreads->addListeningThread(vh->getPort());
   
   if(extSource)
-  {
-    int ret = extSource->addVHost(vh);
-    mutex.unlock();
-    return ret;
-  }
+    {
+      int ret = extSource->addVHost(vh);
+      mutex.unlock();
+      return ret;
+    }
 
   it = hostList.begin();
 
   try
-  {
-    for(;it != hostList.end(); it++)
     {
-      hostl = *it;
-
-      /* Do not do a case sensitive compare under windows.  */
-#ifdef WIN32
-      if(!stringcmpi(vh->getAccessesLogFileName(), 
-                     hostl->getAccessesLogFileName()))
-#else
-        if(!stringcmp(vh->getAccessesLogFileName(), 
-                      hostl->getAccessesLogFileName()))
-#endif
+      if(!vh->getProtocolName())
         {
           string error;
-          error.assign("Warning: multiple hosts use the same log file:" );
-          error.append(vh->getAccessesLogFileName());
-          Server::getInstance()->logLockAccess();
-          Server::getInstance()->logPreparePrintError();
-          Server::getInstance()->logWriteln(error.c_str());     
-          Server::getInstance()->logEndPrintError();
-          Server::getInstance()->logUnlockAccess();
+          error.assign("Warning: protocol not defined for virtual host: " );
+          error.append(vh->getName());
+          error.append(", using HTTP by default");
+          vh->setProtocolName("http");
+          Server::getInstance()->logWriteln(error.c_str(), ERROR);
         }
-
-#ifdef WIN32
-      if(!stringcmpi(vh->getWarningsLogFileName(), 
-                     hostl->getWarningsLogFileName()))
-#else
-      if(!stringcmp(vh->getWarningsLogFileName(), 
-                    hostl->getWarningsLogFileName()))
-#endif
-      {
-        string error;
-        error.assign("Warning: multiple hosts use the same log file:" );
-        error.append(vh->getWarningsLogFileName());
-        Server::getInstance()->logLockAccess();
-        Server::getInstance()->logPreparePrintError();
-        Server::getInstance()->logWriteln(error.c_str());     
-        Server::getInstance()->logEndPrintError();
-        Server::getInstance()->logUnlockAccess();
-      }
+      hostList.push_back(vh);
+      mutex.unlock();
+      return 0;
     }
-
-    if(!vh->getProtocolName())
+  catch(...)
     {
-      string error;
-      error.assign("Warning: protocol not defined for virtual host: " );
-      error.append(vh->getName());
-      error.append(", using HTTP by default");
-      vh->setProtocolName("http");
-      Server::getInstance()->logLockAccess();
-      Server::getInstance()->logPreparePrintError();
-      Server::getInstance()->logWriteln(error.c_str());     
-      Server::getInstance()->logEndPrintError();
-      Server::getInstance()->logUnlockAccess();
-    }
-    hostList.push_back(vh);
-    mutex.unlock();
-    return 0;
-  }
-  catch(...)
-  {
-    mutex.unlock();
-    return -1;
-  };
+      mutex.unlock();
+      return -1;
+    };
 }
 
 /*!
@@ -125,57 +79,58 @@
   mutex.lock();
 
   try
-  {
-    if(extSource)
     {
-      Vhost* ret = extSource->getVHost(host, ip, port);
-      mutex.unlock();
-      return ret;
-    }
+      if(extSource)
+        {
+          Vhost* ret = extSource->getVHost(host, ip, port);
+          mutex.unlock();
+          return ret;
+        }
 
-    it = hostList.begin();
+      it = hostList.begin();
 
-    /*Do a linear search here. We have to use the first full-matching 
-     *virtual host. 
-     */
-    for(; it != hostList.end(); it++)
-    {
-      Vhost* vh = *it;
-      /* Control if the host port is the correct one.  */
-      if(vh->getPort() != port)
-        continue;
-      /* If ip is defined check that it is allowed to connect to the host.  */
-      if(ip && !vh->isIPAllowed(ip))
-        continue;
-      /* If host is defined check if it is allowed to connect to the host.  */
-      if(host && !vh->isHostAllowed(host))
-        continue;
-      /* We find a valid host.  */
+      /*Do a linear search here. We have to use the first full-matching 
+       *virtual host. 
+       */
+      for(; it != hostList.end(); it++)
+        {
+          Vhost* vh = *it;
+          /* Control if the host port is the correct one.  */
+          if(vh->getPort() != port)
+            continue;
+          /* If ip is defined check that it is allowed to connect to the host.  */
+          if(ip && !vh->isIPAllowed(ip))
+            continue;
+          /* If host is defined check if it is allowed to connect to the host.  */
+          if(host && !vh->isHostAllowed(host))
+            continue;
+          /* We find a valid host.  */
+          mutex.unlock();
+          /* Add a reference.  */
+          vh->addRef();
+          return vh;
+        }
       mutex.unlock();
-      /* Add a reference.  */
-      vh->addRef();
-      return vh;
+      return 0;
     }
-    mutex.unlock();
-    return 0;
-  }
   catch(...)
-  {
-    mutex.unlock();
-    return 0;   
-  };
+    {
+      mutex.unlock();
+      return 0;   
+    };
 }
 
 /*!
  *VhostManager costructor.
  *\param lt A ListenThreads object to use to create new threads.
  */
-VhostManager::VhostManager(ListenThreads* lt)
+VhostManager::VhostManager(ListenThreads* lt, LogManager* lm)
 {
   listenThreads = lt;
   hostList.clear();
   extSource = 0;
   mutex.init();
+  logManager = lm;
 }
 
 /*!
@@ -190,19 +145,19 @@
   it = hostList.begin();  
   
   try
-  {
-    for(;it != hostList.end(); it++)
-      delete *it;
+    {
+      for(;it != hostList.end(); it++)
+        delete *it;
       
-    hostList.clear();
+      hostList.clear();
     
-    mutex.unlock();
-  }
+      mutex.unlock();
+    }
   catch(...)
-  {
-    mutex.unlock();
-    return;  
-  };
+    {
+      mutex.unlock();
+      return;  
+    };
 }
 
 /*!
@@ -223,61 +178,53 @@
 }
 
 /*!
- *Change the file owner for the log files.
+ *Change the file owner for the log locations.
  */
-void VhostManager::changeFilesOwner()
+void VhostManager::changeLocationsOwner ()
 {
   if(Server::getInstance()->getUid() | Server::getInstance()->getGid())
-  {
-    int uid = Server::getInstance()->getUid();
-    int gid = Server::getInstance()->getGid();
+    {
+      int uid = Server::getInstance()->getUid();
+      int gid = Server::getInstance()->getGid();
 
-    /*
-     *Change the user and group identifier to -1
-     *if they are not specified.
-     */
-    if(!uid)
-      uid = -1;
+      /*
+       *Change the user and group identifier to -1
+       *if they are not specified.
+       */
+      if(!uid)
+        uid = -1;
 
-    if(!gid)
-      gid = -1;
+      if(!gid)
+        gid = -1;
 
-    /*
-     *Change the log files owner if a different user or group
-     *identifier is specified.
-     */
-    for(int i = 0; ; i++)
-    {
-      int err;
-      Vhost* vh = getVHostByNumber(i);
-      /* Break if we reach the end of the list.  */
-      if(!vh)
-        break;
+      /*
+       *Change the log files owner if a different user or group
+       *identifier is specified.
+       */
+      for(int i = 0; ; i++)
+        {
+          int err;
+          Vhost* vh = getVHostByNumber(i);
+          /* Break if we reach the end of the list.  */
+          if(!vh)
+            break;
 
-      /* Chown the log files.  */
-      err = FilesUtility::chown(vh->getAccessesLogFileName(), uid, gid);
-      if(err)
-      {
-        string str;
-        str.assign("Error changing owner for: ");
-        str.append(vh->getAccessesLogFileName());
-        Server::getInstance()->logPreparePrintError();
-        Server::getInstance()->logWriteln(str);
-        Server::getInstance()->logEndPrintError();
-      }
+          /* Chown the log files.  */
+          err = logManager->chown (vh, "ACCESSLOG", uid, gid);
+          if(err)
+            {
+              string str ("Error changing owner for accesses log locations");
+              Server::getInstance()->logWriteln(str.c_str (), ERROR);
+            }
 
-      err = FilesUtility::chown(vh->getWarningsLogFileName(), uid, gid);
-      if(err)
-      {
-        string str;
-        str.assign("Error changing owner for: ");
-        str.append(vh->getWarningsLogFileName());
-        Server::getInstance()->logPreparePrintError();
-        Server::getInstance()->logWriteln(str);
-        Server::getInstance()->logEndPrintError();
-      }
+          err = logManager->chown (vh, "WARNINGLOG", uid, gid);
+          if(err)
+            {
+              string str ("Error changing owner for errors log locations");
+              Server::getInstance()->logWriteln(str.c_str (), ERROR);
+            }
+        }
     }
-  }
 }
 
 
@@ -289,333 +236,391 @@
   return hostList.size();
 }
 
+string
+VhostManager::saveXMLlogData (string name, Vhost* vh)
+{
+  list<string> l;
+  ostringstream oss;
+  if (!logManager->get (vh, name, &l))
+    {
+      list<string>::iterator it;
+      oss << "<STREAMS>\r\n";
+      for (it = l.begin (); it != l.end (); it++)
+        {
+          oss << "<STREAM>\r\n";
+          oss << "<LOCATION>";
+          oss << *it;
+          oss << "</LOCATION>\r\n";
+          u_long cycle = 0;
+          if (!logManager->getCycle (*it, &cycle))
+            {
+              oss << "<CYCLE>";
+              oss << cycle;
+              oss << "</CYCLE>\r\n";
+            }
+          list<string> f;
+          if (!logManager->getFilters (*it, &f))
+            {
+              oss << "<FILTERS>\r\n";
+              list<string>::iterator it_1;
+              for (it_1 = f.begin (); it_1 != f.end (); it_1++)
+                {
+                  oss << "<FILTER>";
+                  oss << *it_1;
+                  oss << "</FILTER>\r\n";
+                }
+              oss << "</FILTERS>\r\n";
+            }
+          oss << "</STREAM>\r\n";
+        }
+      oss << "</STREAMS>\r\n";
+    }
+  return oss.str ();
+}
+
+void
+VhostManager::loadXMLlogData (string name, Vhost* vh, xmlNode* lcur)
+{
+  xmlAttr *attr;
+  string opt;
+  attr = lcur->properties;
+  while (attr)
+    {
+      opt.append((char*)attr->name);
+      opt.append("=");
+      opt.append((char*)attr->children->content);
+      if(attr->next)
+        {
+          opt.append(",");
+        }
+      attr = attr->next;
+    }
+  string location;
+  list<string> filters;
+  u_long cycle;
+  xmlNode* streams = lcur->children;
+  for (; streams->next; streams = streams->next)
+    {
+      if (streams->type == XML_ELEMENT_NODE &&
+          !xmlStrcmp (streams->name, (const xmlChar*)"STREAMS"))
+        {
+          xmlNode* currStream = streams->children;
+          for (; currStream->next; currStream = currStream->next)
+            {
+              if (currStream->type == XML_ELEMENT_NODE &&
+                  !xmlStrcmp (currStream->name, (const xmlChar*)"STREAM"))
+                {
+                  xmlNode* parameters = currStream->children;
+                  location.assign ("");
+                  filters.clear ();
+                  cycle = 0;
+                  for (; parameters->next; parameters = parameters->next)
+                    {
+                      if (parameters->type == XML_ELEMENT_NODE)
+                        {
+                          if (!xmlStrcmp (parameters->name,
+                                          (const xmlChar*)"LOCATION"))
+                            {
+                              if (parameters->children &&
+                                  parameters->children->content)
+                                {
+                                  location.assign ((char*)parameters->children->content);
+                                }
+                            }
+                          else if (!xmlStrcmp (parameters->name,
+                                               (const xmlChar*)"CYCLE"))
+                            {
+                              if (parameters->children &&
+                                  parameters->children->content)
+                                {
+                                  cycle = atoi ((char*)parameters->children->content);
+                                }
+                            }
+                          else if (!xmlStrcmp (parameters->name,
+                                               (const xmlChar*)"FILTERS"))
+                            {
+                              xmlNode* filterList = parameters->children;
+                              for (; filterList; filterList = filterList->next)
+                                {
+                                  if (filterList->type == XML_ELEMENT_NODE)
+                                    {
+                                      if (!xmlStrcmp (filterList->name,
+                                                      (const xmlChar*)"FILTER"))
+                                        {
+                                          if (filterList->children &&
+                                              filterList->children->content)
+                                            {
+                                              string filter ((char*)filterList->children->content);
+                                              filters.push_back (filter);
+                                            }
+                                        }
+                                    }
+                                }
+                            }
+                        }
+                    }
+                  int err = 1;
+                  string str ("VhostManager::loadXMLlogData : Unrecognized log type");
+
+                  if (!name.compare ("ACCESSLOG"))
+                    {
+                      err = vh->openAccessLog (location, filters, cycle);
+                      vh->setAccessLogOpt (opt.c_str ());
+                      str.assign ("Error opening accesses log location " + location);
+                    }
+                  else if (!name.compare ("WARNINGLOG"))
+                    {
+                      err = vh->openWarningLog (location, filters, cycle);
+                      vh->setWarningLogOpt (opt.c_str ());
+                      str.assign ("Error opening warnings log location " + location);
+                    }
+                  if (err)
+                    {
+                      Server::getInstance ()->logWriteln (str.c_str (), ERROR);
+                    }
+                }
+            }
+        }
+    }
+}
+
 /*!
  *Load the virtual hosts from a XML configuration file
  *Returns non-null on errors.
  *\param filename The XML file to open.
  *\param maxlogSize The maximum dimension for the log file.
  */
-int VhostManager::loadXMLConfigurationFile(const char *filename, 
-                                           int maxlogSize)
+int VhostManager::loadXMLConfigurationFile(const char *filename)
 {
   XmlParser parser;
   xmlDocPtr doc;
   xmlNodePtr node;
-    string errMsg;
+  string errMsg;
   if(parser.open(filename))
-  {
-    errMsg.assign("Error opening: ");
-    errMsg.append(filename);
-    Server::getInstance()->logLockAccess();
-    Server::getInstance()->logPreparePrintError();
-    Server::getInstance()->logWriteln(errMsg.c_str());
-    Server::getInstance()->logEndPrintError();
-    Server::getInstance()->logUnlockAccess();
-    return -1;
-  }
+    {
+      errMsg.assign("Error opening: ");
+      errMsg.append(filename);
+      Server::getInstance()->logWriteln(errMsg.c_str(), ERROR);
+      return -1;
+    }
   doc = parser.getDoc();
   node = doc->children->children;
   for(;node;node = node->next )
-  {
-    xmlNodePtr lcur;
-    Vhost *vh;
-    if(xmlStrcmp(node->name, (const xmlChar *)"VHOST"))
-      continue;
-    lcur=node->children;
-    vh=new Vhost();
-    if(vh == 0)
     {
-      parser.close();
-      clean();
-      errMsg.assign("Error: allocating memory");
-      Server::getInstance()->logLockAccess();
-      Server::getInstance()->logPreparePrintError();
-      Server::getInstance()->logWriteln(errMsg.c_str());
-      Server::getInstance()->logEndPrintError();
-      Server::getInstance()->logUnlockAccess();
-      return -1;
-    }
+      xmlNodePtr lcur;
+      Vhost *vh;
+      if(xmlStrcmp(node->name, (const xmlChar *)"VHOST"))
+        continue;
+      lcur=node->children;
+      vh=new Vhost(logManager);
+      if(vh == 0)
+        {
+          parser.close();
+          clean();
+          errMsg.assign("Error: allocating memory");
+          Server::getInstance()->logWriteln(errMsg.c_str(), ERROR);
+          return -1;
+        }
     
-    SslContext* sslContext = vh->getVhostSSLContext();
+      SslContext* sslContext = vh->getVhostSSLContext();
     
-    while(lcur)
-    {
-      if(!xmlStrcmp(lcur->name, (const xmlChar *)"HOST"))
-      {
-        int useRegex = 0;
-        xmlAttr *attrs = lcur->properties;
-        while(attrs)
+      while(lcur)
         {
-            if(!xmlStrcmp(attrs->name, (const xmlChar *)"isRegex"))
+          if(!xmlStrcmp(lcur->name, (const xmlChar *)"HOST"))
             {
-              if(attrs->children && attrs->children->content && 
-                 (!xmlStrcmp(attrs->children->content, 
-                             (const xmlChar *)"YES")))
-              {
-                useRegex = 1;
-              }
+              int useRegex = 0;
+              xmlAttr *attrs = lcur->properties;
+              while(attrs)
+                {
+                  if(!xmlStrcmp(attrs->name, (const xmlChar *)"isRegex"))
+                    {
+                      if(attrs->children && attrs->children->content && 
+                         (!xmlStrcmp(attrs->children->content, 
+                                     (const xmlChar *)"YES")))
+                        {
+                          useRegex = 1;
+                        }
+                    }
+                  attrs = attrs->next;
+                }
+
+              vh->addHost((const char*)lcur->children->content, useRegex);
             }
-            attrs = attrs->next;
-        }
+          else if(!xmlStrcmp(lcur->name, (const xmlChar *)"NAME"))
+            {
+              vh->setName((char*)lcur->children->content);
+            }
+          else if(!xmlStrcmp(lcur->name, (const xmlChar *)"SSL_PRIVATEKEY"))
+            {
+              string pk((char*)lcur->children->content);
+              sslContext->setPrivateKeyFile(pk);
+            }
+          else if(!xmlStrcmp(lcur->name, (const xmlChar *)"SSL_CERTIFICATE"))
+            {
+              string certificate((char*)lcur->children->content);
+              sslContext->setCertificateFile(certificate);
+            }
+          else if(!xmlStrcmp(lcur->name, (const xmlChar *)"CONNECTIONS_PRIORITY"))
+            {
+              vh->setDefaultPriority(atoi((const char*)lcur->children->content));
 
-        vh->addHost((const char*)lcur->children->content, useRegex);
-      }
-      else if(!xmlStrcmp(lcur->name, (const xmlChar *)"NAME"))
-      {
-        vh->setName((char*)lcur->children->content);
-      }
-      else if(!xmlStrcmp(lcur->name, (const xmlChar *)"SSL_PRIVATEKEY"))
-      {
-        string pk((char*)lcur->children->content);
-        sslContext->setPrivateKeyFile(pk);
-      }
-      else if(!xmlStrcmp(lcur->name, (const xmlChar *)"SSL_CERTIFICATE"))
-      {
-        string certificate((char*)lcur->children->content);
-        sslContext->setCertificateFile(certificate);
-      }
-      else if(!xmlStrcmp(lcur->name, (const xmlChar *)"CONNECTIONS_PRIORITY"))
-      {
-        vh->setDefaultPriority(atoi((const char*)lcur->children->content));
+            }
+          else if(!xmlStrcmp(lcur->name, (const xmlChar *)"SSL_PASSWORD"))
+            {
+              string pw;
+              if(lcur->children)
+                pw.assign((char*)lcur->children->content);
+              else
+                pw.assign("");
 
-      }
-      else if(!xmlStrcmp(lcur->name, (const xmlChar *)"SSL_PASSWORD"))
-      {
-        string pw;
-        if(lcur->children)
-          pw.assign((char*)lcur->children->content);
-        else
-          pw.assign("");
+              sslContext->setPassword(pw);
 
-          sslContext->setPassword(pw);
-
-      }
-      else if(!xmlStrcmp(lcur->name, (const xmlChar *)"IP"))
-      {
-        int useRegex = 0;
-        xmlAttr *attrs =  lcur->properties;
-        while(attrs)
-        {
-          if(!xmlStrcmp(attrs->name, (const xmlChar *)"isRegex"))
-          {
-            if(attrs->children && attrs->children->content && 
-               (!xmlStrcmp(attrs->children->content, 
-                           (const xmlChar *)"YES")))
+            }
+          else if(!xmlStrcmp(lcur->name, (const xmlChar *)"IP"))
             {
-              useRegex = 1;
+              int useRegex = 0;
+              xmlAttr *attrs =  lcur->properties;
+              while(attrs)
+                {
+                  if(!xmlStrcmp(attrs->name, (const xmlChar *)"isRegex"))
+                    {
+                      if(attrs->children && attrs->children->content && 
+                         (!xmlStrcmp(attrs->children->content, 
+                                     (const xmlChar *)"YES")))
+                        {
+                          useRegex = 1;
+                        }
+                    }
+                  attrs = attrs->next;
+                }
+              vh->addIP((char*)lcur->children->content, useRegex);
             }
-          }
-          attrs = attrs->next;
-        }
-       vh->addIP((char*)lcur->children->content, useRegex);
-      }
-      else if(!xmlStrcmp(lcur->name, (const xmlChar *)"PORT"))
-      {
-        int val = atoi((char*)lcur->children->content);
-        if(val > (1 << 16) || strlen((const char*)lcur->children->content) > 6)
-        {
-          errMsg.assign("Error: specified port greater than 65536 or invalid: ");
-          errMsg.append((char*)lcur->children->content);
-          Server::getInstance()->logLockAccess();
-          Server::getInstance()->logPreparePrintError();
-          Server::getInstance()->logWriteln(errMsg.c_str());
-          Server::getInstance()->logEndPrintError();
-          Server::getInstance()->logUnlockAccess();
+          else if(!xmlStrcmp(lcur->name, (const xmlChar *)"PORT"))
+            {
+              int val = atoi((char*)lcur->children->content);
+              if(val > (1 << 16) || strlen((const char*)lcur->children->content) > 6)
+                {
+                  errMsg.assign("Error: specified port greater than 65536 or invalid: ");
+                  errMsg.append((char*)lcur->children->content);
+                  Server::getInstance()->logWriteln(errMsg.c_str(), ERROR);
+                }
+              vh->setPort((u_short)val);
+            }
+          else if(!xmlStrcmp(lcur->name, (const xmlChar *)"PROTOCOL"))
+            {
+              char* lastChar = (char*)lcur->children->content;
+              while(*lastChar != '\0')
+                {
+                  *lastChar = tolower (*lastChar);
+                  lastChar++;
+                }
+              vh->setProtocolName((char*)lcur->children->content);
+            }
+          else if(!xmlStrcmp(lcur->name, (const xmlChar *)"DOCROOT"))
+            {
+              if(lcur->children && lcur->children->content)
+                {
+                  char* lastChar = (char*)lcur->children->content;
+                  while(*(lastChar+1) != '\0')
+                    lastChar++;
 
-        }
-        vh->setPort((u_short)val);
-      }
-      else if(!xmlStrcmp(lcur->name, (const xmlChar *)"PROTOCOL"))
-      {
-        char* lastChar = (char*)lcur->children->content;
-        while(*lastChar != '\0')
-        {
-          *lastChar = tolower (*lastChar);
-          lastChar++;
-        }
-        vh->setProtocolName((char*)lcur->children->content);
-      }
-      else if(!xmlStrcmp(lcur->name, (const xmlChar *)"DOCROOT"))
-      {
-        if(lcur->children && lcur->children->content)
-        {
-          char* lastChar = (char*)lcur->children->content;
-          while(*(lastChar+1) != '\0')
-            lastChar++;
+                  if(*lastChar == '\\' || *lastChar == '/')
+                    {
+                      *lastChar = '\0';
+                    }
+                  vh->setDocumentRoot((const char*)lcur->children->content);
+                }
+              else
+                {
+                  vh->setDocumentRoot("");
+                }
+            }
+          else if(!xmlStrcmp(lcur->name, (const xmlChar *)"SYSFOLDER"))
+            {
+              if(lcur->children && lcur->children->content)
+                {
+                  char* lastChar = (char*)lcur->children->content;
+                  while(*(lastChar+1) != '\0')
+                    lastChar++;
 
-          if(*lastChar == '\\' || *lastChar == '/')
-          {
-            *lastChar = '\0';
-          }
-          vh->setDocumentRoot((const char*)lcur->children->content);
-        }
-        else
+                  if(*lastChar == '\\' || *lastChar == '/')
+                    {
+                      *lastChar = '\0';
+                    }
+                  vh->setSystemRoot((const char*)lcur->children->content);
+                }
+              else
+                {
+                  vh->setSystemRoot("");
+                }
+            }
+          else if(!xmlStrcmp(lcur->name, (const xmlChar *)"ACCESSLOG"))
+            {
+              loadXMLlogData ("ACCESSLOG", vh, lcur);
+            }
+          else if(!xmlStrcmp(lcur->name, (const xmlChar *)"WARNINGLOG"))
+            {
+              loadXMLlogData ("WARNINGLOG", vh, lcur);
+            }
+          else if(!xmlStrcmp(lcur->name, (const xmlChar *)"MIME_FILE"))
+            {
+              if(lcur->children)
+                vh->getMIME()->loadXML((char*)lcur->children->content);
+            }
+          else if(!xmlStrcmp(lcur->name, (const xmlChar *)"THROTTLING_RATE"))
+            {
+              vh->setThrottlingRate((u_long)atoi((char*)lcur->children->content));
+            }
+          else if(lcur->children && lcur->children->content)
+            {
+              string *old;
+              string *s = new string((const char*)lcur->children->content);
+              if(s == 0)
+                {
+                  parser.close();
+                  clean();
+                  return -1;
+                }
+              string keyValue((const char*)lcur->name);
+              old = vh->hashedData.put(keyValue, s);
+              if(old)
+                {
+                  delete old;
+                }            
+            }
+          lcur = lcur->next;
+        }//while(lcur)
+      
+      if (vh->openLogFiles ())
         {
-          vh->setDocumentRoot("");
+          errMsg.assign ("Error: opening log files");
+          Server::getInstance ()->logWriteln (errMsg.c_str (), ERROR);
+          delete vh;
+          vh = 0;
+          continue;
         }
-      }
-      else if(!xmlStrcmp(lcur->name, (const xmlChar *)"SYSFOLDER"))
-      {
-        if(lcur->children && lcur->children->content)
-        {
-          char* lastChar = (char*)lcur->children->content;
-          while(*(lastChar+1) != '\0')
-            lastChar++;
 
-          if(*lastChar == '\\' || *lastChar == '/')
-          {
-            *lastChar = '\0';
-          }
-            vh->setSystemRoot((const char*)lcur->children->content);
-        }
-        else
+      if ( vh->initializeSSL() < 0 )
         {
-          vh->setSystemRoot("");
+          errMsg.assign("Error: initializing vhost");
+          Server::getInstance()->logWriteln(errMsg.c_str(), ERROR);
+          delete vh;
+          vh = 0;
+          continue;
         }
-      }
-      else if(!xmlStrcmp(lcur->name, (const xmlChar *)"ACCESSLOG"))
-      {
-        xmlAttr *attr;
-        string opt;
-        opt.assign("");
-        vh->setAccessLogOpt("");
-        if(lcur->children && lcur->children->content)
-          vh->setAccessesLogFileName((char*)lcur->children->content);
-        else
-        {
-          errMsg.assign("Error: invalid accesses log file name");
-          Server::getInstance()->logLockAccess();
-          Server::getInstance()->logPreparePrintError();
-          Server::getInstance()->logWriteln(errMsg.c_str());
-          Server::getInstance()->logEndPrintError();
-          Server::getInstance()->logUnlockAccess();
-        }
 
-        attr =  lcur->properties;
-        while(attr)
+      if(addVHost(vh))
         {
-          opt.append((char*)attr->name);
-          opt.append("=");
-          opt.append((char*)attr->children->content);
-
-          if(attr->next)
-          {
-            opt.append(",");
-          }
-          attr = attr->next;
+          errMsg.assign("Error: adding vhost");
+          Server::getInstance()->logWriteln(errMsg.c_str(), ERROR);
+          delete vh;
+          vh = 0;
+          continue;
         }
-        vh->setAccessLogOpt(opt.c_str());
-      }
-      else if(!xmlStrcmp(lcur->name, (const xmlChar *)"WARNINGLOG"))
-      {
-        xmlAttr *attr;
-        string opt;
-        opt.assign("");
-
-        if(lcur->children && lcur->children->content)
-          vh->setWarningsLogFileName((char*)lcur->children->content);
-        else
-        {
-          errMsg.assign("Error: invalid warnings log file name");
-          Server::getInstance()->logLockAccess();
-          Server::getInstance()->logPreparePrintError();
-          Server::getInstance()->logWriteln(errMsg.c_str());
-          Server::getInstance()->logEndPrintError();
-          Server::getInstance()->logUnlockAccess();
-        }
-        vh->setWarningLogOpt("");                
-        attr = lcur->properties;
-        while(attr)
-        {
-          opt.append((char*)attr->name);
-          opt.append("=");
-          opt.append((char*)attr->children->content);
-          if(attr->next)
-          {
-     
-            opt.append(",");
-          }
-
-          attr=attr->next;
-        }
-        
-        vh->setWarningLogOpt(opt.c_str());
-      }
-      else if(!xmlStrcmp(lcur->name, (const xmlChar *)"MIME_FILE"))
-      {
-        if(lcur->children)
-          vh->getMIME()->loadXML((char*)lcur->children->content);
-      }
-      else if(!xmlStrcmp(lcur->name, (const xmlChar *)"THROTTLING_RATE"))
-      {
-        vh->setThrottlingRate((u_long)atoi((char*)lcur->children->content));
-       }
-       else if(lcur->children && lcur->children->content)
-       {
-        string *old;
-        string *s = new string((const char*)lcur->children->content);
-        if(s == 0)
-        {
-          parser.close();
-          clean();
-          return -1;
-        }
-        string keyValue((const char*)lcur->name);
-        old = vh->hashedData.put(keyValue, s);
-        if(old)
-        {
-          delete old;
-        }            
-      }
-      lcur = lcur->next;
-    }//while(lcur)
-
-    if(vh->openLogFiles())
-    {
-      errMsg.assign("Error: opening log files");
-      Server::getInstance()->logLockAccess();
-      Server::getInstance()->logPreparePrintError();
-      Server::getInstance()->logWriteln(errMsg.c_str());
-      Server::getInstance()->logEndPrintError();
-      Server::getInstance()->logUnlockAccess();
-      
-      delete vh;
-      vh =0;
-      continue;
     }
-
-    if ( vh->initializeSSL() < 0 )
-    {
-      errMsg.assign("Error: initializing vhost");
-      Server::getInstance()->logLockAccess();
-      Server::getInstance()->logPreparePrintError();
-      Server::getInstance()->logWriteln(errMsg.c_str());
-      Server::getInstance()->logEndPrintError();
-      Server::getInstance()->logUnlockAccess();
-      
-      delete vh;
-      vh = 0;
-      continue;
-    }
-
-    if(addVHost(vh))
-    {
-      errMsg.assign("Error: adding vhost");
-      Server::getInstance()->logLockAccess();
-      Server::getInstance()->logPreparePrintError();
-      Server::getInstance()->logWriteln(errMsg.c_str());
-      Server::getInstance()->logEndPrintError();
-      Server::getInstance()->logUnlockAccess();
-      
-      delete vh;
-      vh = 0;
-      continue;
-    }
-
-  }
   parser.close();
 
-  changeFilesOwner();
+  changeLocationsOwner ();
 
   return 0;
 }
@@ -632,127 +637,131 @@
   mutex.lock();
 
   if(extSource)
-  {
-    int ret = extSource->save();
-    mutex.unlock();
-    return ret;
-  }
+    {
+      int ret = extSource->save();
+      mutex.unlock();
+      return ret;
+    }
 
   out.openFile(filename, File::MYSERVER_CREATE_ALWAYS | File::MYSERVER_OPEN_WRITE);
   out.writeToFile("<?xml version=\"1.0\"?>\r\n<VHOSTS>\r\n", 33, &nbw);
 
   try
-  {
-    list<Vhost*>::iterator i = hostList.begin();
-    for( ; i != hostList.end() ; i++)
     {
-      char port[6];
-      list<Vhost::StringRegex*>::iterator il = (*i)->getIpList()->begin();
-      list<Vhost::StringRegex*>::iterator hl = (*i)->getHostList()->begin();
-      out.writeToFile("<VHOST>\r\n",9,&nbw);
+      list<Vhost*>::iterator i = hostList.begin();
+      for( ; i != hostList.end() ; i++)
+        {
+          char port[6];
+          list<Vhost::StringRegex*>::iterator il = (*i)->getIpList()->begin();
+          list<Vhost::StringRegex*>::iterator hl = (*i)->getHostList()->begin();
+          out.writeToFile("<VHOST>\r\n",9,&nbw);
       
-      out.writeToFile("<NAME>",6,&nbw);
-      out.writeToFile((*i)->getName(), strlen((*i)->getName()), &nbw);
-      out.writeToFile("</NAME>\r\n",9,&nbw);
+          out.writeToFile("<NAME>",6,&nbw);
+          out.writeToFile((*i)->getName(), strlen((*i)->getName()), &nbw);
+          out.writeToFile("</NAME>\r\n",9,&nbw);
        
-      for(; il != (*i)->getIpList()->end(); il++)
-      {
-        string *n = &((*il)->name);
-        out.writeToFile("<IP>",4,&nbw);
-        out.writeToFile(n->c_str(), n->length(), &nbw);
-        out.writeToFile("</IP>\r\n",7,&nbw);
-      }
+          for(; il != (*i)->getIpList()->end(); il++)
+            {
+              string *n = &((*il)->name);
+              out.writeToFile("<IP>",4,&nbw);
+              out.writeToFile(n->c_str(), n->length(), &nbw);
+              out.writeToFile("</IP>\r\n",7,&nbw);
+            }
 
-      for(; hl != (*i)->getHostList()->end(); hl++)
-      {
-        string *n = &((*hl)->name);
-        out.writeToFile("<HOST>",6,&nbw);
-        out.writeToFile(n->c_str(), n->length(), &nbw);
-        out.writeToFile("</HOST>\r\n",9,&nbw);
-      }
+          for(; hl != (*i)->getHostList()->end(); hl++)
+            {
+              string *n = &((*hl)->name);
+              out.writeToFile("<HOST>",6,&nbw);
+              out.writeToFile(n->c_str(), n->length(), &nbw);
+              out.writeToFile("</HOST>\r\n",9,&nbw);
+            }
 
-      out.writeToFile("<PORT>",6,&nbw);
-      sprintf(port,"%i", (*i)->getPort());
-      out.writeToFile(port,(u_long)strlen(port),&nbw);
-      out.writeToFile("</PORT>\r\n",9,&nbw);
+          out.writeToFile("<PORT>",6,&nbw);
+          sprintf(port,"%i", (*i)->getPort());
+          out.writeToFile(port,(u_long)strlen(port),&nbw);
+          out.writeToFile("</PORT>\r\n",9,&nbw);
 
-      if((*i)->getVhostSSLContext()->getPrivateKeyFile().length())
-      {
-        string &pk = (*i)->getVhostSSLContext()->getPrivateKeyFile();
-        out.writeToFile("<SSL_PRIVATEKEY>",16,&nbw);
-        out.writeToFile(pk.c_str(), pk.length(),&nbw);
-        out.writeToFile("</SSL_PRIVATEKEY>\r\n",19,&nbw);
-      }
+          if((*i)->getVhostSSLContext()->getPrivateKeyFile().length())
+            {
+              string &pk = (*i)->getVhostSSLContext()->getPrivateKeyFile();
+              out.writeToFile("<SSL_PRIVATEKEY>",16,&nbw);
+              out.writeToFile(pk.c_str(), pk.length(),&nbw);
+              out.writeToFile("</SSL_PRIVATEKEY>\r\n",19,&nbw);
+            }
       
-      if((*i)->getVhostSSLContext()->getCertificateFile().length())
-      {
-        string &certificate = (*i)->getVhostSSLContext()->getCertificateFile();
-        out.writeToFile("<SSL_CERTIFICATE>", 17, &nbw);
-        out.writeToFile(certificate.c_str(), (u_long)certificate.length(), 
-                        &nbw);
-        out.writeToFile("</SSL_CERTIFICATE>\r\n", 20, &nbw);
-      }
+          if((*i)->getVhostSSLContext()->getCertificateFile().length())
+            {
+              string &certificate = (*i)->getVhostSSLContext()->getCertificateFile();
+              out.writeToFile("<SSL_CERTIFICATE>", 17, &nbw);
+              out.writeToFile(certificate.c_str(), (u_long)certificate.length(), 
+                              &nbw);
+              out.writeToFile("</SSL_CERTIFICATE>\r\n", 20, &nbw);
+            }
 
-      if((*i)->getVhostSSLContext()->getPassword().length())
-      {
-        string& pw = (*i)->getVhostSSLContext()->getPassword();
-        out.writeToFile("<SSL_PASSWORD>", 14, &nbw);
-        out.writeToFile(pw.c_str(), pw.length(), &nbw);
-        out.writeToFile("</SSL_PASSWORD>\r\n", 17, &nbw);
-      }
+          if((*i)->getVhostSSLContext()->getPassword().length())
+            {
+              string& pw = (*i)->getVhostSSLContext()->getPassword();
+              out.writeToFile("<SSL_PASSWORD>", 14, &nbw);
+              out.writeToFile(pw.c_str(), pw.length(), &nbw);
+              out.writeToFile("</SSL_PASSWORD>\r\n", 17, &nbw);
+            }
 
-      out.writeToFile("<PROTOCOL>", 10, &nbw);
-      out.writeToFile((*i)->getProtocolName(), 
-                      strlen((*i)->getProtocolName()), &nbw);
+          out.writeToFile("<PROTOCOL>", 10, &nbw);
+          out.writeToFile((*i)->getProtocolName(), 
+                          strlen((*i)->getProtocolName()), &nbw);
 
-      out.writeToFile("</PROTOCOL>\r\n", 13, &nbw);
+          out.writeToFile("</PROTOCOL>\r\n", 13, &nbw);
       
-      out.writeToFile("<DOCROOT>", 9, &nbw);
-      out.writeToFile((*i)->getDocumentRoot().c_str(), 
-                      (*i)->getDocumentRoot().length(), &nbw);
-      out.writeToFile("</DOCROOT>\r\n", 12, &nbw);
+          out.writeToFile("<DOCROOT>", 9, &nbw);
+          out.writeToFile((*i)->getDocumentRoot().c_str(), 
+                          (*i)->getDocumentRoot().length(), &nbw);
+          out.writeToFile("</DOCROOT>\r\n", 12, &nbw);
       
-      out.writeToFile("<SYSFOLDER>", 11, &nbw);
-      out.writeToFile((*i)->getSystemRoot().c_str(), 
-                      (*i)->getSystemRoot().length(), &nbw);
+          out.writeToFile("<SYSFOLDER>", 11, &nbw);
+          out.writeToFile((*i)->getSystemRoot().c_str(), 
+                          (*i)->getSystemRoot().length(), &nbw);
       
-      out.writeToFile("</SYSFOLDER>\r\n", 14, &nbw);
+          out.writeToFile("</SYSFOLDER>\r\n", 14, &nbw);
       
-      out.writeToFile("<ACCESSLOG>", 13, &nbw);
-      out.writeToFile((*i)->getAccessesLogFileName(),
-                      (u_long)strlen((*i)->getAccessesLogFileName()), &nbw);
-      out.writeToFile("</ACCESSLOG>\r\n", 16, &nbw);
+          out.writeToFile("<ACCESSLOG>", 13, &nbw);
+
+          string accessData = saveXMLlogData ("ACCESSLOG", *i);
+          string warningData = saveXMLlogData ("WARNINGLOG", *i);
+
+          out.writeToFile (accessData.c_str (), accessData.size (), &nbw);
+          
+          out.writeToFile("</ACCESSLOG>\r\n", 16, &nbw);
       
-      out.writeToFile("<WARNINGLOG>", 12, &nbw);
-      out.writeToFile((*i)->getWarningsLogFileName(),
-                      (u_long)strlen((*i)->getWarningsLogFileName()),&nbw);
-      out.writeToFile("</WARNINGLOG>\r\n", 15, &nbw);
+          out.writeToFile("<WARNINGLOG>", 12, &nbw);
+
+          out.writeToFile (warningData.c_str (), warningData.size (), &nbw);
+          
+          out.writeToFile("</WARNINGLOG>\r\n", 15, &nbw);
       
-      {
-        HashMap<string, string*>::Iterator it = (*i)->hashedData.begin();
-        for(; it != (*i)->hashedData.end(); it++)
-        {
-          ostringstream outString;
-          outString << "<" << it.getKey() << ">" << (*it)  << "</" 
-                    << it.getKey() << ">" << endl;
-          out.writeToFile(outString.str().c_str(),outString.str().size(),&nbw);
+          {
+            HashMap<string, string*>::Iterator it = (*i)->hashedData.begin();
+            for(; it != (*i)->hashedData.end(); it++)
+              {
+                ostringstream outString;
+                outString << "<" << it.getKey() << ">" << (*it)  << "</" 
+                          << it.getKey() << ">" << endl;
+                out.writeToFile(outString.str().c_str(),outString.str().size(),&nbw);
+              }
+            out.writeToFile("</VHOST>\r\n", 10, &nbw);
+          }
         }
-        out.writeToFile("</VHOST>\r\n", 10, &nbw);
-      }
+      out.writeToFile("</VHOSTS>\r\n", 11, &nbw);
+      out.close();
+      mutex.unlock();
     }
-    out.writeToFile("</VHOSTS>\r\n", 11, &nbw);
-    out.close();
-    mutex.unlock();
-  }
   catch(...)
-  {
-    mutex.unlock();
-  };
+    {
+      mutex.unlock();
+    };
 
   return 0;
 }
 
-
 /*!
  *Get a virtual host by its position in the list.
  *Zero based list.
@@ -763,33 +772,33 @@
   Vhost* ret = 0;
   mutex.lock();
   try
-  {
-    list<Vhost*>::iterator i = hostList.begin();
-    if(extSource)
     {
-      ret=extSource->getVHostByNumber(n);
+      list<Vhost*>::iterator i = hostList.begin();
+      if(extSource)
+        {
+          ret=extSource->getVHostByNumber(n);
+          mutex.unlock();
+          return ret;
+        }
+    
+      for( ; i != hostList.end(); i++)
+        {
+          if(!(n--))
+            {
+              ret = *i;
+              ret->addRef();
+              break;
+            }
+        }
       mutex.unlock();
+    
       return ret;
     }
-    
-    for( ; i != hostList.end(); i++)
+  catch(...)
     {
-      if(!(n--))
-      {
-        ret = *i;
-        ret->addRef();
-        break;
-      }
-    }
-    mutex.unlock();
-    
-    return ret;
-  }
-  catch(...)
-  {
-    mutex.unlock();
-    return ret;
-  };
+      mutex.unlock();
+      return ret;
+    };
 }
 
 /*!
@@ -801,26 +810,26 @@
 {
   mutex.lock();
   try
-  {
-    list<Vhost*>::iterator i = hostList.begin();
+    {
+      list<Vhost*>::iterator i = hostList.begin();
     
-    for( ;i != hostList.end(); i++)
-    {
-      if(!(n--))
-      {
-        delete *i;
-        mutex.unlock();
-        return 1;
-      }
+      for( ;i != hostList.end(); i++)
+        {
+          if(!(n--))
+            {
+              delete *i;
+              mutex.unlock();
+              return 1;
+            }
+        }
+      mutex.unlock();
+      return 0;
     }
-    mutex.unlock();
-    return 0;
-  }
   catch(...)
-  {
-    mutex.unlock();
-    return 0;   
-  };
+    {
+      mutex.unlock();
+      return 0;   
+    };
 }
 
 /*!

Modified: trunk/myserver/src/connections_scheduler/connections_scheduler.cpp
===================================================================
--- trunk/myserver/src/connections_scheduler/connections_scheduler.cpp	2008-10-08 19:28:07 UTC (rev 2873)
+++ trunk/myserver/src/connections_scheduler/connections_scheduler.cpp	2008-10-08 22:21:10 UTC (rev 2874)
@@ -357,11 +357,7 @@
   {
     if(server)
     {
-      server->logLockAccess();
-      server->logPreparePrintError();
-      server->logWriteln("Error initializing socket pair.");
-      server->logEndPrintError();
-      server->logUnlockAccess();
+      server->logWriteln("Error initializing socket pair.", ERROR);
     }
     return;
   }
@@ -375,11 +371,7 @@
   {
     if(server)
     {
-      server->logLockAccess();
-      server->logPreparePrintError();
-      server->logWriteln("Error initializing dispatcher thread.");
-      server->logEndPrintError();
-      server->logUnlockAccess();
+      server->logWriteln("Error initializing dispatcher thread.", ERROR);
     }
     dispatchedThreadId = 0;
   }

Modified: trunk/myserver/src/connections_scheduler/listen_threads.cpp
===================================================================
--- trunk/myserver/src/connections_scheduler/listen_threads.cpp	2008-10-08 19:28:07 UTC (rev 2873)
+++ trunk/myserver/src/connections_scheduler/listen_threads.cpp	2008-10-08 22:21:10 UTC (rev 2874)
@@ -96,9 +96,7 @@
       serverSocketIPv4->socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
       if (serverSocketIPv4->getHandle() == (FileHandle)INVALID_SOCKET)
       {
-        server->logPreparePrintError();
-        server->logWriteln(languageParser->getValue("ERR_OPENP"));
-        server->logEndPrintError();
+        server->logWriteln(languageParser->getValue("ERR_OPENP"), ERROR);
         delete serverSocketIPv4;
         serverSocketIPv4 = NULL;
       }
@@ -122,9 +120,7 @@
                                         (const char *)&optvalReuseAddr,
                                         sizeof(optvalReuseAddr)) < 0)
         {
-          server->logPreparePrintError();
-          server->logWriteln(languageParser->getValue("ERR_ERROR"));
-          server->logEndPrintError();
+          server->logWriteln(languageParser->getValue("ERR_ERROR"), ERROR);
           delete serverSocketIPv4;
           serverSocketIPv4 = NULL;
           //return 0; allow IPv6
@@ -140,9 +136,7 @@
           if (serverSocketIPv4->bind(&sockServerSocketIPv4,
                                      sizeof(sockaddr_in)) != 0)
           {
-            server->logPreparePrintError();
-            server->logWriteln(languageParser->getValue("ERR_BIND"));
-            server->logEndPrintError();
+            server->logWriteln(languageParser->getValue("ERR_BIND"), ERROR);
             delete serverSocketIPv4;
             serverSocketIPv4 = NULL;
           }
@@ -161,9 +155,7 @@
       serverSocketIPv6->socket(AF_INET6, SOCK_STREAM, IPPROTO_TCP);
       if ( serverSocketIPv6->getHandle() == (FileHandle)INVALID_SOCKET )
       {
-        server->logPreparePrintError();
-        server->logWriteln(languageParser->getValue("ERR_OPENP"));
-        server->logEndPrintError();
+        server->logWriteln(languageParser->getValue("ERR_OPENP"), ERROR);
         delete serverSocketIPv6;
         serverSocketIPv6 = NULL;
       }
@@ -185,9 +177,7 @@
                                         (const char *)&optvalReuseAddr,
                                         sizeof(optvalReuseAddr))<0)
         {
-          server->logPreparePrintError();
-          server->logWriteln(languageParser->getValue("ERR_ERROR"));
-          server->logEndPrintError();
+          server->logWriteln(languageParser->getValue("ERR_ERROR"), ERROR);
           delete serverSocketIPv6;
           serverSocketIPv6 = NULL;
           //return 0;allow IPv6
@@ -197,9 +187,7 @@
                                         (const char *)&optvalReuseAddr,
                                         sizeof(optvalReuseAddr)) < 0)
         {
-          server->logPreparePrintError();
-          server->logWriteln(languageParser->getValue("ERR_ERROR"));
-          server->logEndPrintError();
+          server->logWriteln(languageParser->getValue("ERR_ERROR"), ERROR);
           delete serverSocketIPv6;
           serverSocketIPv6 = NULL;
           //return 0;allow IPv6
@@ -215,9 +203,7 @@
           if ( serverSocketIPv6->bind(&sockServerSocketIPv6,
                                       sizeof(sockaddr_in6)) != 0)
           {
-            server->logPreparePrintError();
-            server->logWriteln(languageParser->getValue("ERR_BIND"));
-            server->logEndPrintError();
+            server->logWriteln(languageParser->getValue("ERR_BIND"), ERROR);
             delete serverSocketIPv6;
             serverSocketIPv6 = NULL;
           }
@@ -241,18 +227,14 @@
     server->logWriteln(languageParser->getValue("MSG_SLISTEN"));
     if (serverSocketIPv4 != NULL && serverSocketIPv4->listen(SOMAXCONN))
     {
-      server->logPreparePrintError();
-      server->logWriteln(languageParser->getValue("ERR_LISTEN"));
-      server->logEndPrintError();
+      server->logWriteln(languageParser->getValue("ERR_LISTEN"), ERROR);
       delete serverSocketIPv4;
       serverSocketIPv4 = NULL;
     }
 
     if (serverSocketIPv6 != NULL && serverSocketIPv6->listen(SOMAXCONN))
     {
-      server->logPreparePrintError();
-      server->logWriteln(languageParser->getValue("ERR_LISTEN"));
-      server->logEndPrintError();
+      server->logWriteln(languageParser->getValue("ERR_LISTEN"), ERROR);
       delete serverSocketIPv6;
       serverSocketIPv6 = NULL;
     }

Modified: trunk/myserver/src/filter/console.cpp
===================================================================
--- trunk/myserver/src/filter/console.cpp	2008-10-08 19:28:07 UTC (rev 2873)
+++ trunk/myserver/src/filter/console.cpp	2008-10-08 22:21:10 UTC (rev 2874)
@@ -1,25 +1,24 @@
 /*
-MyServer
-Copyright (C) 2006, 2008 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
-(at your option) any later version.
+  MyServer
+  Copyright (C) 2006, 2008 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
+  (at your option) any later version.
 
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-GNU General Public License for more details.
+  This program is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+  GNU General Public License for more details.
 
-You should have received a copy of the GNU General Public License
-along with this program.  If not, see <http://www.gnu.org/licenses/>.
+  You should have received a copy of the GNU General Public License
+  along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
 
 #include <include/filter/console.h>
 
 Console::Console () : Stream ()
 {
-  
 }
 
 Console::~Console ()
@@ -30,19 +29,84 @@
 int 
 Console::flush (u_long* nbw)
 {
-  return *nbw = 0;
+  if (fd)
+    {
+      return *nbw = 0;
+    }
+  return 1;
 }
 
 int
 Console::read (char* buffer, u_long len, u_long* nbr)
 {
-  return *nbr = 0;
+  if (fd)
+    {
+      return *nbr = 0;
+    }
+  return 1;
 }
 
 int
 Console::write (const char* buffer, u_long len, u_long* nbw)
 {
-  cout << buffer;
-  *nbw = len;
+  if (fd)
+    {
+      *fd << buffer;
+      *nbw = len;
+      return 0;
+    }
+  return 1;
+}
+
+int 
+Console::openConsole (string fd)
+{
+  int success = 1;
+  if (!fd.compare ("stdout"))
+    {
+      this->fd = &cout;
+      success = 0;
+    }
+  else if (!fd.compare ("stderr"))
+    {
+      this->fd = &cerr;
+      success = 0;
+    }
+  return success;
+}
+
+int
+Console::enterErrorMode ()
+{
+#ifdef WIN32
+
+  int success = 
+    SetConsoleTextAttribute (GetStdHandle ((fd == &cout) ? STD_OUTPUT_HANDLE : STD_ERROR_HANDLE),
+                             FOREGROUND_RED |
+                             FOREGROUND_INTENSITY);
+  if (success)
+    return 0;
+#endif
+#ifdef NOT_WIN
+  *fd << "\033[31;1m";
   return 0;
+#endif
 }
+
+int
+Console::exitErrorMode ()
+{
+#ifdef WIN32
+  int success = 
+    SetConsoleTextAttribute (GetStdHandle ((fd == &cout) ? STD_OUTPUT_HANDLE : STD_ERROR_HANDLE),
+                             FOREGROUND_RED |
+                             FOREGROUND_GREEN |
+                             FOREGROUND_BLUE);
+  if (success)
+    return 0;
+#endif
+#ifdef NOT_WIN
+  *fd << "\033[0m";
+  return 0;
+#endif
+}

Modified: trunk/myserver/src/http_handler/cgi/cgi.cpp
===================================================================
--- trunk/myserver/src/http_handler/cgi/cgi.cpp	2008-10-08 19:28:07 UTC (rev 2873)
+++ trunk/myserver/src/http_handler/cgi/cgi.cpp	2008-10-08 22:21:10 UTC (rev 2874)
@@ -195,7 +195,6 @@
   {
     if(!FilesUtility::fileExists(tmpCgiPath.c_str()))
     {
-      td->connection->host->warningsLogRequestAccess(td->id);
       if(tmpCgiPath.length() > 0)
       {
         string msg;
@@ -209,7 +208,6 @@
         td->connection->host->warningsLogWrite(
                                     "Cgi: Executable file not specified");
       }
-      td->connection->host->warningsLogTerminateAccess(td->id);    
       td->scriptPath.assign("");
       td->scriptFile.assign("");
       td->scriptDir.assign("");
@@ -253,10 +251,8 @@
    */
   if(stdOutFile.create())
   {
-    td->connection->host->warningsLogRequestAccess(td->id);
     td->connection->host->warningsLogWrite
                           ("Cgi: Cannot create CGI stdout file");
-    td->connection->host->warningsLogTerminateAccess(td->id);
     chain.clearAllFilters(); 
     return td->http->raiseHTTPError(500);
   }
@@ -265,9 +261,7 @@
   if(stdInFile.openFile(td->inputDataPath, 
                         File::MYSERVER_OPEN_READ | File::MYSERVER_OPEN_ALWAYS))
   {
-    td->connection->host->warningsLogRequestAccess(td->id);
     td->connection->host->warningsLogWrite("Cgi: Cannot open CGI stdin file");
-    td->connection->host->warningsLogTerminateAccess(td->id);
     stdOutFile.close();
     chain.clearAllFilters(); 
     return td->http->raiseHTTPError(500);
@@ -298,9 +292,7 @@
        spi.stdIn == (FileHandle)-1 || 
        spi.stdOut == (FileHandle)-1)
   {
-    td->connection->host->warningsLogRequestAccess(td->id);
     td->connection->host->warningsLogWrite("Cgi: Invalid base/file/file.handler");
-    td->connection->host->warningsLogTerminateAccess(td->id);
     stdOutFile.close();
     chain.clearAllFilters(); 
     return td->http->raiseHTTPError(500);
@@ -312,10 +304,8 @@
     {
       stdInFile.close();
       stdOutFile.close();
-      td->connection->host->warningsLogRequestAccess(td->id);
       td->connection->host->warningsLogWrite
                                        ("Cgi: Error in the CGI execution");
-      td->connection->host->warningsLogTerminateAccess(td->id);
       chain.clearAllFilters(); 
       return td->http->raiseHTTPError(500);
     }
@@ -352,10 +342,8 @@
     {
       stdInFile.close();
       stdOutFile.close();
-      td->connection->host->warningsLogRequestAccess(td->id);
       td->connection->host->warningsLogWrite
         ("Cgi: Error reading from CGI std out file");
-      td->connection->host->warningsLogTerminateAccess(td->id);
       chain.clearAllFilters();
       return td->http->raiseHTTPError(500);
     }
@@ -380,9 +368,7 @@
     
     if(headerOffset == 0)
     {
-      td->connection->host->warningsLogRequestAccess(td->id);
       td->connection->host->warningsLogWrite("Cgi: Error CGI zero bytes read");
-      td->connection->host->warningsLogTerminateAccess(td->id);
       td->http->raiseHTTPError(500);
       stdOutFile.close();
       stdInFile.close();
@@ -489,9 +475,7 @@
                                                                    &nbw, 
                                                                    1))
   {
-    td->connection->host->warningsLogRequestAccess(td->id);
     td->connection->host->warningsLogWrite("Cgi: Error loading filters");
-    td->connection->host->warningsLogTerminateAccess(td->id);
     stdOutFile.close();
     stdInFile.close();
     cgiProc.terminateProcess();

Modified: trunk/myserver/src/http_handler/fastcgi/fastcgi.cpp
===================================================================
--- trunk/myserver/src/http_handler/fastcgi/fastcgi.cpp	2008-10-08 19:28:07 UTC (rev 2873)
+++ trunk/myserver/src/http_handler/fastcgi/fastcgi.cpp	2008-10-08 22:21:10 UTC (rev 2874)
@@ -114,10 +114,8 @@
                                                     &nbw, 
                                                     1))
       {
-        td->connection->host->warningsLogRequestAccess(td->id);
         td->connection->host->warningsLogWrite(
                                              "FastCGI: Error loading filters");
-        td->connection->host->warningsLogTerminateAccess(td->id);
         chain.clearAllFilters();
         return td->http->raiseHTTPError(500);
       }
@@ -211,9 +209,7 @@
     if(Server::getInstance()->getVerbosity() > 2)
     {
       *td->buffer << "FastCGI: Error to build env string" << '\0';
-      td->connection->host->warningsLogRequestAccess(td->id);
       td->connection->host->warningsLogWrite(td->buffer->getBuffer());
-      td->connection->host->warningsLogTerminateAccess(td->id);
     }
     chain.clearAllFilters();
     return td->http->raiseHTTPError(500);
@@ -227,9 +223,7 @@
     if(Server::getInstance()->getVerbosity() > 2)
     {
       *td->buffer << "FastCGI: Error opening stdin file" << '\0';
-      td->connection->host->warningsLogRequestAccess(td->id);
       td->connection->host->warningsLogWrite(td->buffer->getBuffer());
-      td->connection->host->warningsLogTerminateAccess(td->id);
     }
     chain.clearAllFilters();
     return td->http->raiseHTTPError(500);
@@ -244,9 +238,7 @@
     {
       *td->buffer << "FastCGI: Error connecting to FastCGI "
                   << cmdLine.str().c_str() << " process" << '\0';
-      td->connection->host->warningsLogRequestAccess(td->id);
       td->connection->host->warningsLogWrite(td->buffer->getBuffer());
-      td->connection->host->warningsLogTerminateAccess(td->id);
     }
     chain.clearAllFilters();
     return td->http->raiseHTTPError(500);
@@ -264,9 +256,7 @@
     if(Server::getInstance()->getVerbosity() > 2)
     {
       *td->buffer<< "FastCGI: Error beginning the request" << '\0';
-      td->connection->host->warningsLogRequestAccess(td->id);
       td->connection->host->warningsLogWrite(td->buffer->getBuffer());
-      td->connection->host->warningsLogTerminateAccess(td->id);
     }
     chain.clearAllFilters();
     con.sock.close();
@@ -280,9 +270,7 @@
     if(Server::getInstance()->getVerbosity() > 2)
     {
       *td->buffer << "FastCGI: Error sending params" << '\0';
-      td->connection->host->warningsLogRequestAccess(td->id);
       td->connection->host->warningsLogWrite(td->buffer->getBuffer());
-      td->connection->host->warningsLogTerminateAccess(td->id);
     }
     chain.clearAllFilters();
     con.sock.close();
@@ -295,9 +283,7 @@
     if(Server::getInstance()->getVerbosity() > 2)
     {
       *td->buffer << "FastCGI: Error sending params" << '\0';
-      td->connection->host->warningsLogRequestAccess(td->id);
       td->connection->host->warningsLogWrite(td->buffer->getBuffer());
-      td->connection->host->warningsLogTerminateAccess(td->id);
     }
     chain.clearAllFilters();
     con.sock.close();
@@ -313,9 +299,7 @@
       if(Server::getInstance()->getVerbosity() > 2)
       {
         *td->buffer << "FastCGI: Error sending POST data" << '\0';
-        td->connection->host->warningsLogRequestAccess(td->id);
         td->connection->host->warningsLogWrite(td->buffer->getBuffer());
-        td->connection->host->warningsLogTerminateAccess(td->id);
       }
 
     /*! Send the STDIN data.  */
@@ -328,10 +312,8 @@
         if(Server::getInstance()->getVerbosity() > 2)
         {
           *td->buffer << "FastCGI: Error reading from file" << '\0';
-          td->connection->host->warningsLogRequestAccess(td->id);
           td->connection->host->warningsLogWrite(
                                                     td->buffer->getBuffer());
-          td->connection->host->warningsLogTerminateAccess(td->id);
         }
         return td->http->sendHTTPhardError500();
       }
@@ -352,9 +334,7 @@
         if(Server::getInstance()->getVerbosity() > 2)
         {
           *td->buffer << "FastCGI: Error sending data" << '\0';
-          td->connection->host->warningsLogRequestAccess(td->id);
           td->connection->host->warningsLogWrite(td->buffer->getBuffer());
-          td->connection->host->warningsLogTerminateAccess(td->id);
         }
         chain.clearAllFilters();
         return td->http->raiseHTTPError(500);
@@ -369,11 +349,9 @@
     if(Server::getInstance()->getVerbosity() > 2)
     {
       *td->buffer << "FastCGI: Error sending POST data" << '\0';
-      td->connection->host->warningsLogRequestAccess(td->id);
       td->connection->host->
                      warningsLogWrite(td->buffer->getBuffer());
 
-      td->connection->host->warningsLogTerminateAccess(td->id);
     }
     con.sock.close();
     return td->http->raiseHTTPError(500);
@@ -393,9 +371,7 @@
   {
     td->buffer->setLength(0);
     *td->buffer << "FastCGI: Error opening stdout file" << '\0';
-    td->connection->host->warningsLogRequestAccess(td->id);
     td->connection->host->warningsLogWrite(td->buffer->getBuffer());
-    td->connection->host->warningsLogTerminateAccess(td->id);
     return td->http->raiseHTTPError(500);
   }
 
@@ -420,9 +396,7 @@
       {
         td->buffer->setLength(0);
         *td->buffer << "FastCGI: Error reading data" << '\0';
-        td->connection->host->warningsLogRequestAccess(td->id);
         td->connection->host->warningsLogWrite(td->buffer->getBuffer());
-        td->connection->host->warningsLogTerminateAccess(td->id);
         sendFcgiBody(&con, 0, 0, FCGIABORT_REQUEST, id);
         ret = 0;
         break;
@@ -432,9 +406,7 @@
     {
       td->buffer->setLength(0);
       *td->buffer << "FastCGI: Error timeout" << '\0';
-      td->connection->host->warningsLogRequestAccess(td->id);
       td->connection->host->warningsLogWrite(td->buffer->getBuffer());
-      td->connection->host->warningsLogTerminateAccess(td->id);
       sendFcgiBody(&con, 0, 0, FCGIABORT_REQUEST, id);
       con.sock.shutdown(2);
       con.sock.close();

Modified: trunk/myserver/src/http_handler/http_dir/http_dir.cpp
===================================================================
--- trunk/myserver/src/http_handler/http_dir/http_dir.cpp	2008-10-08 19:28:07 UTC (rev 2873)
+++ trunk/myserver/src/http_handler/http_dir/http_dir.cpp	2008-10-08 22:21:10 UTC (rev 2874)
@@ -200,9 +200,7 @@
                                                         td->mime->filters, 
                                              td->connection->socket, &nbw, 1))
   {
-    td->connection->host->warningsLogRequestAccess(td->id);
     td->connection->host->warningsLogWrite("HttpDir: Error loading filters");
-    td->connection->host->warningsLogTerminateAccess(td->id);
     chain.clearAllFilters(); 
     return td->http->raiseHTTPError(500);
   }

Modified: trunk/myserver/src/http_handler/http_file/http_file.cpp
===================================================================
--- trunk/myserver/src/http_handler/http_file/http_file.cpp	2008-10-08 19:28:07 UTC (rev 2873)
+++ trunk/myserver/src/http_handler/http_file/http_file.cpp	2008-10-08 22:21:10 UTC (rev 2874)
@@ -509,9 +509,7 @@
   {
     file->close();
     delete file;
-    s->host->warningsLogRequestAccess(td->id);
     s->host->warningsLogWrite("HttpFile: Error allocating memory");
-    s->host->warningsLogTerminateAccess(td->id);
     chain.clearAllFilters();
     return td->http->raiseHTTPError(500);
   }
@@ -519,9 +517,7 @@
   {
     file->close();
     delete file;
-    s->host->warningsLogRequestAccess(td->id);
     s->host->warningsLogWrite("HttpFile: Internal error");
-    s->host->warningsLogTerminateAccess(td->id);
     chain.clearAllFilters();
     return td->http->raiseHTTPError(500);
   };

Modified: trunk/myserver/src/http_handler/isapi/isapi.cpp
===================================================================
--- trunk/myserver/src/http_handler/isapi/isapi.cpp	2008-10-08 19:28:07 UTC (rev 2873)
+++ trunk/myserver/src/http_handler/isapi/isapi.cpp	2008-10-08 22:21:10 UTC (rev 2874)
@@ -1027,10 +1027,8 @@
   /*!
    *On other archs returns a non implemented error. 
    */
-  td->connection->host->warningsLogRequestAccess(td->id);
   td->connection->host->warningsLogWrite(
                                    "ISAPI: Not implemented");
-  td->connection->host->warningsLogTerminateAccess(td->id);  
   return td->http->raiseHTTPError(501);
 #endif  
 }

Modified: trunk/myserver/src/http_handler/mscgi/mscgi.cpp
===================================================================
--- trunk/myserver/src/http_handler/mscgi/mscgi.cpp	2008-10-08 19:28:07 UTC (rev 2873)
+++ trunk/myserver/src/http_handler/mscgi/mscgi.cpp	2008-10-08 22:21:10 UTC (rev 2874)
@@ -107,9 +107,7 @@
                                                                    &nbw, 
                                                                    1))
   {
-    td->connection->host->warningsLogRequestAccess(td->id);
     td->connection->host->warningsLogWrite("MSCGI: Error loading filters");
-    td->connection->host->warningsLogTerminateAccess(td->id);
     chain.clearAllFilters(); 
     return td->http->raiseHTTPError(500);
   }
@@ -133,9 +131,7 @@
       string msg;
       msg.assign("MSCGI: error accessing entrypoint for ");
       msg.append(exec);
-      td->connection->host->warningsLogRequestAccess(td->id);
       td->connection->host->warningsLogWrite(msg.c_str());
-      td->connection->host->warningsLogTerminateAccess(td->id);
       return td->http->raiseHTTPError(500);
     }
     hinstLib.close();

Modified: trunk/myserver/src/http_handler/scgi/scgi.cpp
===================================================================
--- trunk/myserver/src/http_handler/scgi/scgi.cpp	2008-10-08 19:28:07 UTC (rev 2873)
+++ trunk/myserver/src/http_handler/scgi/scgi.cpp	2008-10-08 22:21:10 UTC (rev 2874)
@@ -81,9 +81,7 @@
                                                     &nbw, 
                                                     1))
     {
-      td->connection->host->warningsLogRequestAccess(td->id);
       td->connection->host->warningsLogWrite("SCGI: Error loading filters");
-      td->connection->host->warningsLogTerminateAccess(td->id);
       chain.clearAllFilters();
       return td->http->raiseHTTPError(500);
     }
@@ -177,9 +175,7 @@
     if(Server::getInstance()->getVerbosity() > 2)
     {
       *td->buffer << "SCGI: Error to build env string" << '\0';
-      td->connection->host->warningsLogRequestAccess(td->id);
       td->connection->host->warningsLogWrite(td->buffer->getBuffer());
-      td->connection->host->warningsLogTerminateAccess(td->id);
     }
     chain.clearAllFilters();
     return td->http->raiseHTTPError(500);
@@ -193,9 +189,7 @@
     if(Server::getInstance()->getVerbosity() > 2)
     {
       *td->buffer << "SCGI: Error opening stdin file" << '\0';
-      td->connection->host->warningsLogRequestAccess(td->id);
       td->connection->host->warningsLogWrite(td->buffer->getBuffer());
-      td->connection->host->warningsLogTerminateAccess(td->id);
     }
     chain.clearAllFilters();
     return td->http->raiseHTTPError(500);
@@ -210,9 +204,7 @@
     {
       *td->buffer << "SCGI: Error connecting to SCGI "
                   << cmdLine.str().c_str() << " process" << '\0';
-      td->connection->host->warningsLogRequestAccess(td->id);
       td->connection->host->warningsLogWrite(td->buffer->getBuffer());
-      td->connection->host->warningsLogTerminateAccess(td->id);
     }
     chain.clearAllFilters();
     return td->http->raiseHTTPError(500);

Modified: trunk/myserver/src/http_handler/wincgi/wincgi.cpp
===================================================================
--- trunk/myserver/src/http_handler/wincgi/wincgi.cpp	2008-10-08 19:28:07 UTC (rev 2873)
+++ trunk/myserver/src/http_handler/wincgi/wincgi.cpp	2008-10-08 22:21:10 UTC (rev 2874)
@@ -476,9 +476,7 @@
    */
   td->buffer->setLength(0);
   *td->buffer << "WinCGI: Not implemented";
-  td->connection->host->warningsLogRequestAccess(td->id);
   td->connection->host->warningsLogWrite(td->buffer->getBuffer());
-  td->connection->host->warningsLogTerminateAccess(td->id);
   return td->http->raiseHTTPError(501);
 #endif
 }

Modified: trunk/myserver/src/log/log_manager.cpp
===================================================================
--- trunk/myserver/src/log/log_manager.cpp	2008-10-08 19:28:07 UTC (rev 2873)
+++ trunk/myserver/src/log/log_manager.cpp	2008-10-08 22:21:10 UTC (rev 2874)
@@ -17,15 +17,11 @@
 
 #include <include/log/log_manager.h>
 
-int const LogManager::TYPE_CONSOLE = 1;
-int const LogManager::TYPE_FILE = 2;
-
-LogManager::LogManager (FiltersFactory* filtersFactory,
-                        LogStreamFactory* logStreamFactory,
+LogManager::LogManager (FiltersFactory* ff,
                         LoggingLevel level) : level (level)
 {
-  this->filtersFactory = filtersFactory;
-  this->logStreamFactory = logStreamFactory;
+  this->ff = ff;
+  lsf = new LogStreamFactory ();
   mutex = new Mutex ();
   mutex->init ();
 }
@@ -35,343 +31,460 @@
   if (!empty ())
     clear ();
   delete mutex;
+  delete lsf;
 }
 
 int
-LogManager::addLogStream (string location, 
-                          list<string>& filters, 
-                          u_long cycleLog)
+LogManager::clear ()
 {
   mutex->lock ();
-  int retVal = 1;
-  if (!contains (location))
+  map<string, LogStream*>::iterator it;
+  for (it = logStreams.begin (); it != logStreams.end (); it++)
     {
-      LogStream* logStream = logStreamFactory->createLogStream (filtersFactory,
-                                                                location,
-                                                                filters,
-                                                                cycleLog);
-      if (logStream)
-        {
-          logStreams[location] = logStream;
-          retVal = 0;
-        }
+      delete it->second;
     }
+  logStreams.clear ();
+  owners.clear ();
   mutex->unlock ();
-  return retVal;
+  return !empty ();
 }
 
 int
-LogManager::removeLogStream (string location)
+LogManager::add (void* owner, string type, string location, 
+                 list<string>& filters, u_long cycle)
 {
   mutex->lock ();
-  int retVal = 1;
-  if (contains (location))
+  int success = 1;
+  if (!contains (location))
     {
-      delete logStreams[location];
-      logStreams.erase (location);
-      retVal = 0;
+      LogStream* ls = lsf->create (ff, location, filters, cycle);
+      if (ls)
+        {
+          success = (add (owner) || add (owner, type) ||
+                     add (owner, type, location, ls));
+        }
     }
   mutex->unlock ();
-  return retVal;
+  return success;
 }
 
-LogStream*
-LogManager::getLogStream (string location)
+int
+LogManager::add (void* owner)
 {
-  LogStream* retVal = 0;
-  if (contains (location))
-    retVal = logStreams[location];
-  return retVal;
+  int success = 1;
+  if (owner)
+    {
+      if (!contains (owner))
+        {
+          map<string, map<string, LogStream*> > type;
+          owners[owner] = type;
+        }
+      success = 0;
+    }
+  return success;
 }
 
 int
-LogManager::notifyLogStreams (LogStreamEvent evt, 
-                              void* message, 
-                              void* reply)
+LogManager::add (void* owner, string type)
 {
-  map<string, LogStream*>::iterator it;
-  int retVal = 0;
-  for (it = logStreams.begin (); it != logStreams.end (); it++)
+  int success = 1;
+  if (type.size ())
     {
-      retVal |= it->second->update (evt, message, reply);
+      if (!contains (owner, type))
+        {
+          map<string, LogStream*> target;
+          owners[owner][type] = target;
+        }
+      success = 0;
     }
-  return retVal;
+  return success;
 }
 
 int
-LogManager::log (string message, LoggingLevel level, string location)
+LogManager::add (void* owner, string type, string location, LogStream* ls)
 {
+  logStreams[location] = ls;
+  owners[owner][type][location] = ls;
+  if (contains (location) && contains (owner, type, location))
+    {
+      return 0;
+    }
+  return 1;
+}
+
+int 
+LogManager::remove (void* owner)
+{
   mutex->lock ();
-  int retVal = 1;
-  if (level >= this->level)
+  int success = 1;
+  if (contains (owner))
     {
-      if (contains (location))
+      map<string, map<string, LogStream*> > m = owners[owner];
+      map<string, map<string, LogStream*> >::iterator it_1;
+      for (it_1 = m.begin (); it_1 != m.end (); it_1++)
         {
-          retVal = logStreams[location]->log (message);
+          map<string, LogStream*> t = it_1->second;
+          map<string, LogStream*>::iterator it_2;
+          for (it_2 = t.begin (); it_2 != t.end (); it_2++)
+            {
+              delete it_2->second;
+              logStreams.erase (it_2->first);
+            }
+          t.clear ();
         }
-      else if (!location.compare ("all"))
-        {
-          retVal = notifyLogStreams (EVT_LOG, static_cast<void*>(&message));
-        }
+      m.clear ();
+      success = 0;
     }
   mutex->unlock ();
-  return retVal;
+  return success;
 }
 
 int
-LogManager::close (string location)
+LogManager::notify (void* owner, string type, string location, 
+                    LogStreamEvent evt, void* message, void* reply)
 {
-  mutex->lock ();
-  int retVal = 1;
-  if (contains (location))
+  int success = 1;
+  if (contains (owner, type, location))
     {
-      retVal = logStreams[location]->close ();
+      success = owners[owner][type][location]->update (evt, message, reply);
     }
-  else if (!location.compare ("all"))
+  return success;
+}
+
+int
+LogManager::notify (void* owner, string type, LogStreamEvent evt, 
+                    void* message, void* reply)
+{
+  int success = 1;
+  if (contains (owner, type))
     {
-      retVal = notifyLogStreams (EVT_CLOSE);
+      success = 0;
+      map<string, LogStream*> m = owners[owner][type];
+      map<string, LogStream*>::iterator it;
+      for (it = m.begin (); it != m.end (); it++)
+        {
+          success |= notify (owner, type, it->first, evt, message, reply);
+        }
     }
-  mutex->unlock ();
-  return retVal;
+  return success;
 }
 
-void
-LogManager::setCycleLog (u_long cycleLog, string location)
+int
+LogManager::notify (void* owner, LogStreamEvent evt, void* message, 
+                    void* reply)
 {
-  mutex->lock ();
-  if (contains (location))
+  int success = 1;
+  if (contains (owner))
     {
-      logStreams[location]->setCycleLog (cycleLog);
+      success = 0;
+      map<string, map<string, LogStream*> > m = owners[owner];
+      map<string, map<string, LogStream*> >::iterator it;
+      for (it = m.begin (); it != m.end (); it++)
+        {
+          success |= notify (owner, it->first, evt, message, reply);
+        }
     }
-  else if (!location.compare ("all"))
-    {
-      notifyLogStreams (EVT_SET_CYCLE_LOG, static_cast<void*>(&cycleLog));
-    }
-  mutex->unlock ();
+  return success;
 }
 
-LoggingLevel
-LogManager::setLoggingLevel (LoggingLevel level)
+int

@@ Diff output truncated at 153600 characters. @@




From MAILER-DAEMON Thu Oct 09 11:41:15 2008
Received: from mailman by lists.gnu.org with archive (Exim 4.43)
	id 1Knxdb-0001Lt-EY
	for mharc-myserver-commit@gnu.org; Thu, 09 Oct 2008 11:41:15 -0400
Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43)
	id 1KnxdY-0001KY-L3
	for myserver-commit@gnu.org; Thu, 09 Oct 2008 11:41:12 -0400
Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43)
	id 1KnxdX-0001JT-4I
	for myserver-commit@gnu.org; Thu, 09 Oct 2008 11:41:11 -0400
Received: from [199.232.76.173] (port=56745 helo=monty-python.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.43) id 1KnxdW-0001J9-Dx
	for myserver-commit@gnu.org; Thu, 09 Oct 2008 11:41:10 -0400
Received: from savannah.gnu.org ([199.232.41.3]:52470 helo=sv.gnu.org)
	by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32)
	(Exim 4.60) (envelope-from <INVALID.NOREPLY@gnu.org>)
	id 1KnxdU-0003K9-Ba
	for myserver-commit@gnu.org; Thu, 09 Oct 2008 11:41:09 -0400
Received: from cvs.savannah.gnu.org ([199.232.41.69])
	by sv.gnu.org with esmtp (Exim 4.63)
	(envelope-from <INVALID.NOREPLY@gnu.org>) id 1KnxdR-0003CW-B1
	for myserver-commit@gnu.org; Thu, 09 Oct 2008 15:41:05 +0000
Received: from francesco_pipita by cvs.savannah.gnu.org with local (Exim 4.63)
	(envelope-from <francesco_pipita@savannah.gnu.org>)
	id 1KnxdR-0003CS-0k
	for myserver-commit@gnu.org; Thu, 09 Oct 2008 15:41:05 +0000
MIME-Version: 1.0
Errors-To: francesco_pipita
To: myserver-commit@gnu.org
X-Mailer: SVN::Notify 2.64: http://search.cpan.org/dist/SVN-Notify/
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
From: Francesco Pipita <francesco.pipita@gmail.com>
Message-Id: <E1KnxdR-0003CS-0k@cvs.savannah.gnu.org>
Date: Thu, 09 Oct 2008 15:41:05 +0000
X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 3)
Subject: [myserver-commit] [2875] Added more tests for the LogManager.
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/pipermail/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, 09 Oct 2008 15:41:13 -0000

Revision: 2875
          http://svn.sv.gnu.org/viewvc/?view=rev&root=myserver&revision=2875
Author:   francesco_pipita
Date:     2008-10-09 15:41:04 +0000 (Thu, 09 Oct 2008)

Log Message:
-----------
Added more tests for the LogManager.

Modified Paths:
--------------
    trunk/myserver/tests/test_file_stream.cpp
    trunk/myserver/tests/test_file_stream_creator.cpp
    trunk/myserver/tests/test_log_manager.cpp

Modified: trunk/myserver/tests/test_file_stream.cpp
===================================================================
--- trunk/myserver/tests/test_file_stream.cpp	2008-10-08 22:21:10 UTC (rev 2874)
+++ trunk/myserver/tests/test_file_stream.cpp	2008-10-09 15:41:04 UTC (rev 2875)
@@ -1,19 +1,19 @@
 /*
- MyServer
- Copyright (C) 2008 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
- (at your option) any later version.
+  MyServer
+  Copyright (C) 2008 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
+  (at your option) any later version.
  
- This program is distributed in the hope that it will be useful, 
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- GNU General Public License for more details.
+  This program is distributed in the hope that it will be useful, 
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+  GNU General Public License for more details.
  
- You should have received a copy of the GNU General Public License
- along with this program.  If not, see <http://www.gnu.org/licenses/>.
- */
+  You should have received a copy of the GNU General Public License
+  along with this program.  If not, see <http://www.gnu.org/licenses/>.
+*/
 
 #include <list>
 #include <string>
@@ -29,27 +29,41 @@
 #include <include/base/file/files_utility.h>
 #include <include/base/file/file.h>
 #include <include/base/utility.h>
+#include <include/filter/gzip/gzip.h>
+#include <include/filter/gzip/gzip_decompress.h>
 
 class TestFileStream : public CppUnit::TestFixture
 {
   CPPUNIT_TEST_SUITE (TestFileStream);
   CPPUNIT_TEST (testCycleLog);
+  CPPUNIT_TEST (testReOpen);
   CPPUNIT_TEST_SUITE_END ();
 public:
   void setUp ()
   {
     fsc = new FileStreamCreator ();
     ff = new FiltersFactory ();
+    ff->insert ("gzip", Gzip::factory);
     setcwdBuffer ();
   }
 
   void testCycleLog ()
   {
     list<string> filters;
-    string message ("thisisaverylongmessage\n");
-    string message2 ("thisisanothermessage\n");
-    LogStream* ls = fsc->create (ff, "foo", filters, 10);
+    string message;
+    string message2;
+    LogStream* ls;
 
+#ifdef WIN32
+    message.assign ("thisisaverylongmessage\r\n");
+    message2.assign ("thisisanothermessage\r\n");
+#endif
+#ifdef NOT_WIN
+    message.assign ("thisisaverylongmessage\n");
+    message2.assign ("thisisanothermessage\n");
+#endif
+    ls = fsc->create (ff, "foo", filters, 10);
+    CPPUNIT_ASSERT (ls);
     CPPUNIT_ASSERT (!ls->log (message));
     CPPUNIT_ASSERT (!ls->log (message2));
     ls->close ();
@@ -76,6 +90,39 @@
     delete ls;
   }
 
+  void testReOpen ()
+  {
+    list<string> filters;
+    LogStream* ls;
+    File f;
+    char buf[128];
+    u_long nbr;
+    string message1;
+    string message2;
+    
+    ls = fsc->create (ff, "foo", filters, 0);
+    CPPUNIT_ASSERT (ls);
+#ifdef WIN32
+    message1.assign ("message1\r\n");
+    message2.assign ("message2\r\n");
+#endif
+#ifdef NOT_WIN
+    message1.assign ("message1\n");
+    message2.assign ("message2\n");
+#endif
+    ls->log (message1);
+    delete ls;
+    ls = fsc->create (ff, "foo", filters, 0);
+    CPPUNIT_ASSERT (ls);
+    ls->log (message2);
+    delete ls;
+    f.openFile ("foo", FileStream::defaultFileMask);
+    f.read (buf, 128, &nbr);
+    f.close ();
+    buf[nbr] = '\0';
+    CPPUNIT_ASSERT (!string (buf).compare (message1.append (message2)));
+  }
+  
   void tearDown ()
   {
     delete ff;

Modified: trunk/myserver/tests/test_file_stream_creator.cpp
===================================================================
--- trunk/myserver/tests/test_file_stream_creator.cpp	2008-10-08 22:21:10 UTC (rev 2874)
+++ trunk/myserver/tests/test_file_stream_creator.cpp	2008-10-09 15:41:04 UTC (rev 2875)
@@ -45,10 +45,6 @@
     list<string> filters;
     LogStream* ls = fsc->create (ff, "foo", filters, 0);
     CPPUNIT_ASSERT (ls);
-#ifdef NOT_WIN
-    ls = fsc->create (ff, "/dev/", filters, 0);
-    CPPUNIT_ASSERT (!ls);
-#endif
   }
   
   void tearDown ()

Modified: trunk/myserver/tests/test_log_manager.cpp
===================================================================
--- trunk/myserver/tests/test_log_manager.cpp	2008-10-08 22:21:10 UTC (rev 2874)
+++ trunk/myserver/tests/test_log_manager.cpp	2008-10-09 15:41:04 UTC (rev 2875)
@@ -47,6 +47,7 @@
   CPPUNIT_TEST (testCycleWithGzipChain);
   CPPUNIT_TEST (testCount);
   CPPUNIT_TEST (testGet);
+  CPPUNIT_TEST (testReOpen);
   CPPUNIT_TEST_SUITE_END ();
 public:
   void setUp ()
@@ -275,6 +276,37 @@
     CPPUNIT_ASSERT (!lm->get (this, "test", "console://stdout", &ls));
   }
 
+  void testReOpen ()
+  {
+    list<string> filters;
+    File f;
+    string message1;
+    string message2;
+    char buf[128];
+    u_long nbr;
+
+#ifdef WIN32
+    message1.assign ("message1\r\n");
+    message2.assign ("message2\r\n");
+#endif
+#ifdef NOT_WIN
+    message1.assign ("message1\n");
+    message2.assign ("message2\n");
+#endif
+
+    lm->add (this, "test", "file://foo", filters, 0);
+    lm->log (this, "test", "file://foo", message1);
+    lm->clear ();
+    CPPUNIT_ASSERT (!lm->add (this, "test", "file://foo", filters, 0));
+    CPPUNIT_ASSERT (!lm->log (this, "test", "file://foo", message2));
+    lm->clear ();
+    f.openFile ("foo", FileStream::defaultFileMask);
+    f.read (buf, 128, &nbr);
+    f.close ();
+    buf[nbr] = '\0';
+    CPPUNIT_ASSERT (!string (buf).compare (message1.append (message2)));
+  }
+
   void tearDown ()
   {
     delete lm;





From MAILER-DAEMON Thu Oct 09 17:24:52 2008
Received: from mailman by lists.gnu.org with archive (Exim 4.43)
	id 1Ko308-0002as-07
	for mharc-myserver-commit@gnu.org; Thu, 09 Oct 2008 17:24:52 -0400
Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43)
	id 1Ko306-0002ac-Tl
	for myserver-commit@gnu.org; Thu, 09 Oct 2008 17:24:50 -0400
Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43)
	id 1Ko305-0002aQ-DG
	for myserver-commit@gnu.org; Thu, 09 Oct 2008 17:24:49 -0400
Received: from [199.232.76.173] (port=46158 helo=monty-python.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.43) id 1Ko305-0002aL-9t
	for myserver-commit@gnu.org; Thu, 09 Oct 2008 17:24:49 -0400
Received: from savannah.gnu.org ([199.232.41.3]:51522 helo=sv.gnu.org)
	by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32)
	(Exim 4.60) (envelope-from <INVALID.NOREPLY@gnu.org>)
	id 1Ko304-0007s7-VT
	for myserver-commit@gnu.org; Thu, 09 Oct 2008 17:24:49 -0400
Received: from cvs.savannah.gnu.org ([199.232.41.69])
	by sv.gnu.org with esmtp (Exim 4.63)
	(envelope-from <INVALID.NOREPLY@gnu.org>) id 1Ko304-0002Pq-CN
	for myserver-commit@gnu.org; Thu, 09 Oct 2008 21:24:48 +0000
Received: from gscrivano by cvs.savannah.gnu.org with local (Exim 4.63)
	(envelope-from <gscrivano@savannah.gnu.org>) id 1Ko304-0002Pm-31
	for myserver-commit@gnu.org; Thu, 09 Oct 2008 21:24:48 +0000
MIME-Version: 1.0
Errors-To: gscrivano
To: myserver-commit@gnu.org
X-Mailer: SVN::Notify 2.64: http://search.cpan.org/dist/SVN-Notify/
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
From: Giuseppe Scrivano <gscrivano@gnu.org>
Message-Id: <E1Ko304-0002Pm-31@cvs.savannah.gnu.org>
Date: Thu, 09 Oct 2008 21:24:48 +0000
X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 3)
Subject: [myserver-commit] [2876] Fixed Server signature environment
	variable value.
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/pipermail/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, 09 Oct 2008 21:24:51 -0000

Revision: 2876
          http://svn.sv.gnu.org/viewvc/?view=rev&root=myserver&revision=2876
Author:   gscrivano
Date:     2008-10-09 21:24:47 +0000 (Thu, 09 Oct 2008)

Log Message:
-----------
Fixed Server signature environment variable value.

Modified Paths:
--------------
    trunk/myserver/src/base/process/process.cpp
    trunk/myserver/src/http_handler/cgi/cgi.cpp
    trunk/myserver/src/protocol/http/env/env.cpp

Modified: trunk/myserver/src/base/process/process.cpp
===================================================================
--- trunk/myserver/src/base/process/process.cpp	2008-10-09 15:41:04 UTC (rev 2875)
+++ trunk/myserver/src/base/process/process.cpp	2008-10-09 21:24:47 UTC (rev 2876)
@@ -214,7 +214,7 @@
     //close(2); // close stderr
     //dup2((int)spi->stdError, 2);
     // Run the script
-    ret = execve((const char*)(spi->cmd.c_str()),
+    ret = execve((const char*)args[0], 
                  (char* const*)args, (char* const*) envp);
     exit(0);
 
@@ -390,7 +390,7 @@
           {
             args[count++] = (const char*)&(spi->arg.c_str())[start];
             spi->arg[i] = '\0';
-
+            
             while((spi->arg[i] == ' ') && (i < len))
               i++;
 
@@ -427,6 +427,7 @@
       // change to working dir
     if(spi->cwd.length())
       chdir((const char*)(spi->cwd.c_str()));
+
     // If stdOut is -1, pipe to /dev/null
     if((long)spi->stdOut == -1)
       spi->stdOut = (FileHandle)open("/dev/null",O_WRONLY);
@@ -453,10 +454,9 @@
     //dup2((int)spi->stdError, 2);
     // Run the script
 
-    ret = execve((const char*)(spi->cmd.c_str()),
-                 (char* const*)args,(char* const*) envp);
+    ret = execve ((const char*) args[0],
+                 (char* const*)args, (char* const*) envp);
 
-
     exit(1);
   } // end else if(pid == 0)
   else

Modified: trunk/myserver/src/http_handler/cgi/cgi.cpp
===================================================================
--- trunk/myserver/src/http_handler/cgi/cgi.cpp	2008-10-09 15:41:04 UTC (rev 2875)
+++ trunk/myserver/src/http_handler/cgi/cgi.cpp	2008-10-09 21:24:47 UTC (rev 2876)
@@ -137,7 +137,6 @@
     
   tmpScriptPath.assign(scriptpath);
   FilesUtility::splitPath(tmpScriptPath, td->scriptDir, td->scriptFile);
-  
 
   chain.setProtocol(td->http);
   chain.setProtocolData(td);
@@ -261,7 +260,7 @@
   if(stdInFile.openFile(td->inputDataPath, 
                         File::MYSERVER_OPEN_READ | File::MYSERVER_OPEN_ALWAYS))
   {
-    td->connection->host->warningsLogWrite("Cgi: Cannot open CGI stdin file");
+    td->connection->host->warningsLogWrite("Cgi: Cannot open CGI stdin file.");
     stdOutFile.close();
     chain.clearAllFilters(); 
     return td->http->raiseHTTPError(500);
@@ -292,7 +291,7 @@
        spi.stdIn == (FileHandle)-1 || 
        spi.stdOut == (FileHandle)-1)
   {
-    td->connection->host->warningsLogWrite("Cgi: Invalid base/file/file.handler");
+    td->connection->host->warningsLogWrite("Cgi: Invalid file handler.");
     stdOutFile.close();
     chain.clearAllFilters(); 
     return td->http->raiseHTTPError(500);

Modified: trunk/myserver/src/protocol/http/env/env.cpp
===================================================================
--- trunk/myserver/src/protocol/http/env/env.cpp	2008-10-09 15:41:04 UTC (rev 2875)
+++ trunk/myserver/src/protocol/http/env/env.cpp	2008-10-09 21:24:47 UTC (rev 2876)
@@ -53,7 +53,7 @@
   HttpRequestHeader::Entry* reqEntry = NULL;
 
   memCgi.setExternalBuffer(cgiEnv, td->buffer2->getRealLength());
-  memCgi << "SERVER_SOFTWARE=" << MYSERVER_VERSION;
+  memCgi << "SERVER_SOFTWARE=GNU MyServer " << MYSERVER_VERSION;
 
 #ifdef WIN32
   memCgi << " (WIN32)";
@@ -71,7 +71,7 @@
   memCgi << Server::getInstance()->getServerName();
   
   memCgi << end_str << "SERVER_SIGNATURE=";
-  memCgi << "<address>" << MYSERVER_VERSION << "</address>";
+  memCgi << "<address>GNU MyServer " << MYSERVER_VERSION << "</address>";
   
   memCgi << end_str << "SERVER_PROTOCOL=";
   memCgi << td->request.ver.c_str();  





From MAILER-DAEMON Fri Oct 10 13:53:08 2008
Received: from mailman by lists.gnu.org with archive (Exim 4.43)
	id 1KoMAm-0002vx-4U
	for mharc-myserver-commit@gnu.org; Fri, 10 Oct 2008 13:53:08 -0400
Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43)
	id 1KoMAj-0002vc-Uq
	for myserver-commit@gnu.org; Fri, 10 Oct 2008 13:53:05 -0400
Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43)
	id 1KoMAi-0002vQ-LN
	for myserver-commit@gnu.org; Fri, 10 Oct 2008 13:53:05 -0400
Received: from [199.232.76.173] (port=40144 helo=monty-python.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.43) id 1KoMAi-0002vN-Hn
	for myserver-commit@gnu.org; Fri, 10 Oct 2008 13:53:04 -0400
Received: from savannah.gnu.org ([199.232.41.3]:39306 helo=sv.gnu.org)
	by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32)
	(Exim 4.60) (envelope-from <INVALID.NOREPLY@gnu.org>)
	id 1KoMAi-0005F1-Iw
	for myserver-commit@gnu.org; Fri, 10 Oct 2008 13:53:04 -0400
Received: from cvs.savannah.gnu.org ([199.232.41.69])
	by sv.gnu.org with esmtp (Exim 4.63)
	(envelope-from <INVALID.NOREPLY@gnu.org>) id 1KoMAh-00017w-L4
	for myserver-commit@gnu.org; Fri, 10 Oct 2008 17:53:03 +0000
Received: from gscrivano by cvs.savannah.gnu.org with local (Exim 4.63)
	(envelope-from <gscrivano@savannah.gnu.org>) id 1KoMAh-00017q-8B
	for myserver-commit@gnu.org; Fri, 10 Oct 2008 17:53:03 +0000
MIME-Version: 1.0
Errors-To: gscrivano
To: myserver-commit@gnu.org
X-Mailer: SVN::Notify 2.64: http://search.cpan.org/dist/SVN-Notify/
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
From: Giuseppe Scrivano <gscrivano@gnu.org>
Message-Id: <E1KoMAh-00017q-8B@cvs.savannah.gnu.org>
Date: Fri, 10 Oct 2008 17:53:03 +0000
X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 3)
Subject: [myserver-commit] [2877] Fixed problem with `PATH_INFO' and
 `PATH_TRANSLATED' environment variables.
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/pipermail/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, 10 Oct 2008 17:53:06 -0000

Revision: 2877
          http://svn.sv.gnu.org/viewvc/?view=rev&root=myserver&revision=2877
Author:   gscrivano
Date:     2008-10-10 17:53:02 +0000 (Fri, 10 Oct 2008)

Log Message:
-----------
Fixed problem with `PATH_INFO' and `PATH_TRANSLATED' environment variables.

Modified Paths:
--------------
    trunk/myserver/src/protocol/http/http.cpp

Modified: trunk/myserver/src/protocol/http/http.cpp
===================================================================
--- trunk/myserver/src/protocol/http/http.cpp	2008-10-09 21:24:47 UTC (rev 2876)
+++ trunk/myserver/src/protocol/http/http.cpp	2008-10-10 17:53:02 UTC (rev 2877)
@@ -344,6 +344,8 @@
  *\param filename Resource to access.
  *\param yetmapped Is the resource mapped to the localfilesystem?
  *\param permissions Permission mask for this resource.
+ *\return Return 200 on success.
+ *\return Any other value is the HTTP error code.
  */
 int Http::getFilePermissions(string& filename, string& directory, string& file, 
                              string &filenamePath, int yetmapped, int* permissions)
@@ -510,6 +512,8 @@
  *\param filename Resource to access.
  *\param yetmapped Is the resource mapped to the localfilesystem?
  *\param permissions Permission mask for this resource.
+ *\return Return 200 on success.
+ *\return Any other value is the HTTP error code.
  */
 int Http::preprocessHttpRequest(string& filename, int yetmapped, int* permissions)
 {
@@ -517,6 +521,7 @@
   string file;
   int filenamePathLen;
   string dirscan;
+  int ret;
 
   try
   {
@@ -525,6 +530,13 @@
       td->response.connection.assign( "keep-alive");
     }
 
+
+    ret = getFilePermissions (filename, directory, file, 
+                              td->filenamePath, yetmapped, permissions);
+
+    if (ret != 200)
+      return ret;
+
     /*!
      *Get the PATH_INFO value.
      *Use dirscan as a buffer for put temporary directory scan.
@@ -591,9 +603,6 @@
       td->pathTranslated.assign("");
     }
     FilesUtility::completePath(td->filenamePath);
-
-    return getFilePermissions(filename, directory, file, 
-                             td->filenamePath, yetmapped, permissions);
   }
   catch(...)
   {





From MAILER-DAEMON Sat Oct 11 08:33:17 2008
Received: from mailman by lists.gnu.org with archive (Exim 4.43)
	id 1Koden-0005H7-EP
	for mharc-myserver-commit@gnu.org; Sat, 11 Oct 2008 08:33:17 -0400
Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43)
	id 1Kodel-0005GP-Fs
	for myserver-commit@gnu.org; Sat, 11 Oct 2008 08:33:15 -0400
Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43)
	id 1Kodek-0005FO-Rs
	for myserver-commit@gnu.org; Sat, 11 Oct 2008 08:33:14 -0400
Received: from [199.232.76.173] (port=58035 helo=monty-python.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.43) id 1Kodek-0005FD-Kn
	for myserver-commit@gnu.org; Sat, 11 Oct 2008 08:33:14 -0400
Received: from savannah.gnu.org ([199.232.41.3]:57424 helo=sv.gnu.org)
	by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32)
	(Exim 4.60) (envelope-from <INVALID.NOREPLY@gnu.org>)
	id 1Kodek-0002bJ-P2
	for myserver-commit@gnu.org; Sat, 11 Oct 2008 08:33:14 -0400
Received: from cvs.savannah.gnu.org ([199.232.41.69])
	by sv.gnu.org with esmtp (Exim 4.63)
	(envelope-from <INVALID.NOREPLY@gnu.org>) id 1Kodej-0004pE-Tx
	for myserver-commit@gnu.org; Sat, 11 Oct 2008 12:33:14 +0000
Received: from gscrivano by cvs.savannah.gnu.org with local (Exim 4.63)
	(envelope-from <gscrivano@savannah.gnu.org>) id 1Kodej-0004p9-LN
	for myserver-commit@gnu.org; Sat, 11 Oct 2008 12:33:13 +0000
MIME-Version: 1.0
Errors-To: gscrivano
To: myserver-commit@gnu.org
X-Mailer: SVN::Notify 2.64: http://search.cpan.org/dist/SVN-Notify/
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
From: Giuseppe Scrivano <gscrivano@gnu.org>
Message-Id: <E1Kodej-0004p9-LN@cvs.savannah.gnu.org>
Date: Sat, 11 Oct 2008 12:33:13 +0000
X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 3)
Subject: [myserver-commit] [2878] Fixed server signature.
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/pipermail/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, 11 Oct 2008 12:33:15 -0000

Revision: 2878
          http://svn.sv.gnu.org/viewvc/?view=rev&root=myserver&revision=2878
Author:   gscrivano
Date:     2008-10-11 12:33:13 +0000 (Sat, 11 Oct 2008)

Log Message:
-----------
Fixed server signature.

Modified Paths:
--------------
    trunk/myserver/src/protocol/http/http_headers.cpp
    trunk/myserver/src/server/server.cpp

Modified: trunk/myserver/src/protocol/http/http_headers.cpp
===================================================================
--- trunk/myserver/src/protocol/http/http_headers.cpp	2008-10-10 17:53:02 UTC (rev 2877)
+++ trunk/myserver/src/protocol/http/http_headers.cpp	2008-10-11 12:33:13 UTC (rev 2878)
@@ -74,7 +74,7 @@
   }
   else
   {
-    pos += myserver_strlcpy(pos, "Server: ", MAX-(long)(pos-str));
+    pos += myserver_strlcpy(pos, "Server: GNU MyServer ", MAX-(long)(pos-str));
     pos += myserver_strlcpy(pos, MYSERVER_VERSION,  MAX-(long)(pos-str));
     pos += myserver_strlcpy(pos, "\r\n", MAX-(long)(pos-str));
   }
@@ -305,7 +305,8 @@
   getRFC822GMTTime(date,HTTP_RESPONSE_DATE_DIM);
   response->date.assign(date);
   response->dateExp.assign(date);
-  response->serverName.assign(MYSERVER_VERSION);
+  response->serverName.assign("GNU MyServer ");
+  response->serverName.append(MYSERVER_VERSION);
 }
 
 /*!

Modified: trunk/myserver/src/server/server.cpp
===================================================================
--- trunk/myserver/src/server/server.cpp	2008-10-10 17:53:02 UTC (rev 2877)
+++ trunk/myserver/src/server/server.cpp	2008-10-11 12:33:13 UTC (rev 2878)
@@ -715,7 +715,7 @@
     {
       size_t length;
       string softwareSignature;
-      softwareSignature.assign("************");
+      softwareSignature.assign("************ GNU MyServer ");
       softwareSignature.append(MYSERVER_VERSION);
       softwareSignature.append("************");
       length = softwareSignature.length();





From MAILER-DAEMON Sun Oct 12 13:03:47 2008
Received: from mailman by lists.gnu.org with archive (Exim 4.43)
	id 1Kp4M7-0000Yq-KO
	for mharc-myserver-commit@gnu.org; Sun, 12 Oct 2008 13:03:47 -0400
Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43)
	id 1Kp4M5-0000Xu-CQ
	for myserver-commit@gnu.org; Sun, 12 Oct 2008 13:03:45 -0400
Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43)
	id 1Kp4M4-0000XP-Cp
	for myserver-commit@gnu.org; Sun, 12 Oct 2008 13:03:44 -0400
Received: from [199.232.76.173] (port=48748 helo=monty-python.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.43) id 1Kp4M4-0000XH-65
	for myserver-commit@gnu.org; Sun, 12 Oct 2008 13:03:44 -0400
Received: from savannah.gnu.org ([199.232.41.3]:33492 helo=sv.gnu.org)
	by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32)
	(Exim 4.60) (envelope-from <INVALID.NOREPLY@gnu.org>)
	id 1Kp4M3-0004Qi-LZ
	for myserver-commit@gnu.org; Sun, 12 Oct 2008 13:03:43 -0400
Received: from cvs.savannah.gnu.org ([199.232.41.69])
	by sv.gnu.org with esmtp (Exim 4.63)
	(envelope-from <INVALID.NOREPLY@gnu.org>) id 1Kp4M3-00042o-1T
	for myserver-commit@gnu.org; Sun, 12 Oct 2008 17:03:43 +0000
Received: from gscrivano by cvs.savannah.gnu.org with local (Exim 4.63)
	(envelope-from <gscrivano@savannah.gnu.org>) id 1Kp4M2-00042j-Q9
	for myserver-commit@gnu.org; Sun, 12 Oct 2008 17:03:42 +0000
MIME-Version: 1.0
Errors-To: gscrivano
To: myserver-commit@gnu.org
X-Mailer: SVN::Notify 2.64: http://search.cpan.org/dist/SVN-Notify/
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
From: Giuseppe Scrivano <gscrivano@gnu.org>
Message-Id: <E1Kp4M2-00042j-Q9@cvs.savannah.gnu.org>
Date: Sun, 12 Oct 2008 17:03:42 +0000
X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 3)
Subject: [myserver-commit] [2879] Use `TextOutputter' by default.
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/pipermail/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, 12 Oct 2008 17:03:45 -0000

Revision: 2879
          http://svn.sv.gnu.org/viewvc/?view=rev&root=myserver&revision=2879
Author:   gscrivano
Date:     2008-10-12 17:03:42 +0000 (Sun, 12 Oct 2008)

Log Message:
-----------
Use `TextOutputter' by default.

Modified Paths:
--------------
    trunk/myserver/tests/main.cpp

Modified: trunk/myserver/tests/main.cpp
===================================================================
--- trunk/myserver/tests/main.cpp	2008-10-11 12:33:13 UTC (rev 2878)
+++ trunk/myserver/tests/main.cpp	2008-10-12 17:03:42 UTC (rev 2879)
@@ -15,6 +15,7 @@
  along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
+#include <cppunit/TextOutputter.h>
 #include <cppunit/CompilerOutputter.h>
 #include <cppunit/XmlOutputter.h>
 #include <cppunit/extensions/TestFactoryRegistry.h>
@@ -23,18 +24,22 @@
 
 #include <string.h>
 
-int main(int argc, char* argv[])
+int main (int argc, char* argv[])
 {
-  bool xml = argc > 1 && !strcmp(argv[1], "xml");
+  bool xml = argc > 1 && !strcmp (argv[1], "xml");
+  bool compiler = argc > 1 && !strcmp (argv[1], "compiler");
+
   CppUnit::Outputter * out;
   CppUnit::Test *suite = CppUnit::TestFactoryRegistry::getRegistry().makeTest();
   CppUnit::TextUi::TestRunner runner;
-  runner.addTest( suite );
+  runner.addTest ( suite );
 
   if (xml)
     out = new CppUnit::XmlOutputter( &runner.result(), std::cerr );
+  else if (compiler)
+    out = new CppUnit::CompilerOutputter( &runner.result(), std::cerr );
   else
-    out = new CppUnit::CompilerOutputter( &runner.result(), std::cerr );
+    out = new CppUnit::TextOutputter( &runner.result(), std::cerr );
 
   runner.setOutputter( out );
 





From MAILER-DAEMON Mon Oct 13 15:20:35 2008
Received: from mailman by lists.gnu.org with archive (Exim 4.43)
	id 1KpSy3-0002mJ-CS
	for mharc-myserver-commit@gnu.org; Mon, 13 Oct 2008 15:20:35 -0400
Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43)
	id 1KpSy1-0002ls-RJ
	for myserver-commit@gnu.org; Mon, 13 Oct 2008 15:20:33 -0400
Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43)
	id 1KpSy0-0002lW-Ml
	for myserver-commit@gnu.org; Mon, 13 Oct 2008 15:20:32 -0400
Received: from [199.232.76.173] (port=60474 helo=monty-python.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.43) id 1KpSy0-0002lT-Gp
	for myserver-commit@gnu.org; Mon, 13 Oct 2008 15:20:32 -0400
Received: from savannah.gnu.org ([199.232.41.3]:55746 helo=sv.gnu.org)
	by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32)
	(Exim 4.60) (envelope-from <INVALID.NOREPLY@gnu.org>)
	id 1KpSy0-000566-4w
	for myserver-commit@gnu.org; Mon, 13 Oct 2008 15:20:32 -0400
Received: from cvs.savannah.gnu.org ([199.232.41.69])
	by sv.gnu.org with esmtp (Exim 4.63)
	(envelope-from <INVALID.NOREPLY@gnu.org>) id 1KpSxw-00075G-2Q
	for myserver-commit@gnu.org; Mon, 13 Oct 2008 19:20:28 +0000
Received: from gscrivano by cvs.savannah.gnu.org with local (Exim 4.63)
	(envelope-from <gscrivano@savannah.gnu.org>) id 1KpSxv-00075A-7F
	for myserver-commit@gnu.org; Mon, 13 Oct 2008 19:20:27 +0000
MIME-Version: 1.0
Errors-To: gscrivano
To: myserver-commit@gnu.org
X-Mailer: SVN::Notify 2.64: http://search.cpan.org/dist/SVN-Notify/
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
From: Giuseppe Scrivano <gscrivano@gnu.org>
Message-Id: <E1KpSxv-00075A-7F@cvs.savannah.gnu.org>
Date: Mon, 13 Oct 2008 19:20:27 +0000
X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 3)
Subject: [myserver-commit] [2880] Make Regex constructor inline.
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/pipermail/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, 13 Oct 2008 19:20:34 -0000

Revision: 2880
          http://svn.sv.gnu.org/viewvc/?view=rev&root=myserver&revision=2880
Author:   gscrivano
Date:     2008-10-13 19:20:25 +0000 (Mon, 13 Oct 2008)

Log Message:
-----------
Make Regex constructor inline.

Modified Paths:
--------------
    trunk/myserver/include/base/regex/myserver_regex.h
    trunk/myserver/src/base/regex/myserver_regex.cpp

Modified: trunk/myserver/include/base/regex/myserver_regex.h
===================================================================
--- trunk/myserver/include/base/regex/myserver_regex.h	2008-10-12 17:03:42 UTC (rev 2879)
+++ trunk/myserver/include/base/regex/myserver_regex.h	2008-10-13 19:20:25 UTC (rev 2880)
@@ -1,7 +1,7 @@
 /* -*- mode: c++ -*- */
 /*
 MyServer
-Copyright (C) 2002, 2003, 2004, 2007 Free Software Foundation, Inc.
+Copyright (C) 2002, 2003, 2004, 2007, 2008 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
@@ -54,7 +54,7 @@
 class Regex
 {
 public:
-  Regex();
+  Regex(){compiled = 0;}
   void clone(Regex&);
   Regex(Regex&);
   Regex(const char *pattern, int flags);

Modified: trunk/myserver/src/base/regex/myserver_regex.cpp
===================================================================
--- trunk/myserver/src/base/regex/myserver_regex.cpp	2008-10-12 17:03:42 UTC (rev 2879)
+++ trunk/myserver/src/base/regex/myserver_regex.cpp	2008-10-13 19:20:25 UTC (rev 2880)
@@ -1,6 +1,6 @@
 /*
 MyServer
-Copyright (C) 2002, 2003, 2004, 2007 Free Software Foundation, Inc.
+Copyright (C) 2002, 2003, 2004, 2007, 2008 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
@@ -61,14 +61,6 @@
 }
 
 /*!
- *Constructor for the class.
- */
-Regex::Regex()
-{
-  compiled = 0;
-}
-
-/*!
  *Destructor for the class
  */
 Regex::~Regex()





From MAILER-DAEMON Mon Oct 13 15:25:02 2008
Received: from mailman by lists.gnu.org with archive (Exim 4.43)
	id 1KpT2M-0004Tf-AF
	for mharc-myserver-commit@gnu.org; Mon, 13 Oct 2008 15:25:02 -0400
Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43)
	id 1KpT2K-0004Sh-2Y
	for myserver-commit@gnu.org; Mon, 13 Oct 2008 15:25:00 -0400
Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43)
	id 1KpT2I-0004Qp-Rb
	for myserver-commit@gnu.org; Mon, 13 Oct 2008 15:24:59 -0400
Received: from [199.232.76.173] (port=52080 helo=monty-python.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.43) id 1KpT2I-0004Qm-Gy
	for myserver-commit@gnu.org; Mon, 13 Oct 2008 15:24:58 -0400
Received: from savannah.gnu.org ([199.232.41.3]:60478 helo=sv.gnu.org)
	by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32)
	(Exim 4.60) (envelope-from <INVALID.NOREPLY@gnu.org>)
	id 1KpT2I-0005q7-8J
	for myserver-commit@gnu.org; Mon, 13 Oct 2008 15:24:58 -0400
Received: from cvs.savannah.gnu.org ([199.232.41.69])
	by sv.gnu.org with esmtp (Exim 4.63)
	(envelope-from <INVALID.NOREPLY@gnu.org>) id 1KpT2H-0007Qx-DL
	for myserver-commit@gnu.org; Mon, 13 Oct 2008 19:24:57 +0000
Received: from gscrivano by cvs.savannah.gnu.org with local (Exim 4.63)
	(envelope-from <gscrivano@savannah.gnu.org>) id 1KpT2H-0007Qs-4g
	for myserver-commit@gnu.org; Mon, 13 Oct 2008 19:24:57 +0000
MIME-Version: 1.0
Errors-To: gscrivano
To: myserver-commit@gnu.org
X-Mailer: SVN::Notify 2.64: http://search.cpan.org/dist/SVN-Notify/
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
From: Giuseppe Scrivano <gscrivano@gnu.org>
Message-Id: <E1KpT2H-0007Qs-4g@cvs.savannah.gnu.org>
Date: Mon, 13 Oct 2008 19:24:57 +0000
X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 3)
Subject: [myserver-commit] [2881] Initial security file documentation.
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/pipermail/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, 13 Oct 2008 19:25:00 -0000

Revision: 2881
          http://svn.sv.gnu.org/viewvc/?view=rev&root=myserver&revision=2881
Author:   gscrivano
Date:     2008-10-13 19:24:56 +0000 (Mon, 13 Oct 2008)

Log Message:
-----------
Initial security file documentation.

Modified Paths:
--------------
    trunk/myserver/documentation/myserver.texi

Added Paths:
-----------
    trunk/myserver/documentation/security.texi

Modified: trunk/myserver/documentation/myserver.texi
===================================================================
--- trunk/myserver/documentation/myserver.texi	2008-10-13 19:20:25 UTC (rev 2880)
+++ trunk/myserver/documentation/myserver.texi	2008-10-13 19:24:56 UTC (rev 2881)
@@ -71,6 +71,7 @@
 * Virtual hosts:: Virtual hosts configuration.
 * MIME types:: MIME types configuration.
 * Process security:: Process security.
+* Security files:: Describe how use security files.
 * SSL certificates:: Show how to use SSL certificates.
 * Log management:: Describe how to use the log management features.
 
@@ -100,12 +101,17 @@
 @cindex MIME types
 @include mime_types.texi
 
-@node Process security, SSL certificates, MIME types, Top
+@node Process security, Security files, MIME types, Top
 @chapter Process security
 @cindex Process security
 @include process_security.texi
 
-@node SSL certificates, Log management, Process security, Top
+@node Security files, SSL certificates, Process security, Top
+@chapter Process security
+@cindex Process security
+@include process_security.texi
+
+@node SSL certificates, Log management, Security files, Top
 @chapter SSL certificates
 @cindex SSL certificates
 @include ssl_certificates.texi

Added: trunk/myserver/documentation/security.texi
===================================================================
--- trunk/myserver/documentation/security.texi	                        (rev 0)
+++ trunk/myserver/documentation/security.texi	2008-10-13 19:24:56 UTC (rev 2881)
@@ -0,0 +1,73 @@
+@c -*-texinfo-*-
+It is possible to change almost any configuration for a single
+directory or a single resource trough the @file{.security.xml}.
+This file can be placed in any web directory and it will overwrite
+default configuration values.  If the @file{.security.xml} file is not
+found in the directory where the requested resource is, then MyServer
+will look in the parents directory until the file is found.
+If @file{.security.xml} is not present in the virtual host root
+directory then the default one which is present in the system
+directory will be used.
+
+Usually consider the first valid value found in this order:
+@enumerate
+@item Local @file{.security.xml}.
+@item Parent directories @file{.security.xml}.
+@item System vhost directory @file{.security.xml}.
+@item Virtual host configuration.
+@item Global server configuration.
+@end enumerate
+
+Some values are not configurable in any @file{.security.xml} file and
+they are took directly from the Virtual host configuration and in some
+cases directly from the global configuration file.
+
+In MyServer there are two different steps involved in the logging
+phase: user authentication and validation.
+
+In the first step a permission mask is found given the
+username:password pair, no other information are used in this phase.
+In the second phase this value is refined using more information.
+The two phases are completely separated and it is possible to use
+different sources for any of them.
+
+The @file{.security.xml} can be used for both phases and by default it
+is.
+
+The anonymous user is matched inside MyServer with the ``Guest''
+username and an empty password.
+
+@section Security file user authentication
+The information used for the first phase of logging is a simple list
+of USER elements.  Any permission is configured by an attribute, if
+the attribute value is equal to ``YES'' then the permission is granted.
+
+The permissions that MyServer considers are:
+@enumerate
+@item READ
+@item EXECUTE
+@item BROWSE
+@item WRITE
+@item DELETE
+@end enumerate
+
+In the following example we enable an anonymous user to access
+resources in READ/EXECUTE/BROWSE mode, DELETE and WRITE are both
+denied.
+
+@example
+<SECURITY>
+  <USER name="Guest" password="" READ="YES" EXECUTE="YES" BROWSE="YES"
+     DELETE="NO" WRITE="NO"/>
+</SECURITY>
+@end example
+
+As no other information beside username:password is used, this first
+phase is the same for any protocol supported by MyServer.
+
+@subsection FTP Anonymous user
+To allow the @file{.security.xml} re-use, the FTP ``Anonymous'' user
+is mapped internally by MyServer to the ``Guest'' user.
+@end subsection
+
+@end section





From MAILER-DAEMON Mon Oct 13 17:58:10 2008
Received: from mailman by lists.gnu.org with archive (Exim 4.43)
	id 1KpVQX-0000jk-Ul
	for mharc-myserver-commit@gnu.org; Mon, 13 Oct 2008 17:58:09 -0400
Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43)
	id 1KpVQX-0000jT-13
	for myserver-commit@gnu.org; Mon, 13 Oct 2008 17:58:09 -0400
Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43)
	id 1KpVQV-0000io-DT
	for myserver-commit@gnu.org; Mon, 13 Oct 2008 17:58:08 -0400
Received: from [199.232.76.173] (port=37797 helo=monty-python.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.43) id 1KpVQV-0000il-AF
	for myserver-commit@gnu.org; Mon, 13 Oct 2008 17:58:07 -0400
Received: from savannah.gnu.org ([199.232.41.3]:60977 helo=sv.gnu.org)
	by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32)
	(Exim 4.60) (envelope-from <INVALID.NOREPLY@gnu.org>)
	id 1KpVQV-0004R0-0n
	for myserver-commit@gnu.org; Mon, 13 Oct 2008 17:58:07 -0400
Received: from cvs.savannah.gnu.org ([199.232.41.69])
	by sv.gnu.org with esmtp (Exim 4.63)
	(envelope-from <INVALID.NOREPLY@gnu.org>) id 1KpVQU-000198-DF
	for myserver-commit@gnu.org; Mon, 13 Oct 2008 21:58:06 +0000
Received: from gscrivano by cvs.savannah.gnu.org with local (Exim 4.63)
	(envelope-from <gscrivano@savannah.gnu.org>) id 1KpVQU-000193-4i
	for myserver-commit@gnu.org; Mon, 13 Oct 2008 21:58:06 +0000
MIME-Version: 1.0
Errors-To: gscrivano
To: myserver-commit@gnu.org
X-Mailer: SVN::Notify 2.64: http://search.cpan.org/dist/SVN-Notify/
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
From: Giuseppe Scrivano <gscrivano@gnu.org>
Message-Id: <E1KpVQU-000193-4i@cvs.savannah.gnu.org>
Date: Mon, 13 Oct 2008 21:58:06 +0000
X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 3)
Subject: [myserver-commit] [2882] Fixed link
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/pipermail/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, 13 Oct 2008 21:58:09 -0000

Revision: 2882
          http://svn.sv.gnu.org/viewvc/?view=rev&root=myserver&revision=2882
Author:   gscrivano
Date:     2008-10-13 21:58:05 +0000 (Mon, 13 Oct 2008)

Log Message:
-----------
Fixed link

Modified Paths:
--------------
    trunk/myserver/documentation/myserver.texi

Modified: trunk/myserver/documentation/myserver.texi
===================================================================
--- trunk/myserver/documentation/myserver.texi	2008-10-13 19:24:56 UTC (rev 2881)
+++ trunk/myserver/documentation/myserver.texi	2008-10-13 21:58:05 UTC (rev 2882)
@@ -109,7 +109,7 @@
 @node Security files, SSL certificates, Process security, Top
 @chapter Process security
 @cindex Process security
-@include process_security.texi
+@include security.texi
 
 @node SSL certificates, Log management, Security files, Top
 @chapter SSL certificates





From MAILER-DAEMON Mon Oct 13 17:59:53 2008
Received: from mailman by lists.gnu.org with archive (Exim 4.43)
	id 1KpVSD-0001WY-5n
	for mharc-myserver-commit@gnu.org; Mon, 13 Oct 2008 17:59:53 -0400
Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43)
	id 1KpVSB-0001WT-Tr
	for myserver-commit@gnu.org; Mon, 13 Oct 2008 17:59:51 -0400
Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43)
	id 1KpVSA-0001WH-Hh
	for myserver-commit@gnu.org; Mon, 13 Oct 2008 17:59:50 -0400
Received: from [199.232.76.173] (port=54464 helo=monty-python.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.43) id 1KpVSA-0001WE-AD
	for myserver-commit@gnu.org; Mon, 13 Oct 2008 17:59:50 -0400
Received: from savannah.gnu.org ([199.232.41.3]:32778 helo=sv.gnu.org)
	by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32)
	(Exim 4.60) (envelope-from <INVALID.NOREPLY@gnu.org>)
	id 1KpVS9-0004e7-Uw
	for myserver-commit@gnu.org; Mon, 13 Oct 2008 17:59:50 -0400
Received: from cvs.savannah.gnu.org ([199.232.41.69])
	by sv.gnu.org with esmtp (Exim 4.63)
	(envelope-from <INVALID.NOREPLY@gnu.org>) id 1KpVS9-0001Ef-BG
	for myserver-commit@gnu.org; Mon, 13 Oct 2008 21:59:49 +0000
Received: from gscrivano by cvs.savannah.gnu.org with local (Exim 4.63)
	(envelope-from <gscrivano@savannah.gnu.org>) id 1KpVS9-0001Eb-60
	for myserver-commit@gnu.org; Mon, 13 Oct 2008 21:59:49 +0000
MIME-Version: 1.0
Errors-To: gscrivano
To: myserver-commit@gnu.org
X-Mailer: SVN::Notify 2.64: http://search.cpan.org/dist/SVN-Notify/
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
From: Giuseppe Scrivano <gscrivano@gnu.org>
Message-Id: <E1KpVS9-0001Eb-60@cvs.savannah.gnu.org>
Date: Mon, 13 Oct 2008 21:59:49 +0000
X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 3)
Subject: [myserver-commit] [2883] Removed wrong @end directives.
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/pipermail/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, 13 Oct 2008 21:59:52 -0000

Revision: 2883
          http://svn.sv.gnu.org/viewvc/?view=rev&root=myserver&revision=2883
Author:   gscrivano
Date:     2008-10-13 21:59:48 +0000 (Mon, 13 Oct 2008)

Log Message:
-----------
Removed wrong @end directives.

Modified Paths:
--------------
    trunk/myserver/documentation/security.texi

Modified: trunk/myserver/documentation/security.texi
===================================================================
--- trunk/myserver/documentation/security.texi	2008-10-13 21:58:05 UTC (rev 2882)
+++ trunk/myserver/documentation/security.texi	2008-10-13 21:59:48 UTC (rev 2883)
@@ -68,6 +68,4 @@
 @subsection FTP Anonymous user
 To allow the @file{.security.xml} re-use, the FTP ``Anonymous'' user
 is mapped internally by MyServer to the ``Guest'' user.
-@end subsection
 
-@end section





From MAILER-DAEMON Tue Oct 14 17:48:57 2008
Received: from mailman by lists.gnu.org with archive (Exim 4.43)
	id 1KprlB-0008Gd-J9
	for mharc-myserver-commit@gnu.org; Tue, 14 Oct 2008 17:48:57 -0400
Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43)
	id 1KprlA-0008GY-0z
	for myserver-commit@gnu.org; Tue, 14 Oct 2008 17:48:56 -0400
Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43)
	id 1Kprl9-0008GI-Ea
	for myserver-commit@gnu.org; Tue, 14 Oct 2008 17:48:55 -0400
Received: from [199.232.76.173] (port=34250 helo=monty-python.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.43) id 1Kprl9-0008GF-8h
	for myserver-commit@gnu.org; Tue, 14 Oct 2008 17:48:55 -0400
Received: from savannah.gnu.org ([199.232.41.3]:41669 helo=sv.gnu.org)
	by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32)
	(Exim 4.60) (envelope-from <INVALID.NOREPLY@gnu.org>)
	id 1Kprl8-000572-9F
	for myserver-commit@gnu.org; Tue, 14 Oct 2008 17:48:55 -0400
Received: from cvs.savannah.gnu.org ([199.232.41.69])
	by sv.gnu.org with esmtp (Exim 4.63)
	(envelope-from <INVALID.NOREPLY@gnu.org>) id 1Kprl3-0004Hv-A3
	for myserver-commit@gnu.org; Tue, 14 Oct 2008 21:48:49 +0000
Received: from gscrivano by cvs.savannah.gnu.org with local (Exim 4.63)
	(envelope-from <gscrivano@savannah.gnu.org>) id 1Kprl2-0004Ho-PD
	for myserver-commit@gnu.org; Tue, 14 Oct 2008 21:48:48 +0000
MIME-Version: 1.0
Errors-To: gscrivano
To: myserver-commit@gnu.org
X-Mailer: SVN::Notify 2.64: http://search.cpan.org/dist/SVN-Notify/
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
From: Giuseppe Scrivano <gscrivano@gnu.org>
Message-Id: <E1Kprl2-0004Ho-PD@cvs.savannah.gnu.org>
Date: Tue, 14 Oct 2008 21:48:48 +0000
X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 3)
Subject: [myserver-commit] [2884] Send the HTTP payload only with a
	SUCCESSFUL status 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/pipermail/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, 14 Oct 2008 21:48:56 -0000

Revision: 2884
          http://svn.sv.gnu.org/viewvc/?view=rev&root=myserver&revision=2884
Author:   gscrivano
Date:     2008-10-14 21:48:47 +0000 (Tue, 14 Oct 2008)

Log Message:
-----------
Send the HTTP payload only with a SUCCESSFUL status code.

Modified Paths:
--------------
    trunk/myserver/include/protocol/http/http_response.h
    trunk/myserver/src/http_handler/cgi/cgi.cpp
    trunk/myserver/src/http_handler/fastcgi/fastcgi.cpp
    trunk/myserver/src/http_handler/isapi/isapi.cpp
    trunk/myserver/src/http_handler/scgi/scgi.cpp
    trunk/myserver/src/http_handler/wincgi/wincgi.cpp
    trunk/myserver/src/protocol/http/http_response.cpp
    trunk/myserver/tests/test_http_response.cpp

Modified: trunk/myserver/include/protocol/http/http_response.h
===================================================================
--- trunk/myserver/include/protocol/http/http_response.h	2008-10-13 21:59:48 UTC (rev 2883)
+++ trunk/myserver/include/protocol/http/http_response.h	2008-10-14 21:48:47 UTC (rev 2884)
@@ -1,7 +1,7 @@
 /* -*- mode: c++ -*- */
 /*
 MyServer
-Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc.
+Copyright (C) 2002, 2003, 2004, 2008 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
@@ -48,6 +48,12 @@
  */
 struct HttpResponseHeader : public HttpHeader
 {
+  const static int INFORMATIONAL = 100;
+  const static int SUCCESSFUL = 200;
+  const static int REDIRECTION = 300;
+  const static int CLIENT_ERROR = 400;
+  const static int SERVER_ERROR = 500;
+
   struct Entry
   {
     string *name;
@@ -91,6 +97,8 @@
   HttpResponseHeader();
   ~HttpResponseHeader();
 
+  int getStatusType();
+
   virtual string* getValue(const char* name, string* out);
   virtual string* setValue(const char* name, const char* in);
   void free();

Modified: trunk/myserver/src/http_handler/cgi/cgi.cpp
===================================================================
--- trunk/myserver/src/http_handler/cgi/cgi.cpp	2008-10-13 21:59:48 UTC (rev 2883)
+++ trunk/myserver/src/http_handler/cgi/cgi.cpp	2008-10-14 21:48:47 UTC (rev 2884)
@@ -504,72 +504,75 @@
     nbw += headerOffset - headerSize;
   }
 
-  /* Send the rest of the data until we can read from the pipe.  */
-  for(;;)
+  if (td->response.getStatusType () == HttpResponseHeader::SUCCESSFUL)
   {
-    int aliveProcess = 0;
+    /* Send the rest of the data until we can read from the pipe.  */
+    for(;;)
+    {
+      int aliveProcess = 0;
 
-    /* Process timeout.  */
-    if((int)(getTicks() - procStartTime) > cgiTimeout)
-    {
-      stdOutFile.close();
-      stdInFile.close();
-      chain.clearAllFilters(); 
-      /* Remove the connection on sockets error.  */
-      cgiProc.terminateProcess();
-      return 0;       
-    }
+      /* Process timeout.  */
+      if((int)(getTicks() - procStartTime) > cgiTimeout)
+      {
+        stdOutFile.close();
+        stdInFile.close();
+        chain.clearAllFilters(); 
+        /* Remove the connection on sockets error.  */
+        cgiProc.terminateProcess();
+        return 0;       
+      }
     
-    aliveProcess = cgiProc.isProcessAlive();
+      aliveProcess = cgiProc.isProcessAlive();
 
-    /* Read data from the process standard output file.  */
-    if(stdOutFile.read(td->buffer2->getBuffer(), 
-                       td->buffer2->getRealLength(), 
-                       &nBytesRead))
-    {
-      stdOutFile.close();
-      stdInFile.close();
-      chain.clearAllFilters(); 
-      /* Remove the connection on sockets error.  */
-      cgiProc.terminateProcess();
-      return 0;      
+      /* Read data from the process standard output file.  */
+      if(stdOutFile.read(td->buffer2->getBuffer(), 
+                         td->buffer2->getRealLength(), 
+                         &nBytesRead))
+      {
+        stdOutFile.close();
+        stdInFile.close();
+        chain.clearAllFilters(); 
+        /* Remove the connection on sockets error.  */
+        cgiProc.terminateProcess();
+        return 0;      
+      }
+      
+      if(!aliveProcess && !nBytesRead)
+        break;
+      
+      if(nBytesRead && 
+         HttpDataHandler::appendDataToHTTPChannel(td, 
+                                                  td->buffer2->getBuffer(),
+                                                  nBytesRead,
+                                                  &(td->outputData),
+                                                  &chain,
+                                                  td->appendOutputs, 
+                                                  useChunks))
+      {
+        stdOutFile.close();
+        stdInFile.close();
+        chain.clearAllFilters(); 
+        /* Remove the connection on sockets error.  */
+        cgiProc.terminateProcess();
+        return 0;       
+      }
+      
+      nbw += nBytesRead;
     }
-    
-    if(!aliveProcess && !nBytesRead)
-      break;
-
-    if(nBytesRead && 
-       HttpDataHandler::appendDataToHTTPChannel(td, 
-                                                td->buffer2->getBuffer(),
-                                                nBytesRead,
-                                                &(td->outputData),
-                                                &chain,
-                                                td->appendOutputs, 
-                                                useChunks))
+  
+  
+    /* Send the last null chunk if needed.  */
+    if(useChunks && chain.write("0\r\n\r\n", 5, &nbw2))
     {
       stdOutFile.close();
       stdInFile.close();
       chain.clearAllFilters(); 
+  
       /* Remove the connection on sockets error.  */
       cgiProc.terminateProcess();
       return 0;       
     }
-
-    nbw += nBytesRead;
   }
-  
-  
-  /* Send the last null chunk if needed.  */
-  if(useChunks && chain.write("0\r\n\r\n", 5, &nbw2))
-  {
-    stdOutFile.close();
-    stdInFile.close();
-    chain.clearAllFilters(); 
-  
-    /* Remove the connection on sockets error.  */
-    cgiProc.terminateProcess();
-    return 0;       
-  }
 
   /* Update the Content-Length field for logging activity.  */
   td->sentData += nbw;

Modified: trunk/myserver/src/http_handler/fastcgi/fastcgi.cpp
===================================================================
--- trunk/myserver/src/http_handler/fastcgi/fastcgi.cpp	2008-10-13 21:59:48 UTC (rev 2883)
+++ trunk/myserver/src/http_handler/fastcgi/fastcgi.cpp	2008-10-14 21:48:47 UTC (rev 2884)
@@ -618,67 +618,70 @@
       }
     }
 
-    /*! Flush the data.  */
-    do
+    if (td->response.getStatusType () == HttpResponseHeader::SUCCESSFUL)
     {
-      if(con.tempOut.readFromFile(td->buffer->getBuffer(),
-                                  td->buffer->getRealLength(), &nbr))
+      /*! Flush the data.  */
+      do
       {
-        exit = 1;
-        ret = 0;
-        break;
-      }
+        if(con.tempOut.readFromFile(td->buffer->getBuffer(),
+                                    td->buffer->getRealLength(), &nbr))
+        {
+          exit = 1;
+          ret = 0;
+          break;
+        }
 
-      if(!td->appendOutputs)
-      {
-        u_long nbw2;
-        if(nbr)
+        if(!td->appendOutputs)
         {
-          if(useChunks)
+          u_long nbw2;
+          if(nbr)
           {
-            ostringstream tmp;
-            tmp << hex << nbr << "\r\n";
-            td->response.contentLength.assign(tmp.str());
-            if(chain.write(tmp.str().c_str(), tmp.str().length(), &nbw2))
+            if(useChunks)
             {
+              ostringstream tmp;
+              tmp << hex << nbr << "\r\n";
+              td->response.contentLength.assign(tmp.str());
+              if(chain.write(tmp.str().c_str(), tmp.str().length(), &nbw2))
+              {
+                exit = 1;
+                ret = 0;
+                break;
+              }
+            }
+
+            if(chain.write(td->buffer->getBuffer(), nbr, &nbw2))
+            {
               exit = 1;
               ret = 0;
               break;
             }
-          }
 
-          if(chain.write(td->buffer->getBuffer(), nbr, &nbw2))
-          {
-            exit = 1;
-            ret = 0;
-            break;
+            if(useChunks && chain.write("\r\n", 2, &nbw2))
+            {
+              exit = 1;
+              ret = 0;
+              break;
+            }
           }
-
-          if(useChunks && chain.write("\r\n", 2, &nbw2))
+        }
+        else
+        {
+          u_long nbw = 0;
+          if(td->outputData.writeToFile(td->buffer->getBuffer(), nbr, &nbw))
           {
             exit = 1;
             ret = 0;
             break;
           }
         }
-      }
-      else
+      }while(nbr);
+
+      if(useChunks && chain.write("0\r\n\r\n", 5, &nbw2))
       {
-        u_long nbw = 0;
-        if(td->outputData.writeToFile(td->buffer->getBuffer(), nbr, &nbw))
-        {
-          exit = 1;
-          ret = 0;
-          break;
-        }
+        exit = 1;
+        ret = 0;
+        break;
       }
-    }while(nbr);
-
-    if(useChunks && chain.write("0\r\n\r\n", 5, &nbw2))
-    {
-      exit = 1;
-      ret = 0;
-      break;
     }
 
     break;

Modified: trunk/myserver/src/http_handler/isapi/isapi.cpp
===================================================================
--- trunk/myserver/src/http_handler/isapi/isapi.cpp	2008-10-13 21:59:48 UTC (rev 2883)
+++ trunk/myserver/src/http_handler/isapi/isapi.cpp	2008-10-14 21:48:47 UTC (rev 2884)
@@ -310,7 +310,7 @@
       ConnInfo->headerSent=1;
       
       /*! If only the header was requested return. */
-      if(ConnInfo->headerSent && ConnInfo->onlyHeader)
+      if(ConnInfo->headerSent && ConnInfo->onlyHeader || ConnInfo->td->response.getStatusType () == HttpResponseHeader::SUCCESSFUL)
         return 0;
 
       /*!Send the first chunk. */

Modified: trunk/myserver/src/http_handler/scgi/scgi.cpp
===================================================================
--- trunk/myserver/src/http_handler/scgi/scgi.cpp	2008-10-13 21:59:48 UTC (rev 2883)
+++ trunk/myserver/src/http_handler/scgi/scgi.cpp	2008-10-14 21:48:47 UTC (rev 2884)
@@ -311,32 +311,34 @@
   
   sentData += read - headerSize;
 
-  for(;;)
+  if (td->response.getStatusType () == HttpResponseHeader::SUCCESSFUL)
   {
-    nbr = ctx->sock.recv(td->buffer2->getBuffer(),
-                         td->buffer2->getRealLength(),
-                         0);
+    for(;;)
+    {
+      nbr = ctx->sock.recv(td->buffer2->getBuffer(),
+                           td->buffer2->getRealLength(),
+                           0);
+      
+      if(!nbr || (nbr == (u_long)-1))
+        break;
 
-    if(!nbr || (nbr == (u_long)-1))
-      break;
-
-    if(appendDataToHTTPChannel(td, td->buffer2->getBuffer(),
-                               nbr,
-                               &(td->outputData), 
-                               chain,
-                               td->appendOutputs, 
-                               useChunks))
-     return -1;
-
-    sentData += nbr;
+      if(appendDataToHTTPChannel(td, td->buffer2->getBuffer(),
+                                 nbr,
+                                 &(td->outputData), 
+                                 chain,
+                                 td->appendOutputs, 
+                                 useChunks))
+        return -1;
+      
+      sentData += nbr;
+    }
+    
+    if(!td->appendOutputs && useChunks)
+    {
+      if(chain->write("0\r\n\r\n", 5, &nbw))
+        return -1;
+    }
   }
-
-  if(!td->appendOutputs && useChunks)
-  {
-    if(chain->write("0\r\n\r\n", 5, &nbw))
-      return -1;
-  }
-
   /* For logging activity.  */  
   td->sentData += sentData;
 

Modified: trunk/myserver/src/http_handler/wincgi/wincgi.cpp
===================================================================
--- trunk/myserver/src/http_handler/wincgi/wincgi.cpp	2008-10-13 21:59:48 UTC (rev 2883)
+++ trunk/myserver/src/http_handler/wincgi/wincgi.cpp	2008-10-14 21:48:47 UTC (rev 2884)
@@ -423,45 +423,47 @@
     nbw += nbw2;
   }
 
-  /* Flush the rest of the file.  */
-  do
+  if (td->response.getStatusType () == HttpResponseHeader::SUCCESSFUL)
   {
-    OutFileHandle.readFromFile(buffer, td->buffer2->getLength(), 
-                               &nBytesRead);
-    if(nBytesRead)
+    /* Flush the rest of the file.  */
+    do
     {
-      int ret;
-      if(td->appendOutputs)
+      OutFileHandle.readFromFile(buffer, td->buffer2->getLength(), 
+                                 &nBytesRead);
+      if(nBytesRead)
       {
-        ret = td->outputData.writeToFile(buffer, nBytesRead, &nbw);
-        if(ret)
+        int ret;
+        if(td->appendOutputs)
         {
-          OutFileHandle.close();
-          FilesUtility::deleteFile(outFilePath);
-          FilesUtility::deleteFile(dataFilePath);
-          chain.clearAllFilters();
-          return 0;
-        }
-      }      
-      else
-      {
-        u_long nbw2;
-        ret = chain.write((char*)buffer, nBytesRead, &nbw2);
-        if(ret == -1)
+          ret = td->outputData.writeToFile(buffer, nBytesRead, &nbw);
+          if(ret)
+          {
+            OutFileHandle.close();
+            FilesUtility::deleteFile(outFilePath);
+            FilesUtility::deleteFile(dataFilePath);
+            chain.clearAllFilters();
+            return 0;
+          }
+        }      
+        else
         {
-          OutFileHandle.close();
-          FilesUtility::deleteFile(outFilePath);
-          FilesUtility::deleteFile(dataFilePath);
-          chain.clearAllFilters();
-          return 0;
+          u_long nbw2;
+          ret = chain.write((char*)buffer, nBytesRead, &nbw2);
+          if(ret == -1)
+          {
+            OutFileHandle.close();
+            FilesUtility::deleteFile(outFilePath);
+            FilesUtility::deleteFile(dataFilePath);
+            chain.clearAllFilters();
+            return 0;
+          }
         }
       }
-    }
-    else
-      break;
-
-  }while(nBytesRead);
-
+      else
+        break;
+      
+    }while(nBytesRead);
+  }
   td->sentData += nbw;
 
   chain.clearAllFilters();  

Modified: trunk/myserver/src/protocol/http/http_response.cpp
===================================================================
--- trunk/myserver/src/protocol/http/http_response.cpp	2008-10-13 21:59:48 UTC (rev 2883)
+++ trunk/myserver/src/protocol/http/http_response.cpp	2008-10-14 21:48:47 UTC (rev 2884)
@@ -276,3 +276,24 @@
     return 0;
   }
 } 
+
+/*!
+ *Get the kind of HTTP status code specified by the httpStatus variable.
+ *\return the HTTP status kind.
+ */
+int HttpResponseHeader::getStatusType()
+{
+  if (httpStatus < 200)
+    return HttpResponseHeader::INFORMATIONAL;
+
+  if (httpStatus < 300)
+    return HttpResponseHeader::SUCCESSFUL;
+  
+  if (httpStatus < 400)
+    return HttpResponseHeader::REDIRECTION;
+
+  if (httpStatus < 500)
+    return HttpResponseHeader::CLIENT_ERROR;
+  
+  return HttpResponseHeader::SERVER_ERROR;
+}

Modified: trunk/myserver/tests/test_http_response.cpp
===================================================================
--- trunk/myserver/tests/test_http_response.cpp	2008-10-13 21:59:48 UTC (rev 2883)
+++ trunk/myserver/tests/test_http_response.cpp	2008-10-14 21:48:47 UTC (rev 2884)
@@ -123,8 +123,27 @@
  }
 
 
+  void testStatusType ()
+  {
+    HttpResponseHeader header;
 
+    header.httpStatus = 100;
+    CPPUNIT_ASSERT_EQUAL(header.getStatusType(), HttpResponseHeader::INFORMATIONAL);
+    
+    header.httpStatus = 200;
+    CPPUNIT_ASSERT_EQUAL(header.getStatusType(), HttpResponseHeader::SUCCESSFUL);
+
+    header.httpStatus = 300;
+    CPPUNIT_ASSERT_EQUAL(header.getStatusType(), HttpResponseHeader::REDIRECTION);
+
+    header.httpStatus = 400;
+    CPPUNIT_ASSERT_EQUAL(header.getStatusType(), HttpResponseHeader::CLIENT_ERROR);
+
+    header.httpStatus = 500;
+    CPPUNIT_ASSERT_EQUAL(header.getStatusType(), HttpResponseHeader::SERVER_ERROR);
+  }
   
+  
 };
 
 





From MAILER-DAEMON Wed Oct 15 18:54:27 2008
Received: from mailman by lists.gnu.org with archive (Exim 4.43)
	id 1KqFG6-0006Gn-S0
	for mharc-myserver-commit@gnu.org; Wed, 15 Oct 2008 18:54:26 -0400
Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43)
	id 1KqFG4-0006Gi-Mo
	for myserver-commit@gnu.org; Wed, 15 Oct 2008 18:54:24 -0400
Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43)
	id 1KqFG3-0006GW-9d
	for myserver-commit@gnu.org; Wed, 15 Oct 2008 18:54:23 -0400
Received: from [199.232.76.173] (port=49296 helo=monty-python.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.43) id 1KqFG3-0006GT-3D
	for myserver-commit@gnu.org; Wed, 15 Oct 2008 18:54:23 -0400
Received: from savannah.gnu.org ([199.232.41.3]:43633 helo=sv.gnu.org)
	by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32)
	(Exim 4.60) (envelope-from <INVALID.NOREPLY@gnu.org>)
	id 1KqFG3-0006fF-4H
	for myserver-commit@gnu.org; Wed, 15 Oct 2008 18:54:23 -0400
Received: from cvs.savannah.gnu.org ([199.232.41.69])
	by sv.gnu.org with esmtp (Exim 4.63)
	(envelope-from <INVALID.NOREPLY@gnu.org>) id 1KqFG2-0001fM-6n
	for myserver-commit@gnu.org; Wed, 15 Oct 2008 22:54:22 +0000
Received: from gscrivano by cvs.savannah.gnu.org with local (Exim 4.63)
	(envelope-from <gscrivano@savannah.gnu.org>) id 1KqFG1-0001fG-Vx
	for myserver-commit@gnu.org; Wed, 15 Oct 2008 22:54:22 +0000
MIME-Version: 1.0
Errors-To: gscrivano
To: myserver-commit@gnu.org
X-Mailer: SVN::Notify 2.64: http://search.cpan.org/dist/SVN-Notify/
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
From: Giuseppe Scrivano <gscrivano@gnu.org>
Message-Id: <E1KqFG1-0001fG-Vx@cvs.savannah.gnu.org>
Date: Wed, 15 Oct 2008 22:54:22 +0000
X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 3)
Subject: [myserver-commit] [2885] Removed polling.
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/pipermail/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, 15 Oct 2008 22:54:25 -0000

Revision: 2885
          http://svn.sv.gnu.org/viewvc/?view=rev&root=myserver&revision=2885
Author:   gscrivano
Date:     2008-10-15 22:54:21 +0000 (Wed, 15 Oct 2008)

Log Message:
-----------
Removed polling.  It can be optimized more.

Modified Paths:
--------------
    trunk/myserver/src/http_handler/fastcgi/fastcgi.cpp

Modified: trunk/myserver/src/http_handler/fastcgi/fastcgi.cpp
===================================================================
--- trunk/myserver/src/http_handler/fastcgi/fastcgi.cpp	2008-10-14 21:48:47 UTC (rev 2884)
+++ trunk/myserver/src/http_handler/fastcgi/fastcgi.cpp	2008-10-15 22:54:21 UTC (rev 2885)
@@ -385,7 +385,7 @@
     {
       if((clock_t)(getTicks() - initialTicks) > timeout)
         break;
-      Thread::wait(1);
+      con.sock.dataOnRead (timeout / 1000, timeout % 1000);
     }
 
     if(con.sock.bytesToRead() >= sizeof(FcgiHeader))





From MAILER-DAEMON Thu Oct 16 16:56:47 2008
Received: from mailman by lists.gnu.org with archive (Exim 4.43)
	id 1KqZtn-0001se-1f
	for mharc-myserver-commit@gnu.org; Thu, 16 Oct 2008 16:56:47 -0400
Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43)
	id 1KqZtl-0001sE-Vk
	for myserver-commit@gnu.org; Thu, 16 Oct 2008 16:56:46 -0400
Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43)
	id 1KqZtk-0001rj-VF
	for myserver-commit@gnu.org; Thu, 16 Oct 2008 16:56:45 -0400
Received: from [199.232.76.173] (port=56129 helo=monty-python.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.43) id 1KqZtk-0001rV-Kf
	for myserver-commit@gnu.org; Thu, 16 Oct 2008 16:56:44 -0400
Received: from savannah.gnu.org ([199.232.41.3]:52632 helo=sv.gnu.org)
	by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32)
	(Exim 4.60) (envelope-from <INVALID.NOREPLY@gnu.org>)
	id 1KqZtk-0003Up-7f
	for myserver-commit@gnu.org; Thu, 16 Oct 2008 16:56:44 -0400
Received: from cvs.savannah.gnu.org ([199.232.41.69])
	by sv.gnu.org with esmtp (Exim 4.63)
	(envelope-from <INVALID.NOREPLY@gnu.org>) id 1KqZtj-0000DC-Kw
	for myserver-commit@gnu.org; Thu, 16 Oct 2008 20:56:43 +0000
Received: from gscrivano by cvs.savannah.gnu.org with local (Exim 4.63)
	(envelope-from <gscrivano@savannah.gnu.org>) id 1KqZtj-0000D7-8n
	for myserver-commit@gnu.org; Thu, 16 Oct 2008 20:56:43 +0000
MIME-Version: 1.0
Errors-To: gscrivano
To: myserver-commit@gnu.org
X-Mailer: SVN::Notify 2.64: http://search.cpan.org/dist/SVN-Notify/
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
From: Giuseppe Scrivano <gscrivano@gnu.org>
Message-Id: <E1KqZtj-0000D7-8n@cvs.savannah.gnu.org>
Date: Thu, 16 Oct 2008 20:56:43 +0000
X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 3)
Subject: [myserver-commit] [2886] Code optimizations.
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/pipermail/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, 16 Oct 2008 20:56:46 -0000

Revision: 2886
          http://svn.sv.gnu.org/viewvc/?view=rev&root=myserver&revision=2886
Author:   gscrivano
Date:     2008-10-16 20:56:42 +0000 (Thu, 16 Oct 2008)

Log Message:
-----------
Code optimizations.

Modified Paths:
--------------
    trunk/myserver/include/server/server.h
    trunk/myserver/src/protocol/http/http_request.cpp
    trunk/myserver/src/protocol/http/http_response.cpp

Modified: trunk/myserver/include/server/server.h
===================================================================
--- trunk/myserver/include/server/server.h	2008-10-15 22:54:21 UTC (rev 2885)
+++ trunk/myserver/include/server/server.h	2008-10-16 20:56:42 UTC (rev 2886)
@@ -77,7 +77,7 @@
   bool stopServer(){return mustEndServer;}
   HomeDir* getHomeDir();
   static void createInstance();
-  static Server* getInstance()
+  static inline Server* getInstance()
   {
     return instance;
   }

Modified: trunk/myserver/src/protocol/http/http_request.cpp
===================================================================
--- trunk/myserver/src/protocol/http/http_request.cpp	2008-10-15 22:54:21 UTC (rev 2885)
+++ trunk/myserver/src/protocol/http/http_request.cpp	2008-10-16 20:56:42 UTC (rev 2886)
@@ -37,7 +37,9 @@
  */
 HttpRequestHeader::~HttpRequestHeader()
 {
-  free();
+  HashMap<string, HttpRequestHeader::Entry*>::Iterator it = other.begin();
+  for(; it != other.end(); it++)
+    delete (*it);
 }
 
 /*!

Modified: trunk/myserver/src/protocol/http/http_response.cpp
===================================================================
--- trunk/myserver/src/protocol/http/http_response.cpp	2008-10-15 22:54:21 UTC (rev 2885)
+++ trunk/myserver/src/protocol/http/http_response.cpp	2008-10-16 20:56:42 UTC (rev 2886)
@@ -36,7 +36,9 @@
  */
 HttpResponseHeader::~HttpResponseHeader()
 {
-  free();
+  HashMap<string, HttpResponseHeader::Entry*>::Iterator it = other.begin();
+  for(;it != other.end(); it++)
+    delete (*it);
 }
 
 /*!





From MAILER-DAEMON Sat Oct 18 08:30:27 2008
Received: from mailman by lists.gnu.org with archive (Exim 4.43)
	id 1KrAwt-0007pa-8k
	for mharc-myserver-commit@gnu.org; Sat, 18 Oct 2008 08:30:27 -0400
Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43)
	id 1KrAwr-0007p3-Hy
	for myserver-commit@gnu.org; Sat, 18 Oct 2008 08:30:25 -0400
Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43)
	id 1KrAwq-0007of-UV
	for myserver-commit@gnu.org; Sat, 18 Oct 2008 08:30:25 -0400
Received: from [199.232.76.173] (port=51888 helo=monty-python.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.43) id 1KrAwq-0007oc-L4
	for myserver-commit@gnu.org; Sat, 18 Oct 2008 08:30:24 -0400
Received: from savannah.gnu.org ([199.232.41.3]:44545 helo=sv.gnu.org)
	by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32)
	(Exim 4.60) (envelope-from <INVALID.NOREPLY@gnu.org>)
	id 1KrAwq-0003G9-FD
	for myserver-commit@gnu.org; Sat, 18 Oct 2008 08:30:24 -0400
Received: from cvs.savannah.gnu.org ([199.232.41.69])
	by sv.gnu.org with esmtp (Exim 4.63)
	(envelope-from <INVALID.NOREPLY@gnu.org>) id 1KrAwp-0005EW-Ai
	for myserver-commit@gnu.org; Sat, 18 Oct 2008 12:30:23 +0000
Received: from gscrivano by cvs.savannah.gnu.org with local (Exim 4.63)
	(envelope-from <gscrivano@savannah.gnu.org>) id 1KrAwn-0005ES-NM
	for myserver-commit@gnu.org; Sat, 18 Oct 2008 12:30:22 +0000
MIME-Version: 1.0
Errors-To: gscrivano
To: myserver-commit@gnu.org
X-Mailer: SVN::Notify 2.64: http://search.cpan.org/dist/SVN-Notify/
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
From: Giuseppe Scrivano <gscrivano@gnu.org>
Message-Id: <E1KrAwn-0005ES-NM@cvs.savannah.gnu.org>
Date: Sat, 18 Oct 2008 12:30:21 +0000
X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 3)
Subject: [myserver-commit] [2887] Changed recursive algorithm with an
	iterative version.
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/pipermail/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, 18 Oct 2008 12:30:25 -0000

Revision: 2887
          http://svn.sv.gnu.org/viewvc/?view=rev&root=myserver&revision=2887
Author:   gscrivano
Date:     2008-10-18 12:30:19 +0000 (Sat, 18 Oct 2008)

Log Message:
-----------
Changed recursive algorithm with an iterative version.

Modified Paths:
--------------
    trunk/myserver/src/conf/security/xml_validator.cpp

Modified: trunk/myserver/src/conf/security/xml_validator.cpp
===================================================================
--- trunk/myserver/src/conf/security/xml_validator.cpp	2008-10-16 20:56:42 UTC (rev 2886)
+++ trunk/myserver/src/conf/security/xml_validator.cpp	2008-10-18 12:30:19 UTC (rev 2887)
@@ -229,15 +229,31 @@
   if (!node)
     return 0;
 
-  for (xmlNodePtr cur = node->children; cur; cur = cur->next)
+  xmlNodePtr cur = node->children;
+  for (;;)
   {
+    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) && computeXmlNode (cur, st, cmd, hashedDomains))
-          return 1;
+      if (doCondition (cur, hashedDomains))
+        cur = cur->children;
     }
     else if (!xmlStrcmp (cur->name, (const xmlChar *) "RETURN"))
     {
@@ -285,7 +301,7 @@
   }
       
   string *storedValue = getValue (hashedDomains, name);
-      
+
   if (!storedValue)
     return false;
 





From MAILER-DAEMON Sat Oct 18 12:40:59 2008
Received: from mailman by lists.gnu.org with archive (Exim 4.43)
	id 1KrErL-00086D-Bl
	for mharc-myserver-commit@gnu.org; Sat, 18 Oct 2008 12:40:59 -0400
Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43)
	id 1KrErJ-000866-OT
	for myserver-commit@gnu.org; Sat, 18 Oct 2008 12:40:57 -0400
Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43)
	id 1KrErI-00085u-9E
	for myserver-commit@gnu.org; Sat, 18 Oct 2008 12:40:56 -0400
Received: from [199.232.76.173] (port=38704 helo=monty-python.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.43) id 1KrErI-00085r-3Q
	for myserver-commit@gnu.org; Sat, 18 Oct 2008 12:40:56 -0400
Received: from savannah.gnu.org ([199.232.41.3]:57493 helo=sv.gnu.org)
	by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32)
	(Exim 4.60) (envelope-from <INVALID.NOREPLY@gnu.org>)
	id 1KrErH-0003hd-UB
	for myserver-commit@gnu.org; Sat, 18 Oct 2008 12:40:56 -0400
Received: from cvs.savannah.gnu.org ([199.232.41.69])
	by sv.gnu.org with esmtp (Exim 4.63)
	(envelope-from <INVALID.NOREPLY@gnu.org>) id 1KrErH-0006pC-5y
	for myserver-commit@gnu.org; Sat, 18 Oct 2008 16:40:55 +0000
Received: from gscrivano by cvs.savannah.gnu.org with local (Exim 4.63)
	(envelope-from <gscrivano@savannah.gnu.org>) id 1KrErG-0006p8-Un
	for myserver-commit@gnu.org; Sat, 18 Oct 2008 16:40:55 +0000
MIME-Version: 1.0
Errors-To: gscrivano
To: myserver-commit@gnu.org
X-Mailer: SVN::Notify 2.64: http://search.cpan.org/dist/SVN-Notify/
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
From: Giuseppe Scrivano <gscrivano@gnu.org>
Message-Id: <E1KrErG-0006p8-Un@cvs.savannah.gnu.org>
Date: Sat, 18 Oct 2008 16:40:54 +0000
X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 3)
Subject: [myserver-commit] [2888] Added end-user documentation for the
	security validation phase.
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/pipermail/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, 18 Oct 2008 16:40:58 -0000

Revision: 2888
          http://svn.sv.gnu.org/viewvc/?view=rev&root=myserver&revision=2888
Author:   gscrivano
Date:     2008-10-18 16:40:54 +0000 (Sat, 18 Oct 2008)

Log Message:
-----------
Added end-user documentation for the security validation phase.

Modified Paths:
--------------
    trunk/myserver/documentation/security.texi

Modified: trunk/myserver/documentation/security.texi
===================================================================
--- trunk/myserver/documentation/security.texi	2008-10-18 12:30:19 UTC (rev 2887)
+++ trunk/myserver/documentation/security.texi	2008-10-18 16:40:54 UTC (rev 2888)
@@ -69,3 +69,117 @@
 To allow the @file{.security.xml} re-use, the FTP ``Anonymous'' user
 is mapped internally by MyServer to the ``Guest'' user.
 
+@section Validation phase
+The second phase allows to define some rules that can overload the
+settings specified in the authorization phase.
+
+The default validator used by MyServer is the @file{.security.xml}
+file.
+
+@subsection XML Validation file
+The XML validation phase reads the tag contained in the order that
+they are specified.  It works almost in the same way a programming
+language does, but differently the XML validator doesn't allow a loop
+structure, this is required to terminate the parsing in a finite
+time.
+
+The XML validation is done using four commands: 
+
+@enumerate
+@item CONDITION
+It defines a block that is evaluated only when the specified condition
+is true.
+@item DEFINE
+It defines a new value for a variable that can be used later by the server.
+@item PERMISSION
+Redefine the permission found in the authorization phase.
+@item RETURN
+Immediately return from the validation.
+@end enumerate
+
+@subsubsection CONDITION element
+The @code{CONDITION} block allows to evaluate a condition and in case
+it is satisfied then the inner XML is evaluated too, in case it is not
+satisfied then the inner code is not considered.  It works like the
+@code{if} statement usually present in any programming language but
+offering less syntactical freedom.
+
+Here it is showed a simple use of @code{CONDITION}:
+@example
+<CONDITION name="auth.user" value="Guest">
+...
+</CONDITION>
+@end example
+
+The inner XML code, omitted for clarity, is evaluated only when the
+@code{auth.user} variable is equals to the value "Guest".
+
+
+It may be necessary to specify the other case, evaluate the inner
+block every time the condition is not satisfied.  It is done using the
+@code{not} attribute:
+
+@example
+<CONDITION name="auth.user" value="Guest" not="yes">
+...
+</CONDITION>
+@end example
+
+In this case, the inner block is evaluated every time the
+@code{auth.user} is different than "Guest".
+
+@subsubsection DEFINE element
+The @code{DEFINE} block is used to specify a value for a variable that
+later can be accessed by the server.
+This is the way to specify variables that it is possible to specify in
+the security file (not all variables are allowed to be defined here),
+overloading the value specified in the virtual host or in the server
+global configuration.
+The syntax for the @code{DEFINE} command is:
+@example
+<DEFINE name="http.error.file.404" value="404.html"/>
+@end example
+
+In the previous example the HTTP 404 error page was replaced with a
+customized HTML page.
+
+As the same configuration file can be used by different contexts, as
+a web host or a FTP site, any variable has meaning only in its
+original environment, define @code{http.error.file.404} in a FTP site
+will not have any effect.
+
+@subsubsection PERMISSION element
+The @code{PERMISSION} element has the same syntax used in the first
+authorization phase, the only difference is that username and password
+are not specified.
+
+@example
+<PERMISSION READ="NO" EXECUTE="NO" BROWSE="NO" DELETE="NO" WRITE="NO">
+@end example
+
+The previous example denies any access to the resource, replacing any
+value found previously.
+
+@subsubsection RETURN element
+The @code{RETURN} element allows to exit immediately from the XML flow
+without consider any other other command specified in the file.
+
+It has an additional attribute @code{value} that must be set to the
+value @code{ALLOW} to keep the previous found attribute mask.
+
+To immediately return from the XML file and at the same time deny any
+access, without care of the previous found permission mask, you must
+do:
+@example
+<RETURN value="DENY" />
+@end example
+
+Differently, to return from the flow keeping the found permission mask
+there is need to do like:
+@example
+<RETURN value="DENY" />
+@end example
+
+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.





From MAILER-DAEMON Sat Oct 18 16:38:16 2008
Received: from mailman by lists.gnu.org with archive (Exim 4.43)
	id 1KrIYx-0000xz-SQ
	for mharc-myserver-commit@gnu.org; Sat, 18 Oct 2008 16:38:15 -0400
Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43)
	id 1KrIYx-0000xb-AB
	for myserver-commit@gnu.org; Sat, 18 Oct 2008 16:38:15 -0400
Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43)
	id 1KrIYv-0000xE-J0
	for myserver-commit@gnu.org; Sat, 18 Oct 2008 16:38:13 -0400
Received: from [199.232.76.173] (port=54465 helo=monty-python.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.43) id 1KrIYv-0000wy-CJ
	for myserver-commit@gnu.org; Sat, 18 Oct 2008 16:38:13 -0400
Received: from savannah.gnu.org ([199.232.41.3]:42026 helo=sv.gnu.org)
	by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32)
	(Exim 4.60) (envelope-from <INVALID.NOREPLY@gnu.org>)
	id 1KrIYv-0005jn-2x
	for myserver-commit@gnu.org; Sat, 18 Oct 2008 16:38:13 -0400
Received: from cvs.savannah.gnu.org ([199.232.41.69])
	by sv.gnu.org with esmtp (Exim 4.63)
	(envelope-from <INVALID.NOREPLY@gnu.org>) id 1KrIYu-0008FW-Cm
	for myserver-commit@gnu.org; Sat, 18 Oct 2008 20:38:12 +0000
Received: from gscrivano by cvs.savannah.gnu.org with local (Exim 4.63)
	(envelope-from <gscrivano@savannah.gnu.org>) id 1KrIYu-0008FS-33
	for myserver-commit@gnu.org; Sat, 18 Oct 2008 20:38:12 +0000
MIME-Version: 1.0
Errors-To: gscrivano
To: myserver-commit@gnu.org
X-Mailer: SVN::Notify 2.64: http://search.cpan.org/dist/SVN-Notify/
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
From: Giuseppe Scrivano <gscrivano@gnu.org>
Message-Id: <E1KrIYu-0008FS-33@cvs.savannah.gnu.org>
Date: Sat, 18 Oct 2008 20:38:12 +0000
X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 3)
Subject: [myserver-commit] [2889] Refactoring for `Cgi::send()'.
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/pipermail/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, 18 Oct 2008 20:38:15 -0000

Revision: 2889
          http://svn.sv.gnu.org/viewvc/?view=rev&root=myserver&revision=2889
Author:   gscrivano
Date:     2008-10-18 20:38:11 +0000 (Sat, 18 Oct 2008)

Log Message:
-----------
Refactoring for `Cgi::send()'.  Added `Pipe::waitForData()', some parts of code was changed to use it.

Modified Paths:
--------------
    trunk/myserver/include/base/pipe/pipe.h
    trunk/myserver/include/http_handler/cgi/cgi.h
    trunk/myserver/src/base/pipe/pipe.cpp
    trunk/myserver/src/connections_scheduler/connections_scheduler.cpp
    trunk/myserver/src/http_handler/cgi/cgi.cpp
    trunk/myserver/src/server/clients_thread.cpp
    trunk/myserver/tests/test_pipe.cpp

Modified: trunk/myserver/include/base/pipe/pipe.h
===================================================================
--- trunk/myserver/include/base/pipe/pipe.h	2008-10-18 16:40:54 UTC (rev 2888)
+++ trunk/myserver/include/base/pipe/pipe.h	2008-10-18 20:38:11 UTC (rev 2889)
@@ -40,6 +40,7 @@
 	void closeRead();
 	void closeWrite();
 	bool pipeTerminated(){return terminated;}
+  int waitForData (int sec, int usec);
 private:
   bool terminated;
 #ifdef NOT_WIN

Modified: trunk/myserver/include/http_handler/cgi/cgi.h
===================================================================
--- trunk/myserver/include/http_handler/cgi/cgi.h	2008-10-18 16:40:54 UTC (rev 2888)
+++ trunk/myserver/include/http_handler/cgi/cgi.h	2008-10-18 20:38:11 UTC (rev 2889)
@@ -24,15 +24,24 @@
 #include <include/protocol/http/http_headers.h>
 #include <include/protocol/http/http_data_handler.h>
 
+class Pipe;
+class FiltersChain;
+
 class Cgi : public HttpDataHandler
 {
-  static int cgiTimeout;
 public:
-  static void setTimeout(int);
-  static int getTimeout();
-	virtual int send(HttpThreadContext*, ConnectionPtr s,
+  static void setTimeout (int);
+  static int getTimeout ();
+	virtual int send (HttpThreadContext*, ConnectionPtr s,
                    const char* scriptpath, const char* exec = 0,
                    int execute = 0, int onlyHeader = 0);
+private:
+  int sendData (HttpThreadContext* td, Pipe &stdOutFile, FiltersChain& chain, 
+                Process& cgiProc, int onlyHeader, bool nph);
+  int sendHeader (HttpThreadContext* td, Pipe &stdOutFile, FiltersChain& chain, 
+                  Process& cgiProc, int onlyHeader, bool nph, u_long procStartTime, 
+                  bool keepalive, bool useChunks, int *ret);
+
+  static int cgiTimeout;
 };
 #endif
-

Modified: trunk/myserver/src/base/pipe/pipe.cpp
===================================================================
--- trunk/myserver/src/base/pipe/pipe.cpp	2008-10-18 16:40:54 UTC (rev 2888)
+++ trunk/myserver/src/base/pipe/pipe.cpp	2008-10-18 20:38:11 UTC (rev 2889)
@@ -98,7 +98,7 @@
 #ifdef NOT_WIN
 
 #ifdef HAVE_PIPE
-  return pipe(handles);
+  return pipe (handles);
 #else
   return 1;
 #endif
@@ -271,3 +271,45 @@
     writeHandle = 0;
 #endif
 }
+
+/*!
+ *Wait until new data is ready.  Do not wait more 
+ *than the specified timeout.
+ *\param sec Seconds part of the timeout.
+ *\param sec Micro seconds part of the timeout.
+ */
+int Pipe::waitForData (int sec, int usec)
+{
+#ifdef NOT_WIN
+
+#if HAVE_PIPE
+  struct timeval tv;
+  fd_set readfds;
+  int ret;
+  tv.tv_sec = sec;
+  tv.tv_usec = usec;
+
+  FD_ZERO(&readfds);
+
+  FD_SET(handles[0], &readfds);
+
+  ret = ::select(handles[0] + 1, &readfds, NULL, NULL, &tv);
+
+  if(ret == -1 || ret == 0)
+  {
+    return 0;
+  }
+
+  if (FD_ISSET(handles[0], &readfds))
+    return 1;
+
+  return 0;
+#else
+  return 0;
+#endif
+
+#else
+  return WaitForSingleObject (readHandle, sec * 1000 + usec / 1000) == WAIT_OBJECT_0;
+#endif
+
+}

Modified: trunk/myserver/src/connections_scheduler/connections_scheduler.cpp
===================================================================
--- trunk/myserver/src/connections_scheduler/connections_scheduler.cpp	2008-10-18 16:40:54 UTC (rev 2888)
+++ trunk/myserver/src/connections_scheduler/connections_scheduler.cpp	2008-10-18 20:38:11 UTC (rev 2889)
@@ -546,7 +546,7 @@
   dispatcherArg.terminate = true;
 
   if(server)
-    max = server->getNumThreads() * 10;
+    max = server->getNumThreads() * 2;
 
   for(u_long i = 0; i < max; i++)
   {

Modified: trunk/myserver/src/http_handler/cgi/cgi.cpp
===================================================================
--- trunk/myserver/src/http_handler/cgi/cgi.cpp	2008-10-18 16:40:54 UTC (rev 2888)
+++ trunk/myserver/src/http_handler/cgi/cgi.cpp	2008-10-18 20:38:11 UTC (rev 2889)
@@ -66,25 +66,16 @@
    *Use this flag to check if the CGI executable is 
    *nph (Non Parsed Header).  
    */
-  int nph = 0;
+  bool nph = false;
   ostringstream cmdLine;
-  u_long nbw = 0;
-  u_long nbw2 = 0;
 
   FiltersChain chain;
   Process cgiProc;
-  u_long procStartTime;
 
   StartProcInfo spi;
   string moreArg;
   string tmpCgiPath;
   string tmpScriptPath;
-  u_long nBytesRead;
-  u_long headerSize = 0;
-  bool useChunks = false;
-  bool keepalive = false;
-  bool headerCompleted = false;
-  u_long headerOffset = 0;
 
   /*!
    *Standard CGI uses STDOUT to output the result and the STDIN 
@@ -92,16 +83,14 @@
    */
   Pipe stdOutFile;
   File stdInFile;
-  int subString = cgipath[0] == '"';
-  int len = strlen(cgipath);
+  int len = strlen (cgipath);
   int i;
 
-  td->scriptPath.assign(scriptpath);
+  td->scriptPath.assign (scriptpath);
   
   
+  int subString = cgipath[0] == '"';
   /* Do not modify the text between " and ".  */
-
-  /* Are we in a string block?  */
   for(i = 1; i < len; i++)
   {
     if(!subString && cgipath[i] == ' ')
@@ -110,8 +99,6 @@
       subString = !subString;
   }
 
-  checkDataChunks(td, &keepalive, &useChunks);
-
   /*
    *Save the cgi path and the possible arguments.
    *the (x < len) case is when additional arguments are specified. 
@@ -151,27 +138,23 @@
       args = &td->pathInfo[1];
     
     if(cgipath && strlen(cgipath))
-      cmdLine << td->cgiRoot << "/" << td->cgiFile << " " << moreArg << " " 
+      cmdLine << tmpCgiPath << " " << moreArg << " " 
               << td->scriptFile <<  (args ? args : "" ) ;
     else
-      cmdLine << td->scriptDir << "/" << td->scriptFile << " " 
-              << moreArg << " " << (args ? args : "" );
+      cmdLine << tmpScriptPath << moreArg << " " << (args ? args : "" );
 
-    if(td->scriptFile.length() > 4 && td->scriptFile[0] == 'n'
-       && td->scriptFile[1] == 'p' && td->scriptFile[2] == 'h' 
-       && td->scriptFile[3] == '-' )
-      nph = 1; 
-    else
-      nph = 0;
+    nph = td->scriptFile.length() > 4 && td->scriptFile[0] == 'n'
+      && td->scriptFile[1] == 'p' && td->scriptFile[2] == 'h' 
+      && td->scriptFile[3] == '-' ;
 
     if(cgipath && strlen(cgipath))
     {
-      spi.cmd.assign(td->cgiRoot);
-      spi.cmd.append("/");
-      spi.cmd.append(td->cgiFile);
+      spi.cmd.assign(tmpCgiPath);
+      spi.arg.append(" ");
       spi.arg.assign(moreArg);
       spi.arg.append(" ");
       spi.arg.append(td->scriptFile);
+
       if(args)
       {
         spi.arg.append(" ");
@@ -240,9 +223,9 @@
     if(td->cgiFile.length() > 4 && td->cgiFile[0] == 'n'  
        && td->cgiFile[1] == 'p' && td->cgiFile[2] == 'h' 
        && td->cgiFile[3] == '-' )
-      nph = 1;
+      nph = true;
     else
-      nph = 0;
+      nph = false;
   }
 
   /*
@@ -267,18 +250,12 @@
   }
   
   /*
-   *Build the environment string used by the CGI started
-   *by the execHiddenProcess(...) function.
+   *Build the environment string used by the CGI process.
    *Use the td->buffer2 to build the environment string.
    */
   (td->buffer2->getBuffer())[0] = '\0';
   Env::buildEnvironmentString(td, td->buffer2->getBuffer());
   
-  /*
-   *With this code we execute the CGI process.
-   *Fill the StartProcInfo struct with the correct values and use it
-   *to run the process.
-   */
   spi.cmdLine = cmdLine.str();
   spi.cwd.assign(td->scriptDir);
 
@@ -312,52 +289,166 @@
     stdOutFile.closeWrite();  
   }
 
+  int ret = sendData (td, stdOutFile, chain, cgiProc, onlyHeader, nph);
+
+  stdOutFile.close();
+  stdInFile.close();
+  cgiProc.terminateProcess();
+  chain.clearAllFilters(); 
+
+
+  chain.clearAllFilters();   
+
+  cgiProc.terminateProcess();
+
+  /* Delete the file only if it was created by the CGI module.  */
+  if(!td->inputData.getHandle())
+    FilesUtility::deleteFile(td->inputDataPath.c_str());
+
+  return ret;
+}
+
+/*
+ *Read data from the CGI process and send it back to the client.
+ */
+int Cgi::sendData (HttpThreadContext* td, Pipe &stdOutFile, FiltersChain& chain, 
+                   Process &cgiProc, int onlyHeader, bool nph)
+{
+  u_long nbw = 0;
+  u_long nbw2 = 0;
+  u_long nBytesRead = 0;
+  u_long procStartTime;
+  bool useChunks = false;
+  bool keepalive = false;
+  int ret = 0;
+
   /* Reset the buffer2 length counter. */
   td->buffer2->setLength(0);
 
-  /* Read the CGI output.  */
-  nBytesRead = 0;
-
   procStartTime = getTicks();
 
-  headerSize = 0;
+  checkDataChunks(td, &keepalive, &useChunks);
 
+  if (sendHeader (td, stdOutFile, chain, cgiProc, onlyHeader, nph, procStartTime, keepalive, useChunks, &ret))
+  {
+    return ret;
+  }
+
+  if(!nph && onlyHeader)
+  {
+    return 1;
+  }
+
+
+  /* Create the output filters chain.  */
+  if(td->mime && Server::getInstance()->getFiltersFactory()->chain(&chain,
+                                                                   td->mime->filters, 
+                                                                   td->connection->socket, 
+                                                                   &nbw, 
+                                                                   1))
+  {
+    td->connection->host->warningsLogWrite("Cgi: Error loading filters");
+    return td->http->raiseHTTPError(500);
+  }
+
+  if (td->response.getStatusType () == HttpResponseHeader::SUCCESSFUL)
+  {
+    /* Send the rest of the data until we can read from the pipe.  */
+    for (;;)
+    {
+      nBytesRead = 0;
+      int aliveProcess = 0;
+      u_long ticks = getTicks() - procStartTime;
+
+      if (ticks >= cgiTimeout)
+        break;
+
+      if (stdOutFile.waitForData ((cgiTimeout - ticks) / 1000, (cgiTimeout - ticks) % 1000) == 0)
+        break;
+
+      aliveProcess = !(stdOutFile.pipeTerminated ());
+
+      /* Read data from the process standard output file.  */
+      if (stdOutFile.read(td->buffer2->getBuffer (), 
+                          td->buffer2->getRealLength (), 
+                          &nBytesRead))
+      {
+        return 0;      
+      }
+      
+      if (!aliveProcess && !nBytesRead)
+        break;
+      
+      if (nBytesRead && 
+          HttpDataHandler::appendDataToHTTPChannel (td, 
+                                                    td->buffer2->getBuffer(),
+                                                    nBytesRead,
+                                                    &(td->outputData),
+                                                    &chain,
+                                                    td->appendOutputs, 
+                                                    useChunks))
+      {
+        return 0;       
+      }
+      
+      nbw += nBytesRead;
+    }
+  
+  
+    /* Send the last null chunk if needed.  */
+    if(useChunks && chain.write("0\r\n\r\n", 5, &nbw2))
+    {
+      return 0;       
+    }
+  }
+
+  /* Update the Content-Length field for logging activity.  */
+  td->sentData += nbw;
+  
+  return 1;  
+}
+
+/*!
+ *Send the HTTP header.
+ *\return nonzero if the reply is already complete.
+ */
+int Cgi::sendHeader (HttpThreadContext* td, Pipe &stdOutFile, FiltersChain& chain, 
+                     Process& cgiProc, int onlyHeader, bool nph, u_long procStartTime, 
+                     bool keepalive, bool useChunks, int *ret)
+{
+  u_long headerSize = 0;
+  bool headerCompleted = false;
+  u_long headerOffset = 0;
+  u_long nbw = 0;
+  u_long nBytesRead;
   /* Parse initial chunks of data looking for the HTTP header.  */
   while(!headerCompleted && !nph)
   {
+    u_long ticks = getTicks() - procStartTime;
     bool term;
+    nBytesRead = 0;
     /* Do not try to read using a small buffer as this has some
        bad influence on the performances.  */
     if(td->buffer2->getRealLength() - headerOffset - 1 < 512)
       break;
     
-    nBytesRead = 0;
-    
     term = stdOutFile.pipeTerminated();
-      
-    if(stdOutFile.read(td->buffer2->getBuffer() + headerOffset, 
-                       td->buffer2->getRealLength() - headerOffset - 1, 
-                       &nBytesRead))
+
+    if (stdOutFile.waitForData ((cgiTimeout - ticks) / 1000, (cgiTimeout - ticks) % 1000) == 0)
+      break;
+
+    if (stdOutFile.read (td->buffer2->getBuffer() + headerOffset, 
+                         td->buffer2->getRealLength() - headerOffset - 1, 
+                         &nBytesRead))
     {
-      stdInFile.close();
-      stdOutFile.close();
-      td->connection->host->warningsLogWrite
-        ("Cgi: Error reading from CGI std out file");
-      chain.clearAllFilters();
-      return td->http->raiseHTTPError(500);
+      *ret = td->http->raiseHTTPError(500);
+      return 1;
     }
       
-    if(nBytesRead == 0)
+    if (nBytesRead == 0 && term)
     {
-      if((int)(getTicks() - procStartTime) > cgiTimeout)
-         break;
-      else
-      {
-        if(term)
-          break;
-        
-        continue;
-      }
+      *ret = td->http->raiseHTTPError(500);
+      return 1;
     }
 
     headerOffset += nBytesRead;
@@ -367,17 +458,10 @@
     
     if(headerOffset == 0)
     {
-      td->connection->host->warningsLogWrite("Cgi: Error CGI zero bytes read");
-      td->http->raiseHTTPError(500);
-      stdOutFile.close();
-      stdInFile.close();
-      chain.clearAllFilters(); 
-      cgiProc.terminateProcess();
-      return 0;
+      *ret = td->http->raiseHTTPError(500);
+      return 1;
     }
 
-    /* Standard CGI can include an extra HTTP header.  */
-    nbw = 0;
     for(u_long i = std::max(0, (int)headerOffset - (int)nBytesRead - 10); 
         i < headerOffset; i++)
     {
@@ -431,11 +515,7 @@
        */
       if(location && location->length())
       {
-        td->http->sendHTTPRedirect(location->c_str());
-        stdOutFile.close();
-        stdInFile.close();
-        chain.clearAllFilters(); 
-        cgiProc.terminateProcess();
+        *ret = td->http->sendHTTPRedirect(location->c_str());
         return 1;
       }
 
@@ -444,44 +524,15 @@
 
       td->buffer->setLength((u_int)strlen(td->buffer->getBuffer()));
 
-      if(chain.write(td->buffer->getBuffer(),
-                     static_cast<int>(td->buffer->getLength()), &nbw2))
+      if (chain.write(td->buffer->getBuffer(),
+                      static_cast<int>(td->buffer->getLength()), &nbw))
       {
-        stdInFile.close();
-        stdOutFile.close();
-        chain.clearAllFilters(); 
-        /* Remove the connection on sockets error.  */
-        cgiProc.terminateProcess();
-        return 0;
+        *ret = 0;
+        return 1;
       }
     }
   }
 
-  if(!nph && onlyHeader)
-  {
-    stdOutFile.close();
-    stdInFile.close();
-    chain.clearAllFilters(); 
-    cgiProc.terminateProcess();
-    return 1;
-  }
-
-
-  /* Create the output filters chain.  */
-  if(td->mime && Server::getInstance()->getFiltersFactory()->chain(&chain,
-                                                                   td->mime->filters, 
-                                                                   td->connection->socket, 
-                                                                   &nbw, 
-                                                                   1))
-  {
-    td->connection->host->warningsLogWrite("Cgi: Error loading filters");
-    stdOutFile.close();
-    stdInFile.close();
-    cgiProc.terminateProcess();
-    chain.clearAllFilters(); 
-    return td->http->raiseHTTPError(500);
-  }
-
   if(headerOffset - headerSize)
   {
     /* Flush the buffer.  Data from the header parsing can be present.  */
@@ -493,103 +544,14 @@
                                                 td->appendOutputs, 
                                                 useChunks))
     {
-      stdOutFile.close();
-      stdInFile.close();
-      chain.clearAllFilters(); 
-      /* Remove the connection on sockets error.  */
-      cgiProc.terminateProcess();
       return 0;    
     }
 
-    nbw += headerOffset - headerSize;
+    td->sentData += headerOffset - headerSize;
   }
 
-  if (td->response.getStatusType () == HttpResponseHeader::SUCCESSFUL)
-  {
-    /* Send the rest of the data until we can read from the pipe.  */
-    for(;;)
-    {
-      int aliveProcess = 0;
 
-      /* Process timeout.  */
-      if((int)(getTicks() - procStartTime) > cgiTimeout)
-      {
-        stdOutFile.close();
-        stdInFile.close();
-        chain.clearAllFilters(); 
-        /* Remove the connection on sockets error.  */
-        cgiProc.terminateProcess();
-        return 0;       
-      }
-    
-      aliveProcess = cgiProc.isProcessAlive();
-
-      /* Read data from the process standard output file.  */
-      if(stdOutFile.read(td->buffer2->getBuffer(), 
-                         td->buffer2->getRealLength(), 
-                         &nBytesRead))
-      {
-        stdOutFile.close();
-        stdInFile.close();
-        chain.clearAllFilters(); 
-        /* Remove the connection on sockets error.  */
-        cgiProc.terminateProcess();
-        return 0;      
-      }
-      
-      if(!aliveProcess && !nBytesRead)
-        break;
-      
-      if(nBytesRead && 
-         HttpDataHandler::appendDataToHTTPChannel(td, 
-                                                  td->buffer2->getBuffer(),
-                                                  nBytesRead,
-                                                  &(td->outputData),
-                                                  &chain,
-                                                  td->appendOutputs, 
-                                                  useChunks))
-      {
-        stdOutFile.close();
-        stdInFile.close();
-        chain.clearAllFilters(); 
-        /* Remove the connection on sockets error.  */
-        cgiProc.terminateProcess();
-        return 0;       
-      }
-      
-      nbw += nBytesRead;
-    }
-  
-  
-    /* Send the last null chunk if needed.  */
-    if(useChunks && chain.write("0\r\n\r\n", 5, &nbw2))
-    {
-      stdOutFile.close();
-      stdInFile.close();
-      chain.clearAllFilters(); 
-  
-      /* Remove the connection on sockets error.  */
-      cgiProc.terminateProcess();
-      return 0;       
-    }
-  }
-
-  /* Update the Content-Length field for logging activity.  */
-  td->sentData += nbw;
-
-  chain.clearAllFilters();   
-
-  cgiProc.terminateProcess();
-
-  /* Close the stdin and stdout files used by the CGI.  */
-  stdOutFile.close();
-  stdInFile.close();
-
-  /* Delete the file only if it was created by the CGI module.  */
-  if(!td->inputData.getHandle())
-    FilesUtility::deleteFile(td->inputDataPath.c_str());
-  
-  return 1;  
+  return 0;
 }
 
 /*!

Modified: trunk/myserver/src/server/clients_thread.cpp
===================================================================
--- trunk/myserver/src/server/clients_thread.cpp	2008-10-18 16:40:54 UTC (rev 2888)
+++ trunk/myserver/src/server/clients_thread.cpp	2008-10-18 20:38:11 UTC (rev 2889)
@@ -187,7 +187,7 @@
        */
       if((!ct->isStatic()) && ct->isToDestroy())
       {
-        Thread::wait(1);
+        Thread::wait(1000);
         continue;
       }
 

Modified: trunk/myserver/tests/test_pipe.cpp
===================================================================
--- trunk/myserver/tests/test_pipe.cpp	2008-10-18 16:40:54 UTC (rev 2888)
+++ trunk/myserver/tests/test_pipe.cpp	2008-10-18 20:38:11 UTC (rev 2889)
@@ -30,6 +30,7 @@
   CPPUNIT_TEST( testCreateClose ); 
   CPPUNIT_TEST( testWriteRead );
   CPPUNIT_TEST( testInverted );
+  CPPUNIT_TEST( testWaitForData );
   CPPUNIT_TEST_SUITE_END();
 
   Pipe *pipe;
@@ -87,7 +88,27 @@
     pipe->close();
   }
 
+  void testWaitForData()
+  {
+    char outBuff[256];
+    char inBuff[256];
+    u_long nbw;
+    u_long nbr;
 
+    strcpy(outBuff, "MyServer is a powerful and easy to configure web server");
+
+    int ret = pipe->create();
+
+    CPPUNIT_ASSERT_EQUAL(pipe->waitForData(0, 100), 0);
+
+    ret = pipe->write(outBuff, 256, &nbw);
+
+    CPPUNIT_ASSERT_EQUAL(pipe->waitForData(0, 100), 1);
+
+    pipe->close();
+  }
+
+
   void testInverted()
   {
     Pipe pipeInv;





From MAILER-DAEMON Sat Oct 18 17:02:43 2008
Received: from mailman by lists.gnu.org with archive (Exim 4.43)
	id 1KrIwd-0008UG-9H
	for mharc-myserver-commit@gnu.org; Sat, 18 Oct 2008 17:02:43 -0400
Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43)
	id 1KrIwc-0008UB-1r
	for myserver-commit@gnu.org; Sat, 18 Oct 2008 17:02:42 -0400
Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43)
	id 1KrIwZ-0008Tz-Hy
	for myserver-commit@gnu.org; Sat, 18 Oct 2008 17:02:40 -0400
Received: from [199.232.76.173] (port=50288 helo=monty-python.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.43) id 1KrIwZ-0008Tw-EK
	for myserver-commit@gnu.org; Sat, 18 Oct 2008 17:02:39 -0400
Received: from savannah.gnu.org ([199.232.41.3]:36192 helo=sv.gnu.org)
	by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32)
	(Exim 4.60) (envelope-from <INVALID.NOREPLY@gnu.org>)
	id 1KrIwY-0008W2-Tp
	for myserver-commit@gnu.org; Sat, 18 Oct 2008 17:02:39 -0400
Received: from cvs.savannah.gnu.org ([199.232.41.69])
	by sv.gnu.org with esmtp (Exim 4.63)
	(envelope-from <INVALID.NOREPLY@gnu.org>) id 1KrIwY-0001CT-3Z
	for myserver-commit@gnu.org; Sat, 18 Oct 2008 21:02:38 +0000
Received: from gscrivano by cvs.savannah.gnu.org with local (Exim 4.63)
	(envelope-from <gscrivano@savannah.gnu.org>) id 1KrIwX-0001CO-Oy
	for myserver-commit@gnu.org; Sat, 18 Oct 2008 21:02:37 +0000
MIME-Version: 1.0
Errors-To: gscrivano
To: myserver-commit@gnu.org
X-Mailer: SVN::Notify 2.64: http://search.cpan.org/dist/SVN-Notify/
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
From: Giuseppe Scrivano <gscrivano@gnu.org>
Message-Id: <E1KrIwX-0001CO-Oy@cvs.savannah.gnu.org>
Date: Sat, 18 Oct 2008 21:02:37 +0000
X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 3)
Subject: [myserver-commit] [2890] Code refactoring:
 changed some names and added log messages for CGI timeouts.
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/pipermail/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, 18 Oct 2008 21:02:42 -0000

Revision: 2890
          http://svn.sv.gnu.org/viewvc/?view=rev&root=myserver&revision=2890
Author:   gscrivano
Date:     2008-10-18 21:02:37 +0000 (Sat, 18 Oct 2008)

Log Message:
-----------
Code refactoring: changed some names and added log messages for CGI timeouts.

Modified Paths:
--------------
    trunk/myserver/include/base/process/process.h
    trunk/myserver/src/base/process/process.cpp
    trunk/myserver/src/base/process/process_server_manager.cpp
    trunk/myserver/src/http_handler/cgi/cgi.cpp
    trunk/myserver/src/http_handler/wincgi/wincgi.cpp

Modified: trunk/myserver/include/base/process/process.h
===================================================================
--- trunk/myserver/include/base/process/process.h	2008-10-18 20:38:11 UTC (rev 2889)
+++ trunk/myserver/include/base/process/process.h	2008-10-18 21:02:37 UTC (rev 2890)
@@ -53,8 +53,6 @@
 
 class Process
 {
-private:
-  int pid;
 public:
 #ifdef HAVE_PTHREAD
 	static Mutex forkMutex;
@@ -63,8 +61,8 @@
 	static void forkChild();
 #endif
 	static void initialize();
-  int execHiddenProcess(StartProcInfo* spi, u_long timeout = 0xFFFFFFFF);
-  int execConcurrentProcess(StartProcInfo* spi);
+  int execAndWait (StartProcInfo* spi, u_long timeout = 0xFFFFFFFF);
+  int exec (StartProcInfo* spi);
   int terminateProcess();
   int isProcessAlive();
   static int setuid(u_long);
@@ -72,5 +70,10 @@
 	static int setAdditionalGroups(u_long len, u_long *groups);
   Process();
   ~Process();
+
+  /*! Return the process ID.  */
+  int getPid (){return pid;}
+private:
+  int pid;
 };
 #endif

Modified: trunk/myserver/src/base/process/process.cpp
===================================================================
--- trunk/myserver/src/base/process/process.cpp	2008-10-18 20:38:11 UTC (rev 2889)
+++ trunk/myserver/src/base/process/process.cpp	2008-10-18 21:02:37 UTC (rev 2890)
@@ -47,12 +47,11 @@
 #endif
 
 /*!
- *Execute an hidden process and wait until it ends itself or its execution
- *time is greater than the timeout value.
+ *Execute a process and wait for its execution or the timeout.
  *Return -1 on fails.
  *Return 0 on success.
  */
-int Process::execHiddenProcess(StartProcInfo *spi, u_long timeout)
+int Process::execAndWait (StartProcInfo *spi, u_long timeout)
 {
   int ret = 0;
 #ifdef NOT_WIN
@@ -309,7 +308,7 @@
  *Return -1 on fails.
  *Return the new process identifier on success.
  */
-int Process::execConcurrentProcess(StartProcInfo* spi)
+int Process::exec(StartProcInfo* spi)
 {
   int ret;
   pid = 0;

Modified: trunk/myserver/src/base/process/process_server_manager.cpp
===================================================================
--- trunk/myserver/src/base/process/process_server_manager.cpp	2008-10-18 20:38:11 UTC (rev 2889)
+++ trunk/myserver/src/base/process/process_server_manager.cpp	2008-10-18 21:02:37 UTC (rev 2890)
@@ -443,24 +443,21 @@
         spi.cmdLine.assign(path);
         server->path.assign(path);
 
-        spi.stdOut = spi.stdError =(FileHandle) -1;
-        if(server->process.execConcurrentProcess(&spi) == -1)
+        spi.stdOut = spi.stdError = (FileHandle) -1;
+        if (server->process.exec (&spi) == -1)
         {
           server->socket.close();
-          //return 1; allow IPv6
         }
         
       }
       else
       {
         server->socket.close();
-        //return 1; allow IPv6
     }
     }
     else
     {
       server->socket.close();
-      //return 1; allow IPv6
     }
   }
   else
@@ -494,7 +491,7 @@
 
       spi.stdOut = spi.stdError =(FileHandle) -1;
 
-      if(server->process.execConcurrentProcess(&spi) == -1)
+      if(server->process.exec (&spi) == -1)
       {
         server->socket.close();
         return 1;

Modified: trunk/myserver/src/http_handler/cgi/cgi.cpp
===================================================================
--- trunk/myserver/src/http_handler/cgi/cgi.cpp	2008-10-18 20:38:11 UTC (rev 2889)
+++ trunk/myserver/src/http_handler/cgi/cgi.cpp	2008-10-18 21:02:37 UTC (rev 2890)
@@ -276,7 +276,7 @@
 
   /* Execute the CGI process. */
   {
-    if( cgiProc.execConcurrentProcess(&spi) == -1)
+    if( cgiProc.exec (&spi) == -1)
     {
       stdInFile.close();
       stdOutFile.close();
@@ -360,12 +360,15 @@
       int aliveProcess = 0;
       u_long ticks = getTicks() - procStartTime;
 
-      if (ticks >= cgiTimeout)
+      if (ticks >= cgiTimeout || 
+          stdOutFile.waitForData ((cgiTimeout - ticks) / 1000, (cgiTimeout - ticks) % 1000) == 0)
+      {
+        ostringstream msg;
+        msg << "Cgi: timeout for process " << cgiProc.getPid();
+        td->connection->host->warningsLogWrite (msg.str ().c_str ());
         break;
+      }
 
-      if (stdOutFile.waitForData ((cgiTimeout - ticks) / 1000, (cgiTimeout - ticks) % 1000) == 0)
-        break;
-
       aliveProcess = !(stdOutFile.pipeTerminated ());
 
       /* Read data from the process standard output file.  */
@@ -435,7 +438,12 @@
     term = stdOutFile.pipeTerminated();
 
     if (stdOutFile.waitForData ((cgiTimeout - ticks) / 1000, (cgiTimeout - ticks) % 1000) == 0)
+    {
+      ostringstream msg;
+      msg << "Cgi: timeout for process " << cgiProc.getPid ();
+      td->connection->host->warningsLogWrite (msg.str ().c_str ());    
       break;
+    }
 
     if (stdOutFile.read (td->buffer2->getBuffer() + headerOffset, 
                          td->buffer2->getRealLength() - headerOffset - 1, 

Modified: trunk/myserver/src/http_handler/wincgi/wincgi.cpp
===================================================================
--- trunk/myserver/src/http_handler/wincgi/wincgi.cpp	2008-10-18 20:38:11 UTC (rev 2889)
+++ trunk/myserver/src/http_handler/wincgi/wincgi.cpp	2008-10-18 21:02:37 UTC (rev 2890)
@@ -307,7 +307,7 @@
   spi.cmdLine.append(dataFilePath);
   spi.cwd.assign(pathname);
   spi.envString = 0;
-  if (proc.execHiddenProcess(&spi, timeout))
+  if (proc.execAndWait (&spi, timeout))
   {
     ostringstream msg;
     msg << "WinCGI: Error executing process " << filename;





From MAILER-DAEMON Sun Oct 19 11:30:28 2008
Received: from mailman by lists.gnu.org with archive (Exim 4.43)
	id 1KraEe-0008LX-03
	for mharc-myserver-commit@gnu.org; Sun, 19 Oct 2008 11:30:28 -0400
Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43)
	id 1KraEc-0008Kv-A9
	for myserver-commit@gnu.org; Sun, 19 Oct 2008 11:30:26 -0400
Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43)
	id 1KraEb-0008KY-48
	for myserver-commit@gnu.org; Sun, 19 Oct 2008 11:30:25 -0400
Received: from [199.232.76.173] (port=40852 helo=monty-python.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.43) id 1KraEa-0008KP-VD
	for myserver-commit@gnu.org; Sun, 19 Oct 2008 11:30:25 -0400
Received: from savannah.gnu.org ([199.232.41.3]:43552 helo=sv.gnu.org)
	by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32)
	(Exim 4.60) (envelope-from <INVALID.NOREPLY@gnu.org>)
	id 1KraEZ-0005BH-NY
	for myserver-commit@gnu.org; Sun, 19 Oct 2008 11:30:24 -0400
Received: from cvs.savannah.gnu.org ([199.232.41.69])
	by sv.gnu.org with esmtp (Exim 4.63)
	(envelope-from <INVALID.NOREPLY@gnu.org>) id 1KraEY-0007lf-Fj
	for myserver-commit@gnu.org; Sun, 19 Oct 2008 15:30:22 +0000
Received: from gscrivano by cvs.savannah.gnu.org with local (Exim 4.63)
	(envelope-from <gscrivano@savannah.gnu.org>) id 1KraEX-0007lW-EP
	for myserver-commit@gnu.org; Sun, 19 Oct 2008 15:30:21 +0000
MIME-Version: 1.0
Errors-To: gscrivano
To: myserver-commit@gnu.org
X-Mailer: SVN::Notify 2.64: http://search.cpan.org/dist/SVN-Notify/
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
From: Giuseppe Scrivano <gscrivano@gnu.org>
Message-Id: <E1KraEX-0007lW-EP@cvs.savannah.gnu.org>
Date: Sun, 19 Oct 2008 15:30:21 +0000
X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 3)
Subject: [myserver-commit] [2891] Don'
 t use a temporary file to cache the FastCGI server reply but forward
 directly to the client .
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/pipermail/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, 19 Oct 2008 15:30:26 -0000

Revision: 2891
          http://svn.sv.gnu.org/viewvc/?view=rev&root=myserver&revision=2891
Author:   gscrivano
Date:     2008-10-19 15:30:12 +0000 (Sun, 19 Oct 2008)

Log Message:
-----------
Don't use a temporary file to cache the FastCGI server reply but forward directly to the client.  Removed polling from `Socket::recv' when a timeout is specified.

Modified Paths:
--------------
    trunk/myserver/include/http_handler/fastcgi/fastcgi.h
    trunk/myserver/src/base/socket/socket.cpp
    trunk/myserver/src/http_handler/fastcgi/fastcgi.cpp

Modified: trunk/myserver/include/http_handler/fastcgi/fastcgi.h
===================================================================
--- trunk/myserver/include/http_handler/fastcgi/fastcgi.h	2008-10-18 21:02:37 UTC (rev 2890)
+++ trunk/myserver/include/http_handler/fastcgi/fastcgi.h	2008-10-19 15:30:12 UTC (rev 2891)
@@ -149,31 +149,46 @@
 	HttpThreadContext* td;
   FastCgiServer* server;
 	Socket sock;
-	File tempOut;
+
+  bool useChunks;
+  bool keepalive;
+  bool headerSent;
 };
 
+class FiltersChain;
+
 class FastCgi : public HttpDataHandler
 {
 public:
-  static int getTimeout();
-  static void setTimeout(int);
-	FastCgi();
-	static int load(XmlParser*);
-	virtual int send(HttpThreadContext* td, ConnectionPtr connection,
+  static int getTimeout ();
+  static void setTimeout (int);
+	FastCgi ();
+	static int load (XmlParser*);
+	virtual int send (HttpThreadContext* td, ConnectionPtr connection,
                    const char* scriptpath, const char *cgipath, 
                    int execute = 0, int onlyHeader = 0);
-	static int unLoad();
+	static int unLoad ();
 private:
 	static ProcessServerManager *processServerManager;
 	static int timeout;
 	static int initialized;
 
-	void generateFcgiHeader( FcgiHeader&, int ,int, int );
-	Socket getFcgiConnection();
-	int buildFASTCGIEnvironmentString(HttpThreadContext*,char*,char*);
-	int sendFcgiBody(FcgiContext* con, char* buffer, int len, int type, int id);
-	FastCgiServer* isFcgiServerRunning(const char*);
-  FastCgiServer* runFcgiServer(FcgiContext*, const char*);
-	FastCgiServer* connect(FcgiContext*, const char*);
+  int handleHeader (FcgiContext* con, FiltersChain* chain, 
+                    bool *responseCompleted);
+  int sendData (FcgiContext* con, u_long dim, 
+                u_long timeout, FiltersChain* chain,
+                bool *responseCompleted, int onlyHeader);
+  int fastCgiRequest (FcgiContext* con, int id);
+  int readHeader (FcgiContext *con, FcgiHeader* header,
+                  u_long started, u_long timeout, int id);
+
+
+	void generateFcgiHeader ( FcgiHeader&, int ,int, int );
+	Socket getFcgiConnection ();
+	int buildFASTCGIEnvironmentString (HttpThreadContext*,char*,char*);
+	int sendFcgiBody (FcgiContext* con, char* buffer, int len, int type, int id);
+	FastCgiServer* isFcgiServerRunning (const char*);
+  FastCgiServer* runFcgiServer (FcgiContext*, const char*);
+	FastCgiServer* connect (FcgiContext*, const char*);
 };
 #endif

Modified: trunk/myserver/src/base/socket/socket.cpp
===================================================================
--- trunk/myserver/src/base/socket/socket.cpp	2008-10-18 21:02:37 UTC (rev 2890)
+++ trunk/myserver/src/base/socket/socket.cpp	2008-10-19 15:30:12 UTC (rev 2891)
@@ -622,18 +622,12 @@
  */
 int Socket::recv(char* buffer, int len, int flags, u_long timeout)
 {
-  u_long time = getTicks();
-  while(getTicks() - time < timeout)
-  {
-    /*! Check if there is data to read before do it. */
-    if(bytesToRead())
-      return recv(buffer, len, flags);
-  }
-  return 0;
+  if (dataOnRead (timeout / 1000, timeout % 1000))
+    return recv(buffer, len, flags);
 
+  return 0;
 }
 
-
 /*!
  *Receive data from the socket.
  *Returns -1 on errors.

Modified: trunk/myserver/src/http_handler/fastcgi/fastcgi.cpp
===================================================================
--- trunk/myserver/src/http_handler/fastcgi/fastcgi.cpp	2008-10-18 21:02:37 UTC (rev 2890)
+++ trunk/myserver/src/http_handler/fastcgi/fastcgi.cpp	2008-10-19 15:30:12 UTC (rev 2891)
@@ -62,10 +62,10 @@
                   int execute, int onlyHeader)
 {
   FcgiContext con;
-  FcgiBeginRequestBody tBody;
   u_long nbr = 0;
   FcgiHeader header;
   FiltersChain chain;
+  u_long nbw;
 
   u_long headerSize = 0;
 
@@ -74,9 +74,6 @@
 
   clock_t initialTicks;
 
-  string outDataPath;
-
-  int sizeEnvString;
   FastCgiServer* server = 0;
   int id;
   ostringstream cmdLine;
@@ -84,13 +81,11 @@
 
   string moreArg;
 
-  bool useChunks = false;
-  bool keepalive = false;
+  con.useChunks = false;
+  con.keepalive = false;
 
-  /*! Size of data chunks to use with STDIN.  */
-  const size_t maxStdinChunk = 8192;
-
   con.td = td;
+  con.headerSent = false;
 
   td->scriptPath.assign(scriptpath);
 
@@ -105,24 +100,20 @@
   chain.setProtocol(td->http);
   chain.setProtocolData(td);
   chain.setStream(td->connection->socket);
-  if(td->mime)
+ 
+  if(td->mime && Server::getInstance()->getFiltersFactory()->chain(&chain,
+                                                                   td->mime->filters,
+                                                                   td->connection->socket,
+                                                                   &nbw, 
+                                                                   1))
   {
-    u_long nbw;
-    if(td->mime && Server::getInstance()->getFiltersFactory()->chain(&chain,
-                                                    td->mime->filters,
-                                                    td->connection->socket,
-                                                    &nbw, 
-                                                    1))
-      {
-        td->connection->host->warningsLogWrite(
-                                             "FastCGI: Error loading filters");
-        chain.clearAllFilters();
-        return td->http->raiseHTTPError(500);
-      }
+    td->connection->host->warningsLogWrite("FastCGI: Error loading filters");
+    chain.clearAllFilters();
+    return td->http->raiseHTTPError(500);
   }
 
-  td->buffer->setLength(0);
-  td->buffer2->getAt(0) = '\0';
+  td->buffer->setLength (0);
+  td->buffer2->getAt (0) = '\0';
 
 
   {
@@ -200,20 +191,6 @@
 #endif
   }
 
-  Env::buildEnvironmentString(td, td->buffer->getBuffer());
-  sizeEnvString = buildFASTCGIEnvironmentString(td,td->buffer->getBuffer(),
-                                                td->buffer2->getBuffer());
-  if(sizeEnvString == -1)
-  {
-    td->buffer->setLength(0);
-    if(Server::getInstance()->getVerbosity() > 2)
-    {
-      *td->buffer << "FastCGI: Error to build env string" << '\0';
-      td->connection->host->warningsLogWrite(td->buffer->getBuffer());
-    }
-    chain.clearAllFilters();
-    return td->http->raiseHTTPError(500);
-  }
   td->inputData.close();
   if(td->inputData.openFile(td->inputDataPath, File::MYSERVER_OPEN_READ | 
                             File::MYSERVER_OPEN_ALWAYS |
@@ -229,12 +206,12 @@
     return td->http->raiseHTTPError(500);
   }
 
-  server = connect(&con, cmdLine.str().c_str());
+  server = connect (&con, cmdLine.str().c_str());
 
-  if(server == 0)
+  if (server == 0)
   {
-    td->buffer->setLength(0);
-    if(Server::getInstance()->getVerbosity() > 2)
+    td->buffer->setLength (0);
+    if(Server::getInstance ()->getVerbosity () > 2)
     {
       *td->buffer << "FastCGI: Error connecting to FastCGI "
                   << cmdLine.str().c_str() << " process" << '\0';
@@ -245,118 +222,12 @@
   }
 
   id = td->id + 1;
-  tBody.roleB1 = ( FCGIRESPONDER >> 8 ) & 0xff;
-  tBody.roleB0 = ( FCGIRESPONDER ) & 0xff;
-  tBody.flags = 0;
-  memset( tBody.reserved, 0, sizeof( tBody.reserved ) );
 
-  if(sendFcgiBody(&con, (char*)&tBody, sizeof(tBody), FCGIBEGIN_REQUEST, id))
+  if (fastCgiRequest (&con, id))
   {
-    td->buffer->setLength(0);
-    if(Server::getInstance()->getVerbosity() > 2)
-    {
-      *td->buffer<< "FastCGI: Error beginning the request" << '\0';
-      td->connection->host->warningsLogWrite(td->buffer->getBuffer());
-    }
-    chain.clearAllFilters();
-    con.sock.close();
     return td->http->raiseHTTPError(500);
   }
 
-  if(sendFcgiBody(&con,td->buffer2->getBuffer(), sizeEnvString,
-                  FCGIPARAMS, id))
-  {
-    td->buffer->setLength(0);
-    if(Server::getInstance()->getVerbosity() > 2)
-    {
-      *td->buffer << "FastCGI: Error sending params" << '\0';
-      td->connection->host->warningsLogWrite(td->buffer->getBuffer());
-    }
-    chain.clearAllFilters();
-    con.sock.close();
-    return td->http->raiseHTTPError(501);
-  }
-
-  if(sendFcgiBody(&con, 0, 0, FCGIPARAMS, id))
-  {
-    td->buffer->setLength(0);
-    if(Server::getInstance()->getVerbosity() > 2)
-    {
-      *td->buffer << "FastCGI: Error sending params" << '\0';
-      td->connection->host->warningsLogWrite(td->buffer->getBuffer());
-    }
-    chain.clearAllFilters();
-    con.sock.close();
-    return td->http->raiseHTTPError(500);
-  }
-
-  if(atoi(td->request.contentLength.c_str()))
-  {
-    td->buffer->setLength(0);
-
-
-    if(td->inputData.setFilePointer(0))
-      if(Server::getInstance()->getVerbosity() > 2)
-      {
-        *td->buffer << "FastCGI: Error sending POST data" << '\0';
-        td->connection->host->warningsLogWrite(td->buffer->getBuffer());
-      }
-
-    /*! Send the STDIN data.  */
-    do
-    {
-      if(td->inputData.readFromFile(td->buffer->getBuffer(),
-                                    maxStdinChunk, &nbr))
-      {
-        td->buffer->setLength(0);
-        if(Server::getInstance()->getVerbosity() > 2)
-        {
-          *td->buffer << "FastCGI: Error reading from file" << '\0';
-          td->connection->host->warningsLogWrite(
-                                                    td->buffer->getBuffer());
-        }
-        return td->http->sendHTTPhardError500();
-      }
-
-      if(!nbr)
-        break;
-
-      generateFcgiHeader( header, FCGISTDIN, id, nbr);
-      if(con.sock.send((char*)&header, sizeof(header), 0) == -1)
-      {
-        chain.clearAllFilters();
-        return td->http->raiseHTTPError(501);
-      }
-
-      if(con.sock.send(td->buffer->getBuffer(),nbr,0) == -1)
-      {
-        td->buffer->setLength(0);
-        if(Server::getInstance()->getVerbosity() > 2)
-        {
-          *td->buffer << "FastCGI: Error sending data" << '\0';
-          td->connection->host->warningsLogWrite(td->buffer->getBuffer());
-        }
-        chain.clearAllFilters();
-        return td->http->raiseHTTPError(500);
-      }
-    }while(nbr == maxStdinChunk);
-  }
-
-  /*! Final stdin chunk.  */
-  if(sendFcgiBody(&con, 0, 0, FCGISTDIN, id))
-  {
-    td->buffer->setLength(0);
-    if(Server::getInstance()->getVerbosity() > 2)
-    {
-      *td->buffer << "FastCGI: Error sending POST data" << '\0';
-      td->connection->host->
-                     warningsLogWrite(td->buffer->getBuffer());
-
-    }
-    con.sock.close();
-    return td->http->raiseHTTPError(500);
-  }
-
   /*! Now read the output. This flag is used by the external loop.  */
   exit = 0;
 
@@ -365,53 +236,21 @@
 
   initialTicks = getTicks();
 
-  FilesUtility::temporaryFileName(td->id, outDataPath);
+  td->buffer->setLength(0);
+  checkDataChunks(td, &con.keepalive, &con.useChunks);
 
-  if(con.tempOut.createTemporaryFile(outDataPath.c_str()))
-  {
-    td->buffer->setLength(0);
-    *td->buffer << "FastCGI: Error opening stdout file" << '\0';
-    td->connection->host->warningsLogWrite(td->buffer->getBuffer());
-    return td->http->raiseHTTPError(500);
-  }
-
   do
   {
     u_long dim;
-    u_long dataSent;
     u_long nbw;
-
-    while(con.sock.bytesToRead() < sizeof(FcgiHeader))
+    
+    if (readHeader (&con, &header, initialTicks, timeout, id))
     {
-      if((clock_t)(getTicks() - initialTicks) > timeout)
-        break;
-      con.sock.dataOnRead (timeout / 1000, timeout % 1000);
-    }
-
-    if(con.sock.bytesToRead() >= sizeof(FcgiHeader))
-    {
-      nbr = con.sock.recv((char*)&header, sizeof(FcgiHeader), 0, 
-                          static_cast<u_long>(timeout));
-      if(nbr != sizeof(FcgiHeader))
-      {
-        td->buffer->setLength(0);
-        *td->buffer << "FastCGI: Error reading data" << '\0';
-        td->connection->host->warningsLogWrite(td->buffer->getBuffer());
-        sendFcgiBody(&con, 0, 0, FCGIABORT_REQUEST, id);
-        ret = 0;
-        break;
-      }
-    }
-    else
-    {
-      td->buffer->setLength(0);
-      *td->buffer << "FastCGI: Error timeout" << '\0';
-      td->connection->host->warningsLogWrite(td->buffer->getBuffer());
-      sendFcgiBody(&con, 0, 0, FCGIABORT_REQUEST, id);
-      con.sock.shutdown(2);
-      con.sock.close();
+      exit = 1;
+      ret = 1;
       break;
     }
+
     /*!
      *contentLengthB1 is the high word of the content length value
      *while contentLengthB0 is the low one.
@@ -419,7 +258,7 @@
      *of eight byte then do an or with contentLengthB0.
      */
     dim = (header.contentLengthB1 << 8) | header.contentLengthB0;
-    dataSent = 0;
+
     if(dim == 0)
     {
       exit = 1;
@@ -427,6 +266,8 @@
     }
     else
     {
+      bool headerCompleted = false;
+
       switch(header.type)
       {
         case FCGISTDERR:
@@ -436,28 +277,21 @@
           ret = 0;
           break;
         case FCGISTDOUT:
-          dataSent = 0;
+          headerCompleted = false;
+          ret = sendData (&con, dim, static_cast<u_long>(timeout), &chain, 
+                          &headerCompleted, onlyHeader);
 
-          while(dataSent < dim)
+          if (ret)
           {
-            nbr = con.sock.recv(td->buffer->getBuffer(),
-                                std::min(static_cast<u_long>(td->buffer->getRealLength()),
-                                         dim - dataSent), 0, static_cast<u_long>(timeout));
-            if(nbr == (u_long)-1)
-            {
-              exit = 1;
-              ret = 0;
-              break;
-            }
+            exit = 1;
+            ret = 0;
+            break;
+          }
 
-            if(con.tempOut.writeToFile((char*)(td->buffer->getBuffer()), 
-                                       nbr, &nbw))
-            {
-              exit = 1;
-              ret = 0;
-              break;
-            }
-            dataSent += nbr;
+          if (headerCompleted)
+          {
+            exit = 1;
+            break;
           }
 
           break;
@@ -474,12 +308,12 @@
     if(header.paddingLength)
     {
       u_long toPad = header.paddingLength;
-      while(toPad)
+      while (toPad)
       {
         nbr = con.sock.recv(td->buffer->getBuffer(),
                             std::min(toPad, (u_long)td->buffer->getRealLength()), 0, 
                             static_cast<u_long>(timeout));
-        if(nbr == (u_long)-1)
+        if (nbr == (u_long)-1)
         {
           exit = 1;
           ret = 0;
@@ -488,208 +322,16 @@
         toPad -= nbr;
       }
     }
+  }while (!exit);
 
-  }while((!exit) && nbr);
+  /* Send the last null chunk if needed.  */
+  if((td->response.getStatusType () == HttpResponseHeader::SUCCESSFUL) && 
+     con.useChunks && chain.write("0\r\n\r\n", 5, &nbw))
+    return 0;       
 
-  con.tempOut.setFilePointer(0);
-  td->buffer->getAt(0) = '\0';
-  buffer = td->buffer->getBuffer();
-
-
-
-  /*! Return an error message if ret is 0.  */
-  if((!ret) || con.tempOut.readFromFile(buffer, 
-                                        td->buffer->getRealLength(), &nbr))
-  {
-    con.tempOut.close();
-    FilesUtility::deleteFile(outDataPath.c_str());
-    con.sock.close();
-    chain.clearAllFilters();
-    return td->http->sendHTTPhardError500();
-  }
-
-  /*!
-   *find the \r\n\r\n sequence.
-   */
-  for(u_long i = 0; i < nbr; i++)
-  {
-    if((buffer[i] == '\r') && (buffer[i + 1] == '\n') &&
-       (buffer[i + 2] == '\r') && (buffer[i + 3] == '\n'))
-    {
-      headerSize = i + 4 ;
-      break;
-    }
-  }
-
-  /* For logging.  */
-  td->sentData += con.tempOut.getFileSize() - headerSize;
-
-  HttpHeaders::buildHTTPResponseHeaderStruct(td->buffer->getBuffer(),
-                                             &td->response, 
-                                             &(td->nBytesToRead));
-
-
-  for(;;)
-  {
-    u_long nbw2;
-    if(td->response.location[0])
-    {
-      con.tempOut.close();
-      FilesUtility::deleteFile(outDataPath.c_str());
-      con.sock.close();
-      chain.clearAllFilters();
-      return td->http->sendHTTPRedirect((char*)td->response.location.c_str());
-    }
-    /*! Send the header.  */
-    if(!td->appendOutputs)
-    {
-      checkDataChunks(td, &keepalive, &useChunks);
-
-      HttpHeaders::buildHTTPResponseHeader(td->buffer2->getBuffer(),
-                                            &td->response);
-      if(td->connection->socket->send( td->buffer2->getBuffer(),
-                           static_cast<int>(strlen(td->buffer2->getBuffer())),
-                                      0) == SOCKET_ERROR )
-      {
-        exit = 1;
-        ret = 0;
-        break;
-      }
-
-      if(onlyHeader)
-      {
-        exit = 1;
-        ret = 1;
-        break;
-      }
-
-      if(nbr - headerSize)
-      {
-        if(useChunks)
-        {
-          ostringstream tmp;
-          tmp << hex << (nbr - headerSize) << "\r\n";
-          td->response.contentLength.assign(tmp.str());
-          if(chain.write(tmp.str().c_str(), tmp.str().length(), &nbw2))
-          {
-            exit = 0;
-            ret = 0;
-            break;
-          }
-        }
-
-        if(chain.write((char*)((td->buffer->getBuffer())
-                               +headerSize), nbr - headerSize, &nbw2))
-        {
-          exit = 0;
-          ret = 0;
-          break;
-        }
-
-        if(useChunks && chain.write("\r\n", 2, &nbw2))
-        {
-          exit = 0;
-          ret = 0;
-          break;
-        }
-      }
-    }
-    else/*! If appendOutputs.  */
-    {
-      u_long nbw = 0;    
-      if(onlyHeader)
-      {
-        exit = 1;
-        ret = 1;
-        break;
-      }
-
-      /*!
-       *Send remaining data stored in the buffer.
-       *This is the HTTP header.
-       */
-      if(td->outputData.writeToFile((char*)((td->buffer2->getBuffer())
-                                         + headerSize), nbr - headerSize, 
-                                    &nbw))
-      {
-        exit = 1;
-        ret = 0;
-        break;
-      }
-    }
-
-    if (td->response.getStatusType () == HttpResponseHeader::SUCCESSFUL)
-    {
-      /*! Flush the data.  */
-      do
-      {
-        if(con.tempOut.readFromFile(td->buffer->getBuffer(),
-                                    td->buffer->getRealLength(), &nbr))
-        {
-          exit = 1;
-          ret = 0;
-          break;
-        }
-
-        if(!td->appendOutputs)
-        {
-          u_long nbw2;
-          if(nbr)
-          {
-            if(useChunks)
-            {
-              ostringstream tmp;
-              tmp << hex << nbr << "\r\n";
-              td->response.contentLength.assign(tmp.str());
-              if(chain.write(tmp.str().c_str(), tmp.str().length(), &nbw2))
-              {
-                exit = 1;
-                ret = 0;
-                break;
-              }
-            }
-
-            if(chain.write(td->buffer->getBuffer(), nbr, &nbw2))
-            {
-              exit = 1;
-              ret = 0;
-              break;
-            }
-
-            if(useChunks && chain.write("\r\n", 2, &nbw2))
-            {
-              exit = 1;
-              ret = 0;
-              break;
-            }
-          }
-        }
-        else
-        {
-          u_long nbw = 0;
-          if(td->outputData.writeToFile(td->buffer->getBuffer(), nbr, &nbw))
-          {
-            exit = 1;
-            ret = 0;
-            break;
-          }
-        }
-      }while(nbr);
-
-      if(useChunks && chain.write("0\r\n\r\n", 5, &nbw2))
-      {
-        exit = 1;
-        ret = 0;
-        break;
-      }
-    }
-
-    break;
-  }
   chain.clearAllFilters();
-  con.tempOut.close();
-  FilesUtility::deleteFile(outDataPath.c_str());
   con.sock.close();
+ 
   return ret;
 }
 
@@ -911,3 +553,329 @@
 {
   timeout = ntimeout;
 }
+
+/*!
+ *Do a request to the FastCGI server.
+ *\param con The current FastCGI context.
+ *\param id The request ID.
+ */
+int FastCgi::fastCgiRequest (FcgiContext* con, int id)
+{
+  FcgiBeginRequestBody tBody;
+  HttpThreadContext *td = con->td;
+  /*! Size of data chunks to use with STDIN.  */
+  const size_t maxStdinChunk = 8192;
+  u_long nbr;
+  FcgiHeader header;
+  int sizeEnvString;
+
+  Env::buildEnvironmentString(td, td->buffer->getBuffer());
+  sizeEnvString = buildFASTCGIEnvironmentString(td,td->buffer->getBuffer(),
+                                                td->buffer2->getBuffer());
+  if(sizeEnvString == -1)
+  {
+    td->buffer->setLength(0);
+    if(Server::getInstance()->getVerbosity() > 2)
+    {
+      *td->buffer << "FastCGI: Error to build env string" << '\0';
+      td->connection->host->warningsLogWrite(td->buffer->getBuffer());
+    }
+    return 1;
+  }
+
+
+  tBody.roleB1 = ( FCGIRESPONDER >> 8 ) & 0xff;
+  tBody.roleB0 = ( FCGIRESPONDER ) & 0xff;
+  tBody.flags = 0;
+  memset( tBody.reserved, 0, sizeof( tBody.reserved ) );
+
+  if(sendFcgiBody(con, (char*)&tBody, sizeof(tBody), FCGIBEGIN_REQUEST, id))
+  {
+    td->buffer->setLength(0);
+    if(Server::getInstance()->getVerbosity() > 2)
+    {
+      *td->buffer<< "FastCGI: Error beginning the request" << '\0';
+      td->connection->host->warningsLogWrite(td->buffer->getBuffer());
+    }
+    return 1;
+  }
+
+  if(sendFcgiBody(con, td->buffer2->getBuffer(), sizeEnvString,
+                  FCGIPARAMS, id))
+  {
+    td->buffer->setLength(0);
+    if(Server::getInstance()->getVerbosity() > 2)
+    {
+      *td->buffer << "FastCGI: Error sending params" << '\0';
+      td->connection->host->warningsLogWrite(td->buffer->getBuffer());
+    }
+    return 1;
+  }
+
+  if(sendFcgiBody(con, 0, 0, FCGIPARAMS, id))
+  {
+    td->buffer->setLength(0);
+    if(Server::getInstance()->getVerbosity() > 2)
+    {
+      *td->buffer << "FastCGI: Error sending params" << '\0';
+      td->connection->host->warningsLogWrite(td->buffer->getBuffer());
+    }
+    return 1;
+  }
+
+  if(atoi(td->request.contentLength.c_str()))
+  {
+    td->buffer->setLength(0);
+
+
+    if(td->inputData.setFilePointer(0))
+      if(Server::getInstance()->getVerbosity() > 2)
+      {
+        *td->buffer << "FastCGI: Error sending POST data" << '\0';
+        td->connection->host->warningsLogWrite(td->buffer->getBuffer());
+      }
+
+    /*! Send the STDIN data.  */
+    do
+    {
+      if(td->inputData.readFromFile(td->buffer->getBuffer(),
+                                    maxStdinChunk, &nbr))
+      {
+        td->buffer->setLength(0);
+        if(Server::getInstance()->getVerbosity() > 2)
+        {
+          *td->buffer << "FastCGI: Error reading from file" << '\0';
+          td->connection->host->warningsLogWrite(td->buffer->getBuffer());
+        }
+        return 1;
+      }
+
+      if(!nbr)
+        break;
+
+      generateFcgiHeader( header, FCGISTDIN, id, nbr);
+      if(con->sock.send((char*)&header, sizeof(header), 0) == -1)
+      {
+        return 1;
+      }
+
+      if(con->sock.send(td->buffer->getBuffer(),nbr,0) == -1)
+      {
+        td->buffer->setLength(0);
+        if(Server::getInstance()->getVerbosity() > 2)
+        {
+          *td->buffer << "FastCGI: Error sending data" << '\0';
+          td->connection->host->warningsLogWrite(td->buffer->getBuffer());
+        }
+        return 1;
+      }
+    }while(nbr == maxStdinChunk);
+  }
+
+  /*! Final stdin chunk.  */
+  if(sendFcgiBody(con, 0, 0, FCGISTDIN, id))
+  {
+    td->buffer->setLength(0);
+    if(Server::getInstance()->getVerbosity() > 2)
+    {
+      *td->buffer << "FastCGI: Error sending POST data" << '\0';
+      td->connection->host->warningsLogWrite(td->buffer->getBuffer());
+
+    }
+    return 1;
+  }
+
+  return 0;
+}
+
+
+/*!
+ *Handle the STDOUT data received from the FastCGI server.
+ *The FastCGI header must be read previously, only the payload is processed here.
+ *\param con The current FastCGI context.
+ *\param dim Size of the payload.
+ *\param timeout Connection timeout to use.
+ *\param chain Output chain where to send data.
+ *\param responseCompleted Output value.  It is true when the response is completed.
+ *\param onlyHeader Send only the HTTP header.
+ *\return 0 on success.
+ */
+int FastCgi::sendData (FcgiContext* con, u_long dim, u_long timeout, FiltersChain* chain, 
+                       bool *responseCompleted, int onlyHeader)
+{
+  u_long dataRead = 0;
+  while (dataRead < dim)
+  {
+    HttpThreadContext* td = con->td;
+
+    if (con->headerSent)
+    {
+      td->buffer->setLength (0);
+    }
+
+    if (dim - td->buffer->getLength () == 0)
+    {
+      return 1;
+    }
+
+    u_long nbr = con->sock.recv (td->buffer->getBuffer () + td->buffer->getLength (),
+                                 std::min ((u_long)td->buffer->getRealLength (),
+                                           dim - td->buffer->getLength ()), 
+                                 0, timeout);
+    if (nbr == (u_long)-1 || nbr == 0)
+    {
+      return 1;
+    }
+
+    td->buffer->setLength (td->buffer->getLength () + nbr);
+
+    dataRead += nbr;
+
+    if (!con->headerSent)
+    {
+      return handleHeader (con, chain, responseCompleted);
+    }
+  }
+
+  if (onlyHeader || con->td->response.getStatusType () != HttpResponseHeader::SUCCESSFUL)
+    return 0;
+
+  if(HttpDataHandler::appendDataToHTTPChannel(con->td, 
+                                              con->td->buffer->getBuffer (),
+                                              con->td->buffer->getLength (),
+                                              &(con->td->outputData),
+                                              chain,
+                                              con->td->appendOutputs,
+                                              con->useChunks))
+    return 1;
+  
+  con->td->sentData += con->td->buffer->getLength ();
+
+  return 0;
+}
+
+/*!
+ *Look for a HTTP header in the fastcgi server data.
+ *\param con The current FastCGI context.
+ *\param chain Output chain where to send data.
+ *\param responseCompleted Output value.  It is true when the response is completed.
+ *\return 0 on success.
+ */
+int FastCgi::handleHeader (FcgiContext* con, FiltersChain* chain, bool* responseCompleted)
+{
+  char* buffer = con->td->buffer->getBuffer ();
+  u_long size = con->td->buffer->getLength ();
+  u_long headerSize = 0;
+
+  for(u_long i = 0; i < size - 3; i++)
+  {
+    if((buffer[i] == '\r') && (buffer[i + 1] == '\n') &&
+       (buffer[i + 2] == '\r') && (buffer[i + 3] == '\n'))
+    {
+      headerSize = i + 4;
+      break;
+    }
+  }
+
+  if (headerSize == 0)
+    return 0;
+
+  HttpHeaders::buildHTTPResponseHeaderStruct(con->td->buffer->getBuffer(),
+                                             &con->td->response, 
+                                             &(con->td->nBytesToRead));
+
+  if(!con->td->appendOutputs)
+  {
+    if(con->td->response.location[0])
+    {
+      *responseCompleted = true;
+      con->td->http->sendHTTPRedirect((char*)con->td->response.location.c_str());
+      return 0;
+    }
+
+    HttpHeaders::buildHTTPResponseHeader(con->td->buffer2->getBuffer(),
+                                         &con->td->response);
+
+    if(con->td->connection->socket->send(con->td->buffer2->getBuffer(),
+                                         static_cast<int>(strlen(con->td->buffer2->getBuffer())),
+                                         0) == SOCKET_ERROR )
+    {
+      *responseCompleted = true;
+      return 1;
+    }  
+
+  }
+  
+  con->headerSent = true;
+
+  /* Flush the buffer if remaining data is present.  */
+  if (con->td->response.getStatusType () == HttpResponseHeader::SUCCESSFUL && 
+      size - headerSize)
+  {
+    if(HttpDataHandler::appendDataToHTTPChannel(con->td, 
+                                                con->td->buffer->getBuffer() + headerSize, 
+                                                size - headerSize,
+                                                &(con->td->outputData),
+                                                chain,
+                                                con->td->appendOutputs,
+                                                con->useChunks))
+      return 1;
+
+    con->td->sentData += size - headerSize;
+  }
+
+  return 0;
+}
+
+/*!
+ *Read a FastCGI header.
+ *\param con The FastCGI context.
+ *\param header The header to read.
+ *\param started Start time for the request (it is used to compute the timeout).
+ *\param timeout The timeout to use for the connection.
+ *\param id Request ID.
+ *\return 0 on success.
+ */
+int FastCgi::readHeader (FcgiContext *con, FcgiHeader* header, u_long started, u_long timeout, int id)
+{
+  u_long nbr;
+  HttpThreadContext* td = con->td;
+  char* buffer = (char*) header;
+  u_long readData = 0;
+
+  for (;;)
+  {
+    u_long ticks = getTicks ();
+
+    if (ticks - started > timeout)
+    {
+      td->buffer->setLength(0);
+      *td->buffer << "FastCGI: server timeout" << '\0';
+      td->connection->host->warningsLogWrite(td->buffer->getBuffer());
+      sendFcgiBody(con, 0, 0, FCGIABORT_REQUEST, id);
+      return 1;
+    }
+
+    nbr = con->sock.recv(buffer + readData, sizeof(FcgiHeader) - readData, 0, 
+                         timeout - (ticks - started));
+
+    if (nbr == static_cast<u_long>(-1) || nbr == 0)
+      return 1;
+
+    readData += nbr;
+
+    if (readData == sizeof (FcgiHeader))
+      break;
+
+    if (readData > sizeof (FcgiHeader))
+    {
+      td->buffer->setLength(0);
+      *td->buffer << "FastCGI: Error reading data" << '\0';
+      td->connection->host->warningsLogWrite(td->buffer->getBuffer());
+      sendFcgiBody(con, 0, 0, FCGIABORT_REQUEST, id);
+      return 1;
+    }
+  }
+
+  return 0;
+}





From MAILER-DAEMON Sun Oct 19 12:31:56 2008
Received: from mailman by lists.gnu.org with archive (Exim 4.43)
	id 1KrbC8-0003wx-7D
	for mharc-myserver-commit@gnu.org; Sun, 19 Oct 2008 12:31:56 -0400
Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43)
	id 1KrbC5-0003wF-VS
	for myserver-commit@gnu.org; Sun, 19 Oct 2008 12:31:54 -0400
Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43)
	id 1KrbC5-0003w0-At
	for myserver-commit@gnu.org; Sun, 19 Oct 2008 12:31:53 -0400
Received: from [199.232.76.173] (port=59947 helo=monty-python.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.43) id 1KrbC5-0003vx-5i
	for myserver-commit@gnu.org; Sun, 19 Oct 2008 12:31:53 -0400
Received: from savannah.gnu.org ([199.232.41.3]:52450 helo=sv.gnu.org)
	by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32)
	(Exim 4.60) (envelope-from <INVALID.NOREPLY@gnu.org>)
	id 1KrbC4-0006Dh-Tn
	for myserver-commit@gnu.org; Sun, 19 Oct 2008 12:31:53 -0400
Received: from cvs.savannah.gnu.org ([199.232.41.69])
	by sv.gnu.org with esmtp (Exim 4.63)
	(envelope-from <INVALID.NOREPLY@gnu.org>) id 1KrbC4-0001ig-7U
	for myserver-commit@gnu.org; Sun, 19 Oct 2008 16:31:52 +0000
Received: from gscrivano by cvs.savannah.gnu.org with local (Exim 4.63)
	(envelope-from <gscrivano@savannah.gnu.org>) id 1KrbC3-0001ib-Ss
	for myserver-commit@gnu.org; Sun, 19 Oct 2008 16:31:52 +0000
MIME-Version: 1.0
Errors-To: gscrivano
To: myserver-commit@gnu.org
X-Mailer: SVN::Notify 2.64: http://search.cpan.org/dist/SVN-Notify/
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
From: Giuseppe Scrivano <gscrivano@gnu.org>
Message-Id: <E1KrbC3-0001ib-Ss@cvs.savannah.gnu.org>
Date: Sun, 19 Oct 2008 16:31:51 +0000
X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 3)
Subject: [myserver-commit] [2892] Check if `makeinfo' is present before
	build the documentation.
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/pipermail/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, 19 Oct 2008 16:31:54 -0000

Revision: 2892
          http://svn.sv.gnu.org/viewvc/?view=rev&root=myserver&revision=2892
Author:   gscrivano
Date:     2008-10-19 16:31:51 +0000 (Sun, 19 Oct 2008)

Log Message:
-----------
Check if `makeinfo' is present before build the documentation.  Thanks to Domenico Chierico <spaghetty@gmail.com>.

Modified Paths:
--------------
    trunk/myserver/Makefile.am
    trunk/myserver/configure.in

Modified: trunk/myserver/Makefile.am
===================================================================
--- trunk/myserver/Makefile.am	2008-10-19 15:30:12 UTC (rev 2891)
+++ trunk/myserver/Makefile.am	2008-10-19 16:31:51 UTC (rev 2892)
@@ -9,12 +9,16 @@
 TESTS = tests
 endif
 
+if BUILD_DOC
+DOCS = documentation
+endif
+
 am__aclocal_m4_deps = $(top_srcdir)/m4/gnome-pthread-check.m4 \
         $(top_srcdir)/m4/fltk.m4 $(top_srcdir)/m4/libtool.m4 \
         $(top_srcdir)/m4/libxml.m4 $(top_srcdir)/m4/cppunit.m4 \
         $(top_srcdir)/configure.in
 
 
-SUBDIRS = src include $(CONTROL) $(CGI_LIB) binaries documentation $(TESTS)
+SUBDIRS = src include $(CONTROL) $(CGI_LIB) binaries $(DOCS) $(TESTS)
 
 EXTRA_DIST = stdafx.h stdafx.cpp doxygen SConstruct

Modified: trunk/myserver/configure.in
===================================================================
--- trunk/myserver/configure.in	2008-10-19 15:30:12 UTC (rev 2891)
+++ trunk/myserver/configure.in	2008-10-19 16:31:51 UTC (rev 2892)
@@ -47,6 +47,14 @@
 AM_PROG_LEX
 AC_PROG_YACC
 
+AC_CHECK_PROG(make_info, makeinfo, yes, no)
+if test x$make_info = xno ; then
+   AC_MSG_WARN([ Cannot find makeinfo: info file will not be created])
+   MAKE_DOC=no
+else
+   MAKE_DOC=yes
+fi
+
 CFLAGS="$CFLAGS $_LT_AC_TAGVAR(lt_prog_compiler_pic, CXX)"
 CXXFLAGS="$CXXFLAGS $_LT_AC_TAGVAR(lt_prog_compiler_pic, CXX)"
 LDFLAGS="$LDFLAGS $_LT_AC_TAGVAR(lt_prog_compiler_pic, CXX)"
@@ -352,6 +360,7 @@
 
 AM_CONDITIONAL(BUILD_MSCGI, test "$MAKE_MSCGI" = "yes")
 AM_CONDITIONAL(BUILD_CONTROL, test "$MAKE_CONTROL" = "yes")
+AM_CONDITIONAL(BUILD_DOC, test "$MAKE_DOC" = "yes")
 
 dnl AC_CONFIG_SUBDIRS()
 AC_CONFIG_FILES([





From MAILER-DAEMON Sun Oct 19 13:59:29 2008
Received: from mailman by lists.gnu.org with archive (Exim 4.43)
	id 1KrcYr-0003Ve-Om
	for mharc-myserver-commit@gnu.org; Sun, 19 Oct 2008 13:59:29 -0400
Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43)
	id 1KrcYq-0003V4-7w
	for myserver-commit@gnu.org; Sun, 19 Oct 2008 13:59:28 -0400
Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43)
	id 1KrcYp-0003U9-15
	for myserver-commit@gnu.org; Sun, 19 Oct 2008 13:59:27 -0400
Received: from [199.232.76.173] (port=46733 helo=monty-python.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.43) id 1KrcYo-0003U6-O4
	for myserver-commit@gnu.org; Sun, 19 Oct 2008 13:59:26 -0400
Received: from savannah.gnu.org ([199.232.41.3]:52067 helo=sv.gnu.org)
	by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32)
	(Exim 4.60) (envelope-from <INVALID.NOREPLY@gnu.org>)
	id 1KrcYo-0006M1-9P
	for myserver-commit@gnu.org; Sun, 19 Oct 2008 13:59:26 -0400
Received: from cvs.savannah.gnu.org ([199.232.41.69])
	by sv.gnu.org with esmtp (Exim 4.63)
	(envelope-from <INVALID.NOREPLY@gnu.org>) id 1KrcYn-0005s5-J7
	for myserver-commit@gnu.org; Sun, 19 Oct 2008 17:59:25 +0000
Received: from gscrivano by cvs.savannah.gnu.org with local (Exim 4.63)
	(envelope-from <gscrivano@savannah.gnu.org>) id 1KrcYn-0005rz-9J
	for myserver-commit@gnu.org; Sun, 19 Oct 2008 17:59:25 +0000
MIME-Version: 1.0
Errors-To: gscrivano
To: myserver-commit@gnu.org
X-Mailer: SVN::Notify 2.64: http://search.cpan.org/dist/SVN-Notify/
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
From: Giuseppe Scrivano <gscrivano@gnu.org>
Message-Id: <E1KrcYn-0005rz-9J@cvs.savannah.gnu.org>
Date: Sun, 19 Oct 2008 17:59:25 +0000
X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 3)
Subject: [myserver-commit] [2893] Added `FilesUtility::resetTmpPath()' and
 used at `Server' initialization.
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/pipermail/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, 19 Oct 2008 17:59:28 -0000

Revision: 2893
          http://svn.sv.gnu.org/viewvc/?view=rev&root=myserver&revision=2893
Author:   gscrivano
Date:     2008-10-19 17:59:24 +0000 (Sun, 19 Oct 2008)

Log Message:
-----------
Added `FilesUtility::resetTmpPath()' and used at `Server' initialization.  Some compiler warnings silented.

Modified Paths:
--------------
    trunk/myserver/include/base/file/files_utility.h
    trunk/myserver/include/conf/security/security_token.h
    trunk/myserver/src/base/file/files_utility.cpp
    trunk/myserver/src/conf/vhost/vhost_manager.cpp
    trunk/myserver/src/http_handler/cgi/cgi.cpp
    trunk/myserver/src/http_handler/fastcgi/fastcgi.cpp
    trunk/myserver/src/protocol/http/http.cpp
    trunk/myserver/src/server/server.cpp

Modified: trunk/myserver/include/base/file/files_utility.h
===================================================================
--- trunk/myserver/include/base/file/files_utility.h	2008-10-19 16:31:51 UTC (rev 2892)
+++ trunk/myserver/include/base/file/files_utility.h	2008-10-19 17:59:24 UTC (rev 2893)
@@ -101,6 +101,7 @@
 
   static void temporaryFileName(u_long tid, string &out);
 
+  static void resetTmpPath();
   static void setTmpPath(string & path){tmpPath.assign(path);}
 private:
 	static string tmpPath;

Modified: trunk/myserver/include/conf/security/security_token.h
===================================================================
--- trunk/myserver/include/conf/security/security_token.h	2008-10-19 16:31:51 UTC (rev 2892)
+++ trunk/myserver/include/conf/security/security_token.h	2008-10-19 17:59:24 UTC (rev 2893)
@@ -140,7 +140,7 @@
     resource = r;
   }
 
-  int setMask (int m)
+  void setMask (int m)
   {
     mask = m;
   }
@@ -155,12 +155,12 @@
     neededPassword.assign (pw);
   }
 
-  bool setDone (bool d)
+  void setDone (bool d)
   {
     done = d;
   }
 
-  bool setAuthenticated (bool a)
+  void setAuthenticated (bool a)
   {
     authenticated = a;
   }

Modified: trunk/myserver/src/base/file/files_utility.cpp
===================================================================
--- trunk/myserver/src/base/file/files_utility.cpp	2008-10-19 16:31:51 UTC (rev 2892)
+++ trunk/myserver/src/base/file/files_utility.cpp	2008-10-19 17:59:24 UTC (rev 2893)
@@ -220,18 +220,18 @@
 
 
   for (;;) 
-    {
-	ret = src.readFromFile(buffer, 512, &nbr);
-	if (ret)
-	  return -1;
-
-	if (!nbr)
-	  break;
-
-	ret = dest.writeToFile(buffer, nbr, &nbw);
-	if (ret)
-	  return -1;
-    }
+  {
+    ret = src.readFromFile(buffer, 512, &nbr);
+    if (ret)
+      return -1;
+    
+    if (!nbr)
+      break;
+    
+    ret = dest.writeToFile(buffer, nbr, &nbw);
+    if (ret)
+      return -1;
+  }
   return 0;
 }
 
@@ -777,13 +777,43 @@
 int FilesUtility::deleteDirectory(const char *path)
 {
 #ifdef WIN32
-     return RemoveDirectory(path)?0:-1;
+  return RemoveDirectory(path)?0:-1;
 #else // NOT_WIN
   return rmdir(path);
 #endif
 }
 
+/*!
+ *Set the temporary path to a default one.
+ */
+void FilesUtility::resetTmpPath()
+{
+#ifdef WIN32
+  const char *tmpDir = getenv ("TMPDIR");
+  if (tmpDir)
+    tmpPath.assign (tmpDir);
+  else
+  {
+    TCHAR lpPathBuffer[MAX_PATH];
+    GetTempPath (MAX_PATH, lpPathBuffer);
+    tmpPath.assign (lpPathBuffer);
+  }
+#else
+  const char *tmpDir = getenv ("TMPDIR");
 
+#ifdef P_tmpdir
+  if (tmpDir == NULL)
+    tmpDir = P_tmpdir;
+#endif
+
+  if (tmpDir == NULL)
+    tmpDir = "/tmp";
+
+  tmpPath.assign (tmpDir);
+#endif
+}
+
+
 /*!
  *Create an unique temporary file name.  This function doesn't create the
  *file or open it but generates only its name.
@@ -798,6 +828,6 @@
   if(tmpPath.length() == 0)
     tmpPath.assign(getdefaultwd(0, 0));
 
-  stream << tmpPath << "/tmp_" << counter  << "_" << tid;
+  stream << tmpPath << "/myserver_" << counter  << "_" << tid << ".tmp";
   out.assign(stream.str());
 }

Modified: trunk/myserver/src/conf/vhost/vhost_manager.cpp
===================================================================
--- trunk/myserver/src/conf/vhost/vhost_manager.cpp	2008-10-19 16:31:51 UTC (rev 2892)
+++ trunk/myserver/src/conf/vhost/vhost_manager.cpp	2008-10-19 17:59:24 UTC (rev 2893)
@@ -25,8 +25,6 @@
  */
 int VhostManager::addVHost(Vhost* vh)
 {
-  Vhost* hostl;
-  
   list<Vhost*>::iterator it;
   
   mutex.lock();

Modified: trunk/myserver/src/http_handler/cgi/cgi.cpp
===================================================================
--- trunk/myserver/src/http_handler/cgi/cgi.cpp	2008-10-19 16:31:51 UTC (rev 2892)
+++ trunk/myserver/src/http_handler/cgi/cgi.cpp	2008-10-19 17:59:24 UTC (rev 2893)
@@ -360,7 +360,7 @@
       int aliveProcess = 0;
       u_long ticks = getTicks() - procStartTime;
 
-      if (ticks >= cgiTimeout || 
+      if (ticks >= (u_long)cgiTimeout || 
           stdOutFile.waitForData ((cgiTimeout - ticks) / 1000, (cgiTimeout - ticks) % 1000) == 0)
       {
         ostringstream msg;

Modified: trunk/myserver/src/http_handler/fastcgi/fastcgi.cpp
===================================================================
--- trunk/myserver/src/http_handler/fastcgi/fastcgi.cpp	2008-10-19 16:31:51 UTC (rev 2892)
+++ trunk/myserver/src/http_handler/fastcgi/fastcgi.cpp	2008-10-19 17:59:24 UTC (rev 2893)
@@ -67,8 +67,6 @@
   FiltersChain chain;
   u_long nbw;
 
-  u_long headerSize = 0;
-
   int exit;
   int ret;
 
@@ -77,8 +75,6 @@
   FastCgiServer* server = 0;
   int id;
   ostringstream cmdLine;
-  char *buffer = 0;
-
   string moreArg;
 
   con.useChunks = false;
@@ -242,7 +238,6 @@
   do
   {
     u_long dim;
-    u_long nbw;
     
     if (readHeader (&con, &header, initialTicks, timeout, id))
     {

Modified: trunk/myserver/src/protocol/http/http.cpp
===================================================================
--- trunk/myserver/src/protocol/http/http.cpp	2008-10-19 16:31:51 UTC (rev 2892)
+++ trunk/myserver/src/protocol/http/http.cpp	2008-10-19 17:59:24 UTC (rev 2893)
@@ -350,8 +350,6 @@
 int Http::getFilePermissions(string& filename, string& directory, string& file, 
                              string &filenamePath, int yetmapped, int* permissions)
 {
-  int providedMask;
-
   securityToken.setServer (Server::getInstance ());
   securityToken.setSysDirectory ((string*)&(td->connection->host->getSystemRoot ()));
 

Modified: trunk/myserver/src/server/server.cpp
===================================================================
--- trunk/myserver/src/server/server.cpp	2008-10-19 16:31:51 UTC (rev 2892)
+++ trunk/myserver/src/server/server.cpp	2008-10-19 17:59:24 UTC (rev 2893)
@@ -1119,12 +1119,14 @@
     cachedFiles.initialize(1 << 23);
 
   data = configurationFileManager.getValue("TEMP_DIRECTORY");
-  if(data)
+  if (data)
   {
-    string tmpPath(data);
-    FilesUtility::completePath(tmpPath);
-    FilesUtility::setTmpPath(tmpPath);
+    string tmpPath (data);
+    FilesUtility::completePath (tmpPath);
+    FilesUtility::setTmpPath (tmpPath);
   }
+  else
+    FilesUtility::resetTmpPath ();
 
   data = configurationFileManager.getValue("MAX_FILESCACHE_FILESIZE");
   if(data)





From MAILER-DAEMON Sun Oct 19 14:50:35 2008
Received: from mailman by lists.gnu.org with archive (Exim 4.43)
	id 1KrdMJ-00016Q-0O
	for mharc-myserver-commit@gnu.org; Sun, 19 Oct 2008 14:50:35 -0400
Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43)
	id 1KrdMG-00016I-SD
	for myserver-commit@gnu.org; Sun, 19 Oct 2008 14:50:32 -0400
Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43)
	id 1KrdME-000166-7i
	for myserver-commit@gnu.org; Sun, 19 Oct 2008 14:50:31 -0400
Received: from [199.232.76.173] (port=60373 helo=monty-python.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.43) id 1KrdMD-000163-U8
	for myserver-commit@gnu.org; Sun, 19 Oct 2008 14:50:30 -0400
Received: from savannah.gnu.org ([199.232.41.3]:57619 helo=sv.gnu.org)
	by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32)
	(Exim 4.60) (envelope-from <INVALID.NOREPLY@gnu.org>)
	id 1KrdMC-0004BI-Lt
	for myserver-commit@gnu.org; Sun, 19 Oct 2008 14:50:29 -0400
Received: from cvs.savannah.gnu.org ([199.232.41.69])
	by sv.gnu.org with esmtp (Exim 4.63)
	(envelope-from <INVALID.NOREPLY@gnu.org>) id 1KrdMC-0008VQ-1a
	for myserver-commit@gnu.org; Sun, 19 Oct 2008 18:50:28 +0000
Received: from gscrivano by cvs.savannah.gnu.org with local (Exim 4.63)
	(envelope-from <gscrivano@savannah.gnu.org>) id 1KrdMB-0008VM-IF
	for myserver-commit@gnu.org; Sun, 19 Oct 2008 18:50:27 +0000
MIME-Version: 1.0
Errors-To: gscrivano
To: myserver-commit@gnu.org
X-Mailer: SVN::Notify 2.64: http://search.cpan.org/dist/SVN-Notify/
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
From: Giuseppe Scrivano <gscrivano@gnu.org>
Message-Id: <E1KrdMB-0008VM-IF@cvs.savannah.gnu.org>
Date: Sun, 19 Oct 2008 18:50:27 +0000
X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 3)
Subject: [myserver-commit] [2894] Code refactoring: `File::read()' used
 instead of `File::readFromFile
 ()', `buffer2' renamed to `secondaryBuffer'.
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/pipermail/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, 19 Oct 2008 18:50:33 -0000

Revision: 2894
          http://svn.sv.gnu.org/viewvc/?view=rev&root=myserver&revision=2894
Author:   gscrivano
Date:     2008-10-19 18:50:26 +0000 (Sun, 19 Oct 2008)

Log Message:
-----------
Code refactoring: `File::read()' used instead of `File::readFromFile()', `buffer2' renamed to `secondaryBuffer'.

Modified Paths:
--------------
    trunk/myserver/control/myserver-configure.cpp
    trunk/myserver/include/base/file/file.h
    trunk/myserver/include/base/files_cache/cached_file.h
    trunk/myserver/include/protocol/ftp/ftp.h
    trunk/myserver/include/protocol/http/http_thread_context.h
    trunk/myserver/include/server/clients_thread.h
    trunk/myserver/include/server/server.h
    trunk/myserver/src/base/file/file.cpp
    trunk/myserver/src/base/file/files_utility.cpp
    trunk/myserver/src/base/files_cache/cached_file.cpp
    trunk/myserver/src/http_handler/cgi/cgi.cpp
    trunk/myserver/src/http_handler/fastcgi/fastcgi.cpp
    trunk/myserver/src/http_handler/http_dir/http_dir.cpp
    trunk/myserver/src/http_handler/http_file/http_file.cpp
    trunk/myserver/src/http_handler/isapi/isapi.cpp
    trunk/myserver/src/http_handler/mscgi/mscgi.cpp
    trunk/myserver/src/http_handler/mscgi/mscgi_manager.cpp
    trunk/myserver/src/http_handler/scgi/scgi.cpp
    trunk/myserver/src/http_handler/wincgi/wincgi.cpp
    trunk/myserver/src/log/stream/file_stream.cpp
    trunk/myserver/src/protocol/control/control_protocol.cpp
    trunk/myserver/src/protocol/ftp/ftp.cpp
    trunk/myserver/src/protocol/http/env/env.cpp
    trunk/myserver/src/protocol/http/http.cpp
    trunk/myserver/src/protocol/http/http_data_read.cpp
    trunk/myserver/src/protocol/http/http_headers.cpp
    trunk/myserver/src/server/clients_thread.cpp
    trunk/myserver/src/server/server.cpp
    trunk/myserver/tests/test_cached_file.cpp

Modified: trunk/myserver/control/myserver-configure.cpp
===================================================================
--- trunk/myserver/control/myserver-configure.cpp	2008-10-19 17:59:24 UTC (rev 2893)
+++ trunk/myserver/control/myserver-configure.cpp	2008-10-19 18:50:26 UTC (rev 2894)
@@ -165,7 +165,7 @@
 	     outputF.openFile("myserver.xml", File::MYSERVER_OPEN_WRITE|File::MYSERVER_OPEN_ALWAYS);
 	     for(;;)
 	       {
-		  inputF.readFromFile(buffer, 512, &nbr );
+		  inputF.read(buffer, 512, &nbr );
 		  if(nbr==0)
 		    break;
 		  outputF.writeToFile(buffer, nbr, &nbw);
@@ -181,7 +181,7 @@
 		  outputF.openFile("MIMEtypes.xml", File::MYSERVER_OPEN_WRITE|File::MYSERVER_OPEN_ALWAYS);
 		  for(;;)
 		    {
-		       inputF.readFromFile(buffer, 512, &nbr );
+		       inputF.read(buffer, 512, &nbr );
 		       if(nbr==0)
 			 break;
 		       outputF.writeToFile(buffer, nbr, &nbw);
@@ -200,7 +200,7 @@
 											 File::MYSERVER_OPEN_ALWAYS);
 		  for(;;)
 		    {
-		       inputF.readFromFile(buffer, 512, &nbr );
+		       inputF.read(buffer, 512, &nbr );
 		       if(nbr==0)
 			 break;
 		       outputF.writeToFile(buffer, nbr, &nbw);

Modified: trunk/myserver/include/base/file/file.h
===================================================================
--- trunk/myserver/include/base/file/file.h	2008-10-19 17:59:24 UTC (rev 2893)
+++ trunk/myserver/include/base/file/file.h	2008-10-19 18:50:26 UTC (rev 2894)
@@ -1,7 +1,7 @@
 /* -*- mode: c++ -*- */
 /*
 MyServer
-Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc.
+Copyright (C) 2002, 2003, 2004, 2008 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
@@ -27,9 +27,6 @@
 
 class File : public Stream
 {
-protected:
-	FileHandle handle;
-	string filename;
 public:
 	static const u_long MYSERVER_OPEN_READ;
 	static const u_long MYSERVER_OPEN_WRITE;
@@ -45,7 +42,6 @@
   File(char *,int);
 	virtual FileHandle getHandle();
 	virtual int setHandle(FileHandle);
-	virtual int readFromFile(char* ,u_long ,u_long* );
 	virtual int writeToFile(const char* ,u_long ,u_long* );
 	virtual int createTemporaryFile(const char* );
 
@@ -70,6 +66,8 @@
   /*! Inherithed from Stream. */
   virtual int read(char* buffer, u_long len, u_long *nbr);
   virtual int write(const char* buffer, u_long len, u_long *nbw);
-
+protected:
+	FileHandle handle;
+	string filename;
 };
 #endif

Modified: trunk/myserver/include/base/files_cache/cached_file.h
===================================================================
--- trunk/myserver/include/base/files_cache/cached_file.h	2008-10-19 17:59:24 UTC (rev 2893)
+++ trunk/myserver/include/base/files_cache/cached_file.h	2008-10-19 18:50:26 UTC (rev 2894)
@@ -30,12 +30,12 @@
 class CachedFile : public File
 {
 public:
-	CachedFile(CachedFileBuffer* buffer);
-	virtual FileHandle getHandle();
-	virtual int setHandle(FileHandle);
-	virtual int readFromFile(char* ,u_long ,u_long* );
-	virtual int writeToFile(const char* ,u_long ,u_long* );
-	virtual int createTemporaryFile(const char* );
+	CachedFile (CachedFileBuffer* buffer);
+	virtual FileHandle getHandle ();
+	virtual int setHandle (FileHandle);
+	virtual int read (char* ,u_long ,u_long* );
+	virtual int writeToFile (const char* ,u_long ,u_long* );
+	virtual int createTemporaryFile (const char* );
 
 	virtual int openFile(const char*, u_long );
   virtual int openFile(string const &file, u_long opt)

Modified: trunk/myserver/include/protocol/ftp/ftp.h
===================================================================
--- trunk/myserver/include/protocol/ftp/ftp.h	2008-10-19 17:59:24 UTC (rev 2893)
+++ trunk/myserver/include/protocol/ftp/ftp.h	2008-10-19 18:50:26 UTC (rev 2894)
@@ -89,9 +89,9 @@
 	FtpThreadContext();
 	ConnectionPtr pConnection;
 	MemBuf *buffer;
-	MemBuf *buffer2;
+	MemBuf *secondaryBuffer;
 	u_long buffersize;
-	u_long buffersize2;
+	u_long secondaryBufferSize;
 	u_long m_nParseLength;
 	u_long nBytesToRead;
 	Ftp *pProtocolInterpreter;

Modified: trunk/myserver/include/protocol/http/http_thread_context.h
===================================================================
--- trunk/myserver/include/protocol/http/http_thread_context.h	2008-10-19 17:59:24 UTC (rev 2893)
+++ trunk/myserver/include/protocol/http/http_thread_context.h	2008-10-19 18:50:26 UTC (rev 2894)
@@ -55,9 +55,9 @@
   int onlyHeader;/*! Is the client asking only for the header? */
 	ConnectionPtr connection;
 	MemBuf *buffer;
-	MemBuf *buffer2;
+	MemBuf *secondaryBuffer;
 	u_long buffersize;
-	u_long buffersize2;
+	u_long secondaryBufferSize;
 	u_long id;
 	u_long nBytesToRead;
 	u_long nHeaderChars;

Modified: trunk/myserver/include/server/clients_thread.h
===================================================================
--- trunk/myserver/include/server/clients_thread.h	2008-10-19 17:59:24 UTC (rev 2893)
+++ trunk/myserver/include/server/clients_thread.h	2008-10-19 18:50:26 UTC (rev 2894)
@@ -64,7 +64,7 @@
     INCOMPLETE_REQUEST_NO_WAIT = 3
   };
   MemBuf *getBuffer();
-  MemBuf *getBuffer2();
+  MemBuf *getSecondaryBuffer();
   ClientsThread(Server* server);
   ~ClientsThread();
   void stop();
@@ -92,7 +92,7 @@
   int threadIsStopped;
   int threadIsRunning;
   u_long buffersize;
-  u_long buffersize2;
+  u_long secondaryBufferSize;
   int isRunning();
   int isStopped();
   FtpProtocol *ftpParser;
@@ -100,7 +100,7 @@
   HttpsProtocol* httpsParser;
   ControlProtocol  *controlProtocolParser;
   MemBuf buffer;
-  MemBuf buffer2;
+  MemBuf secondaryBuffer;
   int controlConnections();
   u_long nBytesToRead;
 };

Modified: trunk/myserver/include/server/server.h
===================================================================
--- trunk/myserver/include/server/server.h	2008-10-19 17:59:24 UTC (rev 2893)
+++ trunk/myserver/include/server/server.h	2008-10-19 18:50:26 UTC (rev 2894)
@@ -219,7 +219,7 @@
   u_long verbosity;
   u_long throttlingRate;
   u_long buffersize;
-  u_long buffersize2;
+  u_long secondaryBufferSize;
   /*! Buffer that contains all the local machine IP values.  */
   string *ipAddresses;
   char serverName[HOST_NAME_MAX + 1];

Modified: trunk/myserver/src/base/file/file.cpp
===================================================================
--- trunk/myserver/src/base/file/file.cpp	2008-10-19 17:59:24 UTC (rev 2893)
+++ trunk/myserver/src/base/file/file.cpp	2008-10-19 18:50:26 UTC (rev 2894)
@@ -317,27 +317,6 @@
 }
 
 /*!
- *Read data from a file to a buffer.
- *Return 1 on errors.
- *Return 0 on success.
- *\param buffer The buffer where write.
- *\param buffersize The length of the buffer in bytes.
- *\param nbr How many bytes were read to the buffer.
- */
-int File::readFromFile(char* buffer,u_long buffersize,u_long* nbr)
-{
-#ifdef WIN32
-  int ret = ReadFile((HANDLE)handle, buffer, buffersize, nbr, NULL);
-  return (!ret);
-#endif
-#ifdef NOT_WIN
-  int ret  = ::read((long)handle, buffer, buffersize);
-  *nbr = (u_long)ret;
-  return (ret == -1) ;
-#endif
-}
-
-/*!
  *Create a temporary file.
  *\param filename The new temporary file name.
  */
@@ -446,21 +425,31 @@
 /*!
  *Inherited from Stream.
  */
-int File::read(char* buffer, u_long len, u_long *nbr)
+int File::write(const char* buffer, u_long len, u_long *nbw)
 {
-  int ret = readFromFile(buffer, len, nbr );
+  int ret = writeToFile(buffer, len, nbw );
   if(ret != 0)
     return -1;
   return 0;
 }
 
 /*!
- *Inherited from Stream.
+ *Read data from a file to a buffer.
+ *Return 1 on errors.
+ *Return 0 on success.
+ *\param buffer The buffer where write.
+ *\param buffersize The length of the buffer in bytes.
+ *\param nbr How many bytes were read to the buffer.
  */
-int File::write(const char* buffer, u_long len, u_long *nbw)
+int File::read(char* buffer,u_long buffersize,u_long* nbr)
 {
-  int ret = writeToFile(buffer, len, nbw );
-  if(ret != 0)
-    return -1;
-  return 0;
+#ifdef WIN32
+  int ret = ReadFile((HANDLE)handle, buffer, buffersize, nbr, NULL);
+  return (!ret);
+#endif
+#ifdef NOT_WIN
+  int ret  = ::read((long)handle, buffer, buffersize);
+  *nbr = (u_long)ret;
+  return (ret == -1) ;
+#endif
 }

Modified: trunk/myserver/src/base/file/files_utility.cpp
===================================================================
--- trunk/myserver/src/base/file/files_utility.cpp	2008-10-19 17:59:24 UTC (rev 2893)
+++ trunk/myserver/src/base/file/files_utility.cpp	2008-10-19 18:50:26 UTC (rev 2894)
@@ -221,7 +221,7 @@
 
   for (;;) 
   {
-    ret = src.readFromFile(buffer, 512, &nbr);
+    ret = src.read(buffer, 512, &nbr);
     if (ret)
       return -1;
     

Modified: trunk/myserver/src/base/files_cache/cached_file.cpp
===================================================================
--- trunk/myserver/src/base/files_cache/cached_file.cpp	2008-10-19 17:59:24 UTC (rev 2893)
+++ trunk/myserver/src/base/files_cache/cached_file.cpp	2008-10-19 18:50:26 UTC (rev 2894)
@@ -128,7 +128,7 @@
  *\param buffersize The length of the buffer in bytes.
  *\param nbr How many bytes were read to the buffer.
  */
-int CachedFile::readFromFile(char* buffer, u_long buffersize, u_long* nbr)
+int CachedFile::read(char* buffer, u_long buffersize, u_long* nbr)
 {
   u_long toRead = std::min(buffersize, this->buffer->getFileSize() - fseek);
   const char* src = &(this->buffer->getBuffer()[fseek]);

Modified: trunk/myserver/src/http_handler/cgi/cgi.cpp
===================================================================
--- trunk/myserver/src/http_handler/cgi/cgi.cpp	2008-10-19 17:59:24 UTC (rev 2893)
+++ trunk/myserver/src/http_handler/cgi/cgi.cpp	2008-10-19 18:50:26 UTC (rev 2894)
@@ -251,10 +251,10 @@
   
   /*
    *Build the environment string used by the CGI process.
-   *Use the td->buffer2 to build the environment string.
+   *Use the td->secondaryBuffer to build the environment string.
    */
-  (td->buffer2->getBuffer())[0] = '\0';
-  Env::buildEnvironmentString(td, td->buffer2->getBuffer());
+  (td->secondaryBuffer->getBuffer())[0] = '\0';
+  Env::buildEnvironmentString(td, td->secondaryBuffer->getBuffer());
   
   spi.cmdLine = cmdLine.str();
   spi.cwd.assign(td->scriptDir);
@@ -262,7 +262,7 @@
   spi.stdError = (FileHandle) stdOutFile.getWriteHandle();
   spi.stdIn = (FileHandle) stdInFile.getHandle();
   spi.stdOut = (FileHandle) stdOutFile.getWriteHandle();
-  spi.envString = td->buffer2->getBuffer();
+  spi.envString = td->secondaryBuffer->getBuffer();
   
   if(spi.stdError ==  (FileHandle)-1 || 
        spi.stdIn == (FileHandle)-1 || 
@@ -322,8 +322,8 @@
   bool keepalive = false;
   int ret = 0;
 
-  /* Reset the buffer2 length counter. */
-  td->buffer2->setLength(0);
+  /* Reset the secondaryBuffer length counter. */
+  td->secondaryBuffer->setLength(0);
 
   procStartTime = getTicks();
 
@@ -372,8 +372,8 @@
       aliveProcess = !(stdOutFile.pipeTerminated ());
 
       /* Read data from the process standard output file.  */
-      if (stdOutFile.read(td->buffer2->getBuffer (), 
-                          td->buffer2->getRealLength (), 
+      if (stdOutFile.read(td->secondaryBuffer->getBuffer (), 
+                          td->secondaryBuffer->getRealLength (), 
                           &nBytesRead))
       {
         return 0;      
@@ -384,7 +384,7 @@
       
       if (nBytesRead && 
           HttpDataHandler::appendDataToHTTPChannel (td, 
-                                                    td->buffer2->getBuffer(),
+                                                    td->secondaryBuffer->getBuffer(),
                                                     nBytesRead,
                                                     &(td->outputData),
                                                     &chain,
@@ -432,7 +432,7 @@
     nBytesRead = 0;
     /* Do not try to read using a small buffer as this has some
        bad influence on the performances.  */
-    if(td->buffer2->getRealLength() - headerOffset - 1 < 512)
+    if(td->secondaryBuffer->getRealLength() - headerOffset - 1 < 512)
       break;
     
     term = stdOutFile.pipeTerminated();
@@ -445,8 +445,8 @@
       break;
     }
 
-    if (stdOutFile.read (td->buffer2->getBuffer() + headerOffset, 
-                         td->buffer2->getRealLength() - headerOffset - 1, 
+    if (stdOutFile.read (td->secondaryBuffer->getBuffer() + headerOffset, 
+                         td->secondaryBuffer->getRealLength() - headerOffset - 1, 
                          &nBytesRead))
     {
       *ret = td->http->raiseHTTPError(500);
@@ -461,8 +461,8 @@
 
     headerOffset += nBytesRead;
 
-    if(headerOffset > td->buffersize2 - 5)
-      (td->buffer2->getBuffer())[headerOffset] = '\0';
+    if(headerOffset > td->secondaryBufferSize - 5)
+      (td->secondaryBuffer->getBuffer())[headerOffset] = '\0';
     
     if(headerOffset == 0)
     {
@@ -473,7 +473,7 @@
     for(u_long i = std::max(0, (int)headerOffset - (int)nBytesRead - 10); 
         i < headerOffset; i++)
     {
-      char *buff = td->buffer2->getBuffer();
+      char *buff = td->secondaryBuffer->getBuffer();
       if( (buff[i] == '\r') && (buff[i+1] == '\n') 
           && (buff[i+2] == '\r') && (buff[i+3] == '\n') )
       {
@@ -506,7 +506,7 @@
 
     /* Send the header.  */
     if(headerSize)
-      HttpHeaders::buildHTTPResponseHeaderStruct(td->buffer2->getBuffer(),
+      HttpHeaders::buildHTTPResponseHeaderStruct(td->secondaryBuffer->getBuffer(),
                                                  &td->response, 
                                                  &(td->nBytesToRead));
     /*
@@ -545,7 +545,7 @@
   {
     /* Flush the buffer.  Data from the header parsing can be present.  */
     if(HttpDataHandler::appendDataToHTTPChannel(td, 
-                                                td->buffer2->getBuffer() + headerSize, 
+                                                td->secondaryBuffer->getBuffer() + headerSize, 
                                                 headerOffset - headerSize,
                                                 &(td->outputData),
                                                 &chain,

Modified: trunk/myserver/src/http_handler/fastcgi/fastcgi.cpp
===================================================================
--- trunk/myserver/src/http_handler/fastcgi/fastcgi.cpp	2008-10-19 17:59:24 UTC (rev 2893)
+++ trunk/myserver/src/http_handler/fastcgi/fastcgi.cpp	2008-10-19 18:50:26 UTC (rev 2894)
@@ -109,7 +109,7 @@
   }
 
   td->buffer->setLength (0);
-  td->buffer2->getAt (0) = '\0';
+  td->secondaryBuffer->getAt (0) = '\0';
 
 
   {
@@ -566,7 +566,7 @@
 
   Env::buildEnvironmentString(td, td->buffer->getBuffer());
   sizeEnvString = buildFASTCGIEnvironmentString(td,td->buffer->getBuffer(),
-                                                td->buffer2->getBuffer());
+                                                td->secondaryBuffer->getBuffer());
   if(sizeEnvString == -1)
   {
     td->buffer->setLength(0);
@@ -595,7 +595,7 @@
     return 1;
   }
 
-  if(sendFcgiBody(con, td->buffer2->getBuffer(), sizeEnvString,
+  if(sendFcgiBody(con, td->secondaryBuffer->getBuffer(), sizeEnvString,
                   FCGIPARAMS, id))
   {
     td->buffer->setLength(0);
@@ -633,7 +633,7 @@
     /*! Send the STDIN data.  */
     do
     {
-      if(td->inputData.readFromFile(td->buffer->getBuffer(),
+      if(td->inputData.read(td->buffer->getBuffer(),
                                     maxStdinChunk, &nbr))
       {
         td->buffer->setLength(0);
@@ -788,11 +788,11 @@
       return 0;
     }
 
-    HttpHeaders::buildHTTPResponseHeader(con->td->buffer2->getBuffer(),
+    HttpHeaders::buildHTTPResponseHeader(con->td->secondaryBuffer->getBuffer(),
                                          &con->td->response);
 
-    if(con->td->connection->socket->send(con->td->buffer2->getBuffer(),
-                                         static_cast<int>(strlen(con->td->buffer2->getBuffer())),
+    if(con->td->connection->socket->send(con->td->secondaryBuffer->getBuffer(),
+                                         static_cast<int>(strlen(con->td->secondaryBuffer->getBuffer())),
                                          0) == SOCKET_ERROR )
     {
       *responseCompleted = true;

Modified: trunk/myserver/src/http_handler/http_dir/http_dir.cpp
===================================================================
--- trunk/myserver/src/http_handler/http_dir/http_dir.cpp	2008-10-19 17:59:24 UTC (rev 2893)
+++ trunk/myserver/src/http_handler/http_dir/http_dir.cpp	2008-10-19 18:50:26 UTC (rev 2894)
@@ -259,14 +259,14 @@
 
   browseDirCSSpath = td->http->getBrowseDirCSSFile();
 
-  td->buffer2->setLength(0);
-  *td->buffer2 << "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n"
+  td->secondaryBuffer->setLength(0);
+  *td->secondaryBuffer << "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n"
     "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.1//EN\"\r\n"
     "\"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd\">\r\n"
     "<html xmlns=\"http://www.w3.org/1999/xhtml\" xml:lang=\"en\">"
     "\r\n<head>\r\n<title>" ;
-  *td->buffer2 << td->request.uri.c_str() ;
-  *td->buffer2 << "</title>\r\n";
+  *td->secondaryBuffer << td->request.uri.c_str() ;
+  *td->secondaryBuffer << "</title>\r\n";
 
   /*
    *If it is defined a CSS file for the graphic layout of 
@@ -274,16 +274,16 @@
    */
   if(browseDirCSSpath != 0)
   {
-    *td->buffer2 << "<link rel=\"stylesheet\" href=\""
+    *td->secondaryBuffer << "<link rel=\"stylesheet\" href=\""
                  << browseDirCSSpath 
                  << "\" type=\"text/css\" media=\"all\"/>\r\n";
   }
 
 
-  *td->buffer2 << "</head>\r\n"; 
+  *td->secondaryBuffer << "</head>\r\n"; 
 
-  ret = appendDataToHTTPChannel(td, td->buffer2->getBuffer(),
-                                td->buffer2->getLength(),
+  ret = appendDataToHTTPChannel(td, td->secondaryBuffer->getBuffer(),
+                                td->secondaryBuffer->getLength(),
                                 &(td->outputData), &chain,
                                 td->appendOutputs, useChunks);
   if(ret)
@@ -294,18 +294,18 @@
     return td->http->raiseHTTPError(500);
   }
 
-  sentData = td->buffer2->getLength();
+  sentData = td->secondaryBuffer->getLength();
               
   browseDirCSSpath = td->http->getBrowseDirCSSFile();
 
   filename = directory;
-  td->buffer2->setLength(0);
-  *td->buffer2 << "<body>\r\n<h1>Contents of directory ";
-  *td->buffer2 <<  &td->request.uri[lastSlash] ;
-  *td->buffer2 << "</h1>\r\n<hr />\r\n";
+  td->secondaryBuffer->setLength(0);
+  *td->secondaryBuffer << "<body>\r\n<h1>Contents of directory ";
+  *td->secondaryBuffer <<  &td->request.uri[lastSlash] ;
+  *td->secondaryBuffer << "</h1>\r\n<hr />\r\n";
 
-  ret = appendDataToHTTPChannel(td, td->buffer2->getBuffer(),
-                                td->buffer2->getLength(),
+  ret = appendDataToHTTPChannel(td, td->secondaryBuffer->getBuffer(),
+                                td->secondaryBuffer->getLength(),
                                 &(td->outputData), &chain,
                                 td->appendOutputs, useChunks);
 
@@ -315,7 +315,7 @@
     /* Return an internal server error.  */
     return td->http->raiseHTTPError(500);
   }
-  sentData += td->buffer2->getLength();
+  sentData += td->secondaryBuffer->getLength();
 
   ret = fd.findfirst(filename.c_str());
 
@@ -329,26 +329,26 @@
    *With the current code we build the HTML TABLE to indicize the
    *files in the directory.
    */
-  td->buffer2->setLength(0);
-  *td->buffer2 << "<table width=\"100%\">\r\n<tr>\r\n" ;
+  td->secondaryBuffer->setLength(0);
+  *td->secondaryBuffer << "<table width=\"100%\">\r\n<tr>\r\n" ;
 
   if(sortType == 'f' && !sortReverse)
-    *td->buffer2 << "<th><a href=\"?sort=fI\">File</a></th>\r\n";
+    *td->secondaryBuffer << "<th><a href=\"?sort=fI\">File</a></th>\r\n";
   else
-    *td->buffer2 << "<th><a href=\"?sort=f\">File</a></th>\r\n";
+    *td->secondaryBuffer << "<th><a href=\"?sort=f\">File</a></th>\r\n";
 
   if(sortType == 't' && !sortReverse)
-    *td->buffer2 << "<th><a href=\"?sort=tI\">Last Modified</a></th>\r\n";
+    *td->secondaryBuffer << "<th><a href=\"?sort=tI\">Last Modified</a></th>\r\n";
   else
-    *td->buffer2 << "<th><a href=\"?sort=t\">Last Modified</a></th>\r\n";
+    *td->secondaryBuffer << "<th><a href=\"?sort=t\">Last Modified</a></th>\r\n";
 
   if(sortType == 's' && !sortReverse)
-    *td->buffer2 << "<th><a href=\"?sort=sI\">Size</a></th>\r\n</tr>\r\n";
+    *td->secondaryBuffer << "<th><a href=\"?sort=sI\">Size</a></th>\r\n</tr>\r\n";
   else
-    *td->buffer2 << "<th><a href=\"?sort=s\">Size</a></th>\r\n</tr>\r\n";
+    *td->secondaryBuffer << "<th><a href=\"?sort=s\">Size</a></th>\r\n</tr>\r\n";
 
-  ret = appendDataToHTTPChannel(td, td->buffer2->getBuffer(),
-                                td->buffer2->getLength(),
+  ret = appendDataToHTTPChannel(td, td->secondaryBuffer->getBuffer(),
+                                td->secondaryBuffer->getLength(),
                                 &(td->outputData), &chain,
                                 td->appendOutputs, useChunks);
 
@@ -360,9 +360,9 @@
     return td->http->raiseHTTPError(500);
   }
 
-  sentData += td->buffer2->getLength();
+  sentData += td->secondaryBuffer->getLength();
 
-  td->buffer2->setLength(0);
+  td->secondaryBuffer->setLength(0);
 
   if(FilesUtility::getPathRecursionLevel(td->request.uri) >= 1)
   {
@@ -370,14 +370,14 @@
     file.assign(td->request.uri);
     file.append("/../");
     
-    *td->buffer2 << "<tr>\r\n<td colspan=\"2\">"
+    *td->secondaryBuffer << "<tr>\r\n<td colspan=\"2\">"
                  << "<a href=\""
                  << (td->request.uriEndsWithSlash ? ".." : ".")
            << "\">[ .. ]</a></td>\n"
                  << "<td>[directory]</td></tr>\r\n";
     
-    ret = appendDataToHTTPChannel(td, td->buffer2->getBuffer(),
-                                  td->buffer2->getLength(),
+    ret = appendDataToHTTPChannel(td, td->secondaryBuffer->getBuffer(),
+                                  td->secondaryBuffer->getLength(),
                                   &(td->outputData), &chain,
                                   td->appendOutputs, useChunks);
     if(ret)
@@ -388,7 +388,7 @@
       /* Return an internal server error.  */
       return td->http->raiseHTTPError(500);
     }
-    sentData += td->buffer2->getLength();
+    sentData += td->secondaryBuffer->getLength();
   }
 
   /* Put all files in a vector.  */
@@ -432,42 +432,42 @@
 
     FileStruct& file = *it;
 
-    td->buffer2->setLength(0);
+    td->secondaryBuffer->setLength(0);
 
-    *td->buffer2 << "<tr>\r\n<td><a href=\"";
+    *td->secondaryBuffer << "<tr>\r\n<td><a href=\"";
     if(!td->request.uriEndsWithSlash)
     {
-      *td->buffer2 << &td->request.uri[lastSlash];
-      *td->buffer2 << "/" ;
+      *td->secondaryBuffer << &td->request.uri[lastSlash];
+      *td->secondaryBuffer << "/" ;
     }
     formattedName.assign(file.name);
 
     formatHtml(file.name, formattedName);
 
-    *td->buffer2 << formattedName ;
-    *td->buffer2 << "\">" ;
-    *td->buffer2 << formattedName;
-    *td->buffer2 << "</a></td>\r\n<td>";
+    *td->secondaryBuffer << formattedName ;
+    *td->secondaryBuffer << "\">" ;
+    *td->secondaryBuffer << formattedName;
+    *td->secondaryBuffer << "</a></td>\r\n<td>";
   
     getRFC822GMTTime(file.time_write, fileTime, 32);
 
-    *td->buffer2 << fileTime ;
-    *td->buffer2 << "</td>\r\n<td>";
+    *td->secondaryBuffer << fileTime ;
+    *td->secondaryBuffer << "</td>\r\n<td>";
     
     if(file.attrib & FILE_ATTRIBUTE_DIRECTORY)
     {
-      *td->buffer2 << "[directory]";
+      *td->secondaryBuffer << "[directory]";
     }
     else
     {
       string out;
       getFormattedSize(file.size, out);
-       *td->buffer2 << out;
+       *td->secondaryBuffer << out;
     }
 
-    *td->buffer2 << "</td>\r\n</tr>\r\n";
-    ret = appendDataToHTTPChannel(td, td->buffer2->getBuffer(),
-                                  td->buffer2->getLength(),
+    *td->secondaryBuffer << "</td>\r\n</tr>\r\n";
+    ret = appendDataToHTTPChannel(td, td->secondaryBuffer->getBuffer(),
+                                  td->secondaryBuffer->getLength(),
                                   &(td->outputData), &chain,
                                   td->appendOutputs, useChunks);
     if(ret)
@@ -478,31 +478,31 @@
       return td->http->raiseHTTPError(500);
     }
 
-    sentData += td->buffer2->getLength();
+    sentData += td->secondaryBuffer->getLength();
 
   }
 
-  td->buffer2->setLength(0);
-  *td->buffer2 << "</table>\r\n<hr />\r\n<address>"
+  td->secondaryBuffer->setLength(0);
+  *td->secondaryBuffer << "</table>\r\n<hr />\r\n<address>"
                << MYSERVER_VERSION;
               
   if(host && host->value->length())
   {    
     ostringstream portBuff;
     size_t portSeparator = host->value->find(':');
-    *td->buffer2 << " on ";
+    *td->secondaryBuffer << " on ";
     if(portSeparator != string::npos)
-      *td->buffer2 << host->value->substr(0, portSeparator).c_str() ;
+      *td->secondaryBuffer << host->value->substr(0, portSeparator).c_str() ;
     else
-      *td->buffer2 << host->value->c_str() ;
+      *td->secondaryBuffer << host->value->c_str() ;
     
-    *td->buffer2 << " Port ";
+    *td->secondaryBuffer << " Port ";
     portBuff << td->connection->getLocalPort();
-    *td->buffer2 << portBuff.str();
+    *td->secondaryBuffer << portBuff.str();
   }
-  *td->buffer2 << "</address>\r\n</body>\r\n</html>\r\n";
-  ret = appendDataToHTTPChannel(td, td->buffer2->getBuffer(),
-                                td->buffer2->getLength(),
+  *td->secondaryBuffer << "</address>\r\n</body>\r\n</html>\r\n";
+  ret = appendDataToHTTPChannel(td, td->secondaryBuffer->getBuffer(),
+                                td->secondaryBuffer->getLength(),
                                 &(td->outputData), &chain,
                                 td->appendOutputs, useChunks);
 
@@ -512,11 +512,11 @@
     /* Return an internal server error.  */
     return td->http->raiseHTTPError(500);
   }  
-  sentData += td->buffer2->getLength();
+  sentData += td->secondaryBuffer->getLength();
 
-  *td->buffer2 << end_str;
+  *td->secondaryBuffer << end_str;
   /* Changes the \ character in the / character.  */
-  bufferloop = td->buffer2->getBuffer();
+  bufferloop = td->secondaryBuffer->getBuffer();
   while(*bufferloop++)
     if(*bufferloop == '\\')
       *bufferloop = '/';

Modified: trunk/myserver/src/http_handler/http_file/http_file.cpp
===================================================================
--- trunk/myserver/src/http_handler/http_file/http_file.cpp	2008-10-19 17:59:24 UTC (rev 2893)
+++ trunk/myserver/src/http_handler/http_file/http_file.cpp	2008-10-19 18:50:26 UTC (rev 2894)
@@ -79,7 +79,7 @@
   bool keepalive = false;
   bool useChunks = false;
   bool useModifiers = false;
-  MemoryStream memStream(td->buffer2);
+  MemoryStream memStream(td->secondaryBuffer);
   FiltersChain chain;
   u_long nbw;
   u_long nbr;
@@ -411,7 +411,7 @@
       if(bytesToSend)
       {
         /* Read from the file the bytes to send.  */
-        ret = file->readFromFile(td->buffer->getBuffer(),
+        ret = file->read(td->buffer->getBuffer(),
                                  std::min(static_cast<u_long>(bytesToSend), 
                                           static_cast<u_long>(td->buffer->getRealLength()/2)), 
                                  &nbr);

Modified: trunk/myserver/src/http_handler/isapi/isapi.cpp
===================================================================
--- trunk/myserver/src/http_handler/isapi/isapi.cpp	2008-10-19 17:59:24 UTC (rev 2893)
+++ trunk/myserver/src/http_handler/isapi/isapi.cpp	2008-10-19 18:50:26 UTC (rev 2894)
@@ -299,11 +299,11 @@
           ConnInfo->td->response.connection.assign("Close");
         
         HttpHeaders::buildHTTPResponseHeader(
-                 (char*)ConnInfo->td->buffer2->getBuffer(),&(ConnInfo->td->response));
+                 (char*)ConnInfo->td->secondaryBuffer->getBuffer(),&(ConnInfo->td->response));
   
         if(ConnInfo->connection->socket->send(
-                     (char*)ConnInfo->td->buffer2->getBuffer(),
-                     (int)strlen((char*)ConnInfo->td->buffer2->getBuffer()), 0)==-1)
+                     (char*)ConnInfo->td->secondaryBuffer->getBuffer(),
+                     (int)strlen((char*)ConnInfo->td->secondaryBuffer->getBuffer()), 0)==-1)
           return 0;
       }
       /*! Save the headerSent status. */
@@ -415,7 +415,7 @@
     return 0;
   }
 
-  ConnInfo->td->inputData.readFromFile((char*)lpvBuffer, *lpdwSize, &NumRead);
+  ConnInfo->td->inputData.read((char*)lpvBuffer, *lpdwSize, &NumRead);
 
   if (NumRead == -1) 
   {
@@ -916,9 +916,9 @@
     return td->http->raiseHTTPError(500);
   }
   /*!
-   *Store the environment string in the buffer2.
+   *Store the environment string in the secondaryBuffer.
    */
-  connTable[connIndex].envString=td->buffer2->getBuffer();
+  connTable[connIndex].envString=td->secondaryBuffer->getBuffer();
   
   /*!
    *Build the environment string.

Modified: trunk/myserver/src/http_handler/mscgi/mscgi.cpp
===================================================================
--- trunk/myserver/src/http_handler/mscgi/mscgi.cpp	2008-10-19 17:59:24 UTC (rev 2893)
+++ trunk/myserver/src/http_handler/mscgi/mscgi.cpp	2008-10-19 18:50:26 UTC (rev 2894)
@@ -118,7 +118,7 @@
 
   if (!ret) 
   { 
-    td->buffer2->getAt(0) = '\0';
+    td->secondaryBuffer->getAt(0) = '\0';
 
     ProcMain = (CGIMAIN) hinstLib.getProc( "myserver_main"); 
 
@@ -214,7 +214,7 @@
   if(!mcd->td->appendOutputs)
   {
     HttpThreadContext* td = mcd->td;
-    char *buffer = td->buffer2->getBuffer();
+    char *buffer = td->secondaryBuffer->getBuffer();
     ConnectionPtr s = td->connection;
 
     HttpHeaders::buildHTTPResponseHeader(buffer, &(td->response));

Modified: trunk/myserver/src/http_handler/mscgi/mscgi_manager.cpp
===================================================================
--- trunk/myserver/src/http_handler/mscgi/mscgi_manager.cpp	2008-10-19 17:59:24 UTC (rev 2893)
+++ trunk/myserver/src/http_handler/mscgi/mscgi_manager.cpp	2008-10-19 18:50:26 UTC (rev 2894)
@@ -156,7 +156,7 @@
     return 0;
   do
   {
-    cgidata->td->inputData.readFromFile(&c, 1, &nbr);
+    cgidata->td->inputData.read(&c, 1, &nbr);
     if(nbr == 0)
       break;
     if((c == '&') |(toRead == 1))

Modified: trunk/myserver/src/http_handler/scgi/scgi.cpp
===================================================================
--- trunk/myserver/src/http_handler/scgi/scgi.cpp	2008-10-19 17:59:24 UTC (rev 2893)
+++ trunk/myserver/src/http_handler/scgi/scgi.cpp	2008-10-19 18:50:26 UTC (rev 2894)
@@ -88,7 +88,7 @@
   }
 
   td->buffer->setLength(0);
-  td->buffer2->getAt(0) = '\0';
+  td->secondaryBuffer->getAt(0) = '\0';
 
 
   {
@@ -168,7 +168,7 @@
 
   Env::buildEnvironmentString(td, td->buffer->getBuffer());
   sizeEnvString = buildScgiEnvironmentString(td,td->buffer->getBuffer(),
-                                             td->buffer2->getBuffer());
+                                             td->secondaryBuffer->getBuffer());
   if(sizeEnvString == -1)
   {
     td->buffer->setLength(0);
@@ -209,7 +209,7 @@
     chain.clearAllFilters();
     return td->http->raiseHTTPError(500);
   }
-  ret = sendNetString(&con, td->buffer2->getBuffer(), sizeEnvString);
+  ret = sendNetString(&con, td->secondaryBuffer->getBuffer(), sizeEnvString);
   
   if(td->request.contentLength.size() && 
      !td->request.contentLength.compare("0"))
@@ -261,8 +261,8 @@
     if(!ctx->sock.bytesToRead())
       return -1;
 
-    nbr = ctx->sock.recv(td->buffer2->getBuffer() + read,
-                        td->buffer2->getRealLength() - read,
+    nbr = ctx->sock.recv(td->secondaryBuffer->getBuffer() + read,
+                        td->secondaryBuffer->getRealLength() - read,
                         static_cast<u_long>(timeout));
 
     read += nbr;
@@ -271,10 +271,10 @@
     for(tmpHeaderSize = (tmpHeaderSize > 3) 
           ? tmpHeaderSize - 4 : tmpHeaderSize;
         tmpHeaderSize < read - 4; tmpHeaderSize++)
-      if((td->buffer2->getBuffer()[tmpHeaderSize] == '\r') &&
-         (td->buffer2->getBuffer()[tmpHeaderSize + 1] == '\n') &&
-         (td->buffer2->getBuffer()[tmpHeaderSize + 2] == '\r') &&
-         (td->buffer2->getBuffer()[tmpHeaderSize + 3] == '\n'))
+      if((td->secondaryBuffer->getBuffer()[tmpHeaderSize] == '\r') &&
+         (td->secondaryBuffer->getBuffer()[tmpHeaderSize + 1] == '\n') &&
+         (td->secondaryBuffer->getBuffer()[tmpHeaderSize + 2] == '\r') &&
+         (td->secondaryBuffer->getBuffer()[tmpHeaderSize + 3] == '\n'))
       {
         headerSize = tmpHeaderSize + 4;
         break;
@@ -288,7 +288,7 @@
   {
     if(headerSize)
     {
-      HttpHeaders::buildHTTPResponseHeaderStruct(td->buffer2->getBuffer(),
+      HttpHeaders::buildHTTPResponseHeaderStruct(td->secondaryBuffer->getBuffer(),
                                                  &td->response, 
                                                  &(td->nBytesToRead));
     }
@@ -301,7 +301,7 @@
   }
 
   if(read - headerSize)
-    if(appendDataToHTTPChannel(td, td->buffer2->getBuffer() + headerSize,
+    if(appendDataToHTTPChannel(td, td->secondaryBuffer->getBuffer() + headerSize,
                                read - headerSize,
                                &(td->outputData), 
                                chain,
@@ -315,14 +315,14 @@
   {
     for(;;)
     {
-      nbr = ctx->sock.recv(td->buffer2->getBuffer(),
-                           td->buffer2->getRealLength(),
+      nbr = ctx->sock.recv(td->secondaryBuffer->getBuffer(),
+                           td->secondaryBuffer->getRealLength(),
                            0);
       
       if(!nbr || (nbr == (u_long)-1))
         break;
 
-      if(appendDataToHTTPChannel(td, td->buffer2->getBuffer(),
+      if(appendDataToHTTPChannel(td, td->secondaryBuffer->getBuffer(),
                                  nbr,
                                  &(td->outputData), 
                                  chain,
@@ -373,14 +373,14 @@
     u_long nbr;
     do
     {
-      if(ctx->td->inputData.readFromFile(ctx->td->buffer2->getBuffer(),
-                                         ctx->td->buffer2->getRealLength(), 
+      if(ctx->td->inputData.read(ctx->td->secondaryBuffer->getBuffer(),
+                                         ctx->td->secondaryBuffer->getRealLength(), 
                                          &nbr))
       {
         return -1;
       }
 
-      if(nbr && (ctx->sock.send(ctx->td->buffer2->getBuffer(), nbr, 0) == -1))
+      if(nbr && (ctx->sock.send(ctx->td->secondaryBuffer->getBuffer(), nbr, 0) == -1))
       { 
         return -1;
       }

Modified: trunk/myserver/src/http_handler/wincgi/wincgi.cpp
===================================================================
--- trunk/myserver/src/http_handler/wincgi/wincgi.cpp	2008-10-19 17:59:24 UTC (rev 2893)
+++ trunk/myserver/src/http_handler/wincgi/wincgi.cpp	2008-10-19 18:50:26 UTC (rev 2894)
@@ -151,8 +151,8 @@
     return td->http->raiseHTTPError(500);
   }
 
-  td->buffer2->setLength(0);
-  buffer=td->buffer2->getBuffer();
+  td->secondaryBuffer->setLength(0);
+  buffer=td->secondaryBuffer->getBuffer();
 
   strcpy(buffer, "[CGI]\r\n");
   DataFileHandle.writeToFile(buffer,7,&nbr);
@@ -160,8 +160,8 @@
   strcpy(buffer, "CGI Version=CGI/1.3a WIN\r\n");
   DataFileHandle.writeToFile(buffer,26,&nbr);
 
-  *td->buffer2 << "Server Admin=" << Server::getInstance()->getServerAdmin() << "\r\n";
-  DataFileHandle.writeToFile(buffer,td->buffer2->getLength(),&nbr);
+  *td->secondaryBuffer << "Server Admin=" << Server::getInstance()->getServerAdmin() << "\r\n";
+  DataFileHandle.writeToFile(buffer,td->secondaryBuffer->getLength(),&nbr);
 
   {
     if(td->request.isKeepAlive())
@@ -176,17 +176,17 @@
     }
   }
 
-  td->buffer2->setLength(0);
-  *td->buffer2 << "Request Method=" << td->request.cmd << "\r\n";
-  DataFileHandle.writeToFile(buffer, td->buffer2->getLength(), &nbr);
+  td->secondaryBuffer->setLength(0);
+  *td->secondaryBuffer << "Request Method=" << td->request.cmd << "\r\n";
+  DataFileHandle.writeToFile(buffer, td->secondaryBuffer->getLength(), &nbr);
 
-  td->buffer2->setLength(0);
-  *td->buffer2 << "Request Protocol=HTTP/" << td->request.ver << "\r\n";
-  DataFileHandle.writeToFile(buffer, td->buffer2->getLength(), &nbr);
+  td->secondaryBuffer->setLength(0);
+  *td->secondaryBuffer << "Request Protocol=HTTP/" << td->request.ver << "\r\n";
+  DataFileHandle.writeToFile(buffer, td->secondaryBuffer->getLength(), &nbr);
 
-   td->buffer2->setLength(0);  
-  *td->buffer2 << "Executable Path=" << execname << "\r\n";
-  DataFileHandle.writeToFile(buffer,td->buffer2->getLength(),&nbr);
+   td->secondaryBuffer->setLength(0);  
+  *td->secondaryBuffer << "Executable Path=" << execname << "\r\n";
+  DataFileHandle.writeToFile(buffer,td->secondaryBuffer->getLength(),&nbr);
 
   if(td->request.uriOpts[0])
   {
@@ -332,7 +332,7 @@
     chain.clearAllFilters();
     return td->http->raiseHTTPError(500);
   }
-  OutFileHandle.readFromFile(buffer,td->buffer2->getRealLength(),&nBytesRead);
+  OutFileHandle.read(buffer,td->secondaryBuffer->getRealLength(),&nBytesRead);
   if(!nBytesRead)
   {
     ostringstream msg;
@@ -428,7 +428,7 @@
     /* Flush the rest of the file.  */
     do
     {
-      OutFileHandle.readFromFile(buffer, td->buffer2->getLength(), 
+      OutFileHandle.read(buffer, td->secondaryBuffer->getLength(), 
                                  &nBytesRead);
       if(nBytesRead)
       {

Modified: trunk/myserver/src/log/stream/file_stream.cpp
===================================================================
--- trunk/myserver/src/log/stream/file_stream.cpp	2008-10-19 17:59:24 UTC (rev 2893)
+++ trunk/myserver/src/log/stream/file_stream.cpp	2008-10-19 18:50:26 UTC (rev 2894)
@@ -40,7 +40,7 @@
 FileStream::streamCycle ()
 {
   char *buffer = 0;
-  char *buffer2 = 0;
+  char *secondaryBuffer = 0;
   const u_long bufferSize = MYSERVER_KB (64);
   try
     {
@@ -54,7 +54,7 @@
         {
           return 1;
         }
-      buffer2 = new char[bufferSize];
+      secondaryBuffer = new char[bufferSize];
       if (buffer == 0)
         {
           delete [] buffer;
@@ -68,13 +68,13 @@
         {
           cerr << "could not open " << newFileName << endl;
           delete [] buffer;
-          delete [] buffer2;
+          delete [] secondaryBuffer;
           return 1;
         }
       if (currentFile->setFilePointer (0))
         {
           delete [] buffer;
-          delete [] buffer2;
+          delete [] secondaryBuffer;
           newFile.close ();
           return 1;
         }
@@ -82,10 +82,10 @@
         {
           u_long nbr;
           u_long nbw;
-          if(currentFile->readFromFile (buffer, bufferSize, &nbr))
+          if(currentFile->read (buffer, bufferSize, &nbr))
             {
               delete [] buffer;
-              delete [] buffer2;
+              delete [] secondaryBuffer;
               newFile.close ();
               return 1;
             }
@@ -94,7 +94,7 @@
           if (newFile.writeToFile (buffer, nbr, &nbw))
             {
               delete [] buffer;
-              delete [] buffer2;
+              delete [] secondaryBuffer;
               newFile.close ();
               return 1;
             }
@@ -105,19 +105,19 @@
       if (currentFile->openFile (filepath.c_str(), defaultFileMask))
         {
           delete [] buffer;
-          delete [] buffer2;
+          delete [] secondaryBuffer;
           return 1;
         }
       delete [] buffer;
-      delete [] buffer2;
+      delete [] secondaryBuffer;
       return 0;
     }
   catch (...)
     {
       if (buffer)
         delete [] buffer;
-      if (buffer2)
-        delete [] buffer2;
+      if (secondaryBuffer)
+        delete [] secondaryBuffer;
       throw;
     };
 }

Modified: trunk/myserver/src/protocol/control/control_protocol.cpp
===================================================================
--- trunk/myserver/src/protocol/control/control_protocol.cpp	2008-10-19 17:59:24 UTC (rev 2893)
+++ trunk/myserver/src/protocol/control/control_protocol.cpp	2008-10-19 18:50:26 UTC (rev 2894)
@@ -700,7 +700,7 @@
     u_long nbr;
     for( ; ; )
     {
-      err = outFile->readFromFile(buffer, min(dataToSend, buffersize), &nbr);
+      err = outFile->read(buffer, min(dataToSend, buffersize), &nbr);
       if(err)
       {
         strcpy(buffer,"Control: Error reading from temporary file");
@@ -899,7 +899,7 @@
   }
   for(;;)
   {
-    ret = localfile.readFromFile(b1, bs1, &nbr);
+    ret = localfile.read(b1, bs1, &nbr);
     if(ret)
     {
       string msg;
@@ -993,7 +993,7 @@
   }
   for(;;)
   {
-    ret = in->readFromFile(b1, bs1, &nbr);
+    ret = in->read(b1, bs1, &nbr);
     if(ret)
     {
       string msg;

Modified: trunk/myserver/src/protocol/ftp/ftp.cpp
===================================================================
--- trunk/myserver/src/protocol/ftp/ftp.cpp	2008-10-19 17:59:24 UTC (rev 2893)
+++ trunk/myserver/src/protocol/ftp/ftp.cpp	2008-10-19 18:50:26 UTC (rev 2894)
@@ -184,9 +184,9 @@
 {
   pConnection = NULL;
   buffer = NULL;
-  buffer2 = NULL;
+  secondaryBuffer = NULL;
   buffersize = 0;
-  buffersize2 = 0;
+  secondaryBufferSize = 0;
   m_nParseLength = 0;
   pProtocolInterpreter = NULL;
 }
@@ -352,9 +352,9 @@
   //switch context
   td.pConnection = pConnection;
   td.buffer = pConnection->getActiveThread()->getBuffer();
-  td.buffer2 = pConnection->getActiveThread()->getBuffer2();
+  td.secondaryBuffer = pConnection->getActiveThread()->getSecondaryBuffer();
   td.buffersize = bs1;
-  td.buffersize2 = bs2;
+  td.secondaryBufferSize = bs2;
   td.nBytesToRead = nbtr;
   td.pProtocolInterpreter = this;
   td.m_nParseLength = 0;
@@ -764,13 +764,13 @@
     char *pLine = NULL;
     int nLineLength = 0;
     std::string sLine;
-    MemBuf buffer, buffer2;
+    MemBuf buffer, secondaryBuffer;
     buffer.setLength(1024);
     while ( filesize != 0 )
     {
       memset(buffer.getBuffer(), 0, buffer.getRealLength());
       nBufferSize = std::min(static_cast<u_long>(filesize), static_cast<u_long>(buffer.getRealLength()/2));
-      if ( file->readFromFile(buffer.getBuffer(), nBufferSize, &nbr) )
+      if ( file->read(buffer.getBuffer(), nBufferSize, &nbr) )
       {
         ftp_reply(pConnection, 451);
         file->close();
@@ -787,7 +787,7 @@
       filesize -= nbr;
       pFtpUserData->m_nBytesSent += nbr;
 
-      buffer2.setLength(0);
+      secondaryBuffer.setLength(0);
       pLine = buffer.getBuffer();
       if ( pLine == NULL )
       {
@@ -810,13 +810,13 @@
         {
           sLine.assign(pLine, strlen(pLine));
           if ( !sLine.empty() )
-            buffer2 << sLine;
+            secondaryBuffer << sLine;
           pLine += strlen(pLine);
         }
         else
         {
           sLine.assign(pLine, nLineLength);
-          buffer2 << sLine << "\r\n";
+          secondaryBuffer << sLine << "\r\n";
           if ( *(pLine + nLineLength) == '\r' )
             nLineLength++;
           if ( *(pLine + nLineLength) == '\n' )
@@ -824,8 +824,8 @@
           pLine += nLineLength;
         }
       }
-            if ( pFtpUserData->m_pDataConnection->socket->send(buffer2.getBuffer(), 
-          (u_long)buffer2.getLength(), 0) == SOCKET_ERROR )
+            if ( pFtpUserData->m_pDataConnection->socket->send(secondaryBuffer.getBuffer(), 
+          (u_long)secondaryBuffer.getLength(), 0) == SOCKET_ERROR )
             {
         ftp_reply(pConnection, 451);
                file->close();
@@ -998,13 +998,13 @@
     pFtpUserData->m_sCurrentFileName = pWt->m_sFilePath;
     pFtpUserData->m_nFileSize = filesize;
 
-    MemBuf buffer2;
-    buffer2.setLength(1024);
+    MemBuf secondaryBuffer;
+    secondaryBuffer.setLength(1024);
     while ( filesize != 0 )
     {
-      nBufferSize = std::min(static_cast<u_long>(filesize), static_cast<u_long>(buffer2.getRealLength()/2));
-      if ( file->readFromFile(buffer2.getBuffer(), nBufferSize, &nbr) ||
-        pFtpUserData->m_pDataConnection->socket->send(buffer2.getBuffer(), 
+      nBufferSize = std::min(static_cast<u_long>(filesize), static_cast<u_long>(secondaryBuffer.getRealLength()/2));
+      if ( file->read(secondaryBuffer.getBuffer(), nBufferSize, &nbr) ||
+        pFtpUserData->m_pDataConnection->socket->send(secondaryBuffer.getBuffer(), 
           (u_long)nBufferSize, 0) == SOCKET_ERROR )
       {
         ftp_reply(pConnection, 451);
@@ -1172,7 +1172,7 @@
 #endif
     }
 
-    MemBuf buffer, buffer2;
+    MemBuf buffer, secondaryBuffer;
     buffer.setLength(1024);
     memset(buffer.getBuffer(), 0, buffer.getRealLength());
     char *pLine = NULL;
@@ -1182,8 +1182,8 @@
     while ( pFtpUserData->m_pDataConnection->socket->read(buffer.getBuffer(), 
           (u_long)buffer.getRealLength()-1, &nbr) != SOCKET_ERROR && nbr != 0 )
     {
-      memset(buffer2.getBuffer(), 0, buffer2.getRealLength());
-      buffer2.setLength(0);
+      memset(secondaryBuffer.getBuffer(), 0, secondaryBuffer.getRealLength());
+      secondaryBuffer.setLength(0);
       pLine = buffer.getBuffer();
       if ( pLine == NULL )
       {
@@ -1205,16 +1205,16 @@
         {
           sLine.assign(pLine, strlen(pLine));
           if ( !sLine.empty() )
-            buffer2 << sLine;
+            secondaryBuffer << sLine;
           pLine += strlen(pLine);
         }
         else
         {
           sLine.assign(pLine, nLineLength);
 #ifdef WIN32
-          buffer2 << sLine << "\r\n";
+          secondaryBuffer << sLine << "\r\n";
 #else
-          buffer2 << sLine << "\n";
+          secondaryBuffer << sLine << "\n";
 #endif
           if ( *(pLine + nLineLength) == '\r' )
             nLineLength++;
@@ -1223,7 +1223,7 @@
           pLine += nLineLength;
         }
       }
-      file.write(buffer2.getBuffer(), (u_long)buffer2.getLength(), &nbr);
+      file.write(secondaryBuffer.getBuffer(), (u_long)secondaryBuffer.getLength(), &nbr);
 
       if ( pFtpUserData->m_bBreakDataConnection )
       {
@@ -1706,8 +1706,8 @@
   time_t now;
   time(&now);
 
-  MemBuf &buffer2 = *td.buffer2;
-  buffer2.setLength(0);
+  MemBuf &secondaryBuffer = *td.secondaryBuffer;
+  secondaryBuffer.setLength(0);
   char perm[11];
   if ( FilesUtility::isDirectory(sPath) )
   {
@@ -1795,7 +1795,7 @@
       char fdSizeStr[12];
       sprintf(fdSizeStr, "%li", fd.size);
 
-      buffer2 << (const char *)perm << " " << nlinkStr << " " 
+      secondaryBuffer << (const char *)perm << " " << nlinkStr << " " 
               << username << " " << username << " " << fdSizeStr 
               << " " << (const char *)dateFtpFormat << " " 
               << fd.name << "\r\n";
@@ -1892,7 +1892,7 @@
       char fdSizeStr[12];
       sprintf(fdSizeStr, "%li", fd.size);
 
-      buffer2 << (const char *)perm << " " << nlinkStr << " " 
+      secondaryBuffer << (const char *)perm << " " << nlinkStr << " " 
               << username << " " << username << " " << fdSizeStr 
               << " " << (const char *)dateFtpFormat << " " 
               << fd.name << "\r\n";
@@ -1900,8 +1900,8 @@
       while (!fd.findnext());
     fd.findclose();
   }
-  if( pFtpUserData->m_pDataConnection->socket->send(td.buffer2->getBuffer(), 
-      (u_long)td.buffer2->getLength(), 0) == SOCKET_ERROR)
+  if( pFtpUserData->m_pDataConnection->socket->send(td.secondaryBuffer->getBuffer(), 
+      (u_long)td.secondaryBuffer->getLength(), 0) == SOCKET_ERROR)
   {
     ftp_reply(451);
   }
@@ -1947,20 +1947,20 @@
     return;
   }
 
-  MemBuf &buffer2 = *td.buffer2;
-  buffer2.setLength(0);
+  MemBuf &secondaryBuffer = *td.secondaryBuffer;
+  secondaryBuffer.setLength(0);
   do
   {
     if(fd.name[0] == '.' || !strcmpi(fd.name, "security") )
       continue;
     if ( !sParam.empty() )
-      buffer2 << sParam << "/";
-    buffer2 << fd.name << "\r\n";
+      secondaryBuffer << sParam << "/";
+    secondaryBuffer << fd.name << "\r\n";
   } while (!fd.findnext());
   fd.findclose();
 
-  if( pFtpUserData->m_pDataConnection->socket->send(td.buffer2->getBuffer(), 
-      (u_long)td.buffer2->getLength(), 0) == SOCKET_ERROR)
+  if( pFtpUserData->m_pDataConnection->socket->send(td.secondaryBuffer->getBuffer(), 
+      (u_long)td.secondaryBuffer->getLength(), 0) == SOCKET_ERROR)
   {
     ftp_reply(451);
   }

Modified: trunk/myserver/src/protocol/http/env/env.cpp
===================================================================
--- trunk/myserver/src/protocol/http/env/env.cpp	2008-10-19 17:59:24 UTC (rev 2893)
+++ trunk/myserver/src/protocol/http/env/env.cpp	2008-10-19 18:50:26 UTC (rev 2894)
@@ -52,7 +52,7 @@
   char strTmp[32];
   HttpRequestHeader::Entry* reqEntry = NULL;
 
-  memCgi.setExternalBuffer(cgiEnv, td->buffer2->getRealLength());
+  memCgi.setExternalBuffer(cgiEnv, td->secondaryBuffer->getRealLength());
   memCgi << "SERVER_SOFTWARE=GNU MyServer " << MYSERVER_VERSION;
 
 #ifdef WIN32

Modified: trunk/myserver/src/protocol/http/http.cpp
===================================================================
--- trunk/myserver/src/protocol/http/http.cpp	2008-10-19 17:59:24 UTC (rev 2893)
+++ trunk/myserver/src/protocol/http/http.cpp	2008-10-19 18:50:26 UTC (rev 2894)
@@ -100,26 +100,26 @@
       return raiseHTTPError (ret);
    
     getRFC822GMTTime(time, HTTP_RESPONSE_DATE_DIM);
-    td->buffer2->setLength(0);
-    *td->buffer2 <<  "HTTP/1.1 200 OK\r\n";
-    *td->buffer2 << "Date: " << time ;
-    *td->buffer2 <<  "\r\nServer: "<< MYSERVER_VERSION;
+    td->secondaryBuffer->setLength(0);
+    *td->secondaryBuffer <<  "HTTP/1.1 200 OK\r\n";
+    *td->secondaryBuffer << "Date: " << time ;
+    *td->secondaryBuffer <<  "\r\nServer: "<< MYSERVER_VERSION;
     if(connection && connection->value->length())
-      *td->buffer2 << "\r\nConnection:" << connection->value->c_str() << "\r\n";
-    *td->buffer2 <<"Content-Length: 0\r\nAccept-Ranges: bytes\r\n";
-    *td->buffer2 << "Allow: " << methods << "\r\n";
+      *td->secondaryBuffer << "\r\nConnection:" << connection->value->c_str() << "\r\n";
+    *td->secondaryBuffer <<"Content-Length: 0\r\nAccept-Ranges: bytes\r\n";
+    *td->secondaryBuffer << "Allow: " << methods << "\r\n";
 
     /*!
      *Check if the TRACE command is allowed on the virtual host.
      */
     if (allowHTTPTRACE ())
-      *td->buffer2 << ", TRACE\r\n";
+      *td->secondaryBuffer << ", TRACE\r\n";
 
-    *td->buffer2 << "r\n";
+    *td->secondaryBuffer << "r\n";
 
     /*! Send the HTTP header. */
-    ret = td->connection->socket->send(td->buffer2->getBuffer(),
-                                      (u_long)td->buffer2->getLength(), 0);
+    ret = td->connection->socket->send(td->secondaryBuffer->getBuffer(),
+                                      (u_long)td->secondaryBuffer->getLength(), 0);
     if( ret == SOCKET_ERROR )
     {
       return 0;
@@ -158,20 +158,20 @@
     if (!allowHTTPTRACE ())
       return raiseHTTPError (401);
 
-    td->buffer2->setLength(0);
-    *td->buffer2 << "HTTP/1.1 200 OK\r\n";
-    *td->buffer2 << "Date: " << time << "\r\n";
-    *td->buffer2 << "Server: " << MYSERVER_VERSION  << "\r\n";
+    td->secondaryBuffer->setLength(0);
+    *td->secondaryBuffer << "HTTP/1.1 200 OK\r\n";
+    *td->secondaryBuffer << "Date: " << time << "\r\n";
+    *td->secondaryBuffer << "Server: " << MYSERVER_VERSION  << "\r\n";
     connection = td->request.other.get("Connection");
     if(connection && connection->value->length())
-      *td->buffer2 << "Connection:" << connection->value->c_str() << "\r\n";
-    *td->buffer2 <<"Content-Length:" << tmp << "\r\n"
+      *td->secondaryBuffer << "Connection:" << connection->value->c_str() << "\r\n";
+    *td->secondaryBuffer <<"Content-Length:" << tmp << "\r\n"
                  << "Content-Type: message/http\r\n"
                  << "Accept-Ranges: bytes\r\n\r\n";
 
     /*! Send our HTTP header.  */
-    ret = td->connection->socket->send(td->buffer2->getBuffer(),
-                                      (u_long)td->buffer2->getLength(), 0);
+    ret = td->connection->socket->send(td->secondaryBuffer->getBuffer(),
+                                      (u_long)td->secondaryBuffer->getLength(), 0);
     if( ret == SOCKET_ERROR )
     {
       return 0;
@@ -258,7 +258,7 @@
       for(;;)
       {
         u_long nbr = 0, nbw = 0;
-        if(td->inputData.readFromFile(td->buffer->getBuffer(),
+        if(td->inputData.read(td->buffer->getBuffer(),
                                      td->buffer->getRealLength(), &nbr))
         {
           file.close();
@@ -305,7 +305,7 @@
       for(;;)
       {
         u_long nbr = 0, nbw = 0;
-        if(td->inputData.readFromFile(td->buffer->getBuffer(),
+        if(td->inputData.read(td->buffer->getBuffer(),
                                       td->buffer->getRealLength(), &nbr))
         {
           file.close();
@@ -679,12 +679,12 @@
     ((HttpUserData*)td->connection->protocolBuffer)->nc++;
 
   md5.init();
-  td->buffer2->setLength(0);
-  *td->buffer2 << td->request.digestUsername << ":" << td->request.digestRealm
+  td->secondaryBuffer->setLength(0);
+  *td->secondaryBuffer << td->request.digestUsername << ":" << td->request.digestRealm
                << ":" << securityToken.getNeededPassword();
 
-  md5.update((unsigned char const*)td->buffer2->getBuffer(),
-             (unsigned int)td->buffer2->getLength());
+  md5.update((unsigned char const*)td->secondaryBuffer->getBuffer(),
+             (unsigned int)td->secondaryBuffer->getLength());
   md5.end(A1);
 
   md5.init();
@@ -694,20 +694,20 @@
   else
     uri = (char*)td->request.uriOpts.c_str();
 
-  td->buffer2->setLength(0);
-  *td->buffer2 <<  td->request.cmd.c_str() <<  ":" << uri;
-  md5.update((unsigned char const*)td->buffer2->getBuffer(),
-             (unsigned int)td->buffer2->getLength());
+  td->secondaryBuffer->setLength(0);
+  *td->secondaryBuffer <<  td->request.cmd.c_str() <<  ":" << uri;
+  md5.update((unsigned char const*)td->secondaryBuffer->getBuffer(),
+             (unsigned int)td->secondaryBuffer->getLength());
   md5.end( A2);
 
   md5.init();
-  td->buffer2->setLength(0);
-  *td->buffer2 << A1 << ":"
+  td->secondaryBuffer->setLength(0);
+  *td->secondaryBuffer << A1 << ":"
               << ((HttpUserData*)td->connection->protocolBuffer)->nonce << ":"
               << td->request.digestNc << ":"  << td->request.digestCnonce << ":"
               << td->request.digestQop  << ":" << A2;
-  md5.update((unsigned char const*)td->buffer2->getBuffer(),
-             (unsigned int)td->buffer2->getLength());
+  md5.update((unsigned char const*)td->secondaryBuffer->getBuffer(),
+             (unsigned int)td->secondaryBuffer->getLength());
   md5.end(response);
 
   if(!strcmp(response, td->request.digestResponse))
@@ -1140,7 +1140,7 @@
         return sendHTTPhardError500();
       }
 
-      if(h.readFromFile(linkpath, linkpathSize, &nbr))
+      if(h.read(linkpath, linkpathSize, &nbr))
       {
         h.close();
         delete [] linkpath;
@@ -1265,52 +1265,52 @@
 
   try
   {
-    td->buffer2->setLength(0);
-    *td->buffer2 << td->connection->getIpAddr();
-    *td->buffer2<< " ";
+    td->secondaryBuffer->setLength(0);
+    *td->secondaryBuffer << td->connection->getIpAddr();
+    *td->secondaryBuffer<< " ";
 
     if(td->connection->getLogin()[0])
-      *td->buffer2 << td->connection->getLogin();
+      *td->secondaryBuffer << td->connection->getLogin();
     else
-      *td->buffer2 << "-";
+      *td->secondaryBuffer << "-";
 
-    *td->buffer2<< " ";
+    *td->secondaryBuffer<< " ";
 
     if(td->connection->getLogin()[0])
-      *td->buffer2 << td->connection->getLogin();
+      *td->secondaryBuffer << td->connection->getLogin();
     else
-      *td->buffer2 << "-";
+      *td->secondaryBuffer << "-";
 
-    *td->buffer2 << " [";
+    *td->secondaryBuffer << " [";
 
     getLocalLogFormatDate(time, HTTP_RESPONSE_DATE_DIM);
-    *td->buffer2 <<  time  << "] \"";
+    *td->secondaryBuffer <<  time  << "] \"";
 
     if(td->request.cmd.length())
-      *td->buffer2 << td->request.cmd.c_str() << "";
+      *td->secondaryBuffer << td->request.cmd.c_str() << "";
 
     if(td->request.cmd.length() || td->request.uri.length())
-      *td->buffer2 << " ";
+      *td->secondaryBuffer << " ";
 
     if(td->request.uri.length() == '\0')
-      *td->buffer2 <<  "/";
+      *td->secondaryBuffer <<  "/";
     else
-      *td->buffer2 << td->request.uri.c_str();
+      *td->secondaryBuffer << td->request.uri.c_str();
 
 
     if(td->request.uriOpts.length())
-      *td->buffer2 << "?" << td->request.uriOpts.c_str();
+      *td->secondaryBuffer << "?" << td->request.uriOpts.c_str();
 
     sprintf(tmpStrInt, "%u ", td->response.httpStatus);
 
     if(td->request.ver.length())
-      *td->buffer2 << " " << td->request.ver.c_str()  ;
+      *td->secondaryBuffer << " " << td->request.ver.c_str()  ;
 
-    *td->buffer2<< "\" " << tmpStrInt  << " ";
+    *td->secondaryBuffer<< "\" " << tmpStrInt  << " ";
 
 
     sprintf(tmpStrInt, "%u", td->sentData);
-    *td->buffer2 << tmpStrInt;
+    *td->secondaryBuffer << tmpStrInt;
 
     if(td->connection->host)
     {
@@ -1318,22 +1318,22 @@
       HttpRequestHeader::Entry *referer = td->request.other.get("Refer");
 
       if(strstr((td->connection->host)->getAccessLogOpt(), "type=combined"))
-        *td->buffer2 << " "  << (referer   ? referer->value->c_str() : "")
+        *td->secondaryBuffer << " "  << (referer   ? referer->value->c_str() : "")
                     << " "  << (userAgent ? userAgent->value->c_str() : "");
     }
 #ifdef WIN32
-    *td->buffer2  << "\r\n" << end_str;
+    *td->secondaryBuffer  << "\r\n" << end_str;
 #else
-    *td->buffer2  << "\n" << end_str;
+    *td->secondaryBuffer  << "\n" << end_str;
 #endif
     /*!
      *Request the access to the log file then append the message.
      */
      if(td->connection->host)
      {
-       td->connection->host->accessesLogWrite(td->buffer2->getBuffer());
+       td->connection->host->accessesLogWrite(td->secondaryBuffer->getBuffer());
      }
-    td->buffer2->setLength(0);
+    td->secondaryBuffer->setLength(0);
   }
   catch(...)
   {
@@ -1360,9 +1360,9 @@
   try
   {
     td->buffer = a->getActiveThread()->getBuffer();
-    td->buffer2 = a->getActiveThread()->getBuffer2();
+    td->secondaryBuffer = a->getActiveThread()->getSecondaryBuffer();
     td->buffersize = bs1;
-    td->buffersize2 = bs2;
+    td->secondaryBufferSize = bs2;
     td->nBytesToRead = nbtr;
     td->connection = a;
     td->id = id;
@@ -1838,18 +1838,18 @@
   HttpRequestHeader::Entry *connection = td->request.other.get("Connection");
   HttpRequestHeader::Entry *host = td->request.other.get("Host");
   td->response.httpStatus = 401;
-  td->buffer2->setLength(0);
-  *td->buffer2 << "HTTP/1.1 401 Unauthorized\r\n"
+  td->secondaryBuffer->setLength(0);
+  *td->secondaryBuffer << "HTTP/1.1 401 Unauthorized\r\n"
                << "Accept-Ranges: bytes\r\n";
-  *td->buffer2 << "Server: " << MYSERVER_VERSION << "\r\n";
-  *td->buffer2 << "Content-Type: text/html\r\n"
+  *td->secondaryBuffer << "Server: " << MYSERVER_VERSION << "\r\n";
+  *td->secondaryBuffer << "Content-Type: text/html\r\n"
                << "Connection: ";
-  *td->buffer2 << (connection ? connection->value->c_str() : "");
-  *td->buffer2 << "\r\nContent-Length: 0\r\n";
+  *td->secondaryBuffer << (connection ? connection->value->c_str() : "");
+  *td->secondaryBuffer << "\r\nContent-Length: 0\r\n";
 
   if(td->authScheme == HTTP_AUTH_SCHEME_BASIC)
   {
-    *td->buffer2 <<  "WWW-Authenticate: Basic realm=\""
+    *td->secondaryBuffer <<  "WWW-Authenticate: Basic realm=\""
                 << (host ? host->value->c_str() : "") <<  "\"\r\n";
   }
   else if(td->authScheme == HTTP_AUTH_SCHEME_DIGEST)
@@ -1890,7 +1890,7 @@
       ((HttpUserData*)td->connection->protocolBuffer)->nc = 0;
     }
 
-    *td->buffer2 << "WWW-Authenticate: digest "
+    *td->secondaryBuffer << "WWW-Authenticate: digest "
                 << " qop=\"auth\", algorithm =\"MD5\", realm =\""
                 << ((HttpUserData*)td->connection->protocolBuffer)->realm
                 << "\",  opaque =\""
@@ -1901,11 +1901,11 @@
 
     if(((HttpUserData*)td->connection->protocolBuffer)->cnonce[0])
     {
-      *td->buffer2 << ", cnonce =\""
+      *td->secondaryBuffer << ", cnonce =\""
                   <<((HttpUserData*)td->connection->protocolBuffer)->cnonce
                   <<"\" ";
     }
-    *td->buffer2 << "\r\n";
+    *td->secondaryBuffer << "\r\n";
   }
   else
   {
@@ -1914,12 +1914,12 @@
      */
     return raiseHTTPError(501);
   }
-  *td->buffer2 << "Date: ";
+  *td->secondaryBuffer << "Date: ";
   getRFC822GMTTime(time, HTTP_RESPONSE_DATE_DIM);
-  *td->buffer2  << time
+  *td->secondaryBuffer  << time
                << "\r\n\r\n";
-  if(td->connection->socket->send(td->buffer2->getBuffer(),
-                                 td->buffer2->getLength(), 0) == -1)
+  if(td->connection->socket->send(td->secondaryBuffer->getBuffer(),
+                                 td->secondaryBuffer->getLength(), 0) == -1)
   {
     return 0;
   }
@@ -2112,20 +2112,20 @@
   *td->buffer << " from: " ;
   *td->buffer << td->connection->getIpAddr() ;
   *td->buffer << "\r\n";
-  td->buffer2->setLength(0);
-  *td->buffer2 << "HTTP/1.1 500 System Error\r\n";
-  *td->buffer2 << "Server: " << MYSERVER_VERSION << "\r\n";
-  *td->buffer2 <<" Content-Type: text/html\r\nContent-Length: ";
+  td->secondaryBuffer->setLength(0);
+  *td->secondaryBuffer << "HTTP/1.1 500 System Error\r\n";
+  *td->secondaryBuffer << "Server: " << MYSERVER_VERSION << "\r\n";
+  *td->secondaryBuffer <<" Content-Type: text/html\r\nContent-Length: ";
   tmp.intToStr((int)strlen(hardHTML), tmpStr, 12);
-  *td->buffer2 << tmp;
-  *td->buffer2 << "\r\n";
-  *td->buffer2 <<"Date: ";
+  *td->secondaryBuffer << tmp;
+  *td->secondaryBuffer << "\r\n";
+  *td->secondaryBuffer <<"Date: ";
   getRFC822GMTTime(time, HTTP_RESPONSE_DATE_DIM);
-  *td->buffer2 << time;
-  *td->buffer2 << "\r\n\r\n";
+  *td->secondaryBuffer << time;
+  *td->secondaryBuffer << "\r\n\r\n";
   /*! Send the header.  */
-  if(td->connection->socket->send(td->buffer2->getBuffer(),
-                                 (u_long)td->buffer2->getLength(), 0) != -1)
+  if(td->connection->socket->send(td->secondaryBuffer->getBuffer(),
+                                 (u_long)td->secondaryBuffer->getLength(), 0) != -1)
   {
     /*! Send the body.  */
     if(!td->onlyHeader)
@@ -2242,24 +2242,24 @@
   HttpRequestHeader::Entry *connection = td->request.other.get("Connection");
 
   td->response.httpStatus = 302;
-  td->buffer2->setLength(0);
-  *td->buffer2 << "HTTP/1.1 302 Moved\r\nAccept-Ranges: bytes\r\n"
+  td->secondaryBuffer->setLength(0);
+  *td->secondaryBuffer << "HTTP/1.1 302 Moved\r\nAccept-Ranges: bytes\r\n"
               << "Server: "  << MYSERVER_VERSION << "\r\n"
               << "Content-Type: text/html\r\n"
               << "Location: " << newURL << "\r\n"
               << "Content-Length: 0\r\n";
 
   if(connection && !stringcmpi(connection->value->c_str(), "keep-alive"))
-    *td->buffer2 << "Connection: keep-alive\r\n";
+    *td->secondaryBuffer << "Connection: keep-alive\r\n";
   else
-    *td->buffer2 << "Connection: close\r\n";
+    *td->secondaryBuffer << "Connection: close\r\n";
 
-  *td->buffer2<< "Date: ";
+  *td->secondaryBuffer<< "Date: ";
   getRFC822GMTTime(time, HTTP_RESPONSE_DATE_DIM);
-  *td->buffer2 << time
+  *td->secondaryBuffer << time
               << "\r\n\r\n";
-  if(td->connection->socket->send(td->buffer2->getBuffer(),
-                                 (int)td->buffer2->getLength(), 0) == -1)
+  if(td->connection->socket->send(td->secondaryBuffer->getBuffer(),
+                                 (int)td->secondaryBuffer->getLength(), 0) == -1)
     return 0;
 
   return 1;
@@ -2274,21 +2274,21 @@
   HttpRequestHeader::Entry *connection = td->request.other.get("Connection");
 
   td->response.httpStatus = 304;
-  td->buffer2->setLength(0);
-  *td->buffer2 << "HTTP/1.1 304 Not Modified\r\nAccept-Ranges: bytes\r\n"
+  td->secondaryBuffer->setLength(0);
+  *td->secondaryBuffer << "HTTP/1.1 304 Not Modified\r\nAccept-Ranges: bytes\r\n"
               << "Server: "  << MYSERVER_VERSION << "\r\n";
 
   if(connection && !stringcmpi(connection->value->c_str(), "keep-alive"))
-    *td->buffer2 << "Connection: keep-alive\r\n";
+    *td->secondaryBuffer << "Connection: keep-alive\r\n";
   else
-    *td->buffer2 << "Connection: close\r\n";
+    *td->secondaryBuffer << "Connection: close\r\n";
 
   getRFC822GMTTime(time, HTTP_RESPONSE_DATE_DIM);
 
-  *td->buffer2 << "Date: " << time << "\r\n\r\n";
+  *td->secondaryBuffer << "Date: " << time << "\r\n\r\n";
 
-  if(td->connection->socket->send(td->buffer2->getBuffer(),
-                                 (int)td->buffer2->getLength(), 0) == -1)
+  if(td->connection->socket->send(td->secondaryBuffer->getBuffer(),
+                                 (int)td->secondaryBuffer->getLength(), 0) == -1)
     return 0;
   return 1;
 }

Modified: trunk/myserver/src/protocol/http/http_data_read.cpp
===================================================================
--- trunk/myserver/src/protocol/http/http_data_read.cpp	2008-10-19 17:59:24 UTC (rev 2893)
+++ trunk/myserver/src/protocol/http/http_data_read.cpp	2008-10-19 18:50:26 UTC (rev 2894)
@@ -334,8 +334,8 @@
                                     &inPos,
                                     bufferDataSize,
                                     td->connection->socket,
-                                    td->buffer2->getBuffer(),
-                                    td->buffer2->getRealLength() - 1,
+                                    td->secondaryBuffer->getBuffer(),
+                                    td->secondaryBuffer->getRealLength() - 1,
                                     &nbr,
                                     timeout,
                                     &(td->inputData));
@@ -368,8 +368,8 @@
                                        &inPos,
                                        bufferDataSize,
                                        td->connection->socket,
-                                       td->buffer2->getBuffer(),
-                                       td->buffer2->getRealLength() - 1,
+                                       td->secondaryBuffer->getBuffer(),
+                                       td->secondaryBuffer->getRealLength() - 1,
                                        &nbr,
                                        timeout))
     {
@@ -389,9 +389,9 @@
       return 1;
     }
 
-    td->buffer2->getBuffer()[nbr] = '\0';
+    td->secondaryBuffer->getBuffer()[nbr] = '\0';
 
-    if(nbr && td->inputData.writeToFile(td->buffer2->getBuffer(), nbr, &nbw))
+    if(nbr && td->inputData.writeToFile(td->secondaryBuffer->getBuffer(), nbr, &nbw))
     {
       td->inputDataPath.assign("");
       td->outputDataPath.assign("");

Modified: trunk/myserver/src/protocol/http/http_headers.cpp
===================================================================
--- trunk/myserver/src/protocol/http/http_headers.cpp	2008-10-19 17:59:24 UTC (rev 2893)
+++ trunk/myserver/src/protocol/http/http_headers.cpp	2008-10-19 18:50:26 UTC (rev 2894)
@@ -671,8 +671,8 @@
         const char *base64 = &token[strlen("Basic ")];
         int len = getEndLine(base64, 64);
         const char *tmp = base64 + len - 1;
-        const char* lbuffer2;
-        const char* keep_lbuffer2;
+        const char* lsecondaryBuffer;
+        const char* keep_lsecondaryBuffer;
         char login[32];
         char password[32];
         
@@ -688,24 +688,24 @@
         }
         if (len <= 1)
           return 400;
-        lbuffer2 = base64Utils.Decode(base64,&len);
-        keep_lbuffer2 = lbuffer2;
+        lsecondaryBuffer = base64Utils.Decode(base64,&len);
+        keep_lsecondaryBuffer = lsecondaryBuffer;
    
-        for(i = 0; (*lbuffer2 != ':') && (i < 32);i++)
+        for(i = 0; (*lsecondaryBuffer != ':') && (i < 32);i++)
         {
-          login[i] = *lbuffer2++;
+          login[i] = *lsecondaryBuffer++;
           login[i+1] = '\0';
         }
-        lbuffer2++;
-        for(i = 0; (*lbuffer2) && (i < 31); i++)
+        lsecondaryBuffer++;
+        for(i = 0; (*lsecondaryBuffer) && (i < 31); i++)
         {
-          password[i] = *lbuffer2++;
+          password[i] = *lsecondaryBuffer++;
           password[i+1] = '\0';
         }
         connection->setLogin(login);
         connection->setPassword(password);
         tokenOff = getEndLine(token, 100);
-        delete keep_lbuffer2;
+        delete keep_lsecondaryBuffer;
       }
       else if(!request->auth.compare("Digest"))
       {

Modified: trunk/myserver/src/server/clients_thread.cpp
===================================================================
--- trunk/myserver/src/server/clients_thread.cpp	2008-10-19 17:59:24 UTC (rev 2893)
+++ trunk/myserver/src/server/clients_thread.cpp	2008-10-19 18:50:26 UTC (rev 2894)
@@ -92,7 +92,7 @@
   controlProtocolParser = 0;
 
   buffer.free();
-  buffer2.free();
+  secondaryBuffer.free();
 }
 
 /*!
@@ -151,12 +151,12 @@
   ct->threadIsRunning = 1;
   ct->threadIsStopped = 0;
   ct->buffersize = ct->server->getBuffersize();
-  ct->buffersize2 = ct->server->getBuffersize2();
+  ct->secondaryBufferSize = ct->server->getBuffersize2();
   
   ct->buffer.setLength(ct->buffersize);
   ct->buffer.m_nSizeLimit = ct->buffersize;
-  ct->buffer2.setLength(ct->buffersize2);
-  ct->buffer2.m_nSizeLimit = ct->buffersize2;
+  ct->secondaryBuffer.setLength(ct->secondaryBufferSize);
+  ct->secondaryBuffer.m_nSizeLimit = ct->secondaryBufferSize;
 
   /* Built-in protocols will be initialized at the first use.  */
   ct->httpParser = 0;
@@ -355,9 +355,9 @@
     {
       retcode = c->getContinuation()(c, 
                                      (char*)buffer.getBuffer(), 
-                                     (char*)buffer2.getBuffer(), 
+                                     (char*)secondaryBuffer.getBuffer(), 
                                      buffer.getRealLength(), 
-                                     buffer2.getRealLength(), 
+                                     secondaryBuffer.getRealLength(), 
                                      nBytesToRead, 
                                      id);
       c->setContinuation(NULL);
@@ -369,9 +369,9 @@
       {
         retcode = protocol->controlConnection(c, 
                                               (char*)buffer.getBuffer(), 
-                                              (char*)buffer2.getBuffer(), 
+                                              (char*)secondaryBuffer.getBuffer(), 
                                               buffer.getRealLength(), 
-                                              buffer2.getRealLength(), 
+                                              secondaryBuffer.getRealLength(), 
                                               nBytesToRead, 
                                               id);
       }
@@ -457,11 +457,11 @@
   return &buffer;
 }
 /*!
- *Get a pointer to the buffer2.
+ *Get a pointer to the secondaryBuffer.
  */
-MemBuf *ClientsThread::getBuffer2()
+MemBuf *ClientsThread::getSecondaryBuffer()
 {
-  return &buffer2;
+  return &secondaryBuffer;
 }
 
 /*!

Modified: trunk/myserver/src/server/server.cpp
===================================================================
--- trunk/myserver/src/server/server.cpp	2008-10-19 17:59:24 UTC (rev 2893)
+++ trunk/myserver/src/server/server.cpp	2008-10-19 18:50:26 UTC (rev 2894)
@@ -1048,7 +1048,7 @@
   data = configurationFileManager.getValue("BUFFER_SIZE");
   if(data)
   {
-    buffersize=buffersize2= (atol(data) > 81920) ?  atol(data) :  81920 ;
+    buffersize=secondaryBufferSize= (atol(data) > 81920) ?  atol(data) :  81920 ;
   }
   data = configurationFileManager.getValue("CONNECTION_TIMEOUT");
   if(data)
@@ -2056,7 +2056,7 @@
  */
 u_long Server::getBuffersize2()
 {
-  return buffersize2;
+  return secondaryBufferSize;
 }
 
 /*!

Modified: trunk/myserver/tests/test_cached_file.cpp
===================================================================
--- trunk/myserver/tests/test_cached_file.cpp	2008-10-19 17:59:24 UTC (rev 2893)
+++ trunk/myserver/tests/test_cached_file.cpp	2008-10-19 18:50:26 UTC (rev 2894)
@@ -96,7 +96,7 @@
 
     char *buffer =new char[size];
 
-    int ret = cf->readFromFile(buffer, size, &nbr);
+    int ret = cf->read(buffer, size, &nbr);
 
     CPPUNIT_ASSERT_EQUAL(ret, 0);
     CPPUNIT_ASSERT(nbr > 0);





From MAILER-DAEMON Mon Oct 20 16:21:24 2008
Received: from mailman by lists.gnu.org with archive (Exim 4.43)
	id 1Ks1Fk-0002DZ-Le
	for mharc-myserver-commit@gnu.org; Mon, 20 Oct 2008 16:21:24 -0400
Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43)
	id 1Ks1Fi-0002Co-Fd
	for myserver-commit@gnu.org; Mon, 20 Oct 2008 16:21:22 -0400
Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43)
	id 1Ks1Fh-0002CN-T2
	for myserver-commit@gnu.org; Mon, 20 Oct 2008 16:21:22 -0400
Received: from [199.232.76.173] (port=59435 helo=monty-python.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.43) id 1Ks1Fh-0002CH-Bm
	for myserver-commit@gnu.org; Mon, 20 Oct 2008 16:21:21 -0400
Received: from savannah.gnu.org ([199.232.41.3]:52447 helo=sv.gnu.org)
	by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32)
	(Exim 4.60) (envelope-from <INVALID.NOREPLY@gnu.org>)
	id 1Ks1Fg-0001Mp-LP
	for myserver-commit@gnu.org; Mon, 20 Oct 2008 16:21:21 -0400
Received: from cvs.savannah.gnu.org ([199.232.41.69])
	by sv.gnu.org with esmtp (Exim 4.63)
	(envelope-from <INVALID.NOREPLY@gnu.org>) id 1Ks1Fe-0001gX-EB
	for myserver-commit@gnu.org; Mon, 20 Oct 2008 20:21:18 +0000
Received: from gscrivano by cvs.savannah.gnu.org with local (Exim 4.63)
	(envelope-from <gscrivano@savannah.gnu.org>) id 1Ks1Fd-0001gT-B9
	for myserver-commit@gnu.org; Mon, 20 Oct 2008 20:21:17 +0000
MIME-Version: 1.0
Errors-To: gscrivano
To: myserver-commit@gnu.org
X-Mailer: SVN::Notify 2.64: http://search.cpan.org/dist/SVN-Notify/
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
From: Giuseppe Scrivano <gscrivano@gnu.org>
Message-Id: <E1Ks1Fd-0001gT-B9@cvs.savannah.gnu.org>
Date: Mon, 20 Oct 2008 20:21:17 +0000
X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 3)
Subject: [myserver-commit] [2895]
 Added possibility to choose which columns show when a directory is browsed
 .
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/pipermail/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, 20 Oct 2008 20:21:22 -0000

Revision: 2895
          http://svn.sv.gnu.org/viewvc/?view=rev&root=myserver&revision=2895
Author:   gscrivano
Date:     2008-10-20 20:21:15 +0000 (Mon, 20 Oct 2008)

Log Message:
-----------
Added possibility to choose which columns show when a directory is browsed.

Modified Paths:
--------------
    trunk/myserver/include/http_handler/http_dir/http_dir.h
    trunk/myserver/include/protocol/http/http.h
    trunk/myserver/include/protocol/http/http_thread_context.h
    trunk/myserver/src/http_handler/http_dir/http_dir.cpp
    trunk/myserver/src/protocol/http/http.cpp

Modified: trunk/myserver/include/http_handler/http_dir/http_dir.h
===================================================================
--- trunk/myserver/include/http_handler/http_dir/http_dir.h	2008-10-19 18:50:26 UTC (rev 2894)
+++ trunk/myserver/include/http_handler/http_dir/http_dir.h	2008-10-20 20:21:15 UTC (rev 2895)
@@ -52,6 +52,10 @@
   static bool compareFileStructByTime (HttpDir::FileStruct i, HttpDir::FileStruct j);
   static bool compareFileStructBySize (HttpDir::FileStruct i, HttpDir::FileStruct j);
   void getFormattedSize(u_long bytes, string& out);
+  
+  void generateHeader (MemBuf &out, char sortType, bool sortReverse, const char *formatString);
+  void generateElement (MemBuf &out, FileStruct& fs, string &linkPrefix, const char *formatString);
+
 };
 
 

Modified: trunk/myserver/include/protocol/http/http.h
===================================================================
--- trunk/myserver/include/protocol/http/http.h	2008-10-19 18:50:26 UTC (rev 2894)
+++ trunk/myserver/include/protocol/http/http.h	2008-10-20 20:21:15 UTC (rev 2895)
@@ -22,7 +22,6 @@
 #include <include/protocol/http/http_thread_context.h>
 #include <include/protocol/protocol.h>
 #include <include/protocol/http/http_headers.h>
-#include <include/conf/security/security_token.h>
 #include <include/conf/security/security_cache.h>
 #include <include/base/xml/xml_parser.h>
 #include <include/base/thread/thread.h>
@@ -188,10 +187,9 @@
 
   static HttpStaticData* getStaticData();
 
-  SecurityToken *getSecurityToken (){return &securityToken;}
+  SecurityToken *getSecurityToken (){return &(td->securityToken);}
 
 protected:
-  SecurityToken securityToken;
   HttpDataHandler* mscgi;
   HttpDataHandler* wincgi;
   HttpDataHandler* isapi;

Modified: trunk/myserver/include/protocol/http/http_thread_context.h
===================================================================
--- trunk/myserver/include/protocol/http/http_thread_context.h	2008-10-19 18:50:26 UTC (rev 2894)
+++ trunk/myserver/include/protocol/http/http_thread_context.h	2008-10-20 20:21:15 UTC (rev 2895)
@@ -27,6 +27,7 @@
 #include <include/base/mem_buff/mem_buff.h>
 #include <include/connection/connection.h>
 #include <include/conf/mime/mime_manager.h>
+#include <include/conf/security/security_token.h>
 
 extern "C" {
 #ifdef WIN32
@@ -83,6 +84,8 @@
 	Http* http;
 	MimeRecord *mime;
 	int sentData;
+  SecurityToken securityToken;
+
 	const char* getVhostDir();
 	const char* getVhostSys();
 	const char* getHashedData (const char *name);

Modified: trunk/myserver/src/http_handler/http_dir/http_dir.cpp
===================================================================
--- trunk/myserver/src/http_handler/http_dir/http_dir.cpp	2008-10-19 18:50:26 UTC (rev 2894)
+++ trunk/myserver/src/http_handler/http_dir/http_dir.cpp	2008-10-20 20:21:15 UTC (rev 2895)
@@ -163,6 +163,126 @@
 }
 
 /*!
+ *Generate the HTML header for the results table.
+ *\param out Buffer where write it.
+ *\param sortType How elements are sorted.
+ *\param sortReverse True if element are in reverse order.
+ *\param formatString Decide which fields show.
+ */
+void HttpDir::generateHeader (MemBuf &out, char sortType, bool sortReverse,
+                              const char* formatString)
+{
+  const char* cur = formatString;
+
+  out << "<tr>\r\n";
+
+  for (;;)
+  {
+    while (*cur && ((*cur == '%' ) || (*cur == ' ' )))
+      cur++;
+
+    if (!(*cur))
+      break;
+
+    switch (*cur)
+    {
+    case 'f':
+      if (sortType == 'f' && !sortReverse)
+        out << "<th><a href=\"?sort=fI\">File</a></th>\r\n";
+      else
+        out << "<th><a href=\"?sort=f\">File</a></th>\r\n";
+      break;
+
+    case 't':
+      if (sortType == 't' && !sortReverse)
+        out << "<th><a href=\"?sort=tI\">Last Modified</a></th>\r\n";
+      else
+        out << "<th><a href=\"?sort=t\">Last Modified</a></th>\r\n";
+      break;
+
+    case 's':
+    if (sortType == 's' && !sortReverse)
+      out << "<th><a href=\"?sort=sI\">Size</a></th>\r\n";
+    else
+      out << "<th><a href=\"?sort=s\">Size</a></th>\r\n";
+    break;
+    }
+    cur++;
+  }
+
+  out << "</tr>\r\n";
+}
+
+/*!
+ *Generate the HTML code for an element in the result table.
+ *\param out Buffer where write the HTML.
+ *\param file Structure with information on the element.
+ *\param uriEndWithSlash Specify if the requested resource 
+ *ends with a slash.
+ *\param formatString Specify which element show.
+ */
+void HttpDir::generateElement (MemBuf &out, 
+                               FileStruct &file, 
+                               string &linkPrefix,
+                               const char *formatString)
+{
+  char fileTime[32];
+  string name;
+
+  formatHtml (file.name, name);
+
+  out << "<tr>\r\n";
+  
+  const char* cur = formatString;
+
+  for (;;)
+  {
+    while (*cur && ((*cur == '%' ) || (*cur == ' ' )))
+      cur++;
+
+    if (!(*cur))
+      break;
+
+    switch (*cur)
+    {
+    case 'f':
+      out << "<td><a href=\"";
+      out << linkPrefix << name;
+      out << "\">" ;
+      out << name;
+      out << "</a></td>\r\n";
+      break;
+
+    case 't':
+      getRFC822GMTTime(file.time_write, fileTime, 32);
+      out << "<td>";
+      out << fileTime ;
+      out << "</td>\r\n";
+      break;
+
+    case 's':
+      out << "<td>";
+      if(file.attrib & FILE_ATTRIBUTE_DIRECTORY)
+      {
+        out << "[directory]";
+      }
+      else
+      {
+        string tmp;
+        getFormattedSize(file.size, tmp);
+        out << tmp;
+      }
+      out << "</td>";
+      break;
+    }
+
+    cur++;
+  }
+  out << "</tr>\r\n";
+}
+
+
+/*!
  *Browse a directory printing its contents in an HTML file.
  *\param td The current thread context.
  *\param s The current connection structure.
@@ -182,7 +302,6 @@
   int lastSlash = 0;
   bool useChunks = false;
   u_long sentData = 0;
-  char fileTime[32];
   char* bufferloop;
   const char* browseDirCSSpath;
   bool keepalive = false;
@@ -190,6 +309,12 @@
   size_t sortIndex;
   char sortType;
   bool sortReverse = false;
+  string linkPrefix;
+  const char *formatString = td->securityToken.getHashedData ("http.dir.format", 
+                                                              MYSERVER_SECURITY_CONF | MYSERVER_VHOST_CONF |
+                                                              MYSERVER_SERVER_CONF, "%f%t%s");
+
+
   HttpRequestHeader::Entry *host = td->request.other.get("Host");
 
 
@@ -330,23 +455,10 @@
    *files in the directory.
    */
   td->secondaryBuffer->setLength(0);
-  *td->secondaryBuffer << "<table width=\"100%\">\r\n<tr>\r\n" ;
+  *td->secondaryBuffer << "<table width=\"100%\">\r\n" ;
 
-  if(sortType == 'f' && !sortReverse)
-    *td->secondaryBuffer << "<th><a href=\"?sort=fI\">File</a></th>\r\n";
-  else
-    *td->secondaryBuffer << "<th><a href=\"?sort=f\">File</a></th>\r\n";
+  generateHeader (*td->secondaryBuffer, sortType, sortReverse, formatString);
 
-  if(sortType == 't' && !sortReverse)
-    *td->secondaryBuffer << "<th><a href=\"?sort=tI\">Last Modified</a></th>\r\n";
-  else
-    *td->secondaryBuffer << "<th><a href=\"?sort=t\">Last Modified</a></th>\r\n";
-
-  if(sortType == 's' && !sortReverse)
-    *td->secondaryBuffer << "<th><a href=\"?sort=sI\">Size</a></th>\r\n</tr>\r\n";
-  else
-    *td->secondaryBuffer << "<th><a href=\"?sort=s\">Size</a></th>\r\n</tr>\r\n";
-
   ret = appendDataToHTTPChannel(td, td->secondaryBuffer->getBuffer(),
                                 td->secondaryBuffer->getLength(),
                                 &(td->outputData), &chain,
@@ -366,15 +478,33 @@
 
   if(FilesUtility::getPathRecursionLevel(td->request.uri) >= 1)
   {
+    const char* cur = formatString;
     string file;
     file.assign(td->request.uri);
     file.append("/../");
     
-    *td->secondaryBuffer << "<tr>\r\n<td colspan=\"2\">"
-                 << "<a href=\""
-                 << (td->request.uriEndsWithSlash ? ".." : ".")
-           << "\">[ .. ]</a></td>\n"
-                 << "<td>[directory]</td></tr>\r\n";
+    *td->secondaryBuffer << "<tr>\r\n";
+
+    for (;;)
+    {
+      while (*cur && ((*cur == '%' ) || (*cur == ' ' )))
+        cur++;
+      
+      if (!(*cur))
+        break;
+
+      if (*cur == 'f')
+        *td->secondaryBuffer << "<td>\n"
+                             << "<a href=\""
+                             << (td->request.uriEndsWithSlash ? ".." : ".")
+                             << "\">[ .. ]</a></td>\n";
+      else
+        *td->secondaryBuffer << "<td></td>\n";
+
+      cur++;
+    }
+
+    *td->secondaryBuffer << "</tr>\r\n";
     
     ret = appendDataToHTTPChannel(td, td->secondaryBuffer->getBuffer(),
                                   td->secondaryBuffer->getLength(),
@@ -424,48 +554,25 @@
   if(sortReverse)
     reverse (files.begin(), files.end());
 
+  if(!td->request.uriEndsWithSlash)
+  {
+    linkPrefix.assign (&td->request.uri[lastSlash]);
+    linkPrefix.append ("/");
+  }
+  else
+    linkPrefix.assign ("");
+
+
   /* Build the files table and send it.  */
   for(vector<FileStruct>::iterator it = files.begin();
       it != files.end(); it++)
   {  
-    string formattedName;
-
     FileStruct& file = *it;
 
     td->secondaryBuffer->setLength(0);
 
-    *td->secondaryBuffer << "<tr>\r\n<td><a href=\"";
-    if(!td->request.uriEndsWithSlash)
-    {
-      *td->secondaryBuffer << &td->request.uri[lastSlash];
-      *td->secondaryBuffer << "/" ;
-    }
-    formattedName.assign(file.name);
+    generateElement (*td->secondaryBuffer, file, linkPrefix, formatString);
 
-    formatHtml(file.name, formattedName);
-
-    *td->secondaryBuffer << formattedName ;
-    *td->secondaryBuffer << "\">" ;
-    *td->secondaryBuffer << formattedName;
-    *td->secondaryBuffer << "</a></td>\r\n<td>";
-  
-    getRFC822GMTTime(file.time_write, fileTime, 32);
-
-    *td->secondaryBuffer << fileTime ;
-    *td->secondaryBuffer << "</td>\r\n<td>";
-    
-    if(file.attrib & FILE_ATTRIBUTE_DIRECTORY)
-    {
-      *td->secondaryBuffer << "[directory]";
-    }
-    else
-    {
-      string out;
-      getFormattedSize(file.size, out);
-       *td->secondaryBuffer << out;
-    }
-
-    *td->secondaryBuffer << "</td>\r\n</tr>\r\n";
     ret = appendDataToHTTPChannel(td, td->secondaryBuffer->getBuffer(),
                                   td->secondaryBuffer->getLength(),
                                   &(td->outputData), &chain,

Modified: trunk/myserver/src/protocol/http/http.cpp
===================================================================
--- trunk/myserver/src/protocol/http/http.cpp	2008-10-19 18:50:26 UTC (rev 2894)
+++ trunk/myserver/src/protocol/http/http.cpp	2008-10-20 20:21:15 UTC (rev 2895)
@@ -197,8 +197,8 @@
  */
 bool Http::allowHTTPTRACE()
 {
-  const char *allowTrace = securityToken.getHashedData ("http.allow_trace", MYSERVER_VHOST_CONF |
-                                                        MYSERVER_SERVER_CONF, "NO");
+  const char *allowTrace = td->securityToken.getHashedData ("http.allow_trace", MYSERVER_VHOST_CONF |
+                                                              MYSERVER_SERVER_CONF, "NO");
 
   if (!strcmpi (allowTrace, "YES"))
     return true;
@@ -350,18 +350,18 @@
 int Http::getFilePermissions(string& filename, string& directory, string& file, 
                              string &filenamePath, int yetmapped, int* permissions)
 {
-  securityToken.setServer (Server::getInstance ());
-  securityToken.setSysDirectory ((string*)&(td->connection->host->getSystemRoot ()));
+  td->securityToken.setServer (Server::getInstance ());
+  td->securityToken.setSysDirectory ((string*)&(td->connection->host->getSystemRoot ()));
 
-  securityToken.setVhost (td->connection->host);
+  td->securityToken.setVhost (td->connection->host);
 
   try
   {
     FilesUtility::splitPath (filename, directory, file);
     FilesUtility::completePath (directory);
 
-    securityToken.setResource (&filenamePath);
-    securityToken.setDirectory (&directory);
+    td->securityToken.setResource (&filenamePath);
+    td->securityToken.setDirectory (&directory);
 
     /*!
      *td->filenamePath is the file system mapped path while filename
@@ -440,27 +440,27 @@
       return 500;
     }
 
-    securityToken.setUser (user);
-    securityToken.setPassword (password);
+    td->securityToken.setUser (user);
+    td->securityToken.setPassword (password);
 
-    AuthDomain auth (&securityToken);
+    AuthDomain auth (&(td->securityToken));
     HttpReqSecurityDomain httpReqSecDom (&(td->request));
 
-    string validator (securityToken.getHashedData ("sec.validator", MYSERVER_VHOST_CONF |
+    string validator (td->securityToken.getHashedData ("sec.validator", MYSERVER_VHOST_CONF |
                                                    MYSERVER_SERVER_CONF, "xml"));
-    string authMethod (securityToken.getHashedData ("sec.auth_method", MYSERVER_VHOST_CONF |
+    string authMethod (td->securityToken.getHashedData ("sec.auth_method", MYSERVER_VHOST_CONF |
                                                     MYSERVER_SERVER_CONF, "xml"));
 
 
     SecurityDomain* domains[] = {&auth, &httpReqSecDom, NULL};
 
-    Server::getInstance()->getSecurityManager ()->getPermissionMask (&securityToken, domains, 
+    Server::getInstance()->getSecurityManager ()->getPermissionMask (&(td->securityToken), domains, 
                                                                      validator, authMethod);
 
-    const char *authType = securityToken.getHashedData ("http.auth", MYSERVER_SECURITY_CONF |
+    const char *authType = td->securityToken.getHashedData ("http.auth", MYSERVER_SECURITY_CONF |
                                                         MYSERVER_VHOST_CONF |
                                                         MYSERVER_SERVER_CONF);
-    *permissions = securityToken.getMask ();
+    *permissions = td->securityToken.getMask ();
 
     /*! Check if we have to use digest for the current directory. */
     if(authType && !strcmpi(authType, "Digest"))
@@ -476,8 +476,8 @@
 
         if(hud->digest == 1)
         {
-          td->connection->setPassword (securityToken.getNeededPassword ().c_str ());
-          *permissions = securityToken.getProvidedMask ();
+          td->connection->setPassword (td->securityToken.getNeededPassword ().c_str ());
+          *permissions = td->securityToken.getProvidedMask ();
         }
       }
       td->authScheme = HTTP_AUTH_SCHEME_DIGEST;
@@ -493,7 +493,7 @@
     return 500;
   }
 
-  const char *tr = securityToken.getHashedData ("connection.throttling", MYSERVER_SECURITY_CONF |
+  const char *tr = td->securityToken.getHashedData ("connection.throttling", MYSERVER_SECURITY_CONF |
                                                 MYSERVER_VHOST_CONF |
                                                 MYSERVER_SERVER_CONF);
 
@@ -681,7 +681,7 @@
   md5.init();
   td->secondaryBuffer->setLength(0);
   *td->secondaryBuffer << td->request.digestUsername << ":" << td->request.digestRealm
-               << ":" << securityToken.getNeededPassword();
+               << ":" << td->securityToken.getNeededPassword();
 
   md5.update((unsigned char const*)td->secondaryBuffer->getBuffer(),
              (unsigned int)td->secondaryBuffer->getLength());
@@ -1934,7 +1934,6 @@
 {
   try
   {
-    int ret = 0;
     string time;
     ostringstream errorFile;
     string errorMessage;
@@ -1974,9 +1973,9 @@
     char errorName [32];
     sprintf (errorName, "http.error.file.%i", ID);
 
-    const char *defErrorFile = securityToken.getHashedData (errorName, MYSERVER_SECURITY_CONF |
-                                                            MYSERVER_VHOST_CONF |
-                                                            MYSERVER_SERVER_CONF);
+    const char *defErrorFile = td->securityToken.getHashedData (errorName, MYSERVER_SECURITY_CONF |
+                                                                MYSERVER_VHOST_CONF |
+                                                                MYSERVER_SERVER_CONF);
 
     if (defErrorFile)
     {





From MAILER-DAEMON Tue Oct 21 16:54:02 2008
Received: from mailman by lists.gnu.org with archive (Exim 4.43)
	id 1KsOEr-0002Ll-Vt
	for mharc-myserver-commit@gnu.org; Tue, 21 Oct 2008 16:54:02 -0400
Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43)
	id 1KsOEp-0002LT-RQ
	for myserver-commit@gnu.org; Tue, 21 Oct 2008 16:53:59 -0400
Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43)
	id 1KsOEp-0002Kk-BI
	for myserver-commit@gnu.org; Tue, 21 Oct 2008 16:53:59 -0400
Received: from [199.232.76.173] (port=45013 helo=monty-python.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.43) id 1KsOEp-0002Kg-4q
	for myserver-commit@gnu.org; Tue, 21 Oct 2008 16:53:59 -0400
Received: from savannah.gnu.org ([199.232.41.3]:51065 helo=sv.gnu.org)
	by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32)
	(Exim 4.60) (envelope-from <INVALID.NOREPLY@gnu.org>)
	id 1KsOEo-0003f2-QT
	for myserver-commit@gnu.org; Tue, 21 Oct 2008 16:53:58 -0400
Received: from cvs.savannah.gnu.org ([199.232.41.69])
	by sv.gnu.org with esmtp (Exim 4.63)
	(envelope-from <INVALID.NOREPLY@gnu.org>) id 1KsOEo-0000TH-6a
	for myserver-commit@gnu.org; Tue, 21 Oct 2008 20:53:58 +0000
Received: from gscrivano by cvs.savannah.gnu.org with local (Exim 4.63)
	(envelope-from <gscrivano@savannah.gnu.org>) id 1KsOEn-0000TC-Th
	for myserver-commit@gnu.org; Tue, 21 Oct 2008 20:53:58 +0000
MIME-Version: 1.0
Errors-To: gscrivano
To: myserver-commit@gnu.org
X-Mailer: SVN::Notify 2.64: http://search.cpan.org/dist/SVN-Notify/
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
From: Giuseppe Scrivano <gscrivano@gnu.org>
Message-Id: <E1KsOEn-0000TC-Th@cvs.savannah.gnu.org>
Date: Tue, 21 Oct 2008 20:53:57 +0000
X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 3)
Subject: [myserver-commit] [2896] Changed code to find `PATH_INFO'.
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/pipermail/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, 21 Oct 2008 20:54:00 -0000

Revision: 2896
          http://svn.sv.gnu.org/viewvc/?view=rev&root=myserver&revision=2896
Author:   gscrivano
Date:     2008-10-21 20:53:57 +0000 (Tue, 21 Oct 2008)

Log Message:
-----------
Changed code to find `PATH_INFO'.

Modified Paths:
--------------
    trunk/myserver/include/base/file/files_utility.h
    trunk/myserver/src/base/file/files_utility.cpp
    trunk/myserver/src/conf/security/xml_validator.cpp
    trunk/myserver/src/protocol/http/http.cpp

Modified: trunk/myserver/include/base/file/files_utility.h
===================================================================
--- trunk/myserver/include/base/file/files_utility.h	2008-10-20 20:21:15 UTC (rev 2895)
+++ trunk/myserver/include/base/file/files_utility.h	2008-10-21 20:53:57 UTC (rev 2896)
@@ -103,6 +103,7 @@
 
   static void resetTmpPath();
   static void setTmpPath(string & path){tmpPath.assign(path);}
+
 private:
 	static string tmpPath;
 };

Modified: trunk/myserver/src/base/file/files_utility.cpp
===================================================================
--- trunk/myserver/src/base/file/files_utility.cpp	2008-10-20 20:21:15 UTC (rev 2895)
+++ trunk/myserver/src/base/file/files_utility.cpp	2008-10-21 20:53:57 UTC (rev 2896)
@@ -312,9 +312,10 @@
                        NULL, OPEN_EXISTING,
                        FILE_ATTRIBUTE_NORMAL | FILE_FLAG_BACKUP_SEMANTICS,
                        NULL);
- int nRet = hFile != INVALID_HANDLE_VALUE ? 1 : 0;
-    CloseHandle(hFile);
-    return nRet;
+
+  int nRet = hFile != INVALID_HANDLE_VALUE ? 1 : 0;
+  CloseHandle(hFile);
+  return nRet;
 #endif
 #ifdef NOT_WIN
   struct stat F_Stats;

Modified: trunk/myserver/src/conf/security/xml_validator.cpp
===================================================================
--- trunk/myserver/src/conf/security/xml_validator.cpp	2008-10-20 20:21:15 UTC (rev 2895)
+++ trunk/myserver/src/conf/security/xml_validator.cpp	2008-10-21 20:53:57 UTC (rev 2896)
@@ -319,8 +319,6 @@
 void XmlValidator::doPermission (xmlNodePtr node, SecurityToken *st, HashMap<string, SecurityDomain*> *hashedDomains)
 {
   string name;
-  const xmlChar *isNot = (const xmlChar*)"";
-  const xmlChar *value = (const xmlChar*)"";
   xmlAttr *attrs = node->properties;
 
   st->setProvidedMask (getPermissions (attrs));

Modified: trunk/myserver/src/protocol/http/http.cpp
===================================================================
--- trunk/myserver/src/protocol/http/http.cpp	2008-10-20 20:21:15 UTC (rev 2895)
+++ trunk/myserver/src/protocol/http/http.cpp	2008-10-21 20:53:57 UTC (rev 2896)
@@ -546,36 +546,32 @@
     filenamePathLen = (int)td->filenamePath.length();
     dirscan.assign("");
 
-    for(int i = 0, len = 0; i < filenamePathLen ; i++)
+    for(u_long i = 0; i < filenamePathLen ; )
     {
       /*!
-       *http://host/pathtofile/filetosend.php/PATH_INFO_VALUE?QUERY_INFO_VALUE
-       *When a request has this form send the file filetosend.php with the
+       *http://host/path/to/file/file.txt/PATH_INFO_VALUE?QUERY_INFO_VALUE
+       *When a request has this form send the file file.txt with the
        *environment string PATH_INFO equals to PATH_INFO_VALUE and QUERY_INFO
        *to QUERY_INFO_VALUE.
        *
        *If there is the '/' character check if dirscan is a file.
        */
-      if(i && (td->filenamePath[i] == '/'))
-      {
-        /*!
-         *If the token is a file.
-         */
-        if(!FilesUtility::isDirectory(dirscan.c_str()))
-        {
-          td->pathInfo.assign((char*) & (td->filenamePath[i]));
-          td->filenamePath.assign(dirscan);
-          break;
-        }
-      }
 
-      if(len + 1 < filenamePathLen)
+      u_long next = td->filenamePath.find ('/', i + 1);
+
+      if (next == string::npos)
+        break;
+
+      const char *curr = td->filenamePath.substr (0, next).c_str ();
+
+      if(!FilesUtility::isDirectory (curr))
       {
-        char db[2];
-        db[0] = (td->filenamePath)[i];
-        db[1] = '\0';
-        dirscan.append(db);
+        td->pathInfo.assign (&(td->filenamePath.c_str ()[next]));
+        td->filenamePath.erase (next);
+        break;
       }
+
+      i = next;
     }
 
     /*!





From MAILER-DAEMON Wed Oct 22 14:05:32 2008
Received: from mailman by lists.gnu.org with archive (Exim 4.43)
	id 1Ksi5L-0006CX-Sh
	for mharc-myserver-commit@gnu.org; Wed, 22 Oct 2008 14:05:32 -0400
Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43)
	id 1Ksi5G-00069k-Jd
	for myserver-commit@gnu.org; Wed, 22 Oct 2008 14:05:27 -0400
Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43)
	id 1Ksi5C-00067y-C5
	for myserver-commit@gnu.org; Wed, 22 Oct 2008 14:05:24 -0400
Received: from [199.232.76.173] (port=35681 helo=monty-python.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.43) id 1Ksi5B-00067u-6g
	for myserver-commit@gnu.org; Wed, 22 Oct 2008 14:05:21 -0400
Received: from savannah.gnu.org ([199.232.41.3]:51234 helo=sv.gnu.org)
	by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32)
	(Exim 4.60) (envelope-from <INVALID.NOREPLY@gnu.org>)
	id 1Ksi59-0005N4-P4
	for myserver-commit@gnu.org; Wed, 22 Oct 2008 14:05:20 -0400
Received: from cvs.savannah.gnu.org ([199.232.41.69])
	by sv.gnu.org with esmtp (Exim 4.63)
	(envelope-from <INVALID.NOREPLY@gnu.org>) id 1Ksi57-0005qM-0l
	for myserver-commit@gnu.org; Wed, 22 Oct 2008 18:05:17 +0000
Received: from gscrivano by cvs.savannah.gnu.org with local (Exim 4.63)
	(envelope-from <gscrivano@savannah.gnu.org>) id 1Ksi56-0005qI-L0
	for myserver-commit@gnu.org; Wed, 22 Oct 2008 18:05:16 +0000
MIME-Version: 1.0
Errors-To: gscrivano
To: myserver-commit@gnu.org
X-Mailer: SVN::Notify 2.64: http://search.cpan.org/dist/SVN-Notify/
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
From: Giuseppe Scrivano <gscrivano@gnu.org>
Message-Id: <E1Ksi56-0005qI-L0@cvs.savannah.gnu.org>
Date: Wed, 22 Oct 2008 18:05:16 +0000
X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 3)
Subject: [myserver-commit] [2897] Removed `HttpHeaderChecker' class.
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/pipermail/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, 22 Oct 2008 18:05:28 -0000

Revision: 2897
          http://svn.sv.gnu.org/viewvc/?view=rev&root=myserver&revision=2897
Author:   gscrivano
Date:     2008-10-22 18:05:14 +0000 (Wed, 22 Oct 2008)

Log Message:
-----------
Removed `HttpHeaderChecker' class.  It is obsoleted by the new security functionalities.

Modified Paths:
--------------
    trunk/myserver/include/conf/mime/mime_manager.h
    trunk/myserver/include/protocol/http/Makefile.am
    trunk/myserver/myserver.dev
    trunk/myserver/src/conf/mime/mime_manager.cpp
    trunk/myserver/src/protocol/http/Makefile.am
    trunk/myserver/src/protocol/http/http.cpp

Removed Paths:
-------------
    trunk/myserver/include/protocol/http/http_header_checker.h
    trunk/myserver/src/protocol/http/http_header_checker.cpp

Modified: trunk/myserver/include/conf/mime/mime_manager.h
===================================================================
--- trunk/myserver/include/conf/mime/mime_manager.h	2008-10-21 20:53:57 UTC (rev 2896)
+++ trunk/myserver/include/conf/mime/mime_manager.h	2008-10-22 18:05:14 UTC (rev 2897)
@@ -21,7 +21,6 @@
 
 #include <include/base/utility.h>
 #include <include/base/hash_map/hash_map.h>
-#include <include/protocol/http/http_header_checker.h>
 #include <include/base/sync/read_write_lock.h>
 
 #ifdef WIN32
@@ -99,9 +98,8 @@
 	int command;
 	string cgiManager;
 	unsigned int extensionHashCode;
-	HttpHeaderChecker headerChecker;
 	MimeRecord()
-	{headerChecker.clear(); filters.clear(); extension.assign(""); 
+	{filters.clear(); extension.assign(""); 
 		mimeType.assign(""); cgiManager.assign(""); cmdName.assign("");
 		command=extensionHashCode = 0;}
 	MimeRecord(MimeRecord&);

Modified: trunk/myserver/include/protocol/http/Makefile.am
===================================================================
--- trunk/myserver/include/protocol/http/Makefile.am	2008-10-21 20:53:57 UTC (rev 2896)
+++ trunk/myserver/include/protocol/http/Makefile.am	2008-10-22 18:05:14 UTC (rev 2897)
@@ -1,4 +1,4 @@
 httpincludedir=$(includedir)/myserver/include/protocol/http
-httpinclude_HEADERS = http_data_handler.h http_data_read.h http_errors.h http.h http_header_checker.h http_header.h http_headers.h http_request.h http_req_security_domain.h http_response.h http_thread_context.h
+httpinclude_HEADERS = http_data_handler.h http_data_read.h http_errors.h http.h http_header.h http_headers.h http_request.h http_req_security_domain.h http_response.h http_thread_context.h
 SUBDIRS = env
 

Deleted: trunk/myserver/include/protocol/http/http_header_checker.h
===================================================================
--- trunk/myserver/include/protocol/http/http_header_checker.h	2008-10-21 20:53:57 UTC (rev 2896)
+++ trunk/myserver/include/protocol/http/http_header_checker.h	2008-10-22 18:05:14 UTC (rev 2897)
@@ -1,63 +0,0 @@
-/* -*- mode: c++ -*- */
-/*
-MyServer
-Copyright (C) 2005 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
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program.  If not, see <http://www.gnu.org/licenses/>.
-*/
-
-#ifndef HTTP_HEADER_CHECKER_H
-#define HTTP_HEADER_CHECKER_H
-
-#include "stdafx.h"
-#include <include/protocol/http/http_headers.h>
-#include <include/base/regex/myserver_regex.h>
-#include <include/protocol/http/http_request.h>
-#include <include/protocol/http/http_response.h>
-
-#include <string>
-#include <sstream>
-#include <list>
-using namespace std;
-
-class HttpHeaderChecker
-{
-public:
-  enum CMD{DENY=0,  ALLOW=1};  
-  struct Rule
-  {
-    string name;
-    Regex value;
-    CMD cmd;
-    Rule()
-    {name.assign(""); cmd=ALLOW;}
-
-    Rule(Rule& r)
-    {name.assign(r.name); value.clone(r.value); cmd=r.cmd;}
-  };
-  HttpHeaderChecker();
-  HttpHeaderChecker(HttpHeaderChecker&);
-  ~HttpHeaderChecker();  
-  void addRule(HttpHeaderChecker::Rule*);
-  void addRule(HttpHeaderChecker::Rule&);
-  void clear();
-  int isAllowed(HttpHeader*);
-  CMD getDefaultCmd();
-  void setDefaultCmd(CMD);
-  void clone(HttpHeaderChecker&);
-protected:
-  list<HttpHeaderChecker::Rule*> rules;
-  CMD defaultCmd;
-};
-
-#endif

Modified: trunk/myserver/myserver.dev
===================================================================
--- trunk/myserver/myserver.dev	2008-10-21 20:53:57 UTC (rev 2896)
+++ trunk/myserver/myserver.dev	2008-10-22 18:05:14 UTC (rev 2897)
@@ -1,7 +1,7 @@
 [Project]
 FileName=myserver.dev
 Name=myserver
-UnitCount=94
+UnitCount=112
 Type=1
 Ver=1
 ObjFiles=
@@ -87,7 +87,7 @@
 BuildCmd=
 
 [Unit5]
-FileName=src\conf\mime\mime_manager.cpp
+FileName=src\log\stream\console_stream_creator.cpp
 CompileCpp=1
 Folder=myserver
 Compile=1
@@ -97,7 +97,7 @@
 BuildCmd=
 
 [Unit6]
-FileName=src\conf\security\security_cache.cpp
+FileName=src\log\stream\file_stream.cpp
 CompileCpp=1
 Folder=myserver
 Compile=1
@@ -107,7 +107,7 @@
 BuildCmd=
 
 [Unit7]
-FileName=src\conf\security\security.cpp
+FileName=src\log\stream\log_stream.cpp
 CompileCpp=1
 Folder=myserver
 Compile=1
@@ -117,7 +117,7 @@
 BuildCmd=
 
 [Unit8]
-FileName=src\conf\vhost\vhost.cpp
+FileName=src\log\stream\log_stream_factory.cpp
 CompileCpp=1
 Folder=myserver
 Compile=1
@@ -127,7 +127,7 @@
 BuildCmd=
 
 [Unit9]
-FileName=src\conf\vhost\vhost_manager.cpp
+FileName=src\log\stream\socket_stream.cpp
 CompileCpp=1
 Folder=myserver
 Compile=1
@@ -137,7 +137,7 @@
 BuildCmd=
 
 [Unit10]
-FileName=src\connections_scheduler\connections_scheduler.cpp
+FileName=src\log\stream\file_stream_creator.cpp
 CompileCpp=1
 Folder=myserver
 Compile=1
@@ -147,7 +147,7 @@
 BuildCmd=
 
 [Unit11]
-FileName=src\connections_scheduler\listen_threads.cpp
+FileName=src\log\stream\log_stream_creator.cpp
 CompileCpp=1
 Folder=myserver
 Compile=1
@@ -157,7 +157,7 @@
 BuildCmd=
 
 [Unit12]
-FileName=src\http_handler\wincgi\wincgi.cpp
+FileName=src\log\stream\console_stream.cpp
 CompileCpp=1
 Folder=myserver
 Compile=1
@@ -167,7 +167,7 @@
 BuildCmd=
 
 [Unit13]
-FileName=src\http_handler\cgi\cgi.cpp
+FileName=src\log\stream\socket_stream_creator.cpp
 CompileCpp=1
 Folder=myserver
 Compile=1
@@ -177,7 +177,7 @@
 BuildCmd=
 
 [Unit14]
-FileName=src\http_handler\mscgi\mscgi.cpp
+FileName=src\conf\mime\mime_manager.cpp
 CompileCpp=1
 Folder=myserver
 Compile=1
@@ -187,7 +187,7 @@
 BuildCmd=
 
 [Unit15]
-FileName=src\http_handler\mscgi\mscgi_manager.cpp
+FileName=src\conf\security\validator.cpp
 CompileCpp=1
 Folder=myserver
 Compile=1
@@ -197,7 +197,7 @@
 BuildCmd=
 
 [Unit16]
-FileName=src\http_handler\fastcgi\fastcgi.cpp
+FileName=src\conf\security\security_manager.cpp
 CompileCpp=1
 Folder=myserver
 Compile=1
@@ -207,7 +207,7 @@
 BuildCmd=
 
 [Unit17]
-FileName=src\http_handler\http_file\http_file.cpp
+FileName=src\conf\security\security_domain.cpp
 CompileCpp=1
 Folder=myserver
 Compile=1
@@ -217,7 +217,7 @@
 BuildCmd=
 
 [Unit18]
-FileName=src\http_handler\scgi\scgi.cpp
+FileName=src\conf\security\auth_method.cpp
 CompileCpp=1
 Folder=myserver
 Compile=1
@@ -227,7 +227,7 @@
 BuildCmd=
 
 [Unit19]
-FileName=src\http_handler\isapi\isapi.cpp
+FileName=src\conf\security\auth_method_factory.cpp
 CompileCpp=1
 Folder=myserver
 Compile=1
@@ -237,7 +237,7 @@
 BuildCmd=
 
 [Unit20]
-FileName=src\http_handler\http_dir\http_dir.cpp
+FileName=src\conf\security\security_cache.cpp
 CompileCpp=1
 Folder=myserver
 Compile=1
@@ -247,7 +247,7 @@
 BuildCmd=
 
 [Unit21]
-FileName=src\base\utility.cpp
+FileName=src\conf\security\auth_domain.cpp
 CompileCpp=1
 Folder=myserver
 Compile=1
@@ -257,7 +257,7 @@
 BuildCmd=
 
 [Unit22]
-FileName=src\base\find_data\find_data.cpp
+FileName=src\conf\security\security_token.cpp
 CompileCpp=1
 Folder=myserver
 Compile=1
@@ -267,7 +267,7 @@
 BuildCmd=
 
 [Unit23]
-FileName=src\base\file\files_utility.cpp
+FileName=src\conf\security\xml_validator.cpp
 CompileCpp=1
 Folder=myserver
 Compile=1
@@ -277,7 +277,7 @@
 BuildCmd=
 
 [Unit24]
-FileName=src\base\file\file.cpp
+FileName=src\conf\security\validator_factory.cpp
 CompileCpp=1
 Folder=myserver
 Compile=1
@@ -287,7 +287,7 @@
 BuildCmd=
 
 [Unit25]
-FileName=src\base\pipe\pipe.cpp
+FileName=src\conf\vhost\vhost.cpp
 CompileCpp=1
 Folder=myserver
 Compile=1
@@ -297,7 +297,7 @@
 BuildCmd=
 
 [Unit26]
-FileName=src\base\base64\mime_utils.cpp
+FileName=src\conf\vhost\vhost_manager.cpp
 CompileCpp=1
 Folder=myserver
 Compile=1
@@ -307,7 +307,7 @@
 BuildCmd=
 
 [Unit27]
-FileName=src\base\mem_buff\mem_buff.cpp
+FileName=src\connections_scheduler\connections_scheduler.cpp
 CompileCpp=1
 Folder=myserver
 Compile=1
@@ -317,7 +317,7 @@
 BuildCmd=
 
 [Unit28]
-FileName=src\base\home_dir\home_dir.cpp
+FileName=src\connections_scheduler\listen_threads.cpp
 CompileCpp=1
 Folder=myserver
 Compile=1
@@ -327,7 +327,7 @@
 BuildCmd=
 
 [Unit29]
-FileName=src\base\multicast\multicast.cpp
+FileName=src\http_handler\wincgi\wincgi.cpp
 CompileCpp=1
 Folder=myserver
 Compile=1
@@ -337,7 +337,7 @@
 BuildCmd=
 
 [Unit30]
-FileName=src\base\sync\recursive_mutex.cpp
+FileName=src\http_handler\cgi\cgi.cpp
 CompileCpp=1
 Folder=myserver
 Compile=1
@@ -347,7 +347,7 @@
 BuildCmd=
 
 [Unit31]
-FileName=src\base\sync\semaphore.cpp
+FileName=src\http_handler\mscgi\mscgi.cpp
 CompileCpp=1
 Folder=myserver
 Compile=1
@@ -357,7 +357,7 @@
 BuildCmd=
 
 [Unit32]
-FileName=src\base\sync\mutex.cpp
+FileName=src\http_handler\mscgi\mscgi_manager.cpp
 CompileCpp=1
 Folder=myserver
 Compile=1
@@ -367,7 +367,7 @@
 BuildCmd=
 
 [Unit33]
-FileName=src\base\sync\event.cpp
+FileName=src\http_handler\fastcgi\fastcgi.cpp
 CompileCpp=1
 Folder=myserver
 Compile=1
@@ -377,7 +377,7 @@
 BuildCmd=
 
 [Unit34]
-FileName=src\base\sync\read_write_lock.cpp
+FileName=src\http_handler\http_file\http_file.cpp
 CompileCpp=1
 Folder=myserver
 Compile=1
@@ -387,7 +387,7 @@
 BuildCmd=
 
 [Unit35]
-FileName=src\base\safetime\safetime.cpp
+FileName=src\http_handler\scgi\scgi.cpp
 CompileCpp=1
 Folder=myserver
 Compile=1
@@ -397,7 +397,7 @@
 BuildCmd=
 
 [Unit36]
-FileName=src\base\socket\socket.cpp
+FileName=src\http_handler\isapi\isapi.cpp
 CompileCpp=1
 Folder=myserver
 Compile=1
@@ -407,7 +407,7 @@
 BuildCmd=
 
 [Unit37]
-FileName=src\base\socket\ssl_socket.cpp
+FileName=src\http_handler\http_dir\http_dir.cpp
 CompileCpp=1
 Folder=myserver
 Compile=1
@@ -417,7 +417,7 @@
 BuildCmd=
 
 [Unit38]
-FileName=src\base\hash_map\hash_map.cpp
+FileName=src\base\utility.cpp
 CompileCpp=1
 Folder=myserver
 Compile=1
@@ -427,7 +427,7 @@
 BuildCmd=
 
 [Unit39]
-FileName=src\base\dynamic_lib\dynamiclib.cpp
+FileName=src\base\find_data\find_data.cpp
 CompileCpp=1
 Folder=myserver
 Compile=1
@@ -437,7 +437,7 @@
 BuildCmd=
 
 [Unit40]
-FileName=src\base\process\process_server_manager.cpp
+FileName=src\base\file\files_utility.cpp
 CompileCpp=1
 Folder=myserver
 Compile=1
@@ -447,7 +447,7 @@
 BuildCmd=
 
 [Unit41]
-FileName=src\base\process\process.cpp
+FileName=src\base\file\file.cpp
 CompileCpp=1
 Folder=myserver
 Compile=1
@@ -457,7 +457,7 @@
 BuildCmd=
 
 [Unit42]
-FileName=src\base\md5\md5.cpp
+FileName=src\base\pipe\pipe.cpp
 CompileCpp=1
 Folder=myserver
 Compile=1
@@ -467,7 +467,7 @@
 BuildCmd=
 
 [Unit43]
-FileName=src\base\ssl\ssl.cpp
+FileName=src\base\base64\mime_utils.cpp
 CompileCpp=1
 Folder=myserver
 Compile=1
@@ -477,7 +477,7 @@
 BuildCmd=
 
 [Unit44]
-FileName=src\base\xml\xml_parser.cpp
+FileName=src\base\mem_buff\mem_buff.cpp
 CompileCpp=1
 Folder=myserver
 Compile=1
@@ -487,7 +487,7 @@
 BuildCmd=
 
 [Unit45]
-FileName=src\base\files_cache\cached_file_factory.cpp
+FileName=src\base\home_dir\home_dir.cpp
 CompileCpp=1
 Folder=myserver
 Compile=1
@@ -497,7 +497,7 @@
 BuildCmd=
 
 [Unit46]
-FileName=src\base\files_cache\cached_file_buffer.cpp
+FileName=src\base\multicast\multicast.cpp
 CompileCpp=1
 Folder=myserver
 Compile=1
@@ -507,7 +507,7 @@
 BuildCmd=
 
 [Unit47]
-FileName=src\base\files_cache\cached_file.cpp
+FileName=src\base\sync\recursive_mutex.cpp
 CompileCpp=1
 Folder=myserver
 Compile=1
@@ -517,7 +517,7 @@
 BuildCmd=
 
 [Unit48]
-FileName=src\base\string\stringutils.cpp
+FileName=src\base\sync\semaphore.cpp
 CompileCpp=1
 Folder=myserver
 Compile=1
@@ -527,7 +527,7 @@
 BuildCmd=
 
 [Unit49]
-FileName=src\base\string\securestr.cpp
+FileName=src\base\sync\mutex.cpp
 CompileCpp=1
 Folder=myserver
 Compile=1
@@ -537,7 +537,7 @@
 BuildCmd=
 
 [Unit50]
-FileName=src\base\regex\myserver_regex.cpp
+FileName=src\base\sync\event.cpp
 CompileCpp=1
 Folder=myserver
 Compile=1
@@ -547,7 +547,7 @@
 BuildCmd=
 
 [Unit51]
-FileName=src\base\thread\thread.cpp
+FileName=src\base\sync\read_write_lock.cpp
 CompileCpp=1
 Folder=myserver
 Compile=1
@@ -557,7 +557,7 @@
 BuildCmd=
 
 [Unit52]
-FileName=src\protocol\protocol.cpp
+FileName=src\base\safetime\safetime.cpp
 CompileCpp=1
 Folder=myserver
 Compile=1
@@ -567,7 +567,7 @@
 BuildCmd=
 
 [Unit53]
-FileName=src\protocol\protocol_buffer.cpp
+FileName=src\base\socket\socket.cpp
 CompileCpp=1
 Folder=myserver
 Compile=1
@@ -577,7 +577,7 @@
 BuildCmd=
 
 [Unit54]
-FileName=src\protocol\ftp\ftp_parser.cpp
+FileName=src\base\socket\ssl_socket.cpp
 CompileCpp=1
 Folder=myserver
 Compile=1
@@ -587,7 +587,7 @@
 BuildCmd=
 
 [Unit55]
-FileName=src\protocol\ftp\ftp_lexer.cpp
+FileName=src\base\hash_map\hash_map.cpp
 CompileCpp=1
 Folder=myserver
 Compile=1
@@ -597,7 +597,7 @@
 BuildCmd=
 
 [Unit56]
-FileName=src\protocol\ftp\ftp.cpp
+FileName=src\base\dynamic_lib\dynamiclib.cpp
 CompileCpp=1
 Folder=myserver
 Compile=1
@@ -607,7 +607,7 @@
 BuildCmd=
 
 [Unit57]
-FileName=src\protocol\control\control_header.cpp
+FileName=src\base\process\process_server_manager.cpp
 CompileCpp=1
 Folder=myserver
 Compile=1
@@ -617,7 +617,7 @@
 BuildCmd=
 
 [Unit58]
-FileName=src\protocol\control\control_protocol.cpp
+FileName=src\base\process\process.cpp
 CompileCpp=1
 Folder=myserver
 Compile=1
@@ -627,7 +627,7 @@
 BuildCmd=
 
 [Unit59]
-FileName=src\protocol\https\https.cpp
+FileName=src\base\md5\md5.cpp
 CompileCpp=1
 Folder=myserver
 Compile=1
@@ -637,7 +637,7 @@
 BuildCmd=
 
 [Unit60]
-FileName=src\protocol\http\http_data_handler.cpp
+FileName=src\base\ssl\ssl.cpp
 CompileCpp=1
 Folder=myserver
 Compile=1
@@ -647,7 +647,7 @@
 BuildCmd=
 
 [Unit61]
-FileName=src\protocol\http\http_errors.cpp
+FileName=src\base\xml\xml_parser.cpp
 CompileCpp=1
 Folder=myserver
 Compile=1
@@ -657,7 +657,7 @@
 BuildCmd=
 
 [Unit62]
-FileName=src\protocol\http\http_response.cpp
+FileName=src\base\files_cache\cached_file_factory.cpp
 CompileCpp=1
 Folder=myserver
 Compile=1
@@ -667,7 +667,7 @@
 BuildCmd=
 
 [Unit63]
-FileName=src\protocol\http\http_data_read.cpp
+FileName=src\base\files_cache\cached_file_buffer.cpp
 CompileCpp=1
 Folder=myserver
 Compile=1
@@ -677,7 +677,7 @@
 BuildCmd=
 
 [Unit64]
-FileName=src\protocol\http\http.cpp
+FileName=src\base\files_cache\cached_file.cpp
 CompileCpp=1
 Folder=myserver
 Compile=1
@@ -687,7 +687,7 @@
 BuildCmd=
 
 [Unit65]
-FileName=src\protocol\http\http_headers.cpp
+FileName=src\base\string\stringutils.cpp
 CompileCpp=1
 Folder=myserver
 Compile=1
@@ -697,7 +697,7 @@
 BuildCmd=
 
 [Unit66]
-FileName=src\protocol\http\http_thread_context.cpp
+FileName=src\base\string\securestr.cpp
 CompileCpp=1
 Folder=myserver
 Compile=1
@@ -707,7 +707,7 @@
 BuildCmd=
 
 [Unit67]
-FileName=src\protocol\http\http_header_checker.cpp
+FileName=src\base\regex\myserver_regex.cpp
 CompileCpp=1
 Folder=myserver
 Compile=1
@@ -717,6 +717,176 @@
 BuildCmd=
 
 [Unit68]
+FileName=src\base\thread\thread.cpp
+CompileCpp=1
+Folder=myserver
+Compile=1
+Link=1
+Priority=1000
+OverrideBuildCmd=0
+BuildCmd=
+
+[Unit69]
+FileName=src\protocol\protocol.cpp
+CompileCpp=1
+Folder=myserver
+Compile=1
+Link=1
+Priority=1000
+OverrideBuildCmd=0
+BuildCmd=
+
+[Unit70]
+FileName=src\protocol\protocol_buffer.cpp
+CompileCpp=1
+Folder=myserver
+Compile=1
+Link=1
+Priority=1000
+OverrideBuildCmd=0
+BuildCmd=
+
+[Unit71]
+FileName=src\protocol\ftp\ftp_parser.cpp
+CompileCpp=1
+Folder=myserver
+Compile=1
+Link=1
+Priority=1000
+OverrideBuildCmd=0
+BuildCmd=
+
+[Unit72]
+FileName=src\protocol\ftp\ftp_lexer.cpp
+CompileCpp=1
+Folder=myserver
+Compile=1
+Link=1
+Priority=1000
+OverrideBuildCmd=0
+BuildCmd=
+
+[Unit73]
+FileName=src\protocol\ftp\ftp.cpp
+CompileCpp=1
+Folder=myserver
+Compile=1
+Link=1
+Priority=1000
+OverrideBuildCmd=0
+BuildCmd=
+
+[Unit74]
+FileName=src\protocol\control\control_header.cpp
+CompileCpp=1
+Folder=myserver
+Compile=1
+Link=1
+Priority=1000
+OverrideBuildCmd=0
+BuildCmd=
+
+[Unit75]
+FileName=src\protocol\control\control_protocol.cpp
+CompileCpp=1
+Folder=myserver
+Compile=1
+Link=1
+Priority=1000
+OverrideBuildCmd=0
+BuildCmd=
+
+[Unit76]
+FileName=src\protocol\https\https.cpp
+CompileCpp=1
+Folder=myserver
+Compile=1
+Link=1
+Priority=1000
+OverrideBuildCmd=0
+BuildCmd=
+
+[Unit77]
+FileName=src\protocol\http\http_data_handler.cpp
+CompileCpp=1
+Folder=myserver
+Compile=1
+Link=1
+Priority=1000
+OverrideBuildCmd=0
+BuildCmd=
+
+[Unit78]
+FileName=src\protocol\http\http_errors.cpp
+CompileCpp=1
+Folder=myserver
+Compile=1
+Link=1
+Priority=1000
+OverrideBuildCmd=0
+BuildCmd=
+
+[Unit79]
+FileName=src\protocol\http\http_response.cpp
+CompileCpp=1
+Folder=myserver
+Compile=1
+Link=1
+Priority=1000
+OverrideBuildCmd=0
+BuildCmd=
+
+[Unit80]
+FileName=src\protocol\http\http_req_security_domain.cpp
+CompileCpp=1
+Folder=myserver
+Compile=1
+Link=1
+Priority=1000
+OverrideBuildCmd=0
+BuildCmd=
+
+[Unit81]
+FileName=src\protocol\http\http_data_read.cpp
+CompileCpp=1
+Folder=myserver
+Compile=1
+Link=1
+Priority=1000
+OverrideBuildCmd=0
+BuildCmd=
+
+[Unit82]
+FileName=src\protocol\http\http.cpp
+CompileCpp=1
+Folder=myserver
+Compile=1
+Link=1
+Priority=1000
+OverrideBuildCmd=0
+BuildCmd=
+
+[Unit83]
+FileName=src\protocol\http\http_headers.cpp
+CompileCpp=1
+Folder=myserver
+Compile=1
+Link=1
+Priority=1000
+OverrideBuildCmd=0
+BuildCmd=
+
+[Unit84]
+FileName=src\protocol\http\http_thread_context.cpp
+CompileCpp=1
+Folder=myserver
+Compile=1
+Link=1
+Priority=1000
+OverrideBuildCmd=0
+BuildCmd=
+
+[Unit85]
 FileName=src\protocol\http\http_request.cpp
 CompileCpp=1
 Folder=myserver
@@ -726,7 +896,7 @@
 OverrideBuildCmd=0
 BuildCmd=
 
-[Unit69]
+[Unit86]
 FileName=src\protocol\http\env\env.cpp
 CompileCpp=1
 Folder=myserver
@@ -736,7 +906,7 @@
 OverrideBuildCmd=0
 BuildCmd=
 
-[Unit70]
+[Unit87]
 FileName=src\filter\memory_stream.cpp
 CompileCpp=1
 Folder=myserver
@@ -746,7 +916,7 @@
 OverrideBuildCmd=0
 BuildCmd=
 
-[Unit71]
+[Unit88]
 FileName=src\filter\filter.cpp
 CompileCpp=1
 Folder=myserver
@@ -756,7 +926,7 @@
 OverrideBuildCmd=0
 BuildCmd=
 
-[Unit72]
+[Unit89]
 FileName=src\filter\filters_chain.cpp
 CompileCpp=1
 Folder=myserver
@@ -766,7 +936,7 @@
 OverrideBuildCmd=0
 BuildCmd=
 
-[Unit73]
+[Unit90]
 FileName=src\filter\stream.cpp
 CompileCpp=1
 Folder=myserver
@@ -776,7 +946,17 @@
 OverrideBuildCmd=0
 BuildCmd=
 
-[Unit74]
+[Unit91]
+FileName=src\filter\console.cpp
+CompileCpp=1
+Folder=myserver
+Compile=1
+Link=1
+Priority=1000
+OverrideBuildCmd=0
+BuildCmd=
+
+[Unit92]
 FileName=src\filter\filters_factory.cpp
 CompileCpp=1
 Folder=myserver
@@ -786,7 +966,7 @@
 OverrideBuildCmd=0
 BuildCmd=
 
-[Unit75]
+[Unit93]
 FileName=src\filter\gzip\gzip_decompress.cpp
 CompileCpp=1
 Folder=myserver
@@ -796,7 +976,7 @@
 OverrideBuildCmd=0
 BuildCmd=
 
-[Unit76]
+[Unit94]
 FileName=src\filter\gzip\gzip.cpp
 CompileCpp=1
 Folder=myserver
@@ -806,7 +986,7 @@
 OverrideBuildCmd=0
 BuildCmd=
 
-[Unit77]
+[Unit95]
 FileName=src\plugin\generic_plugins_manager.cpp
 CompileCpp=1
 Folder=myserver
@@ -816,7 +996,7 @@
 OverrideBuildCmd=0
 BuildCmd=
 
-[Unit78]
+[Unit96]
 FileName=src\plugin\plugins_namespace_manager.cpp
 CompileCpp=1
 Folder=myserver
@@ -826,7 +1006,7 @@
 OverrideBuildCmd=0
 BuildCmd=
 
-[Unit79]
+[Unit97]
 FileName=src\plugin\plugins_namespace.cpp
 CompileCpp=1
 Folder=myserver
@@ -836,7 +1016,7 @@
 OverrideBuildCmd=0
 BuildCmd=
 
-[Unit80]
+[Unit98]
 FileName=src\plugin\plugin.cpp
 CompileCpp=1
 Folder=myserver
@@ -846,7 +1026,7 @@
 OverrideBuildCmd=0
 BuildCmd=
 
-[Unit81]
+[Unit99]
 FileName=src\plugin\plugins_manager.cpp
 CompileCpp=1
 Folder=myserver
@@ -856,7 +1036,7 @@
 OverrideBuildCmd=0
 BuildCmd=
 
-[Unit82]
+[Unit100]
 FileName=src\plugin\executor\dyn_executor_manager.cpp
 CompileCpp=1
 Folder=myserver
@@ -866,7 +1046,7 @@
 OverrideBuildCmd=0
 BuildCmd=
 
-[Unit83]
+[Unit101]
 FileName=src\plugin\executor\dynamic_executor.cpp
 CompileCpp=1
 Folder=myserver
@@ -876,7 +1056,7 @@
 OverrideBuildCmd=0
 BuildCmd=
 
-[Unit84]
+[Unit102]
 FileName=src\plugin\http_manager\dyn_http_manager_list.cpp
 CompileCpp=1
 Folder=myserver
@@ -886,7 +1066,7 @@
 OverrideBuildCmd=0
 BuildCmd=
 
-[Unit85]
+[Unit103]
 FileName=src\plugin\http_manager\dyn_http_manager.cpp
 CompileCpp=1
 Folder=myserver
@@ -896,7 +1076,7 @@
 OverrideBuildCmd=0
 BuildCmd=
 
-[Unit86]
+[Unit104]
 FileName=src\plugin\protocol\dynamic_protocol.cpp
 CompileCpp=1
 Folder=myserver
@@ -906,7 +1086,7 @@
 OverrideBuildCmd=0
 BuildCmd=
 
-[Unit87]
+[Unit105]
 FileName=src\plugin\protocol\protocols_manager.cpp
 CompileCpp=1
 Folder=myserver
@@ -916,7 +1096,7 @@
 OverrideBuildCmd=0
 BuildCmd=
 
-[Unit88]
+[Unit106]
 FileName=src\plugin\filter\dyn_filter.cpp
 CompileCpp=1
 Folder=myserver
@@ -926,7 +1106,7 @@
 OverrideBuildCmd=0
 BuildCmd=
 
-[Unit89]
+[Unit107]
 FileName=src\plugin\filter\dyn_filter_file.cpp
 CompileCpp=1
 Folder=myserver
@@ -936,7 +1116,7 @@
 OverrideBuildCmd=0
 BuildCmd=
 
-[Unit90]
+[Unit108]
 FileName=src\plugin\filter\dyn_filters_manager.cpp
 CompileCpp=1
 Folder=myserver
@@ -946,7 +1126,7 @@
 OverrideBuildCmd=0
 BuildCmd=
 
-[Unit91]
+[Unit109]
 FileName=src\plugin\http_command\dyn_http_command.cpp
 CompileCpp=1
 Folder=myserver
@@ -956,7 +1136,7 @@
 OverrideBuildCmd=0
 BuildCmd=
 
-[Unit92]
+[Unit110]
 FileName=src\plugin\http_command\dyn_http_command_manager.cpp
 CompileCpp=1
 Folder=myserver
@@ -966,7 +1146,7 @@
 OverrideBuildCmd=0
 BuildCmd=
 
-[Unit93]
+[Unit111]
 FileName=src\server\clients_thread.cpp
 CompileCpp=1
 Folder=myserver
@@ -976,7 +1156,7 @@
 OverrideBuildCmd=0
 BuildCmd=
 
-[Unit94]
+[Unit112]
 FileName=src\server\server.cpp
 CompileCpp=1
 Folder=myserver

Modified: trunk/myserver/src/conf/mime/mime_manager.cpp
===================================================================
--- trunk/myserver/src/conf/mime/mime_manager.cpp	2008-10-21 20:53:57 UTC (rev 2896)
+++ trunk/myserver/src/conf/mime/mime_manager.cpp	2008-10-22 18:05:14 UTC (rev 2897)
@@ -77,7 +77,6 @@
   command = m.command;
   cmdName.assign(m.cmdName);
   cgiManager.assign(m.cgiManager);
-  headerChecker.clone(m.headerChecker);
 } 
 
 /*!
@@ -86,7 +85,6 @@
 void MimeRecord::clear()
 {
   filters.clear();
-  headerChecker.clear();
   extension.assign(""); 
   mimeType.assign(""); 
   cmdName.assign("");
@@ -148,54 +146,8 @@
       continue;
     rc.clear();
 
-    while(attrs)
-    {
-      if(!xmlStrcmp(attrs->name, (const xmlChar *)"defaultAction"))
-      {
-        if(attrs->children && attrs->children->content && 
-           (!xmlStrcmp(attrs->children->content, (const xmlChar *)"ALLOW")))
-          rc.headerChecker.setDefaultCmd(HttpHeaderChecker::ALLOW);
-        else
-          rc.headerChecker.setDefaultCmd(HttpHeaderChecker::DENY);
-      }
-      attrs = attrs->next;
-    }
-
     while(lcur)
     {
-      if(lcur->name && !xmlStrcmp(lcur->name, (const xmlChar *)"ACTION"))
-      {
-        HttpHeaderChecker::Rule r;
-        xmlAttr *actionAttrs = lcur->properties; 
-
-        if(lcur->children->content && lcur->children->content &&
-           (!xmlStrcmp(lcur->children->content, (const xmlChar *)"DENY")))
-          r.cmd = HttpHeaderChecker::DENY;
-        else
-          r.cmd = HttpHeaderChecker::ALLOW;
-
-        while(actionAttrs)
-        {
-          if(!xmlStrcmp(actionAttrs->name, (const xmlChar *)"name"))
-          {
-            if(actionAttrs->children && actionAttrs->children->content)
-              r.name.assign((const char*)actionAttrs->children->content);
-
-          }
-
-          if(!xmlStrcmp(actionAttrs->name, (const xmlChar *)"value"))
-          {
-            if(actionAttrs->children && actionAttrs->children->content)
-              r.value.compile((const char*)actionAttrs->children->content, 
-                              REG_EXTENDED);
-          }
-          actionAttrs=actionAttrs->next;
-
-        }
-        rc.headerChecker.addRule(r);
-      }
-
-
       if(lcur->name && !xmlStrcmp(lcur->name, (const xmlChar *)"EXT"))
       {
         if(lcur->children->content)

Modified: trunk/myserver/src/protocol/http/Makefile.am
===================================================================
--- trunk/myserver/src/protocol/http/Makefile.am	2008-10-21 20:53:57 UTC (rev 2896)
+++ trunk/myserver/src/protocol/http/Makefile.am	2008-10-22 18:05:14 UTC (rev 2897)
@@ -1,5 +1,5 @@
 lib_LIBRARIES = libhttp.a
-libhttp_a_SOURCES = http.cpp http_data_handler.cpp http_data_read.cpp http_errors.cpp http_header_checker.cpp http_headers.cpp http_request.cpp http_req_security_domain.cpp http_response.cpp http_thread_context.cpp
+libhttp_a_SOURCES = http.cpp http_data_handler.cpp http_data_read.cpp http_errors.cpp http_headers.cpp http_request.cpp http_req_security_domain.cpp http_response.cpp http_thread_context.cpp
 SUBDIRS = env
 INCLUDES = $(all_includes)
 

Modified: trunk/myserver/src/protocol/http/http.cpp
===================================================================
--- trunk/myserver/src/protocol/http/http.cpp	2008-10-21 20:53:57 UTC (rev 2896)
+++ trunk/myserver/src/protocol/http/http.cpp	2008-10-22 18:05:14 UTC (rev 2897)
@@ -886,8 +886,7 @@
       }
     }
 
-    if(td->mime &&
-       !td->mime->headerChecker.isAllowed(&(td->request)))
+    if(td->mime)
     {
       return sendAuth();
     }

Deleted: trunk/myserver/src/protocol/http/http_header_checker.cpp
===================================================================
--- trunk/myserver/src/protocol/http/http_header_checker.cpp	2008-10-21 20:53:57 UTC (rev 2896)
+++ trunk/myserver/src/protocol/http/http_header_checker.cpp	2008-10-22 18:05:14 UTC (rev 2897)
@@ -1,152 +0,0 @@
-/*
-MyServer
-Copyright (C) 2005 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
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful, 
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program.  If not, see <http://www.gnu.org/licenses/>.
-*/
-
-
-#include <include/protocol/http/http.h>
-#include <include/protocol/http/http_headers.h>
-#include <include/protocol/http/http_header_checker.h>
-
-#include <string>
-#include <ostream>
-
-using namespace std;
-
-extern "C" 
-{
-#ifdef WIN32
-#include <direct.h>
-#include <errno.h>
-#endif
-
-#ifdef NOT_WIN
-#include <string.h>
-#include <errno.h>
-#endif
-}
-
-/*!
- *Add a rule to check to the chain.
- */
-void HttpHeaderChecker::addRule(HttpHeaderChecker::Rule& r)
-{
-  HttpHeaderChecker::Rule* r2 = new Rule(r); 
-  if(r2)
-    addRule(r2);
-}
-
-/*!
- *Add a rule to check to the chain.
- */
-void HttpHeaderChecker::addRule(HttpHeaderChecker::Rule* r)
-{
-  rules.push_back(r);
-}
-
-/*!
- *Clear all the used memory.
- */
-void HttpHeaderChecker::clear()
-{
-  list<HttpHeaderChecker::Rule*>::iterator i = rules.begin();
-  for(;i != rules.end(); i++)
-  {
-    Rule *r = *i;
-    r->name.clear();
-    r->value.free();
-    delete r;
-  }
-  rules.clear();
-}
-
-/*!
- *Constructor.
- */
-HttpHeaderChecker::HttpHeaderChecker()
-{
-  defaultCmd=ALLOW;
-}
-
-/*!
- *Destroy the object.
- */
-HttpHeaderChecker::~HttpHeaderChecker()
-{
-  clear();
-}
-
-/*!
- *Check if the header is allowed by the chain.
- */
-int HttpHeaderChecker::isAllowed(HttpHeader* h)
-{
-  list<HttpHeaderChecker::Rule*>::iterator i = rules.begin();
-  for(; i != rules.end(); i++)
-  {
-    string *val = h->getValue((*i)->name.c_str(), 0);
-    if(val && (*i)->value.isCompiled())
-    {
-      regmatch_t pm;
-      if(!(*i)->value.exec(val->c_str(), 1,&pm, REG_NOTEOL))
-      {
-        return (*i)->cmd;
-      }
-    }
-  }
-  return defaultCmd;
-}
-
-/*!
- *Return the default action used by the chain.
- *Zero means deny access, one means that access is allowed by default.
- */
-HttpHeaderChecker::CMD HttpHeaderChecker::getDefaultCmd()
-{
-  return defaultCmd;
-}
-
-/*!
- *Set te default action to use.
- *Zero to deny access, one to allow access by default.
- */
-void HttpHeaderChecker::setDefaultCmd(HttpHeaderChecker::CMD cmd)
-{
-  defaultCmd = cmd;
-}
-
-/*!
- *Construct by copy.
- */
-HttpHeaderChecker::HttpHeaderChecker(HttpHeaderChecker& hhc)
-{
-  clone(hhc);
-}
-
-/*!
- *Create a clone of the object.
- */
-void HttpHeaderChecker::clone(HttpHeaderChecker& h)
-{
-  list<HttpHeaderChecker::Rule*>::iterator i = h.rules.begin();
-  clear();
-  for(;i != h.rules.end(); i++)
-  {
-    HttpHeaderChecker::Rule* r = new HttpHeaderChecker::Rule(*(*i));
-    addRule(r);
-  }  
-
-  defaultCmd = h.defaultCmd;
-}





From MAILER-DAEMON Wed Oct 22 14:12:15 2008
Received: from mailman by lists.gnu.org with archive (Exim 4.43)
	id 1KsiBq-0001ox-TO
	for mharc-myserver-commit@gnu.org; Wed, 22 Oct 2008 14:12:14 -0400
Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43)
	id 1KsiBp-0001os-2c
	for myserver-commit@gnu.org; Wed, 22 Oct 2008 14:12:13 -0400
Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43)
	id 1KsiBo-0001og-Oi
	for myserver-commit@gnu.org; Wed, 22 Oct 2008 14:12:12 -0400
Received: from [199.232.76.173] (port=34138 helo=monty-python.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.43) id 1KsiBo-0001od-HU
	for myserver-commit@gnu.org; Wed, 22 Oct 2008 14:12:12 -0400
Received: from savannah.gnu.org ([199.232.41.3]:56821 helo=sv.gnu.org)
	by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32)
	(Exim 4.60) (envelope-from <INVALID.NOREPLY@gnu.org>)
	id 1KsiBn-00078h-VM
	for myserver-commit@gnu.org; Wed, 22 Oct 2008 14:12:12 -0400
Received: from cvs.savannah.gnu.org ([199.232.41.69])
	by sv.gnu.org with esmtp (Exim 4.63)
	(envelope-from <INVALID.NOREPLY@gnu.org>) id 1KsiBh-00068N-98
	for myserver-commit@gnu.org; Wed, 22 Oct 2008 18:12:05 +0000
Received: from gscrivano by cvs.savannah.gnu.org with local (Exim 4.63)
	(envelope-from <gscrivano@savannah.gnu.org>) id 1KsiBh-00068J-0b
	for myserver-commit@gnu.org; Wed, 22 Oct 2008 18:12:05 +0000
MIME-Version: 1.0
Errors-To: gscrivano
To: myserver-commit@gnu.org
X-Mailer: SVN::Notify 2.64: http://search.cpan.org/dist/SVN-Notify/
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
From: Giuseppe Scrivano <gscrivano@gnu.org>
Message-Id: <E1KsiBh-00068J-0b@cvs.savannah.gnu.org>
Date: Wed, 22 Oct 2008 18:12:05 +0000
X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 3)
Subject: [myserver-commit] [2898] Fixed problem introduced by the last
	commit.
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/pipermail/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, 22 Oct 2008 18:12:13 -0000

Revision: 2898
          http://svn.sv.gnu.org/viewvc/?view=rev&root=myserver&revision=2898
Author:   gscrivano
Date:     2008-10-22 18:12:04 +0000 (Wed, 22 Oct 2008)

Log Message:
-----------
Fixed problem introduced by the last commit.

Modified Paths:
--------------
    trunk/myserver/src/protocol/http/http.cpp

Modified: trunk/myserver/src/protocol/http/http.cpp
===================================================================
--- trunk/myserver/src/protocol/http/http.cpp	2008-10-22 18:05:14 UTC (rev 2897)
+++ trunk/myserver/src/protocol/http/http.cpp	2008-10-22 18:12:04 UTC (rev 2898)
@@ -886,11 +886,6 @@
       }
     }
 
-    if(td->mime)
-    {
-      return sendAuth();
-    }
-
     if(mimecmd == CGI_CMD_RUNCGI)
     {
       int allowCgi = 1;





From MAILER-DAEMON Wed Oct 22 17:08:03 2008
Received: from mailman by lists.gnu.org with archive (Exim 4.43)
	id 1Kskvz-0006f9-11
	for mharc-myserver-commit@gnu.org; Wed, 22 Oct 2008 17:08:03 -0400
Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43)
	id 1Kskvx-0006ct-7V
	for myserver-commit@gnu.org; Wed, 22 Oct 2008 17:08:01 -0400
Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43)
	id 1Kskvu-0006aT-7n
	for myserver-commit@gnu.org; Wed, 22 Oct 2008 17:08:00 -0400
Received: from [199.232.76.173] (port=41058 helo=monty-python.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.43) id 1Kskvt-0006aC-QS
	for myserver-commit@gnu.org; Wed, 22 Oct 2008 17:07:57 -0400
Received: from savannah.gnu.org ([199.232.41.3]:60971 helo=sv.gnu.org)
	by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32)
	(Exim 4.60) (envelope-from <INVALID.NOREPLY@gnu.org>)
	id 1Kskvt-0006kR-1H
	for myserver-commit@gnu.org; Wed, 22 Oct 2008 17:07:57 -0400
Received: from cvs.savannah.gnu.org ([199.232.41.69])
	by sv.gnu.org with esmtp (Exim 4.63)
	(envelope-from <INVALID.NOREPLY@gnu.org>) id 1Kskvs-000868-Cr
	for myserver-commit@gnu.org; Wed, 22 Oct 2008 21:07:56 +0000
Received: from gscrivano by cvs.savannah.gnu.org with local (Exim 4.63)
	(envelope-from <gscrivano@savannah.gnu.org>) id 1Kskvs-000864-1F
	for myserver-commit@gnu.org; Wed, 22 Oct 2008 21:07:56 +0000
MIME-Version: 1.0
Errors-To: gscrivano
To: myserver-commit@gnu.org
X-Mailer: SVN::Notify 2.64: http://search.cpan.org/dist/SVN-Notify/
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
From: Giuseppe Scrivano <gscrivano@gnu.org>
Message-Id: <E1Kskvs-000864-1F@cvs.savannah.gnu.org>
Date: Wed, 22 Oct 2008 21:07:56 +0000
X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 3)
Subject: [myserver-commit] [2899] Changed structure for the MIME types
	configuration file.
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/pipermail/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, 22 Oct 2008 21:08:01 -0000

Revision: 2899
          http://svn.sv.gnu.org/viewvc/?view=rev&root=myserver&revision=2899
Author:   gscrivano
Date:     2008-10-22 21:07:55 +0000 (Wed, 22 Oct 2008)

Log Message:
-----------
Changed structure for the MIME types configuration file.  This commit breaks the GUI control application support for MIME types.

Modified Paths:
--------------
    trunk/myserver/binaries/MIMEtypes.xml.default
    trunk/myserver/binaries/MIMEtypes.xml.unix.default
    trunk/myserver/include/conf/mime/mime_manager.h
    trunk/myserver/src/conf/mime/mime_manager.cpp
    trunk/myserver/src/protocol/http/http.cpp

Modified: trunk/myserver/binaries/MIMEtypes.xml.default
===================================================================
--- trunk/myserver/binaries/MIMEtypes.xml.default	2008-10-22 18:12:04 UTC (rev 2898)
+++ trunk/myserver/binaries/MIMEtypes.xml.default	2008-10-22 21:07:55 UTC (rev 2899)
@@ -1,985 +1,565 @@
 <?xml version="1.0"?>
 
-<MIMETYPES>
+<MIMES>
 
-<MIMETYPE>
-<EXT>mscgi</EXT>
-<MIME>text/html</MIME>
-<CMD>RUNMSCGI</CMD>
-<MANAGER>NONE</MANAGER>
-</MIMETYPE>
+<MIME mime="text/html" handler="RUNMSCGI" param="">
+<EXTENSION value="mscgi"/>
+</MIME>
 
-<MIMETYPE>
-<EXT>cgi</EXT>
-<MIME>text/html</MIME>
-<CMD>EXECUTE</CMD>
-<MANAGER>NONE</MANAGER>
-</MIMETYPE>
+<MIME mime="text/html" handler="EXECUTE" param="">
+<EXTENSION value="cgi"/>
+</MIME>
 
-<MIMETYPE>
-<EXT>isapi</EXT>
-<MIME>text/html</MIME>
-<CMD>EXECUTEISAPI</CMD>
-<MANAGER>NONE</MANAGER>
-</MIMETYPE>
+<MIME mime="text/html" handler="EXECUTEISAPI" param="">
+<EXTENSION value="isapi"/>
+</MIME>
 
-<MIMETYPE>
-<EXT>fcgi</EXT>
-<MIME>text/html</MIME>
-<CMD>EXECUTEFASTCGI</CMD>
-<MANAGER>NONE</MANAGER>
-</MIMETYPE>
+<MIME mime="text/html" handler="EXECUTEFASTCGI" param="">
+<EXTENSION value="fcgi"/>
+</MIME>
 
-<MIMETYPE>
-<EXT>wincgi</EXT>
-<MIME>text/html</MIME>
-<CMD>EXECUTEWINCGI</CMD>
-<MANAGER>NONE</MANAGER>
-</MIMETYPE>
+<MIME mime="text/html" handler="EXECUTEWINCGI" param="">
+<EXTENSION value="wincgi"/>
+</MIME>
 
-<MIMETYPE>
-<EXT>ai</EXT>
-<MIME>application/postscript</MIME>
-<CMD>SEND</CMD>
-<MANAGER>NONE</MANAGER>
-</MIMETYPE>
+<MIME mime="application/postscript" handler="SEND" param="">
+<EXTENSION value="ai"/>
+</MIME>
 
-<MIMETYPE>
-<EXT>msxu</EXT>
-<MIME>video/vnd.mpegurl</MIME>
-<CMD>SEND</CMD>
-<MANAGER>NONE</MANAGER>
-</MIMETYPE>
+<MIME mime="video/vnd.mpegurl" handler="SEND" param="">
+<EXTENSION value="msxu"/>
+</MIME>
 
-<MIMETYPE>
-<EXT>ice</EXT>
-<MIME>x-conference/x-cooltalk</MIME>
-<CMD>SEND</CMD>
-<MANAGER>NONE</MANAGER>
-</MIMETYPE>
+<MIME mime="x-conference/x-cooltalk" handler="SEND" param="">
+<EXTENSION value="ice"/>
+</MIME>
 
-<MIMETYPE>
-<EXT>movie</EXT>
-<MIME>video/x-sgi-movie</MIME>
-<CMD>SEND</CMD>
-<MANAGER>NONE</MANAGER>
-</MIMETYPE>
+<MIME mime="video/x-sgi-movie" handler="SEND" param="">
+<EXTENSION value="movie"/>
+</MIME>
 
-<MIMETYPE>
-<EXT>ps</EXT>
-<MIME>application/postscript</MIME>
-<CMD>SEND</CMD>
-<MANAGER>NONE</MANAGER>
-</MIMETYPE>
+<MIME mime="application/postscript" handler="SEND" param="">
+<EXTENSION value="ps"/>
+</MIME>
 
-<MIMETYPE>
-<EXT>eps</EXT>
-<MIME>application/postscript</MIME>
-<CMD>SEND</CMD>
-<MANAGER>NONE</MANAGER>
-</MIMETYPE>
+<MIME mime="application/postscript" handler="SEND" param="">
+<EXTENSION value="eps"/>
+</MIME>
 
-<MIMETYPE>
-<EXT>smil</EXT>
-<MIME>application/smil</MIME>
-<CMD>SEND</CMD>
-<MANAGER>NONE</MANAGER>
-</MIMETYPE>
+<MIME mime="application/smil" handler="SEND" param="">
+<EXTENSION value="smil"/>
+</MIME>
 
-<MIMETYPE>
-<EXT>wmlsc</EXT>
-<MIME>application/vnd.wap.wmlscriptc</MIME>
-<CMD>SEND</CMD>
-<MANAGER>NONE</MANAGER>
-</MIMETYPE>
+<MIME mime="application/vnd.wap.wmlscriptc" handler="SEND" param="">
+<EXTENSION value="wmlsc"/>
+</MIME>
 
-<MIMETYPE>
-<EXT>wmlc</EXT>
-<MIME>application/vnd.wap.wmlc</MIME>
-<CMD>SEND</CMD>
-<MANAGER>NONE</MANAGER>
-</MIMETYPE>
+<MIME mime="application/vnd.wap.wmlc" handler="SEND" param="">
+<EXTENSION value="wmlc"/>
+</MIME>
 
-<MIMETYPE>
-<EXT>wbxml</EXT>
-<MIME>application/vnd.wap.wbxml</MIME>
-<CMD>SEND</CMD>
-<MANAGER>NONE</MANAGER>
-</MIMETYPE>
+<MIME mime="application/vnd.wap.wbxml" handler="SEND" param="">
+<EXTENSION value="wbxml"/>
+</MIME>
 
-<MIMETYPE>
-<EXT>smi</EXT>
-<MIME>application/smil</MIME>
-<CMD>SEND</CMD>
-<MANAGER>NONE</MANAGER>
-</MIMETYPE>
+<MIME mime="application/smil" handler="SEND" param="">
+<EXTENSION value="smi"/>
+</MIME>
 
-<MIMETYPE>
-<EXT>dll</EXT>
-<MIME>application/octet-stream</MIME>
-<CMD>SEND</CMD>
-<MANAGER>NONE</MANAGER>
-</MIMETYPE>
+<MIME mime="application/octet-stream" handler="SEND" param="">
+<EXTENSION value="dll"/>
+</MIME>
 
-<MIMETYPE>
-<EXT>so</EXT>
-<MIME>application/octet-stream</MIME>
-<CMD>SEND</CMD>
-<MANAGER>NONE</MANAGER>
-</MIMETYPE>
+<MIME mime="application/octet-stream" handler="SEND" param="">
+<EXTENSION value="so"/>
+</MIME>
 
-<MIMETYPE>
-<EXT>class</EXT>
-<MIME>application/octet-stream</MIME>
-<CMD>SEND</CMD>
-<MANAGER>NONE</MANAGER>
-</MIMETYPE>
+<MIME mime="application/octet-stream" handler="SEND" param="">
+<EXTENSION value="class"/>
+</MIME>
 
-<MIMETYPE>
-<EXT>exe</EXT>
-<MIME>application/octet-stream</MIME>
-<CMD>SEND</CMD>
-<MANAGER>NONE</MANAGER>
-</MIMETYPE>
+<MIME mime="application/octet-stream" handler="SEND" param="">
+<EXTENSION value="exe"/>
+</MIME>
 
-<MIMETYPE>
-<EXT>lzh</EXT>
-<MIME>application/octet-stream</MIME>
-<CMD>SEND</CMD>
-<MANAGER>NONE</MANAGER>
-</MIMETYPE>
+<MIME mime="application/octet-stream" handler="SEND" param="">
+<EXTENSION value="lzh"/>
+</MIME>
 
-<MIMETYPE>
-<EXT>lha</EXT>
-<MIME>application/octet-stream</MIME>
-<CMD>SEND</CMD>
-<MANAGER>NONE</MANAGER>
-</MIMETYPE>
+<MIME mime="application/octet-stream" handler="SEND" param="">
+<EXTENSION value="lha"/>
+</MIME>
 
-<MIMETYPE>
-<EXT>dms</EXT>
-<MIME>application/octet-stream</MIME>
-<CMD>SEND</CMD>
-<MANAGER>NONE</MANAGER>
-</MIMETYPE>
+<MIME mime="application/octet-stream" handler="SEND" param="">
+<EXTENSION value="dms"/>
+</MIME>
 
-<MIMETYPE>
-<EXT>oda</EXT>
-<MIME>application/oda</MIME>
-<CMD>SEND</CMD>
-<MANAGER>NONE</MANAGER>
-</MIMETYPE>
+<MIME mime="application/oda" handler="SEND" param="">
+<EXTENSION value="oda"/>
+</MIME>
 
-<MIMETYPE>
-<EXT>bin</EXT>
-<MIME>application/octet-stream</MIME>
-<CMD>SEND</CMD>
-<MANAGER>NONE</MANAGER>
-</MIMETYPE>
+<MIME mime="application/octet-stream" handler="SEND" param="">
+<EXTENSION value="bin"/>
+</MIME>
 
-<MIMETYPE>
-<EXT>src</EXT>
-<MIME>application/x-wais-source</MIME>
-<CMD>SEND</CMD>
-<MANAGER>NONE</MANAGER>
-</MIMETYPE>
+<MIME mime="application/x-wais-source" handler="SEND" param="">
+<EXTENSION value="src"/>
+</MIME>
 
-<MIMETYPE>
-<EXT>ustar</EXT>
-<MIME>application/x-ustar</MIME>
-<CMD>SEND</CMD>
-<MANAGER>NONE</MANAGER>
-</MIMETYPE>
+<MIME mime="application/x-ustar" handler="SEND" param="">
+<EXTENSION value="ustar"/>
+</MIME>
 
-<MIMETYPE>
-<EXT>ms</EXT>
-<MIME>application/x-troff-ms</MIME>
-<CMD>SEND</CMD>
-<MANAGER>NONE</MANAGER>
-</MIMETYPE>
+<MIME mime="application/x-troff-ms" handler="SEND" param="">
+<EXTENSION value="ms"/>
+</MIME>
 
-<MIMETYPE>
-<EXT>me</EXT>
-<MIME>application/x-troff-me</MIME>
-<CMD>SEND</CMD>
-<MANAGER>NONE</MANAGER>
-</MIMETYPE>
+<MIME mime="application/x-troff-me" handler="SEND" param="">
+<EXTENSION value="me"/>
+</MIME>
 
-<MIMETYPE>
-<EXT>man</EXT>
-<MIME>application/x-troff-man</MIME>
-<CMD>SEND</CMD>
-<MANAGER>NONE</MANAGER>
-</MIMETYPE>
+<MIME mime="application/x-troff-man" handler="SEND" param="">
+<EXTENSION value="man"/>
+</MIME>
 
-<MIMETYPE>
-<EXT>roff</EXT>
-<MIME>application/x-troff</MIME>
-<CMD>SEND</CMD>
-<MANAGER>NONE</MANAGER>
-</MIMETYPE>
+<MIME mime="application/x-troff" handler="SEND" param="">
+<EXTENSION value="roff"/>
+</MIME>
 
-<MIMETYPE>
-<EXT>tr</EXT>
-<MIME>application/x-troff</MIME>
-<CMD>SEND</CMD>
-<MANAGER>NONE</MANAGER>
-</MIMETYPE>
+<MIME mime="application/x-troff" handler="SEND" param="">
+<EXTENSION value="tr"/>
+</MIME>
 
-<MIMETYPE>
-<EXT>t</EXT>
-<MIME>application/x-troff</MIME>
-<CMD>SEND</CMD>
-<MANAGER>NONE</MANAGER>
-</MIMETYPE>
+<MIME mime="application/x-troff" handler="SEND" param="">
+<EXTENSION value="t"/>
+</MIME>
 
-<MIMETYPE>
-<EXT>texi</EXT>
-<MIME>application/x-texinfo</MIME>
-<CMD>SEND</CMD>
-<MANAGER>NONE</MANAGER>
-</MIMETYPE>
+<MIME mime="application/x-texinfo" handler="SEND" param="">
+<EXTENSION value="texi"/>
+</MIME>
 
-<MIMETYPE>
-<EXT>texinfo</EXT>
-<MIME>application/x-texinfo</MIME>
-<CMD>SEND</CMD>
-<MANAGER>NONE</MANAGER>
-</MIMETYPE>
+<MIME mime="application/x-texinfo" handler="SEND" param="">
+<EXTENSION value="texinfo"/>
+</MIME>
 
-<MIMETYPE>
-<EXT>tex</EXT>
-<MIME>application/x-tex</MIME>
-<CMD>SEND</CMD>
-<MANAGER>NONE</MANAGER>
-</MIMETYPE>
+<MIME mime="application/x-tex" handler="SEND" param="">
+<EXTENSION value="tex"/>
+</MIME>
 
-<MIMETYPE>
-<EXT>tcl</EXT>
-<MIME>application/x-tcl</MIME>
-<CMD>SEND</CMD>
-<MANAGER>NONE</MANAGER>
-</MIMETYPE>
+<MIME mime="application/x-tcl" handler="SEND" param="">
+<EXTENSION value="tcl"/>
+</MIME>
 
-<MIMETYPE>
-<EXT>tar</EXT>
-<MIME>application/x-tar</MIME>
-<CMD>SEND</CMD>
-<MANAGER>NONE</MANAGER>
-</MIMETYPE>
+<MIME mime="application/x-tar" handler="SEND" param="">
+<EXTENSION value="tar"/>
+</MIME>
 
-<MIMETYPE>
-<EXT>sv4crc</EXT>
-<MIME>application/x-sv4crc</MIME>
-<CMD>SEND</CMD>
-<MANAGER>NONE</MANAGER>
-</MIMETYPE>
+<MIME mime="application/x-sv4crc" handler="SEND" param="">
+<EXTENSION value="sv4crc"/>
+</MIME>
 
-<MIMETYPE>
-<EXT>sv4cpio</EXT>
-<MIME>application/x-sv4cpio</MIME>
-<CMD>SEND</CMD>
-<MANAGER>NONE</MANAGER>
-</MIMETYPE>
+<MIME mime="application/x-sv4cpio" handler="SEND" param="">
+<EXTENSION value="sv4cpio"/>
+</MIME>
 
-<MIMETYPE>
-<EXT>sit</EXT>
-<MIME>application/x-stuffit</MIME>
-<CMD>SEND</CMD>
-<MANAGER>NONE</MANAGER>
-</MIMETYPE>
+<MIME mime="application/x-stuffit" handler="SEND" param="">
+<EXTENSION value="sit"/>
+</MIME>
 
-<MIMETYPE>
-<EXT>swf</EXT>
-<MIME>application/x-shockwave-flash</MIME>
-<CMD>SEND</CMD>
-<MANAGER>NONE</MANAGER>
-</MIMETYPE>
+<MIME mime="application/x-shockwave-flash" handler="SEND" param="">
+<EXTENSION value="swf"/>
+</MIME>
 
-<MIMETYPE>
-<EXT>shar</EXT>
-<MIME>application/x-shar</MIME>
-<CMD>SEND</CMD>
-<MANAGER>NONE</MANAGER>
-</MIMETYPE>
+<MIME mime="application/x-shar" handler="SEND" param="">
+<EXTENSION value="shar"/>
+</MIME>
 
-<MIMETYPE>
-<EXT>sh</EXT>
-<MIME>application/x-sh</MIME>
-<CMD>SEND</CMD>
-<MANAGER>NONE</MANAGER>
-</MIMETYPE>
+<MIME mime="application/x-sh" handler="SEND" param="">
+<EXTENSION value="sh"/>
+</MIME>
 
-<MIMETYPE>
-<EXT>cpt</EXT>
-<MIME>application/mac-compactpro</MIME>
-<CMD>SEND</CMD>
-<MANAGER>NONE</MANAGER>
-</MIMETYPE>
+<MIME mime="application/mac-compactpro" handler="SEND" param="">
+<EXTENSION value="cpt"/>
+</MIME>
 
-<MIMETYPE>
-<EXT>hqx</EXT>
-<MIME>application/mac-binhex40</MIME>
-<CMD>SEND</CMD>
-<MANAGER>NONE</MANAGER>
-</MIMETYPE>
+<MIME mime="application/mac-binhex40" handler="SEND" param="">
+<EXTENSION value="hqx"/>
+</MIME>
 
-<MIMETYPE>
-<EXT>cdf</EXT>
-<MIME>application/x-netcdf</MIME>
-<CMD>SEND</CMD>
-<MANAGER>NONE</MANAGER>
-</MIMETYPE>
+<MIME mime="application/x-netcdf" handler="SEND" param="">
+<EXTENSION value="cdf"/>
+</MIME>
 
-<MIMETYPE>
-<EXT>ez</EXT>
-<MIME>application/andrew-inset</MIME>
-<CMD>SEND</CMD>
-<MANAGER>NONE</MANAGER>
-</MIMETYPE>
+<MIME mime="application/andrew-inset" handler="SEND" param="">
+<EXTENSION value="ez"/>
+</MIME>
 
-<MIMETYPE>
-<EXT>nc</EXT>
-<MIME>application/x-netcdf</MIME>
-<CMD>SEND</CMD>
-<MANAGER>NONE</MANAGER>
-</MIMETYPE>
+<MIME mime="application/x-netcdf" handler="SEND" param="">
+<EXTENSION value="nc"/>
+</MIME>
 
-<MIMETYPE>
-<EXT>latex</EXT>
-<MIME>application/x-latex</MIME>
-<CMD>SEND</CMD>
-<MANAGER>NONE</MANAGER>
-</MIMETYPE>
+<MIME mime="application/x-latex" handler="SEND" param="">
+<EXTENSION value="latex"/>
+</MIME>
 
-<MIMETYPE>
-<EXT>skm</EXT>
-<MIME>application/x-koan</MIME>
-<CMD>SEND</CMD>
-<MANAGER>NONE</MANAGER>
-</MIMETYPE>
+<MIME mime="application/x-koan" handler="SEND" param="">
+<EXTENSION value="skm"/>
+</MIME>
 
-<MIMETYPE>
-<EXT>skt</EXT>
-<MIME>application/x-koan</MIME>
-<CMD>SEND</CMD>
-<MANAGER>NONE</MANAGER>
-</MIMETYPE>
+<MIME mime="application/x-koan" handler="SEND" param="">
+<EXTENSION value="skt"/>
+</MIME>
 
-<MIMETYPE>
-<EXT>skd</EXT>
-<MIME>application/x-koan</MIME>
-<CMD>SEND</CMD>
-<MANAGER>NONE</MANAGER>
-</MIMETYPE>
+<MIME mime="application/x-koan" handler="SEND" param="">
+<EXTENSION value="skd"/>
+</MIME>
 
-<MIMETYPE>
-<EXT>skp</EXT>
-<MIME>application/x-koan</MIME>
-<CMD>SEND</CMD>
-<MANAGER>NONE</MANAGER>
-</MIMETYPE>
+<MIME mime="application/x-koan" handler="SEND" param="">
+<EXTENSION value="skp"/>
+</MIME>
 
-<MIMETYPE>
-<EXT>js</EXT>
-<MIME>application/x-javascript</MIME>
-<CMD>SEND</CMD>
-<MANAGER>NONE</MANAGER>
-</MIMETYPE>
+<MIME mime="application/x-javascript" handler="SEND" param="">
+<EXTENSION value="js"/>
+</MIME>
 
-<MIMETYPE>
-<EXT>hdf</EXT>
-<MIME>application/x-hdf</MIME>
-<CMD>SEND</CMD>
-<MANAGER>NONE</MANAGER>
-</MIMETYPE>
+<MIME mime="application/x-hdf" handler="SEND" param="">
+<EXTENSION value="hdf"/>
+</MIME>
 
-<MIMETYPE>
-<EXT>gtar</EXT>
-<MIME>application/x-gtar</MIME>
-<CMD>SEND</CMD>
-<MANAGER>NONE</MANAGER>
-</MIMETYPE>
+<MIME mime="application/x-gtar" handler="SEND" param="">
+<EXTENSION value="gtar"/>
+</MIME>
 
-<MIMETYPE>
-<EXT>spl</EXT>
-<MIME>application/x-futuresplash</MIME>
-<CMD>SEND</CMD>
-<MANAGER>NONE</MANAGER>
-</MIMETYPE>
+<MIME mime="application/x-futuresplash" handler="SEND" param="">
+<EXTENSION value="spl"/>
+</MIME>
 
-<MIMETYPE>
-<EXT>dvi</EXT>
-<MIME>application/x-dvi</MIME>
-<CMD>SEND</CMD>
-<MANAGER>NONE</MANAGER>
-</MIMETYPE>
+<MIME mime="application/x-dvi" handler="SEND" param="">
+<EXTENSION value="dvi"/>
+</MIME>
 
-<MIMETYPE>
-<EXT>dxr</EXT>
-<MIME>application/x-director</MIME>
-<CMD>SEND</CMD>
-<MANAGER>NONE</MANAGER>
-</MIMETYPE>
+<MIME mime="application/x-director" handler="SEND" param="">
+<EXTENSION value="dxr"/>
+</MIME>
 
-<MIMETYPE>
-<EXT>dir</EXT>
-<MIME>application/x-director</MIME>
-<CMD>SEND</CMD>
-<MANAGER>NONE</MANAGER>
-</MIMETYPE>
+<MIME mime="application/x-director" handler="SEND" param="">
+<EXTENSION value="dir"/>
+</MIME>
 
-<MIMETYPE>
-<EXT>dcr</EXT>
-<MIME>application/x-director</MIME>
-<CMD>SEND</CMD>
-<MANAGER>NONE</MANAGER>
-</MIMETYPE>
+<MIME mime="application/x-director" handler="SEND" param="">
+<EXTENSION value="dcr"/>
+</MIME>
 
-<MIMETYPE>
-<EXT>csh</EXT>
-<MIME>application/x-csh</MIME>
-<CMD>SEND</CMD>
-<MANAGER>NONE</MANAGER>
-</MIMETYPE>
+<MIME mime="application/x-csh" handler="SEND" param="">
+<EXTENSION value="csh"/>
+</MIME>
 
-<MIMETYPE>
-<EXT>cpio</EXT>
-<MIME>application/x-cpio</MIME>
-<CMD>SEND</CMD>
-<MANAGER>NONE</MANAGER>
-</MIMETYPE>
+<MIME mime="application/x-cpio" handler="SEND" param="">
+<EXTENSION value="cpio"/>
+</MIME>
 
-<MIMETYPE>
-<EXT>pgn</EXT>
-<MIME>application/x-chess-pgn</MIME>
-<CMD>SEND</CMD>
-<MANAGER>NONE</MANAGER>
-</MIMETYPE>
+<MIME mime="application/x-chess-pgn" handler="SEND" param="">
+<EXTENSION value="pgn"/>
+</MIME>
 
-<MIMETYPE>
-<EXT>vcd</EXT>
-<MIME>application/x-cdlink</MIME>
-<CMD>SEND</CMD>
-<MANAGER>NONE</MANAGER>
-</MIMETYPE>
+<MIME mime="application/x-cdlink" handler="SEND" param="">
+<EXTENSION value="vcd"/>
+</MIME>
 
-<MIMETYPE>
-<EXT>bcpio</EXT>
-<MIME>application/x-bcpio</MIME>
-<CMD>SEND</CMD>
-<MANAGER>NONE</MANAGER>
-</MIMETYPE>
+<MIME mime="application/x-bcpio" handler="SEND" param="">
+<EXTENSION value="bcpio"/>
+</MIME>
 
-<MIMETYPE>
-<EXT>xsl</EXT>
-<MIME>text/xml</MIME>
-<CMD>SEND</CMD>
-<MANAGER>NONE</MANAGER>
-</MIMETYPE>
+<MIME mime="text/xml" handler="SEND" param="">
+<EXTENSION value="xsl"/>
+</MIME>
 
-<MIMETYPE>
-<EXT>etx</EXT>
-<MIME>text/x-setext</MIME>
-<CMD>SEND</CMD>
-<MANAGER>NONE</MANAGER>
-</MIMETYPE>
+<MIME mime="text/x-setext" handler="SEND" param="">
+<EXTENSION value="etx"/>
+</MIME>
 
-<MIMETYPE>
-<EXT>tsv</EXT>
-<MIME>text/tab-separated-values</MIME>
-<CMD>SEND</CMD>
-<MANAGER>NONE</MANAGER>
-</MIMETYPE>
+<MIME mime="text/tab-separated-values" handler="SEND" param="">
+<EXTENSION value="tsv"/>
+</MIME>
 
-<MIMETYPE>
-<EXT>sgm</EXT>
-<MIME>text/sgml</MIME>
-<CMD>SEND</CMD>
-<MANAGER>NONE</MANAGER>
-</MIMETYPE>
+<MIME mime="text/sgml" handler="SEND" param="">
+<EXTENSION value="sgm"/>
+</MIME>
 
-<MIMETYPE>
-<EXT>sgml</EXT>
-<MIME>text/sgml</MIME>
-<CMD>SEND</CMD>
-<MANAGER>NONE</MANAGER>
-</MIMETYPE>
+<MIME mime="text/sgml" handler="SEND" param="">
+<EXTENSION value="sgml"/>
+</MIME>
 
-<MIMETYPE>
-<EXT>rtf</EXT>
-<MIME>text/rtf</MIME>
-<CMD>SEND</CMD>
-<MANAGER>NONE</MANAGER>
-</MIMETYPE>
+<MIME mime="text/rtf" handler="SEND" param="">
+<EXTENSION value="rtf"/>
+</MIME>
 
-<MIMETYPE>
-<EXT>rtx</EXT>
-<MIME>text/richtext</MIME>
-<CMD>SEND</CMD>
-<MANAGER>NONE</MANAGER>
-</MIMETYPE>
+<MIME mime="text/richtext" handler="SEND" param="">
+<EXTENSION value="rtx"/>
+</MIME>
 
-<MIMETYPE>
-<EXT>silo</EXT>
-<MIME>model/mesh</MIME>
-<CMD>SEND</CMD>
-<MANAGER>NONE</MANAGER>
-</MIMETYPE>
+<MIME mime="model/mesh" handler="SEND" param="">
+<EXTENSION value="silo"/>
+</MIME>
 
-<MIMETYPE>
-<EXT>mesh</EXT>
-<MIME>model/mesh</MIME>
-<CMD>SEND</CMD>
-<MANAGER>NONE</MANAGER>
-</MIMETYPE>
+<MIME mime="model/mesh" handler="SEND" param="">
+<EXTENSION value="mesh"/>
+</MIME>
 
-<MIMETYPE>
-<EXT>msh</EXT>
-<MIME>model/mesh</MIME>
-<CMD>SEND</CMD>
-<MANAGER>NONE</MANAGER>
-</MIMETYPE>
+<MIME mime="model/mesh" handler="SEND" param="">
+<EXTENSION value="msh"/>
+</MIME>
 
-<MIMETYPE>
-<EXT>iges</EXT>
-<MIME>model/iges</MIME>
-<CMD>SEND</CMD>
-<MANAGER>NONE</MANAGER>
-</MIMETYPE>
+<MIME mime="model/iges" handler="SEND" param="">
+<EXTENSION value="iges"/>
+</MIME>
 
-<MIMETYPE>
-<EXT>igs</EXT>
-<MIME>model/iges</MIME>
-<CMD>SEND</CMD>
-<MANAGER>NONE</MANAGER>
-</MIMETYPE>
+<MIME mime="model/iges" handler="SEND" param="">
+<EXTENSION value="igs"/>
+</MIME>
 
-<MIMETYPE>
-<EXT>m3u</EXT>
-<MIME>audio/x-mpegurl</MIME>
-<CMD>SEND</CMD>
-<MANAGER>NONE</MANAGER>
-</MIMETYPE>
+<MIME mime="audio/x-mpegurl" handler="SEND" param="">
+<EXTENSION value="m3u"/>
+</MIME>
 
-<MIMETYPE>
-<EXT>avi</EXT>
-<MIME>video/x-msvideo</MIME>
-<CMD>SEND</CMD>
-<MANAGER>NONE</MANAGER>
-</MIMETYPE>
+<MIME mime="video/x-msvideo" handler="SEND" param="">
+<EXTENSION value="avi"/>
+</MIME>
 
-<MIMETYPE>
-<EXT>mov</EXT>
-<MIME>video/quicktime</MIME>
-<CMD>SEND</CMD>
-<MANAGER>NONE</MANAGER>
-</MIMETYPE>
+<MIME mime="video/quicktime" handler="SEND" param="">
+<EXTENSION value="mov"/>
+</MIME>
 
-<MIMETYPE>
-<EXT>qt</EXT>
-<MIME>video/quicktime</MIME>
-<CMD>SEND</CMD>
-<MANAGER>NONE</MANAGER>
-</MIMETYPE>
+<MIME mime="video/quicktime" handler="SEND" param="">
+<EXTENSION value="qt"/>
+</MIME>
 
-<MIMETYPE>
-<EXT>mpg</EXT>
-<MIME>video/mpeg</MIME>
-<CMD>SEND</CMD>
-<MANAGER>NONE</MANAGER>
-</MIMETYPE>
+<MIME mime="video/mpeg" handler="SEND" param="">
+<EXTENSION value="mpg"/>
+</MIME>
 
-<MIMETYPE>
-<EXT>mpe</EXT>
-<MIME>video/mpeg</MIME>
-<CMD>SEND</CMD>
-<MANAGER>NONE</MANAGER>
-</MIMETYPE>
+<MIME mime="video/mpeg" handler="SEND" param="">
+<EXTENSION value="mpe"/>
+</MIME>
 
-<MIMETYPE>
-<EXT>mpeg</EXT>
-<MIME>video/mpeg</MIME>
-<CMD>SEND</CMD>
-<MANAGER>NONE</MANAGER>
-</MIMETYPE>
+<MIME mime="video/mpeg" handler="SEND" param="">
+<EXTENSION value="mpeg"/>
+</MIME>
 
-<MIMETYPE>
-<EXT>xht</EXT>
-<MIME>application/xhtml+xml</MIME>
-<CMD>SEND</CMD>
-<MANAGER>NONE</MANAGER>
-</MIMETYPE>
+<MIME mime="application/xhtml+xml" handler="SEND" param="">
+<EXTENSION value="xht"/>
+</MIME>
 
-<MIMETYPE>
-<EXT>xhtml</EXT>
-<MIME>application/xhtml+xml</MIME>
-<CMD>SEND</CMD>
-<MANAGER>NONE</MANAGER>
-</MIMETYPE>
+<MIME mime="application/xhtml+xml" handler="SEND" param="">
+<EXTENSION value="xhtml"/>
+</MIME>
 
-<MIMETYPE>
-<EXT>xwd</EXT>
-<MIME>image/x-xwindowdump</MIME>
-<CMD>SEND</CMD>
-<MANAGER>NONE</MANAGER>
-</MIMETYPE>
+<MIME mime="image/x-xwindowdump" handler="SEND" param="">
+<EXTENSION value="xwd"/>
+</MIME>
 
-<MIMETYPE>
-<EXT>xpm</EXT>
-<MIME>image/x-xpixmap</MIME>
-<CMD>SEND</CMD>
-<MANAGER>NONE</MANAGER>
-</MIMETYPE>
+<MIME mime="image/x-xpixmap" handler="SEND" param="">
+<EXTENSION value="xpm"/>
+</MIME>
 
-<MIMETYPE>
-<EXT>xbm</EXT>
-<MIME>image/x-xbitmap</MIME>
-<CMD>SEND</CMD>
-<MANAGER>NONE</MANAGER>
-</MIMETYPE>
+<MIME mime="image/x-xbitmap" handler="SEND" param="">
+<EXTENSION value="xbm"/>
+</MIME>
 
-<MIMETYPE>
-<EXT>rgb</EXT>
-<MIME>image/x-rgb</MIME>
-<CMD>SEND</CMD>
-<MANAGER>NONE</MANAGER>
-</MIMETYPE>
+<MIME mime="image/x-rgb" handler="SEND" param="">
+<EXTENSION value="rgb"/>
+</MIME>
 
-<MIMETYPE>
-<EXT>ppm</EXT>
-<MIME>image/x-portable-pixmap</MIME>
-<CMD>SEND</CMD>
-<MANAGER>NONE</MANAGER>
-</MIMETYPE>
+<MIME mime="image/x-portable-pixmap" handler="SEND" param="">
+<EXTENSION value="ppm"/>
+</MIME>
 
-<MIMETYPE>
-<EXT>pgm</EXT>
-<MIME>image/x-portable-graymap</MIME>
-<CMD>SEND</CMD>
-<MANAGER>NONE</MANAGER>
-</MIMETYPE>
+<MIME mime="image/x-portable-graymap" handler="SEND" param="">
+<EXTENSION value="pgm"/>
+</MIME>
 
-<MIMETYPE>
-<EXT>pbm</EXT>
-<MIME>image/x-portable-bitmap</MIME>
-<CMD>SEND</CMD>
-<MANAGER>NONE</MANAGER>
-</MIMETYPE>
+<MIME mime="image/x-portable-bitmap" handler="SEND" param="">
+<EXTENSION value="pbm"/>
+</MIME>
 
-<MIMETYPE>
-<EXT>pnm</EXT>
-<MIME>image/x-portable-anymap</MIME>
-<CMD>SEND</CMD>
-<MANAGER>NONE</MANAGER>
-</MIMETYPE>
+<MIME mime="image/x-portable-anymap" handler="SEND" param="">
+<EXTENSION value="pnm"/>
+</MIME>
 
-<MIMETYPE>
-<EXT>ras</EXT>
-<MIME>image/x-cmu-raster</MIME>
-<CMD>SEND</CMD>
-<MANAGER>NONE</MANAGER>
-</MIMETYPE>
+<MIME mime="image/x-cmu-raster" handler="SEND" param="">
+<EXTENSION value="ras"/>
+</MIME>
 
-<MIMETYPE>
-<EXT>wbmp</EXT>
-<MIME>image/vnd.wap.wbmp</MIME>
-<CMD>SEND</CMD>
-<MANAGER>NONE</MANAGER>
-</MIMETYPE>
+<MIME mime="image/vnd.wap.wbmp" handler="SEND" param="">
+<EXTENSION value="wbmp"/>
+</MIME>
 
-<MIMETYPE>
-<EXT>djv</EXT>
-<MIME>image/vnd.djvu</MIME>
-<CMD>SEND</CMD>
-<MANAGER>NONE</MANAGER>
-</MIMETYPE>
+<MIME mime="image/vnd.djvu" handler="SEND" param="">
+<EXTENSION value="djv"/>
+</MIME>
 
-<MIMETYPE>
-<EXT>djvu</EXT>
-<MIME>image/vnd.djvu</MIME>
-<CMD>SEND</CMD>
-<MANAGER>NONE</MANAGER>
-</MIMETYPE>
+<MIME mime="image/vnd.djvu" handler="SEND" param="">
+<EXTENSION value="djvu"/>
+</MIME>
 
-<MIMETYPE>
-<EXT>tif</EXT>
-<MIME>image/tiff</MIME>
-<CMD>SEND</CMD>
-<MANAGER>NONE</MANAGER>
-</MIMETYPE>
+<MIME mime="image/tiff" handler="SEND" param="">
+<EXTENSION value="tif"/>
+</MIME>
 
-<MIMETYPE>
-<EXT>tiff</EXT>
-<MIME>image/tiff</MIME>
-<CMD>SEND</CMD>
-<MANAGER>NONE</MANAGER>
-</MIMETYPE>
+<MIME mime="image/tiff" handler="SEND" param="">
+<EXTENSION value="tiff"/>
+</MIME>
 
-<MIMETYPE>
-<EXT>png</EXT>
-<MIME>image/png</MIME>
-<CMD>SEND</CMD>
-<MANAGER>NONE</MANAGER>
-</MIMETYPE>
+<MIME mime="image/png" handler="SEND" param="">
+<EXTENSION value="png"/>
+</MIME>
 
-<MIMETYPE>
-<EXT>ief</EXT>
-<MIME>image/ief</MIME>
-<CMD>SEND</CMD>
-<MANAGER>NONE</MANAGER>
-</MIMETYPE>
+<MIME mime="image/ief" handler="SEND" param="">
+<EXTENSION value="ief"/>
+</MIME>
 
-<MIMETYPE>
-<EXT>xyz</EXT>
-<MIME>chemical/x-xyz</MIME>
-<CMD>SEND</CMD>
-<MANAGER>NONE</MANAGER>
-</MIMETYPE>
+<MIME mime="chemical/x-xyz" handler="SEND" param="">
+<EXTENSION value="xyz"/>
+</MIME>
 
-<MIMETYPE>
-<EXT>pdb</EXT>
-<MIME>chemical/x-pdb</MIME>
-<CMD>SEND</CMD>
-<MANAGER>NONE</MANAGER>
-</MIMETYPE>
+<MIME mime="chemical/x-pdb" handler="SEND" param="">
+<EXTENSION value="pdb"/>
+</MIME>
 
-<MIMETYPE>
-<EXT>wav</EXT>
-<MIME>audio/x-wav</MIME>
-<CMD>SEND</CMD>
-<MANAGER>NONE</MANAGER>
-</MIMETYPE>
+<MIME mime="audio/x-wav" handler="SEND" param="">
+<EXTENSION value="wav"/>
+</MIME>
 
-<MIMETYPE>
-<EXT>ra</EXT>
-<MIME>audio/x-realaudio</MIME>
-<CMD>SEND</CMD>
-<MANAGER>NONE</MANAGER>
-</MIMETYPE>
+<MIME mime="audio/x-realaudio" handler="SEND" param="">
+<EXTENSION value="ra"/>
+</MIME>
 
-<MIMETYPE>
-<EXT>rpm</EXT>
-<MIME>audio/x-pn-realaudio-plugin</MIME>
-<CMD>SEND</CMD>
-<MANAGER>NONE</MANAGER>
-</MIMETYPE>
+<MIME mime="audio/x-pn-realaudio-plugin" handler="SEND" param="">
+<EXTENSION value="rpm"/>
+</MIME>
 
-<MIMETYPE>
-<EXT>rm</EXT>
-<MIME>audio/x-pn-realaudio</MIME>
-<CMD>SEND</CMD>
-<MANAGER>NONE</MANAGER>
-</MIMETYPE>
+<MIME mime="audio/x-pn-realaudio" handler="SEND" param="">
+<EXTENSION value="rm"/>
+</MIME>
 
-<MIMETYPE>
-<EXT>ram</EXT>
-<MIME>audio/x-pn-realaudio</MIME>
-<CMD>SEND</CMD>
-<MANAGER>NONE</MANAGER>
-</MIMETYPE>
+<MIME mime="audio/x-pn-realaudio" handler="SEND" param="">
+<EXTENSION value="ram"/>
+</MIME>
 
-<MIMETYPE>
-<EXT>aifc</EXT>
-<MIME>audio/x-aiff</MIME>
-<CMD>SEND</CMD>
-<MANAGER>NONE</MANAGER>
-</MIMETYPE>
+<MIME mime="audio/x-aiff" handler="SEND" param="">
+<EXTENSION value="aifc"/>
+</MIME>
 
-<MIMETYPE>
-<EXT>aif</EXT>
-<MIME>audio/x-aiff</MIME>
-<CMD>SEND</CMD>
-<MANAGER>NONE</MANAGER>
-</MIMETYPE>
+<MIME mime="audio/x-aiff" handler="SEND" param="">
+<EXTENSION value="aif"/>
+</MIME>
 
-<MIMETYPE>
-<EXT>aiff</EXT>
-<MIME>audio/x-aiff</MIME>
-<CMD>SEND</CMD>
-<MANAGER>NONE</MANAGER>
-</MIMETYPE>
+<MIME mime="audio/x-aiff" handler="SEND" param="">
+<EXTENSION value="aiff"/>
+</MIME>
 
-<MIMETYPE>
-<EXT>snd</EXT>
-<MIME>audio/basic</MIME>
-<CMD>SEND</CMD>
-<MANAGER>NONE</MANAGER>
-</MIMETYPE>
+<MIME mime="audio/basic" handler="SEND" param="">
+<EXTENSION value="snd"/>
+</MIME>
 
-<MIMETYPE>
-<EXT>au</EXT>
-<MIME>audio/basic</MIME>
-<CMD>SEND</CMD>
-<MANAGER>NONE</MANAGER>
-</MIMETYPE>
+<MIME mime="audio/basic" handler="SEND" param="">
+<EXTENSION value="au"/>
+</MIME>
 
-<MIMETYPE>
-<EXT>mp3</EXT>
-<MIME>audio/mpeg</MIME>
-<CMD>SEND</CMD>
-<MANAGER>NONE</MANAGER>
-</MIMETYPE>
+<MIME mime="audio/mpeg" handler="SEND" param="">
+<EXTENSION value="mp3"/>
+</MIME>
 
-<MIMETYPE>
-<EXT>mp2</EXT>
-<MIME>audio/mpeg</MIME>
-<CMD>SEND</CMD>
-<MANAGER>NONE</MANAGER>
-</MIMETYPE>
+<MIME mime="audio/mpeg" handler="SEND" param="">
+<EXTENSION value="mp2"/>
+</MIME>
 
-<MIMETYPE>
-<EXT>mpga</EXT>
-<MIME>audio/mpeg</MIME>
-<CMD>SEND</CMD>
-<MANAGER>NONE</MANAGER>
-</MIMETYPE>
+<MIME mime="audio/mpeg" handler="SEND" param="">
+<EXTENSION value="mpga"/>
+</MIME>
 
-<MIMETYPE>
-<EXT>kar</EXT>
-<MIME>audio/midi</MIME>
-<CMD>SEND</CMD>
-<MANAGER>NONE</MANAGER>
-</MIMETYPE>
+<MIME mime="audio/midi" handler="SEND" param="">
+<EXTENSION value="kar"/>
+</MIME>
 
-<MIMETYPE>
-<EXT>midi</EXT>
-<MIME>audio/midi</MIME>
-<CMD>SEND</CMD>
-<MANAGER>NONE</MANAGER>
-</MIMETYPE>
+<MIME mime="audio/midi" handler="SEND" param="">
+<EXTENSION value="midi"/>
+</MIME>
 
-<MIMETYPE>
-<EXT>mid</EXT>
-<MIME>audio/midi</MIME>
-<CMD>SEND</CMD>
-<MANAGER>NONE</MANAGER>
-</MIMETYPE>
+<MIME mime="audio/midi" handler="SEND" param="">
+<EXTENSION value="mid"/>
+</MIME>
 
-<MIMETYPE>
-<EXT>xls</EXT>
-<MIME>application/vnd.ms-excel</MIME>
-<CMD>SEND</CMD>
-<MANAGER>NONE</MANAGER>
-</MIMETYPE>
+<MIME mime="application/vnd.ms-excel" handler="SEND" param="">
+<EXTENSION value="xls"/>
+</MIME>
 
-<MIMETYPE>
-<EXT>ppt</EXT>
-<MIME>application/vnd.ms-powerpoint</MIME>
-<CMD>SEND</CMD>
-<MANAGER>NONE</MANAGER>
-</MIMETYPE>
+<MIME mime="application/vnd.ms-powerpoint" handler="SEND" param="">
+<EXTENSION value="ppt"/>
+</MIME>
 
-<MIMETYPE>
-<EXT>doc</EXT>
-<MIME>application/msword</MIME>
-<CMD>SEND</CMD>
-<MANAGER>NONE</MANAGER>
-</MIMETYPE>
+<MIME mime="application/msword" handler="SEND" param="">
+<EXTENSION value="doc"/>
+</MIME>
 
-<MIMETYPE>
-<EXT>pdf</EXT>
-<MIME>application/pdf</MIME>
-<CMD>SEND</CMD>
-<MANAGER>NONE</MANAGER>
-</MIMETYPE>
+<MIME mime="application/pdf" handler="SEND" param="">
+<EXTENSION value="pdf"/>
+</MIME>
 
-<MIMETYPE>
-<EXT>zip</EXT>
-<MIME>application/zip</MIME>
-<CMD>SEND</CMD>
-<MANAGER>NONE</MANAGER>
-</MIMETYPE>
+<MIME mime="application/zip" handler="SEND" param="">
+<EXTENSION value="zip"/>
+</MIME>
 
-<MIMETYPE>
-<EXT>css</EXT>
-<MIME>text/css</MIME>
-<CMD>SEND</CMD>
-<MANAGER>NONE</MANAGER>
-</MIMETYPE>
+<MIME mime="text/css" handler="SEND" param="">
+<EXTENSION value="css"/>
+</MIME>
 
-<MIMETYPE>
-<EXT>bmp</EXT>
-<MIME>image/bmp</MIME>
-<CMD>SEND</CMD>
-<MANAGER>NONE</MANAGER>
-</MIMETYPE>
+<MIME mime="image/bmp" handler="SEND" param="">
+<EXTENSION value="bmp"/>
+</MIME>
 
-<MIMETYPE>
-<EXT>vrml</EXT>
-<MIME>model/vrml</MIME>
-<CMD>SEND</CMD>
-<MANAGER>NONE</MANAGER>
-</MIMETYPE>
+<MIME mime="model/vrml" handler="SEND" param="">
+<EXTENSION value="vrml"/>
+</MIME>
 
-<MIMETYPE>
-<EXT>wrl</EXT>
-<MIME>model/vrml</MIME>
-<CMD>SEND</CMD>
-<MANAGER>NONE</MANAGER>
-</MIMETYPE>
+<MIME mime="model/vrml" handler="SEND" param="">
+<EXTENSION value="wrl"/>
+</MIME>
 
-<MIMETYPE>
-<EXT>asc</EXT>
-<MIME>text/html</MIME>
-<CMD>SEND</CMD>
-<MANAGER>NONE</MANAGER>
-</MIMETYPE>
+<MIME mime="text/html" handler="SEND" param="">
+<EXTENSION value="asc"/>
+</MIME>
 
-<MIMETYPE>
-<EXT>txt</EXT>
-<MIME>text/plain</MIME>
-<CMD>SEND</CMD>
-<MANAGER>NONE</MANAGER>
-</MIMETYPE>
+<MIME mime="text/plain" handler="SEND" param="">
+<EXTENSION value="txt"/>
+</MIME>
 
-<MIMETYPE>
-<EXT>link</EXT>
-<MIME>NONE</MIME>
-<CMD>SENDLINK</CMD>
-<MANAGER>NONE</MANAGER>
-</MIMETYPE>
+<MIME mime="NONE" handler="SENDLINK" param="">
+<EXTENSION value="link"/>
+</MIME>
 
-<MIMETYPE>
-<EXT>xml</EXT>
-<MIME>text/xml</MIME>
-<CMD>SEND</CMD>
-<MANAGER>NONE</MANAGER>
-</MIMETYPE>
+<MIME mime="text/xml" handler="SEND" param="">
+<EXTENSION value="xml"/>
+</MIME>
 
-<MIMETYPE>
-<EXT>jpe</EXT>
-<MIME>image/jpeg</MIME>
-<CMD>SEND</CMD>
-<MANAGER>NONE</MANAGER>
-</MIMETYPE>
+<MIME mime="image/jpeg" handler="SEND" param="">
+<EXTENSION value="jpe"/>
+</MIME>
 
-<MIMETYPE>
-<EXT>jpeg</EXT>
-<MIME>image/jpeg</MIME>
-<CMD>SEND</CMD>
-<MANAGER>NONE</MANAGER>
-</MIMETYPE>
+<MIME mime="image/jpeg" handler="SEND" param="">
+<EXTENSION value="jpeg"/>
+</MIME>
 
-<MIMETYPE>
-<EXT>jpg</EXT>
-<MIME>image/jpeg</MIME>
-<CMD>SEND</CMD>
-<MANAGER>NONE</MANAGER>
-</MIMETYPE>
+<MIME mime="image/jpeg" handler="SEND" param="">
+<EXTENSION value="jpg"/>
+</MIME>
 
-<MIMETYPE>
-<EXT>gif</EXT>
-<MIME>image/gif</MIME>
-<CMD>SEND</CMD>
-<MANAGER>NONE</MANAGER>
-</MIMETYPE>
+<MIME mime="image/gif" handler="SEND" param="">
+<EXTENSION value="gif"/>
+</MIME>
 
-<MIMETYPE>
-<EXT>html</EXT>
-<MIME>text/html</MIME>
-<CMD>SEND</CMD>
-<MANAGER>NONE</MANAGER>
-</MIMETYPE>
+<MIME mime="text/html" handler="SEND" param="">
+<EXTENSION value="html"/>
+</MIME>
 
-</MIMETYPES>
+</MIMES>
\ No newline at end of file

Modified: trunk/myserver/binaries/MIMEtypes.xml.unix.default
===================================================================
--- trunk/myserver/binaries/MIMEtypes.xml.unix.default	2008-10-22 18:12:04 UTC (rev 2898)
+++ trunk/myserver/binaries/MIMEtypes.xml.unix.default	2008-10-22 21:07:55 UTC (rev 2899)
@@ -1,985 +1,565 @@
 <?xml version="1.0"?>
 
-<MIMETYPES>
+<MIMES>
 
-<MIMETYPE>
-<EXT>mscgi</EXT>
-<MIME>text/html</MIME>
-<CMD>RUNMSCGI</CMD>
-<MANAGER>NONE</MANAGER>
-</MIMETYPE>
+<MIME mime="text/html" handler="RUNMSCGI" param="">
+<EXTENSION value="mscgi"/>
+</MIME>
 
-<MIMETYPE>
-<EXT>cgi</EXT>
-<MIME>text/html</MIME>
-<CMD>EXECUTE</CMD>
-<MANAGER>NONE</MANAGER>
-</MIMETYPE>
+<MIME mime="text/html" handler="EXECUTE" param="">
+<EXTENSION value="cgi"/>
+</MIME>
 
-<MIMETYPE>
-<EXT>isapi</EXT>
-<MIME>text/html</MIME>
-<CMD>EXECUTEISAPI</CMD>
-<MANAGER>NONE</MANAGER>
-</MIMETYPE>
+<MIME mime="text/html" handler="EXECUTEISAPI" param="">
+<EXTENSION value="isapi"/>
+</MIME>
 
-<MIMETYPE>
-<EXT>fcgi</EXT>
-<MIME>text/html</MIME>
-<CMD>EXECUTEFASTCGI</CMD>
-<MANAGER>NONE</MANAGER>
-</MIMETYPE>
+<MIME mime="text/html" handler="EXECUTEFASTCGI" param="">
+<EXTENSION value="fcgi"/>
+</MIME>
 
-<MIMETYPE>
-<EXT>wincgi</EXT>
-<MIME>text/html</MIME>
-<CMD>EXECUTEWINCGI</CMD>
-<MANAGER>NONE</MANAGER>
-</MIMETYPE>
+<MIME mime="text/html" handler="EXECUTEWINCGI" param="">
+<EXTENSION value="wincgi"/>
+</MIME>
 
-<MIMETYPE>
-<EXT>ai</EXT>
-<MIME>application/postscript</MIME>
-<CMD>SEND</CMD>
-<MANAGER>NONE</MANAGER>
-</MIMETYPE>
+<MIME mime="application/postscript" handler="SEND" param="">
+<EXTENSION value="ai"/>
+</MIME>
 
-<MIMETYPE>
-<EXT>msxu</EXT>
-<MIME>video/vnd.mpegurl</MIME>
-<CMD>SEND</CMD>
-<MANAGER>NONE</MANAGER>
-</MIMETYPE>
+<MIME mime="video/vnd.mpegurl" handler="SEND" param="">
+<EXTENSION value="msxu"/>
+</MIME>
 
-<MIMETYPE>
-<EXT>ice</EXT>
-<MIME>x-conference/x-cooltalk</MIME>
-<CMD>SEND</CMD>
-<MANAGER>NONE</MANAGER>
-</MIMETYPE>
+<MIME mime="x-conference/x-cooltalk" handler="SEND" param="">
+<EXTENSION value="ice"/>
+</MIME>
 
-<MIMETYPE>
-<EXT>movie</EXT>
-<MIME>video/x-sgi-movie</MIME>
-<CMD>SEND</CMD>
-<MANAGER>NONE</MANAGER>
-</MIMETYPE>
+<MIME mime="video/x-sgi-movie" handler="SEND" param="">
+<EXTENSION value="movie"/>
+</MIME>
 
-<MIMETYPE>
-<EXT>ps</EXT>
-<MIME>application/postscript</MIME>
-<CMD>SEND</CMD>
-<MANAGER>NONE</MANAGER>
-</MIMETYPE>
+<MIME mime="application/postscript" handler="SEND" param="">
+<EXTENSION value="ps"/>
+</MIME>
 
-<MIMETYPE>
-<EXT>eps</EXT>
-<MIME>application/postscript</MIME>
-<CMD>SEND</CMD>
-<MANAGER>NONE</MANAGER>
-</MIMETYPE>
+<MIME mime="application/postscript" handler="SEND" param="">
+<EXTENSION value="eps"/>
+</MIME>
 
-<MIMETYPE>
-<EXT>smil</EXT>
-<MIME>application/smil</MIME>
-<CMD>SEND</CMD>
-<MANAGER>NONE</MANAGER>
-</MIMETYPE>
+<MIME mime="application/smil" handler="SEND" param="">
+<EXTENSION value="smil"/>
+</MIME>
 
-<MIMETYPE>
-<EXT>wmlsc</EXT>
-<MIME>application/vnd.wap.wmlscriptc</MIME>
-<CMD>SEND</CMD>
-<MANAGER>NONE</MANAGER>
-</MIMETYPE>
+<MIME mime="application/vnd.wap.wmlscriptc" handler="SEND" param="">
+<EXTENSION value="wmlsc"/>
+</MIME>
 
-<MIMETYPE>
-<EXT>wmlc</EXT>
-<MIME>application/vnd.wap.wmlc</MIME>
-<CMD>SEND</CMD>
-<MANAGER>NONE</MANAGER>
-</MIMETYPE>
+<MIME mime="application/vnd.wap.wmlc" handler="SEND" param="">
+<EXTENSION value="wmlc"/>
+</MIME>
 
-<MIMETYPE>
-<EXT>wbxml</EXT>
-<MIME>application/vnd.wap.wbxml</MIME>
-<CMD>SEND</CMD>
-<MANAGER>NONE</MANAGER>
-</MIMETYPE>
+<MIME mime="application/vnd.wap.wbxml" handler="SEND" param="">
+<EXTENSION value="wbxml"/>
+</MIME>
 
-<MIMETYPE>
-<EXT>smi</EXT>
-<MIME>application/smil</MIME>
-<CMD>SEND</CMD>
-<MANAGER>NONE</MANAGER>
-</MIMETYPE>
+<MIME mime="application/smil" handler="SEND" param="">
+<EXTENSION value="smi"/>
+</MIME>
 
-<MIMETYPE>
-<EXT>dll</EXT>
-<MIME>application/octet-stream</MIME>
-<CMD>SEND</CMD>
-<MANAGER>NONE</MANAGER>
-</MIMETYPE>
+<MIME mime="application/octet-stream" handler="SEND" param="">
+<EXTENSION value="dll"/>
+</MIME>
 
-<MIMETYPE>
-<EXT>so</EXT>
-<MIME>application/octet-stream</MIME>
-<CMD>SEND</CMD>
-<MANAGER>NONE</MANAGER>
-</MIMETYPE>
+<MIME mime="application/octet-stream" handler="SEND" param="">
+<EXTENSION value="so"/>
+</MIME>
 
-<MIMETYPE>
-<EXT>class</EXT>
-<MIME>application/octet-stream</MIME>
-<CMD>SEND</CMD>
-<MANAGER>NONE</MANAGER>
-</MIMETYPE>
+<MIME mime="application/octet-stream" handler="SEND" param="">
+<EXTENSION value="class"/>
+</MIME>
 
-<MIMETYPE>
-<EXT>exe</EXT>
-<MIME>application/octet-stream</MIME>
-<CMD>SEND</CMD>
-<MANAGER>NONE</MANAGER>
-</MIMETYPE>
+<MIME mime="application/octet-stream" handler="SEND" param="">
+<EXTENSION value="exe"/>
+</MIME>
 
-<MIMETYPE>
-<EXT>lzh</EXT>
-<MIME>application/octet-stream</MIME>
-<CMD>SEND</CMD>
-<MANAGER>NONE</MANAGER>
-</MIMETYPE>
+<MIME mime="application/octet-stream" handler="SEND" param="">
+<EXTENSION value="lzh"/>
+</MIME>
 
-<MIMETYPE>
-<EXT>lha</EXT>
-<MIME>application/octet-stream</MIME>
-<CMD>SEND</CMD>
-<MANAGER>NONE</MANAGER>
-</MIMETYPE>
+<MIME mime="application/octet-stream" handler="SEND" param="">
+<EXTENSION value="lha"/>
+</MIME>
 
-<MIMETYPE>
-<EXT>dms</EXT>
-<MIME>application/octet-stream</MIME>
-<CMD>SEND</CMD>
-<MANAGER>NONE</MANAGER>
-</MIMETYPE>
+<MIME mime="application/octet-stream" handler="SEND" param="">
+<EXTENSION value="dms"/>
+</MIME>
 
-<MIMETYPE>
-<EXT>oda</EXT>
-<MIME>application/oda</MIME>
-<CMD>SEND</CMD>
-<MANAGER>NONE</MANAGER>
-</MIMETYPE>
+<MIME mime="application/oda" handler="SEND" param="">
+<EXTENSION value="oda"/>
+</MIME>
 
-<MIMETYPE>
-<EXT>bin</EXT>
-<MIME>application/octet-stream</MIME>
-<CMD>SEND</CMD>
-<MANAGER>NONE</MANAGER>
-</MIMETYPE>
+<MIME mime="application/octet-stream" handler="SEND" param="">
+<EXTENSION value="bin"/>
+</MIME>
 
-<MIMETYPE>
-<EXT>src</EXT>
-<MIME>application/x-wais-source</MIME>
-<CMD>SEND</CMD>
-<MANAGER>NONE</MANAGER>
-</MIMETYPE>
+<MIME mime="application/x-wais-source" handler="SEND" param="">
+<EXTENSION value="src"/>
+</MIME>
 
-<MIMETYPE>
-<EXT>ustar</EXT>
-<MIME>application/x-ustar</MIME>
-<CMD>SEND</CMD>
-<MANAGER>NONE</MANAGER>
-</MIMETYPE>
+<MIME mime="application/x-ustar" handler="SEND" param="">
+<EXTENSION value="ustar"/>
+</MIME>
 
-<MIMETYPE>
-<EXT>ms</EXT>
-<MIME>application/x-troff-ms</MIME>
-<CMD>SEND</CMD>
-<MANAGER>NONE</MANAGER>
-</MIMETYPE>
+<MIME mime="application/x-troff-ms" handler="SEND" param="">
+<EXTENSION value="ms"/>
+</MIME>
 
-<MIMETYPE>
-<EXT>me</EXT>
-<MIME>application/x-troff-me</MIME>
-<CMD>SEND</CMD>
-<MANAGER>NONE</MANAGER>
-</MIMETYPE>
+<MIME mime="application/x-troff-me" handler="SEND" param="">
+<EXTENSION value="me"/>
+</MIME>
 
-<MIMETYPE>
-<EXT>man</EXT>
-<MIME>application/x-troff-man</MIME>
-<CMD>SEND</CMD>
-<MANAGER>NONE</MANAGER>
-</MIMETYPE>
+<MIME mime="application/x-troff-man" handler="SEND" param="">
+<EXTENSION value="man"/>
+</MIME>
 
-<MIMETYPE>
-<EXT>roff</EXT>
-<MIME>application/x-troff</MIME>
-<CMD>SEND</CMD>
-<MANAGER>NONE</MANAGER>
-</MIMETYPE>
+<MIME mime="application/x-troff" handler="SEND" param="">
+<EXTENSION value="roff"/>
+</MIME>
 
-<MIMETYPE>
-<EXT>tr</EXT>
-<MIME>application/x-troff</MIME>
-<CMD>SEND</CMD>
-<MANAGER>NONE</MANAGER>
-</MIMETYPE>
+<MIME mime="application/x-troff" handler="SEND" param="">
+<EXTENSION value="tr"/>
+</MIME>
 
-<MIMETYPE>
-<EXT>t</EXT>
-<MIME>application/x-troff</MIME>
-<CMD>SEND</CMD>
-<MANAGER>NONE</MANAGER>
-</MIMETYPE>
+<MIME mime="application/x-troff" handler="SEND" param="">
+<EXTENSION value="t"/>
+</MIME>
 
-<MIMETYPE>
-<EXT>texi</EXT>
-<MIME>application/x-texinfo</MIME>
-<CMD>SEND</CMD>
-<MANAGER>NONE</MANAGER>
-</MIMETYPE>
+<MIME mime="application/x-texinfo" handler="SEND" param="">
+<EXTENSION value="texi"/>
+</MIME>
 
-<MIMETYPE>
-<EXT>texinfo</EXT>
-<MIME>application/x-texinfo</MIME>
-<CMD>SEND</CMD>
-<MANAGER>NONE</MANAGER>
-</MIMETYPE>
+<MIME mime="application/x-texinfo" handler="SEND" param="">
+<EXTENSION value="texinfo"/>
+</MIME>
 
-<MIMETYPE>
-<EXT>tex</EXT>
-<MIME>application/x-tex</MIME>
-<CMD>SEND</CMD>
-<MANAGER>NONE</MANAGER>
-</MIMETYPE>
+<MIME mime="application/x-tex" handler="SEND" param="">
+<EXTENSION value="tex"/>
+</MIME>
 
-<MIMETYPE>
-<EXT>tcl</EXT>
-<MIME>application/x-tcl</MIME>
-<CMD>SEND</CMD>
-<MANAGER>NONE</MANAGER>
-</MIMETYPE>
+<MIME mime="application/x-tcl" handler="SEND" param="">
+<EXTENSION value="tcl"/>
+</MIME>
 
-<MIMETYPE>
-<EXT>tar</EXT>
-<MIME>application/x-tar</MIME>
-<CMD>SEND</CMD>
-<MANAGER>NONE</MANAGER>
-</MIMETYPE>
+<MIME mime="application/x-tar" handler="SEND" param="">
+<EXTENSION value="tar"/>
+</MIME>
 
-<MIMETYPE>
-<EXT>sv4crc</EXT>
-<MIME>application/x-sv4crc</MIME>
-<CMD>SEND</CMD>
-<MANAGER>NONE</MANAGER>
-</MIMETYPE>
+<MIME mime="application/x-sv4crc" handler="SEND" param="">
+<EXTENSION value="sv4crc"/>
+</MIME>
 
-<MIMETYPE>
-<EXT>sv4cpio</EXT>
-<MIME>application/x-sv4cpio</MIME>
-<CMD>SEND</CMD>
-<MANAGER>NONE</MANAGER>
-</MIMETYPE>
+<MIME mime="application/x-sv4cpio" handler="SEND" param="">
+<EXTENSION value="sv4cpio"/>
+</MIME>
 
-<MIMETYPE>
-<EXT>sit</EXT>
-<MIME>application/x-stuffit</MIME>
-<CMD>SEND</CMD>
-<MANAGER>NONE</MANAGER>
-</MIMETYPE>
+<MIME mime="application/x-stuffit" handler="SEND" param="">
+<EXTENSION value="sit"/>
+</MIME>
 
-<MIMETYPE>
-<EXT>swf</EXT>
-<MIME>application/x-shockwave-flash</MIME>
-<CMD>SEND</CMD>
-<MANAGER>NONE</MANAGER>
-</MIMETYPE>
+<MIME mime="application/x-shockwave-flash" handler="SEND" param="">
+<EXTENSION value="swf"/>
+</MIME>
 
-<MIMETYPE>
-<EXT>shar</EXT>
-<MIME>application/x-shar</MIME>
-<CMD>SEND</CMD>
-<MANAGER>NONE</MANAGER>
-</MIMETYPE>
+<MIME mime="application/x-shar" handler="SEND" param="">
+<EXTENSION value="shar"/>
+</MIME>
 
-<MIMETYPE>
-<EXT>sh</EXT>
-<MIME>application/x-sh</MIME>
-<CMD>SEND</CMD>
-<MANAGER>NONE</MANAGER>
-</MIMETYPE>
+<MIME mime="application/x-sh" handler="SEND" param="">
+<EXTENSION value="sh"/>
+</MIME>
 
-<MIMETYPE>
-<EXT>cpt</EXT>
-<MIME>application/mac-compactpro</MIME>
-<CMD>SEND</CMD>
-<MANAGER>NONE</MANAGER>
-</MIMETYPE>
+<MIME mime="application/mac-compactpro" handler="SEND" param="">
+<EXTENSION value="cpt"/>
+</MIME>
 
-<MIMETYPE>
-<EXT>hqx</EXT>
-<MIME>application/mac-binhex40</MIME>
-<CMD>SEND</CMD>
-<MANAGER>NONE</MANAGER>
-</MIMETYPE>
+<MIME mime="application/mac-binhex40" handler="SEND" param="">
+<EXTENSION value="hqx"/>
+</MIME>
 
-<MIMETYPE>
-<EXT>cdf</EXT>
-<MIME>application/x-netcdf</MIME>
-<CMD>SEND</CMD>
-<MANAGER>NONE</MANAGER>
-</MIMETYPE>
+<MIME mime="application/x-netcdf" handler="SEND" param="">
+<EXTENSION value="cdf"/>
+</MIME>
 
-<MIMETYPE>
-<EXT>ez</EXT>
-<MIME>application/andrew-inset</MIME>
-<CMD>SEND</CMD>
-<MANAGER>NONE</MANAGER>
-</MIMETYPE>
+<MIME mime="application/andrew-inset" handler="SEND" param="">
+<EXTENSION value="ez"/>
+</MIME>
 
-<MIMETYPE>
-<EXT>nc</EXT>
-<MIME>application/x-netcdf</MIME>
-<CMD>SEND</CMD>
-<MANAGER>NONE</MANAGER>
-</MIMETYPE>
+<MIME mime="application/x-netcdf" handler="SEND" param="">
+<EXTENSION value="nc"/>
+</MIME>
 
-<MIMETYPE>
-<EXT>latex</EXT>
-<MIME>application/x-latex</MIME>
-<CMD>SEND</CMD>
-<MANAGER>NONE</MANAGER>
-</MIMETYPE>
+<MIME mime="application/x-latex" handler="SEND" param="">
+<EXTENSION value="latex"/>
+</MIME>
 
-<MIMETYPE>
-<EXT>skm</EXT>
-<MIME>application/x-koan</MIME>
-<CMD>SEND</CMD>
-<MANAGER>NONE</MANAGER>
-</MIMETYPE>
+<MIME mime="application/x-koan" handler="SEND" param="">
+<EXTENSION value="skm"/>
+</MIME>
 
-<MIMETYPE>
-<EXT>skt</EXT>
-<MIME>application/x-koan</MIME>
-<CMD>SEND</CMD>
-<MANAGER>NONE</MANAGER>
-</MIMETYPE>
+<MIME mime="application/x-koan" handler="SEND" param="">
+<EXTENSION value="skt"/>
+</MIME>
 
-<MIMETYPE>
-<EXT>skd</EXT>
-<MIME>application/x-koan</MIME>
-<CMD>SEND</CMD>
-<MANAGER>NONE</MANAGER>
-</MIMETYPE>
+<MIME mime="application/x-koan" handler="SEND" param="">
+<EXTENSION value="skd"/>
+</MIME>
 
-<MIMETYPE>
-<EXT>skp</EXT>
-<MIME>application/x-koan</MIME>
-<CMD>SEND</CMD>
-<MANAGER>NONE</MANAGER>
-</MIMETYPE>
+<MIME mime="application/x-koan" handler="SEND" param="">
+<EXTENSION value="skp"/>
+</MIME>
 
-<MIMETYPE>
-<EXT>js</EXT>
-<MIME>application/x-javascript</MIME>
-<CMD>SEND</CMD>
-<MANAGER>NONE</MANAGER>
-</MIMETYPE>
+<MIME mime="application/x-javascript" handler="SEND" param="">
+<EXTENSION value="js"/>
+</MIME>
 
-<MIMETYPE>
-<EXT>hdf</EXT>
-<MIME>application/x-hdf</MIME>
-<CMD>SEND</CMD>
-<MANAGER>NONE</MANAGER>
-</MIMETYPE>
+<MIME mime="application/x-hdf" handler="SEND" param="">
+<EXTENSION value="hdf"/>
+</MIME>
 
-<MIMETYPE>
-<EXT>gtar</EXT>
-<MIME>application/x-gtar</MIME>
-<CMD>SEND</CMD>
-<MANAGER>NONE</MANAGER>
-</MIMETYPE>
+<MIME mime="application/x-gtar" handler="SEND" param="">
+<EXTENSION value="gtar"/>
+</MIME>
 
-<MIMETYPE>
-<EXT>spl</EXT>
-<MIME>application/x-futuresplash</MIME>
-<CMD>SEND</CMD>
-<MANAGER>NONE</MANAGER>
-</MIMETYPE>
+<MIME mime="application/x-futuresplash" handler="SEND" param="">
+<EXTENSION value="spl"/>
+</MIME>
 
-<MIMETYPE>
-<EXT>dvi</EXT>
-<MIME>application/x-dvi</MIME>
-<CMD>SEND</CMD>
-<MANAGER>NONE</MANAGER>
-</MIMETYPE>
+<MIME mime="application/x-dvi" handler="SEND" param="">
+<EXTENSION value="dvi"/>
+</MIME>
 
-<MIMETYPE>
-<EXT>dxr</EXT>
-<MIME>application/x-director</MIME>
-<CMD>SEND</CMD>
-<MANAGER>NONE</MANAGER>
-</MIMETYPE>
+<MIME mime="application/x-director" handler="SEND" param="">
+<EXTENSION value="dxr"/>
+</MIME>
 
-<MIMETYPE>
-<EXT>dir</EXT>
-<MIME>application/x-director</MIME>
-<CMD>SEND</CMD>
-<MANAGER>NONE</MANAGER>
-</MIMETYPE>
+<MIME mime="application/x-director" handler="SEND" param="">
+<EXTENSION value="dir"/>
+</MIME>
 
-<MIMETYPE>
-<EXT>dcr</EXT>
-<MIME>application/x-director</MIME>
-<CMD>SEND</CMD>
-<MANAGER>NONE</MANAGER>
-</MIMETYPE>
+<MIME mime="application/x-director" handler="SEND" param="">
+<EXTENSION value="dcr"/>
+</MIME>
 
-<MIMETYPE>
-<EXT>csh</EXT>
-<MIME>application/x-csh</MIME>
-<CMD>SEND</CMD>
-<MANAGER>NONE</MANAGER>
-</MIMETYPE>
+<MIME mime="application/x-csh" handler="SEND" param="">
+<EXTENSION value="csh"/>
+</MIME>
 
-<MIMETYPE>
-<EXT>cpio</EXT>
-<MIME>application/x-cpio</MIME>
-<CMD>SEND</CMD>
-<MANAGER>NONE</MANAGER>
-</MIMETYPE>
+<MIME mime="application/x-cpio" handler="SEND" param="">
+<EXTENSION value="cpio"/>
+</MIME>
 
-<MIMETYPE>
-<EXT>pgn</EXT>
-<MIME>application/x-chess-pgn</MIME>
-<CMD>SEND</CMD>
-<MANAGER>NONE</MANAGER>
-</MIMETYPE>
+<MIME mime="application/x-chess-pgn" handler="SEND" param="">
+<EXTENSION value="pgn"/>
+</MIME>
 
-<MIMETYPE>
-<EXT>vcd</EXT>
-<MIME>application/x-cdlink</MIME>
-<CMD>SEND</CMD>
-<MANAGER>NONE</MANAGER>
-</MIMETYPE>
+<MIME mime="application/x-cdlink" handler="SEND" param="">
+<EXTENSION value="vcd"/>
+</MIME>
 
-<MIMETYPE>
-<EXT>bcpio</EXT>
-<MIME>application/x-bcpio</MIME>
-<CMD>SEND</CMD>
-<MANAGER>NONE</MANAGER>
-</MIMETYPE>
+<MIME mime="application/x-bcpio" handler="SEND" param="">
+<EXTENSION value="bcpio"/>
+</MIME>
 
-<MIMETYPE>
-<EXT>xsl</EXT>
-<MIME>text/xml</MIME>
-<CMD>SEND</CMD>
-<MANAGER>NONE</MANAGER>
-</MIMETYPE>
+<MIME mime="text/xml" handler="SEND" param="">
+<EXTENSION value="xsl"/>
+</MIME>
 
-<MIMETYPE>
-<EXT>etx</EXT>
-<MIME>text/x-setext</MIME>
-<CMD>SEND</CMD>
-<MANAGER>NONE</MANAGER>
-</MIMETYPE>
+<MIME mime="text/x-setext" handler="SEND" param="">
+<EXTENSION value="etx"/>
+</MIME>
 
-<MIMETYPE>
-<EXT>tsv</EXT>
-<MIME>text/tab-separated-values</MIME>
-<CMD>SEND</CMD>
-<MANAGER>NONE</MANAGER>
-</MIMETYPE>
+<MIME mime="text/tab-separated-values" handler="SEND" param="">
+<EXTENSION value="tsv"/>
+</MIME>
 
-<MIMETYPE>
-<EXT>sgm</EXT>
-<MIME>text/sgml</MIME>
-<CMD>SEND</CMD>
-<MANAGER>NONE</MANAGER>
-</MIMETYPE>
+<MIME mime="text/sgml" handler="SEND" param="">
+<EXTENSION value="sgm"/>
+</MIME>
 
-<MIMETYPE>
-<EXT>sgml</EXT>
-<MIME>text/sgml</MIME>
-<CMD>SEND</CMD>
-<MANAGER>NONE</MANAGER>
-</MIMETYPE>
+<MIME mime="text/sgml" handler="SEND" param="">
+<EXTENSION value="sgml"/>
+</MIME>
 
-<MIMETYPE>
-<EXT>rtf</EXT>
-<MIME>text/rtf</MIME>
-<CMD>SEND</CMD>
-<MANAGER>NONE</MANAGER>
-</MIMETYPE>
+<MIME mime="text/rtf" handler="SEND" param="">
+<EXTENSION value="rtf"/>
+</MIME>
 
-<MIMETYPE>
-<EXT>rtx</EXT>
-<MIME>text/richtext</MIME>
-<CMD>SEND</CMD>
-<MANAGER>NONE</MANAGER>
-</MIMETYPE>
+<MIME mime="text/richtext" handler="SEND" param="">
+<EXTENSION value="rtx"/>
+</MIME>
 
-<MIMETYPE>
-<EXT>silo</EXT>
-<MIME>model/mesh</MIME>
-<CMD>SEND</CMD>
-<MANAGER>NONE</MANAGER>
-</MIMETYPE>
+<MIME mime="model/mesh" handler="SEND" param="">
+<EXTENSION value="silo"/>
+</MIME>
 
-<MIMETYPE>
-<EXT>mesh</EXT>
-<MIME>model/mesh</MIME>
-<CMD>SEND</CMD>
-<MANAGER>NONE</MANAGER>
-</MIMETYPE>
+<MIME mime="model/mesh" handler="SEND" param="">
+<EXTENSION value="mesh"/>
+</MIME>
 
-<MIMETYPE>
-<EXT>msh</EXT>
-<MIME>model/mesh</MIME>
-<CMD>SEND</CMD>
-<MANAGER>NONE</MANAGER>
-</MIMETYPE>
+<MIME mime="model/mesh" handler="SEND" param="">
+<EXTENSION value="msh"/>
+</MIME>
 
-<MIMETYPE>
-<EXT>iges</EXT>
-<MIME>model/iges</MIME>
-<CMD>SEND</CMD>
-<MANAGER>NONE</MANAGER>
-</MIMETYPE>
+<MIME mime="model/iges" handler="SEND" param="">
+<EXTENSION value="iges"/>
+</MIME>
 
-<MIMETYPE>
-<EXT>igs</EXT>
-<MIME>model/iges</MIME>
-<CMD>SEND</CMD>
-<MANAGER>NONE</MANAGER>
-</MIMETYPE>
+<MIME mime="model/iges" handler="SEND" param="">
+<EXTENSION value="igs"/>
+</MIME>
 
-<MIMETYPE>
-<EXT>m3u</EXT>
-<MIME>audio/x-mpegurl</MIME>
-<CMD>SEND</CMD>
-<MANAGER>NONE</MANAGER>
-</MIMETYPE>
+<MIME mime="audio/x-mpegurl" handler="SEND" param="">
+<EXTENSION value="m3u"/>
+</MIME>
 
-<MIMETYPE>
-<EXT>avi</EXT>
-<MIME>video/x-msvideo</MIME>
-<CMD>SEND</CMD>
-<MANAGER>NONE</MANAGER>
-</MIMETYPE>
+<MIME mime="video/x-msvideo" handler="SEND" param="">
+<EXTENSION value="avi"/>
+</MIME>
 
-<MIMETYPE>
-<EXT>mov</EXT>
-<MIME>video/quicktime</MIME>
-<CMD>SEND</CMD>
-<MANAGER>NONE</MANAGER>
-</MIMETYPE>
+<MIME mime="video/quicktime" handler="SEND" param="">
+<EXTENSION value="mov"/>
+</MIME>
 
-<MIMETYPE>
-<EXT>qt</EXT>
-<MIME>video/quicktime</MIME>
-<CMD>SEND</CMD>
-<MANAGER>NONE</MANAGER>
-</MIMETYPE>
+<MIME mime="video/quicktime" handler="SEND" param="">
+<EXTENSION value="qt"/>
+</MIME>
 
-<MIMETYPE>
-<EXT>mpg</EXT>
-<MIME>video/mpeg</MIME>
-<CMD>SEND</CMD>
-<MANAGER>NONE</MANAGER>
-</MIMETYPE>
+<MIME mime="video/mpeg" handler="SEND" param="">
+<EXTENSION value="mpg"/>
+</MIME>
 
-<MIMETYPE>
-<EXT>mpe</EXT>
-<MIME>video/mpeg</MIME>
-<CMD>SEND</CMD>
-<MANAGER>NONE</MANAGER>
-</MIMETYPE>
+<MIME mime="video/mpeg" handler="SEND" param="">
+<EXTENSION value="mpe"/>
+</MIME>
 
-<MIMETYPE>
-<EXT>mpeg</EXT>
-<MIME>video/mpeg</MIME>
-<CMD>SEND</CMD>
-<MANAGER>NONE</MANAGER>
-</MIMETYPE>
+<MIME mime="video/mpeg" handler="SEND" param="">
+<EXTENSION value="mpeg"/>
+</MIME>
 
-<MIMETYPE>
-<EXT>xht</EXT>
-<MIME>application/xhtml+xml</MIME>
-<CMD>SEND</CMD>
-<MANAGER>NONE</MANAGER>
-</MIMETYPE>
+<MIME mime="application/xhtml+xml" handler="SEND" param="">
+<EXTENSION value="xht"/>
+</MIME>
 
-<MIMETYPE>
-<EXT>xhtml</EXT>
-<MIME>application/xhtml+xml</MIME>
-<CMD>SEND</CMD>
-<MANAGER>NONE</MANAGER>
-</MIMETYPE>
+<MIME mime="application/xhtml+xml" handler="SEND" param="">
+<EXTENSION value="xhtml"/>
+</MIME>
 
-<MIMETYPE>
-<EXT>xwd</EXT>
-<MIME>image/x-xwindowdump</MIME>
-<CMD>SEND</CMD>
-<MANAGER>NONE</MANAGER>
-</MIMETYPE>
+<MIME mime="image/x-xwindowdump" handler="SEND" param="">
+<EXTENSION value="xwd"/>
+</MIME>
 
-<MIMETYPE>
-<EXT>xpm</EXT>
-<MIME>image/x-xpixmap</MIME>
-<CMD>SEND</CMD>
-<MANAGER>NONE</MANAGER>
-</MIMETYPE>
+<MIME mime="image/x-xpixmap" handler="SEND" param="">
+<EXTENSION value="xpm"/>
+</MIME>
 
-<MIMETYPE>
-<EXT>xbm</EXT>
-<MIME>image/x-xbitmap</MIME>
-<CMD>SEND</CMD>
-<MANAGER>NONE</MANAGER>
-</MIMETYPE>
+<MIME mime="image/x-xbitmap" handler="SEND" param="">
+<EXTENSION value="xbm"/>
+</MIME>
 
-<MIMETYPE>
-<EXT>rgb</EXT>
-<MIME>image/x-rgb</MIME>
-<CMD>SEND</CMD>
-<MANAGER>NONE</MANAGER>
-</MIMETYPE>
+<MIME mime="image/x-rgb" handler="SEND" param="">
+<EXTENSION value="rgb"/>
+</MIME>
 
-<MIMETYPE>
-<EXT>ppm</EXT>
-<MIME>image/x-portable-pixmap</MIME>
-<CMD>SEND</CMD>
-<MANAGER>NONE</MANAGER>
-</MIMETYPE>
+<MIME mime="image/x-portable-pixmap" handler="SEND" param="">
+<EXTENSION value="ppm"/>
+</MIME>
 
-<MIMETYPE>
-<EXT>pgm</EXT>
-<MIME>image/x-portable-graymap</MIME>
-<CMD>SEND</CMD>
-<MANAGER>NONE</MANAGER>
-</MIMETYPE>
+<MIME mime="image/x-portable-graymap" handler="SEND" param="">
+<EXTENSION value="pgm"/>
+</MIME>
 
-<MIMETYPE>
-<EXT>pbm</EXT>
-<MIME>image/x-portable-bitmap</MIME>
-<CMD>SEND</CMD>
-<MANAGER>NONE</MANAGER>
-</MIMETYPE>
+<MIME mime="image/x-portable-bitmap" handler="SEND" param="">
+<EXTENSION value="pbm"/>
+</MIME>
 
-<MIMETYPE>
-<EXT>pnm</EXT>
-<MIME>image/x-portable-anymap</MIME>
-<CMD>SEND</CMD>
-<MANAGER>NONE</MANAGER>
-</MIMETYPE>
+<MIME mime="image/x-portable-anymap" handler="SEND" param="">
+<EXTENSION value="pnm"/>
+</MIME>
 
-<MIMETYPE>
-<EXT>ras</EXT>
-<MIME>image/x-cmu-raster</MIME>
-<CMD>SEND</CMD>
-<MANAGER>NONE</MANAGER>
-</MIMETYPE>
+<MIME mime="image/x-cmu-raster" handler="SEND" param="">
+<EXTENSION value="ras"/>
+</MIME>
 
-<MIMETYPE>
-<EXT>wbmp</EXT>
-<MIME>image/vnd.wap.wbmp</MIME>
-<CMD>SEND</CMD>
-<MANAGER>NONE</MANAGER>
-</MIMETYPE>
+<MIME mime="image/vnd.wap.wbmp" handler="SEND" param="">
+<EXTENSION value="wbmp"/>
+</MIME>
 
-<MIMETYPE>
-<EXT>djv</EXT>
-<MIME>image/vnd.djvu</MIME>
-<CMD>SEND</CMD>
-<MANAGER>NONE</MANAGER>
-</MIMETYPE>
+<MIME mime="image/vnd.djvu" handler="SEND" param="">
+<EXTENSION value="djv"/>
+</MIME>
 
-<MIMETYPE>
-<EXT>djvu</EXT>
-<MIME>image/vnd.djvu</MIME>
-<CMD>SEND</CMD>
-<MANAGER>NONE</MANAGER>
-</MIMETYPE>
+<MIME mime="image/vnd.djvu" handler="SEND" param="">
+<EXTENSION value="djvu"/>
+</MIME>
 
-<MIMETYPE>
-<EXT>tif</EXT>
-<MIME>image/tiff</MIME>
-<CMD>SEND</CMD>
-<MANAGER>NONE</MANAGER>
-</MIMETYPE>
+<MIME mime="image/tiff" handler="SEND" param="">
+<EXTENSION value="tif"/>
+</MIME>
 
-<MIMETYPE>
-<EXT>tiff</EXT>
-<MIME>image/tiff</MIME>
-<CMD>SEND</CMD>
-<MANAGER>NONE</MANAGER>
-</MIMETYPE>
+<MIME mime="image/tiff" handler="SEND" param="">
+<EXTENSION value="tiff"/>
+</MIME>
 
-<MIMETYPE>
-<EXT>png</EXT>
-<MIME>image/png</MIME>
-<CMD>SEND</CMD>
-<MANAGER>NONE</MANAGER>
-</MIMETYPE>
+<MIME mime="image/png" handler="SEND" param="">
+<EXTENSION value="png"/>
+</MIME>
 
-<MIMETYPE>
-<EXT>ief</EXT>
-<MIME>image/ief</MIME>
-<CMD>SEND</CMD>
-<MANAGER>NONE</MANAGER>
-</MIMETYPE>
+<MIME mime="image/ief" handler="SEND" param="">
+<EXTENSION value="ief"/>
+</MIME>
 
-<MIMETYPE>
-<EXT>xyz</EXT>
-<MIME>chemical/x-xyz</MIME>
-<CMD>SEND</CMD>
-<MANAGER>NONE</MANAGER>
-</MIMETYPE>
+<MIME mime="chemical/x-xyz" handler="SEND" param="">
+<EXTENSION value="xyz"/>
+</MIME>
 
-<MIMETYPE>
-<EXT>pdb</EXT>
-<MIME>chemical/x-pdb</MIME>
-<CMD>SEND</CMD>
-<MANAGER>NONE</MANAGER>
-</MIMETYPE>
+<MIME mime="chemical/x-pdb" handler="SEND" param="">
+<EXTENSION value="pdb"/>
+</MIME>
 
-<MIMETYPE>
-<EXT>wav</EXT>
-<MIME>audio/x-wav</MIME>
-<CMD>SEND</CMD>
-<MANAGER>NONE</MANAGER>
-</MIMETYPE>
+<MIME mime="audio/x-wav" handler="SEND" param="">
+<EXTENSION value="wav"/>
+</MIME>
 
-<MIMETYPE>
-<EXT>ra</EXT>
-<MIME>audio/x-realaudio</MIME>
-<CMD>SEND</CMD>
-<MANAGER>NONE</MANAGER>
-</MIMETYPE>
+<MIME mime="audio/x-realaudio" handler="SEND" param="">
+<EXTENSION value="ra"/>
+</MIME>
 
-<MIMETYPE>
-<EXT>rpm</EXT>
-<MIME>audio/x-pn-realaudio-plugin</MIME>
-<CMD>SEND</CMD>
-<MANAGER>NONE</MANAGER>
-</MIMETYPE>
+<MIME mime="audio/x-pn-realaudio-plugin" handler="SEND" param="">
+<EXTENSION value="rpm"/>
+</MIME>
 
-<MIMETYPE>
-<EXT>rm</EXT>
-<MIME>audio/x-pn-realaudio</MIME>
-<CMD>SEND</CMD>
-<MANAGER>NONE</MANAGER>
-</MIMETYPE>
+<MIME mime="audio/x-pn-realaudio" handler="SEND" param="">
+<EXTENSION value="rm"/>
+</MIME>
 
-<MIMETYPE>
-<EXT>ram</EXT>
-<MIME>audio/x-pn-realaudio</MIME>
-<CMD>SEND</CMD>
-<MANAGER>NONE</MANAGER>
-</MIMETYPE>
+<MIME mime="audio/x-pn-realaudio" handler="SEND" param="">
+<EXTENSION value="ram"/>
+</MIME>
 
-<MIMETYPE>
-<EXT>aifc</EXT>
-<MIME>audio/x-aiff</MIME>
-<CMD>SEND</CMD>
-<MANAGER>NONE</MANAGER>
-</MIMETYPE>
+<MIME mime="audio/x-aiff" handler="SEND" param="">
+<EXTENSION value="aifc"/>
+</MIME>
 
-<MIMETYPE>
-<EXT>aif</EXT>
-<MIME>audio/x-aiff</MIME>
-<CMD>SEND</CMD>
-<MANAGER>NONE</MANAGER>
-</MIMETYPE>
+<MIME mime="audio/x-aiff" handler="SEND" param="">
+<EXTENSION value="aif"/>
+</MIME>
 
-<MIMETYPE>
-<EXT>aiff</EXT>
-<MIME>audio/x-aiff</MIME>
-<CMD>SEND</CMD>
-<MANAGER>NONE</MANAGER>
-</MIMETYPE>
+<MIME mime="audio/x-aiff" handler="SEND" param="">
+<EXTENSION value="aiff"/>
+</MIME>
 
-<MIMETYPE>
-<EXT>snd</EXT>
-<MIME>audio/basic</MIME>
-<CMD>SEND</CMD>
-<MANAGER>NONE</MANAGER>
-</MIMETYPE>
+<MIME mime="audio/basic" handler="SEND" param="">
+<EXTENSION value="snd"/>
+</MIME>
 
-<MIMETYPE>
-<EXT>au</EXT>
-<MIME>audio/basic</MIME>
-<CMD>SEND</CMD>
-<MANAGER>NONE</MANAGER>
-</MIMETYPE>
+<MIME mime="audio/basic" handler="SEND" param="">
+<EXTENSION value="au"/>
+</MIME>
 
-<MIMETYPE>
-<EXT>mp3</EXT>
-<MIME>audio/mpeg</MIME>
-<CMD>SEND</CMD>
-<MANAGER>NONE</MANAGER>
-</MIMETYPE>
+<MIME mime="audio/mpeg" handler="SEND" param="">
+<EXTENSION value="mp3"/>
+</MIME>
 
-<MIMETYPE>
-<EXT>mp2</EXT>
-<MIME>audio/mpeg</MIME>
-<CMD>SEND</CMD>
-<MANAGER>NONE</MANAGER>
-</MIMETYPE>
+<MIME mime="audio/mpeg" handler="SEND" param="">
+<EXTENSION value="mp2"/>
+</MIME>
 
-<MIMETYPE>
-<EXT>mpga</EXT>
-<MIME>audio/mpeg</MIME>
-<CMD>SEND</CMD>
-<MANAGER>NONE</MANAGER>
-</MIMETYPE>
+<MIME mime="audio/mpeg" handler="SEND" param="">
+<EXTENSION value="mpga"/>
+</MIME>
 
-<MIMETYPE>
-<EXT>kar</EXT>
-<MIME>audio/midi</MIME>
-<CMD>SEND</CMD>
-<MANAGER>NONE</MANAGER>
-</MIMETYPE>
+<MIME mime="audio/midi" handler="SEND" param="">
+<EXTENSION value="kar"/>
+</MIME>
 
-<MIMETYPE>
-<EXT>midi</EXT>
-<MIME>audio/midi</MIME>
-<CMD>SEND</CMD>
-<MANAGER>NONE</MANAGER>
-</MIMETYPE>
+<MIME mime="audio/midi" handler="SEND" param="">
+<EXTENSION value="midi"/>
+</MIME>
 
-<MIMETYPE>
-<EXT>mid</EXT>
-<MIME>audio/midi</MIME>
-<CMD>SEND</CMD>
-<MANAGER>NONE</MANAGER>
-</MIMETYPE>
+<MIME mime="audio/midi" handler="SEND" param="">
+<EXTENSION value="mid"/>
+</MIME>
 
-<MIMETYPE>
-<EXT>xls</EXT>
-<MIME>application/vnd.ms-excel</MIME>
-<CMD>SEND</CMD>
-<MANAGER>NONE</MANAGER>
-</MIMETYPE>
+<MIME mime="application/vnd.ms-excel" handler="SEND" param="">
+<EXTENSION value="xls"/>
+</MIME>
 
-<MIMETYPE>
-<EXT>ppt</EXT>
-<MIME>application/vnd.ms-powerpoint</MIME>
-<CMD>SEND</CMD>
-<MANAGER>NONE</MANAGER>
-</MIMETYPE>
+<MIME mime="application/vnd.ms-powerpoint" handler="SEND" param="">
+<EXTENSION value="ppt"/>
+</MIME>
 
-<MIMETYPE>
-<EXT>doc</EXT>
-<MIME>application/msword</MIME>
-<CMD>SEND</CMD>
-<MANAGER>NONE</MANAGER>
-</MIMETYPE>
+<MIME mime="application/msword" handler="SEND" param="">
+<EXTENSION value="doc"/>
+</MIME>
 
-<MIMETYPE>
-<EXT>pdf</EXT>
-<MIME>application/pdf</MIME>
-<CMD>SEND</CMD>
-<MANAGER>NONE</MANAGER>
-</MIMETYPE>
+<MIME mime="application/pdf" handler="SEND" param="">
+<EXTENSION value="pdf"/>
+</MIME>
 
-<MIMETYPE>
-<EXT>zip</EXT>
-<MIME>application/zip</MIME>
-<CMD>SEND</CMD>
-<MANAGER>NONE</MANAGER>
-</MIMETYPE>
+<MIME mime="application/zip" handler="SEND" param="">
+<EXTENSION value="zip"/>
+</MIME>
 
-<MIMETYPE>
-<EXT>css</EXT>
-<MIME>text/css</MIME>
-<CMD>SEND</CMD>
-<MANAGER>NONE</MANAGER>
-</MIMETYPE>
+<MIME mime="text/css" handler="SEND" param="">
+<EXTENSION value="css"/>
+</MIME>
 
-<MIMETYPE>
-<EXT>bmp</EXT>
-<MIME>image/bmp</MIME>
-<CMD>SEND</CMD>
-<MANAGER>NONE</MANAGER>
-</MIMETYPE>
+<MIME mime="image/bmp" handler="SEND" param="">
+<EXTENSION value="bmp"/>
+</MIME>
 
-<MIMETYPE>
-<EXT>vrml</EXT>
-<MIME>model/vrml</MIME>
-<CMD>SEND</CMD>
-<MANAGER>NONE</MANAGER>
-</MIMETYPE>
+<MIME mime="model/vrml" handler="SEND" param="">
+<EXTENSION value="vrml"/>
+</MIME>
 
-<MIMETYPE>
-<EXT>wrl</EXT>
-<MIME>model/vrml</MIME>
-<CMD>SEND</CMD>
-<MANAGER>NONE</MANAGER>
-</MIMETYPE>
+<MIME mime="model/vrml" handler="SEND" param="">
+<EXTENSION value="wrl"/>
+</MIME>
 
-<MIMETYPE>
-<EXT>asc</EXT>
-<MIME>text/html</MIME>
-<CMD>SEND</CMD>
-<MANAGER>NONE</MANAGER>
-</MIMETYPE>
+<MIME mime="text/html" handler="SEND" param="">
+<EXTENSION value="asc"/>
+</MIME>
 
-<MIMETYPE>
-<EXT>txt</EXT>
-<MIME>text/plain</MIME>
-<CMD>SEND</CMD>
-<MANAGER>NONE</MANAGER>
-</MIMETYPE>
+<MIME mime="text/plain" handler="SEND" param="">
+<EXTENSION value="txt"/>
+</MIME>
 
-<MIMETYPE>
-<EXT>link</EXT>
-<MIME>NONE</MIME>
-<CMD>SENDLINK</CMD>
-<MANAGER>NONE</MANAGER>
-</MIMETYPE>
+<MIME mime="NONE" handler="SENDLINK" param="">
+<EXTENSION value="link"/>
+</MIME>
 
-<MIMETYPE>
-<EXT>xml</EXT>
-<MIME>text/xml</MIME>
-<CMD>SEND</CMD>
-<MANAGER>NONE</MANAGER>
-</MIMETYPE>
+<MIME mime="text/xml" handler="SEND" param="">
+<EXTENSION value="xml"/>
+</MIME>
 
-<MIMETYPE>
-<EXT>jpe</EXT>
-<MIME>image/jpeg</MIME>
-<CMD>SEND</CMD>
-<MANAGER>NONE</MANAGER>
-</MIMETYPE>
+<MIME mime="image/jpeg" handler="SEND" param="">
+<EXTENSION value="jpe"/>
+</MIME>
 
-<MIMETYPE>
-<EXT>jpeg</EXT>
-<MIME>image/jpeg</MIME>
-<CMD>SEND</CMD>
-<MANAGER>NONE</MANAGER>
-</MIMETYPE>
+<MIME mime="image/jpeg" handler="SEND" param="">
+<EXTENSION value="jpeg"/>
+</MIME>
 
-<MIMETYPE>
-<EXT>jpg</EXT>
-<MIME>image/jpeg</MIME>
-<CMD>SEND</CMD>
-<MANAGER>NONE</MANAGER>
-</MIMETYPE>
+<MIME mime="image/jpeg" handler="SEND" param="">
+<EXTENSION value="jpg"/>
+</MIME>
 
-<MIMETYPE>
-<EXT>gif</EXT>
-<MIME>image/gif</MIME>
-<CMD>SEND</CMD>
-<MANAGER>NONE</MANAGER>
-</MIMETYPE>
+<MIME mime="image/gif" handler="SEND" param="">
+<EXTENSION value="gif"/>
+</MIME>
 
-<MIMETYPE>
-<EXT>html</EXT>
-<MIME>text/html</MIME>
-<CMD>SEND</CMD>
-<MANAGER>NONE</MANAGER>
-</MIMETYPE>
+<MIME mime="text/html" handler="SEND" param="">
+<EXTENSION value="html"/>
+</MIME>
 
-</MIMETYPES>
+</MIMES>

Modified: trunk/myserver/include/conf/mime/mime_manager.h
===================================================================
--- trunk/myserver/include/conf/mime/mime_manager.h	2008-10-22 18:12:04 UTC (rev 2898)
+++ trunk/myserver/include/conf/mime/mime_manager.h	2008-10-22 21:07:55 UTC (rev 2899)
@@ -1,7 +1,7 @@
 /* -*- mode: c++ -*- */
 /*
 MyServer
-Copyright (C) 2002, 2003, 2004, 2007 Free Software Foundation, Inc.
+Copyright (C) 2002, 2003, 2004, 2007, 2008 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
@@ -21,7 +21,7 @@
 
 #include <include/base/utility.h>
 #include <include/base/hash_map/hash_map.h>
-#include <include/base/sync/read_write_lock.h>
+#include <include/base/sync/mutex.h>
 
 #ifdef WIN32
 #include <windows.h>
@@ -43,65 +43,16 @@
 
 using namespace std;
 
-/*!
-*This enum describes all the way that a file is handled by the server.
-*/
-enum CGI_COMMANDS
-{
-	/*! Sends the file as it is; for example an HTML page.  */
-	CGI_CMD_SEND,
-			
-	/*! Run the cgi_manager program.  */
-	CGI_CMD_RUNCGI,
-			
-	/*! Run the ISAPI module.  */
-	CGI_CMD_RUNISAPI,
-			
-	/*! Run the file as a self ISAPI module.  */
-	CGI_CMD_EXECUTEISAPI,
-			
-	/*! Run the the file as a MSCGI script.  */
-	CGI_CMD_RUNMSCGI,
-			
-	/*! Handle the file as an executable.  */
-	CGI_CMD_EXECUTE,
-			
-	/*! Send the file included  in the file.  */
-	CGI_CMD_SENDLINK,
-			
-	/*! Send the file as a WinCGI.  */
-	CGI_CMD_EXECUTEWINCGI,
-	
-	/*! Send the file using the specified FastCGI server.  */
-	CGI_CMD_RUNFASTCGI,
-	
-	/*! Send the file as a FastCGI.  */
-	CGI_CMD_EXECUTEFASTCGI,	
-
-	/*! Send the file using the specified SCGI server.  */
-	CGI_CMD_RUNSCGI,
-	
-	/*! Send the file as a SCGI.  */
-	CGI_CMD_EXECUTESCGI,	
-
-	/*! Use an external plugin to handle this MIME type.  */
-	CGI_CMD_EXTERNAL
-};
-
-
 struct MimeRecord
 {
 	list<string> filters;
 	string extension;
 	string mimeType;
 	string cmdName;
-	int command;
 	string cgiManager;
-	unsigned int extensionHashCode;
 	MimeRecord()
 	{filters.clear(); extension.assign(""); 
-		mimeType.assign(""); cgiManager.assign(""); cmdName.assign("");
-		command=extensionHashCode = 0;}
+		mimeType.assign(""); cgiManager.assign(""); cmdName.assign("");}
 	MimeRecord(MimeRecord&);
 	int addFilter(const char*, int acceptDuplicate = 1);
 	~MimeRecord();
@@ -119,17 +70,12 @@
 	int loadXML(string &filename)
     {return loadXML(filename.c_str());}
 
-	int saveXML(const char *filename);
-	int saveXML(string &filename)
-    {return saveXML(filename.c_str());}
+	MimeRecord* getMIME(const char* ext);
+  MimeRecord* getMIME(string const &ext);
 
-	int getMIME(char* ext,char *dest,char **dest2);
-	int getMIME(int id,char* ext,char *dest,char **dest2);
-  int getMIME(string& ext,string& dest,string& dest2);
-  int getMIME(int id,string& ext,string& dest,string& dest2);
   int isLoaded();
-	MimeRecord *getRecord(string const &ext);
 	void clean();
+
 protected:
 	const char *getFilename();
 	int addRecord(MimeRecord& record);
@@ -140,7 +86,7 @@
   HashMap<string, MimeRecord*> *data;
 	u_long numMimeTypesLoaded;
 	string *filename;
-	ReadWriteLock rwLock;
+	Mutex mutex;
 };
 
 #endif 

Modified: trunk/myserver/src/conf/mime/mime_manager.cpp
===================================================================
--- trunk/myserver/src/conf/mime/mime_manager.cpp	2008-10-22 18:12:04 UTC (rev 2898)
+++ trunk/myserver/src/conf/mime/mime_manager.cpp	2008-10-22 21:07:55 UTC (rev 2899)
@@ -74,7 +74,6 @@
   }
   extension.assign(m.extension); 
   mimeType.assign(m.mimeType);
-  command = m.command;
   cmdName.assign(m.cmdName);
   cgiManager.assign(m.cgiManager);
 } 
@@ -114,7 +113,7 @@
   if(!fn)
     return -1;
 
-  rwLock.writeLock();
+  mutex.lock();
 
   if(filename)
     delete filename;
@@ -126,9 +125,9 @@
 
   data = new HashMap<string, MimeRecord*>();
 
-  if(parser.open(fn))
+  if(parser.open (fn))
   {
-    rwLock.writeUnlock();
+    mutex.unlock ();
     return -1;
   }
 
@@ -140,24 +139,34 @@
   for(; node; node = node->next )
   {
     xmlNodePtr lcur = node->children;
-    xmlAttr *attrs = lcur ? lcur->properties : 0;
+    xmlAttr *attrs;
     MimeRecord rc;
-    if(xmlStrcmp(node->name, (const xmlChar *)"MIMETYPE"))
+    if(xmlStrcmp(node->name, (const xmlChar *)"MIME"))
       continue;
+
     rc.clear();
 
-    while(lcur)
+    for (attrs = node->properties; attrs; attrs = attrs->next)
     {
-      if(lcur->name && !xmlStrcmp(lcur->name, (const xmlChar *)"EXT"))
-      {
-        if(lcur->children->content)
-          rc.extension.assign((const char*)lcur->children->content);
-      }
+      if (!xmlStrcmp (attrs->name, (const xmlChar *)"handler") && 
+          attrs->children && attrs->children->content)
+        rc.cmdName.assign ((const char*)attrs->children->content);
 
-      if(lcur->name && !xmlStrcmp(lcur->name, (const xmlChar *)"MIME"))
+      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"))
       {
-        if(lcur->children->content)
-          rc.mimeType.assign((const char*)lcur->children->content);
+        for (attrs = lcur->properties; attrs; attrs = attrs->next)
+        {
+          if (!xmlStrcmp (attrs->name, (const xmlChar *)"value") && 
+              attrs->children && attrs->children->content)
+            rc.extension.assign ((const char*)attrs->children->content);
+        }
       }
 
       if(lcur->name && !xmlStrcmp(lcur->name, (const xmlChar *)"FILTER"))
@@ -165,91 +174,12 @@
         if(lcur->children->content)
           rc.addFilter((const char*)lcur->children->content);
       }
-
-      if(lcur->name && !xmlStrcmp(lcur->name, (const xmlChar *)"CMD"))
-      {
-        if(lcur->children->content)
-          rc.cmdName.assign((const char*)lcur->children->content);
-        
-        rc.command = CGI_CMD_SEND;
-
-        if(lcur->children->content && 
-           !xmlStrcmp(lcur->children->content,(const xmlChar *)"SEND"))
-          rc.command = CGI_CMD_SEND;
-
-        else if(lcur->children->content && 
-           !xmlStrcmp(lcur->children->content,(const xmlChar *)"RUNCGI"))
-          rc.command = CGI_CMD_RUNCGI;
-      
-        else if(lcur->children->content && 
-           !xmlStrcmp(lcur->children->content,(const xmlChar *)"RUNMSCGI"))
-          rc.command = CGI_CMD_RUNMSCGI;
-
-        else if(lcur->children->content && 
-           !xmlStrcmp(lcur->children->content,(const xmlChar *)"EXECUTE"))
-          rc.command = CGI_CMD_EXECUTE;
-
-        else if(lcur->children->content && 
-           !xmlStrcmp(lcur->children->content,(const xmlChar *)"RUNISAPI"))
-          rc.command = CGI_CMD_RUNISAPI;
-
-        else if(lcur->children->content && 
-           !xmlStrcmp(lcur->children->content,(const xmlChar *)"EXECUTEISAPI"))
-          rc.command = CGI_CMD_EXECUTEISAPI;
-
-        else if(lcur->children->content && 
-           !xmlStrcmp(lcur->children->content,(const xmlChar *)"SENDLINK"))
-          rc.command = CGI_CMD_SENDLINK;
-
-        else if(lcur->children->content && 
-           !xmlStrcmp(lcur->children->content,
-                      (const xmlChar *)"EXECUTEWINCGI"))
-          rc.command = CGI_CMD_EXECUTEWINCGI;
-
-        else if(lcur->children->content && 
-           !xmlStrcmp(lcur->children->content,(const xmlChar *)"RUNFASTCGI"))
-          rc.command = CGI_CMD_RUNFASTCGI;
-
-        else if(lcur->children->content && 
-           !xmlStrcmp(lcur->children->content,
-                      (const xmlChar *)"EXECUTEFASTCGI"))
-          rc.command = CGI_CMD_EXECUTEFASTCGI;
-
-        else if(lcur->children->content && 
-           !xmlStrcmp(lcur->children->content,(const xmlChar *)"RUNSCGI"))
-          rc.command = CGI_CMD_RUNSCGI;
-
-        else if(lcur->children->content && 
-           !xmlStrcmp(lcur->children->content,(const xmlChar *)"EXECUTESCGI"))
-          rc.command = CGI_CMD_EXECUTESCGI;
-
-
-        else if(lcur->children->content)
-          rc.command = CGI_CMD_EXTERNAL;
-      }
-
-      if(lcur->name && !xmlStrcmp(lcur->name, (const xmlChar *)"MANAGER"))
-      {
-        /*! 
-         *If the specified manager is not NONE store its path in the record. 
-         */
-        if(lcur->children->content && strcmpi((char*)lcur->children->content,
-                                               "NONE"))
-        {
-          rc.cgiManager.assign((const char*)lcur->children->content);
-        }
-        else
-        {
-          rc.cgiManager.assign("");
-        }
-      }
-      lcur = lcur->next;
     }
 
     if(addRecord(rc))
     {
       clean();
-      rwLock.writeUnlock();
+      mutex.unlock ();
       return 0;
     }
   }
@@ -260,285 +190,12 @@
 
   retSize = data->size();
 
-  rwLock.writeUnlock();
+  mutex.unlock ();
 
   return retSize;
 }
 
-
 /*!
- *Save the MIME types to a XML file.
- */
-int MimeManager::saveXML(const char *filename)
-{
-  File f;
-  u_long nbw;
-
-  rwLock.writeLock();
-
-  FilesUtility::deleteFile(filename);
-  HashMap<string, MimeRecord*>::Iterator it = data->begin();
-  HashMap<string, MimeRecord*>::Iterator end = data->end();
-
-  f.openFile(filename, File::MYSERVER_OPEN_WRITE | File::MYSERVER_OPEN_ALWAYS);
-  f.writeToFile("<?xml version=\"1.0\"?>\r\n", 23, &nbw);
-  f.writeToFile("<MIMETYPES>\r\n", 13, &nbw);
-
-  for(; it != end; it++)
-  {
-    MimeRecord *rc = *it;
-    char command[16];
-    if(!rc)
-       break;
-    f.writeToFile("\r\n<MIMETYPE>\r\n<EXT>",19,&nbw);
-    f.writeToFile(rc->extension.c_str(),(u_long)rc->extension.length(),&nbw);
-    f.writeToFile("</EXT>\r\n<MIME>",14,&nbw);
-    f.writeToFile(rc->mimeType.c_str(),(u_long)rc->mimeType.length(),&nbw);
-    f.writeToFile("</MIME>\r\n<CMD>",14,&nbw);
-    if(rc->command == CGI_CMD_SEND)
-      strcpy(command, "SEND");
-    else if(rc->command == CGI_CMD_RUNCGI)
-      strcpy(command, "RUNCGI");
-    else if(rc->command == CGI_CMD_RUNMSCGI)
-      strcpy(command, "RUNMSCGI");
-    else if(rc->command == CGI_CMD_EXECUTE)
-      strcpy(command, "EXECUTE");
-    else if(rc->command == CGI_CMD_SENDLINK)
-      strcpy(command, "SENDLINK");
-    else if(rc->command == CGI_CMD_RUNISAPI)
-      strcpy(command, "RUNISAPI");
-    else if(rc->command == CGI_CMD_EXECUTEISAPI)
-      strcpy(command, "EXECUTEISAPI");
-    else if(rc->command == CGI_CMD_EXECUTEWINCGI)
-      strcpy(command, "EXECUTEWINCGI");
-    else if(rc->command == CGI_CMD_RUNFASTCGI)
-      strcpy(command, "RUNFASTCGI");  
-    else if(rc->command == CGI_CMD_EXECUTEFASTCGI)
-      strcpy(command, "EXECUTEFASTCGI");  
-    else if(rc->command == CGI_CMD_RUNSCGI)
-      strcpy(command, "RUNSCGI");  
-    else if(rc->command == CGI_CMD_EXECUTESCGI)
-      strcpy(command, "EXECUTESCGI");  
-    else if(rc->command == CGI_CMD_EXTERNAL)
-      strcpy(command, rc->cmdName.c_str());
-  
-    f.writeToFile(command,(u_long)strlen(command),&nbw);
-
-    f.writeToFile("</CMD>\r\n<MANAGER>",17,&nbw);
-    if(rc->cgiManager.length())
-      f.writeToFile(rc->cgiManager.c_str(), 
-                    (u_long)rc->cgiManager.length(), &nbw);
-    else
-      f.writeToFile("NONE", 4, &nbw);
-    f.writeToFile("</MANAGER>\r\n</MIMETYPE>\r\n", 25, &nbw);  
-  }
-  f.writeToFile("\r\n</MIMETYPES>", 14, &nbw);
-  f.close();
-
-  rwLock.writeUnlock();
-  return 1;
-}
-
-/*!
- *This function returns the type of action to do for handle this file type.
- *Passing a file extension ext this function fills the strings dest and dest2
- *respectly with the MIME type description and if there are the path to the 
- *CGI manager.
- */
-int MimeManager::getMIME(char* ext,char *dest,char **dest2)
-{
-  MimeRecord* mr;
-#ifdef MIME_LOWER_CASE
-  int i, extLen = strlen(ext);
-  char lowerCaseExt[extLen];
-
-  for(i = 0; i < extLen; i++)
-    lowerCaseExt[i] = tolower(ext[i]);
-#endif
-
-  rwLock.readLock();
-
-#ifdef MIME_LOWER_CASE
-  mr = data ? data->get(lowerCaseExt) : 0;
-#else
-  mr = data ? data->get(ext) : 0;
-#endif
-
-  if(mr)
-  {
-    if(dest)
-      strcpy(dest, mr->mimeType.c_str());
-
-    if(dest2)
-    {
-      if(mr->cgiManager.length())
-      {
-        *dest2 = new char[mr->cgiManager.length() + 1];
-        if(*dest2 == 0)
-        {
-          rwLock.readUnlock();
-          return 0;
-        }
-        strcpy(*dest2, mr->cgiManager.c_str());
-        }
-        else
-          *dest2 = 0;
-    }
-    rwLock.readUnlock();
-    return mr->command;
-  }
-  rwLock.readUnlock();
-
-  /*!
-   *If the ext is not registered send the file as it is.
-   */
-  return CGI_CMD_SEND;
-}
-
-/*!
- *This function returns the type of action to do for handle this file type.
- *Passing a file extension ext this function fills the strings dest and dest2
- *respectly with the MIME type description and if there are the path to the 
- *CGI manager.
- */
-int MimeManager::getMIME(string& ext,string& dest,string& dest2)
-{
-  MimeRecord *mr;
-
-#ifdef MIME_LOWER_CASE
-  string lowerCaseExt(ext);
-  transform(lowerCaseExt.begin(), lowerCaseExt.end(), lowerCaseExt.begin(), ::tolower);
-#endif
-
-  rwLock.readLock();
-
-#ifdef MIME_LOWER_CASE
-  mr = data ? data->get(lowerCaseExt.c_str()): 0;
-#else
-  mr = data ? data->get(ext.c_str()): 0;
-#endif
-
-  if(mr)
-  {
-    if(!stringcmpi(mr->extension, ext.c_str()))
-    {
-      dest.assign(mr->mimeType.c_str());
-
-      if(mr->cgiManager.length())
-      {
-        dest2.assign(mr->cgiManager.c_str());
-      }
-      else
-        dest2.assign("");
-    
-      rwLock.readUnlock();
-      return mr->command;
-    }
-  }
-  rwLock.readUnlock();
-  /*!
-   *If the ext is not registered send the file as it is.
-   */
-  return CGI_CMD_SEND;
-}
-
-/*!
- *Get a MIME type by the position of the record in the list.
- */
-int MimeManager::getMIME(int id, char* ext, char *dest, char **dest2)
-{
-  MimeRecord *mr;
-  HashMap<string, MimeRecord*>::Iterator it;
-  HashMap<string, MimeRecord*>::Iterator end;
-
-  if(data == 0)
-    return 0;
-
-  rwLock.readLock();
-
-
-  it = data->begin();
-  end = data->end();
-  if(id > data->size() || id < 0)
-  {
-    rwLock.readUnlock();
-    return CGI_CMD_SEND;   
-  }
-  /*! FIXME: find a O(1) solution.  */
-  while(id-- && it != end)it++;
-
-  mr = *it;
-
-  if(!mr)
-  {
-    rwLock.readUnlock();
-    return CGI_CMD_SEND;
-  }
-
-  if(ext)
-    strcpy(ext, mr->extension.c_str());
-  if(dest)
-    strcpy(dest, mr->mimeType.c_str());
-  if(dest2)
-  {
-    if(mr->cgiManager.length())
-    {
-      *dest2 = new char[mr->cgiManager.length() + 1];
-      if(*dest2 == 0)
-      {
-        rwLock.readUnlock();
-        return 0;
-      }
-      strcpy(*dest2, mr->cgiManager.c_str());
-    }
-    else
-      dest2 = 0;
-  }
-
-  rwLock.readUnlock();
-  return mr->command;
-
-}
-
-/*!
- *Get a MIME type by the position of the record in the list.
- */
-int MimeManager::getMIME(int id,string& ext,string& dest,string& dest2)
-{
-  MimeRecord *mr;
-
-  rwLock.readLock();
-
-  if(!data || id > data->size() || id < 0)
-  {
-    rwLock.readUnlock();
-    return CGI_CMD_SEND;   
-  }
-
-  mr=data->get(ext.c_str());
-  if(mr)
-  {
-    ext.assign(mr->extension);
-    dest.assign(mr->mimeType);
-      
-    if(mr->cgiManager.length())
-      dest2.assign(mr->cgiManager.c_str());
-    else
-      dest2.assign("");
-      
-    rwLock.readUnlock();
-    return mr->command;
-  }
-
-  rwLock.readUnlock();
-  /*!
-   *If the ext is not registered send the file as it is.
-   */
-  return CGI_CMD_SEND;
-}
-
-
-/*!
  *Destroy the object.
  */
 MimeManager::~MimeManager()
@@ -553,7 +210,7 @@
 {
   if(loaded)
   {
-    rwLock.writeLock();
+    mutex.lock ();
     loaded = 0;
     if(filename) 
       delete filename;
@@ -561,18 +218,19 @@
     removeAllRecords();
     delete data;
     data = 0;
-    rwLock.writeUnlock();
+    mutex.unlock ();
   }
 }
 
 /*!
  *Constructor of the class.
  */
-MimeManager::MimeManager() : rwLock(100000)
+MimeManager::MimeManager()
 {
   data = 0;
   filename = 0;
   loaded = 0;
+  mutex.init ();
 }
 
 /*!
@@ -645,15 +303,24 @@
 /*!
  *Get a pointer to an existing record passing its extension.
  */
-MimeRecord *MimeManager::getRecord(string const &ext)
+MimeRecord *MimeManager::getMIME(const char *ext)
 {
+  string str (ext);
+  return getMIME (str);
+}
+
+/*!
+ *Get a pointer to an existing record passing its extension.
+ */
+MimeRecord *MimeManager::getMIME(string const &ext)
+{
   MimeRecord* mr;
 
-  rwLock.readLock();
+  mutex.lock ();
 
   mr = data ? data->get(ext.c_str()) : 0;
 
-  rwLock.readUnlock();
+  mutex.unlock ();
 
   return mr;
 }
@@ -665,11 +332,11 @@
 {
   u_long ret;
 
-  rwLock.readLock();
+  mutex.lock ();
 
   ret = data ? data->size() : 0;
 
-  rwLock.readUnlock();
+  mutex.unlock ();
 
   return ret;
 }

Modified: trunk/myserver/src/protocol/http/http.cpp
===================================================================
--- trunk/myserver/src/protocol/http/http.cpp	2008-10-22 18:12:04 UTC (rev 2898)
+++ trunk/myserver/src/protocol/http/http.cpp	2008-10-22 21:07:55 UTC (rev 2899)
@@ -760,7 +760,8 @@
   string tmpTime;
   string directory;
   string file;
-    
+  DynamicHttpManager* manager;
+
   /*! By default allows only few actions. */
   permissions = MYSERVER_PERMISSION_READ | MYSERVER_PERMISSION_BROWSE ;
 
@@ -875,18 +876,16 @@
       if(td->mime)
       {
         td->response.contentType.assign(td->mime->mimeType);
-        mimecmd = td->mime->command;
         data.assign(td->mime->cgiManager);
       }
       else
       {
         td->response.contentType.assign("text/html");
-        mimecmd = CGI_CMD_SEND;
         data.assign("");
       }
     }
 
-    if(mimecmd == CGI_CMD_RUNCGI)
+    if(!td->mime->cmdName.compare ("RUNCGI"))
     {
       int allowCgi = 1;
       const char *dataH = td->connection->host->getHashedData("ALLOW_CGI");
@@ -906,7 +905,7 @@
                       data.c_str(), 0,  onlyHeader);
       return ret;
     }
-    else if(mimecmd == CGI_CMD_EXECUTE )
+    else if(!td->mime->cmdName.compare ("EXECUTE"))
     {
       int allowCgi = 1;
       const char *dataH = td->connection->host->getHashedData("ALLOW_CGI");
@@ -926,7 +925,7 @@
                       data.c_str(), 1, onlyHeader);
       return ret;
     }
-    else if(mimecmd == CGI_CMD_RUNISAPI)
+    else if(!td->mime->cmdName.compare ("RUNISAPI"))
     {
       int allowIsapi = 1;
       const char *dataH = td->connection->host->getHashedData("ALLOW_ISAPI");
@@ -946,7 +945,7 @@
       return ret;
 
     }
-    else if(mimecmd == CGI_CMD_EXECUTEISAPI)
+    else if(!td->mime->cmdName.compare ("EXECUTEISAPI"))
     {
       if(!(permissions & MYSERVER_PERMISSION_EXECUTE))
       {
@@ -956,7 +955,7 @@
                         data.c_str(), 1, onlyHeader);
       return ret;
     }
-    else if( mimecmd == CGI_CMD_RUNMSCGI )
+    else if(!td->mime->cmdName.compare ("RUNMSGI"))
     {
       char* target;
       int allowMscgi = 1;
@@ -982,7 +981,7 @@
                         target, 1, onlyHeader);
       return ret;
     }
-    else if( mimecmd == CGI_CMD_EXECUTEWINCGI )
+    else if(!td->mime->cmdName.compare ("EXECUTEWINCGI"))
     {
       ostringstream cgipath;
       int allowWincgi = 1;
@@ -1011,7 +1010,7 @@
                          0, 1, onlyHeader);
       return ret;
     }
-    else if( mimecmd == CGI_CMD_RUNFASTCGI )
+    else if(!td->mime->cmdName.compare ("RUNFASTCGI"))
     {
       int allowFastcgi = 1;
       const char *dataH = td->connection->host->getHashedData("ALLOW_FASTCGI");
@@ -1030,7 +1029,7 @@
                           data.c_str(), 0, onlyHeader);
       return ret;
     }
-    else if(mimecmd == CGI_CMD_EXECUTEFASTCGI)
+    else if(!td->mime->cmdName.compare ("EXECUTEFASTCGI"))
     {
       int allowFastcgi = 1;
       const char *dataH = td->connection->host->getHashedData("ALLOW_FASTCGI");
@@ -1049,7 +1048,7 @@
                           data.c_str(), 1, onlyHeader);
       return ret;
     }
-    else if( mimecmd == CGI_CMD_RUNSCGI )
+    else if(!td->mime->cmdName.compare ("RUNSCGI"))
     {
       int allowScgi = 1;
       const char *dataH = td->connection->host->getHashedData("ALLOW_SCGI");
@@ -1068,7 +1067,7 @@
                        data.c_str(), 0, onlyHeader);
       return ret;
     }
-    else if(mimecmd == CGI_CMD_EXECUTESCGI)
+    else if(!td->mime->cmdName.compare ("EXECUTESCGI"))
     {
       int allowScgi = 1;
       const char *dataH = td->connection->host->getHashedData("ALLOW_SCGI");
@@ -1087,8 +1086,7 @@
                        data.c_str(), 1, onlyHeader);
       return ret;
     }
-
-    else if( mimecmd == CGI_CMD_SENDLINK )
+    else if(!td->mime->cmdName.compare ("SENDLINK"))
     {
       u_long nbr;
       char* linkpath;
@@ -1164,7 +1162,7 @@
       delete [] pathInfo;
       return ret;
     }
-    else if( mimecmd == CGI_CMD_EXTERNAL )
+    else if ((manager = staticHttp.dynManagerList.getPlugin(td->mime->cmdName)))
     {
       int allowExternal = 1;
       const char *dataH =
@@ -1180,9 +1178,6 @@
 
       if(allowExternal && td->mime)
       {
-        DynamicHttpManager* manager =
-          staticHttp.dynManagerList.getPlugin(td->mime->cmdName);
-
         if(manager)
           return manager->send(td, td->connection, td->filenamePath.c_str(),
                                data.c_str(), onlyHeader);
@@ -2134,9 +2129,9 @@
 
   if(staticHttp.allowVhostMime && td->connection->host->isMIME() )
   {
-    return td->connection->host->getMIME()->getRecord(ext);
+    return td->connection->host->getMIME()->getMIME(ext);
   }
-  return Server::getInstance()->getMimeManager()->getRecord(ext);
+  return Server::getInstance()->getMimeManager()->getMIME(ext);
 }
 
 /*!





From MAILER-DAEMON Thu Oct 23 16:50:24 2008
Received: from mailman by lists.gnu.org with archive (Exim 4.43)
	id 1Kt78S-0006LN-Ot
	for mharc-myserver-commit@gnu.org; Thu, 23 Oct 2008 16:50:24 -0400
Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43)
	id 1Kt78P-0006KT-Ly
	for myserver-commit@gnu.org; Thu, 23 Oct 2008 16:50:21 -0400
Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43)
	id 1Kt78O-0006Jm-MM
	for myserver-commit@gnu.org; Thu, 23 Oct 2008 16:50:21 -0400
Received: from [199.232.76.173] (port=56018 helo=monty-python.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.43) id 1Kt78O-0006Jj-EI
	for myserver-commit@gnu.org; Thu, 23 Oct 2008 16:50:20 -0400
Received: from savannah.gnu.org ([199.232.41.3]:36980 helo=sv.gnu.org)
	by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32)
	(Exim 4.60) (envelope-from <INVALID.NOREPLY@gnu.org>)
	id 1Kt78N-0007fg-1m
	for myserver-commit@gnu.org; Thu, 23 Oct 2008 16:50:20 -0400
Received: from cvs.savannah.gnu.org ([199.232.41.69])
	by sv.gnu.org with esmtp (Exim 4.63)
	(envelope-from <INVALID.NOREPLY@gnu.org>) id 1Kt78K-0007Fw-5U
	for myserver-commit@gnu.org; Thu, 23 Oct 2008 20:50:16 +0000
Received: from gscrivano by cvs.savannah.gnu.org with local (Exim 4.63)
	(envelope-from <gscrivano@savannah.gnu.org>) id 1Kt78J-0007Fm-KC
	for myserver-commit@gnu.org; Thu, 23 Oct 2008 20:50:15 +0000
MIME-Version: 1.0
Errors-To: gscrivano
To: myserver-commit@gnu.org
X-Mailer: SVN::Notify 2.64: http://search.cpan.org/dist/SVN-Notify/
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
From: Giuseppe Scrivano <gscrivano@gnu.org>
Message-Id: <E1Kt78J-0007Fm-KC@cvs.savannah.gnu.org>
Date: Thu, 23 Oct 2008 20:50:15 +0000
X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 3)
Subject: [myserver-commit] [2900] The control GUI application is moved to
	misc/.
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/pipermail/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, 23 Oct 2008 20:50:21 -0000

Revision: 2900
          http://svn.sv.gnu.org/viewvc/?view=rev&root=myserver&revision=2900
Author:   gscrivano
Date:     2008-10-23 20:50:14 +0000 (Thu, 23 Oct 2008)

Log Message:
-----------
The control GUI application is moved to misc/.

Modified Paths:
--------------
    trunk/myserver/Makefile.am
    trunk/myserver/binaries/NSIS installer script.nsi
    trunk/myserver/binaries/clean_copy.sh
    trunk/myserver/configure.in

Added Paths:
-----------
    trunk/misc/control/
    trunk/misc/control/control/
    trunk/misc/control/fltk.m4
    trunk/misc/control/myserver-configure.cpp

Removed Paths:
-------------
    trunk/misc/control/myserver-configure.cpp
    trunk/myserver/control/
    trunk/myserver/m4/fltk.m4

Copied: trunk/misc/control (from rev 2887, trunk/myserver/control)


Property changes on: trunk/misc/control
___________________________________________________________________
Name: svn:mergeinfo
   + 

Copied: trunk/misc/control/control (from rev 2899, trunk/myserver/control)


Property changes on: trunk/misc/control/control
___________________________________________________________________
Name: svn:mergeinfo
   + 

Copied: trunk/misc/control/fltk.m4 (from rev 2887, trunk/myserver/m4/fltk.m4)
===================================================================
--- trunk/misc/control/fltk.m4	                        (rev 0)
+++ trunk/misc/control/fltk.m4	2008-10-23 20:50:14 UTC (rev 2900)
@@ -0,0 +1,53 @@
+# Config paths for fltk
+# Writen for MyServer
+# based on glib.m4
+
+dnl AM_PATH_FLTK([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
+
+AC_DEFUN([AM_PATH_FLTK],
+[
+AC_ARG_WITH(fltk-prefix,[  --with-fltk-prefix=PFX   Prefix where FLTK is installed (optional)],
+            fltk_config_prefix="$withval", fltk_config_prefix="")
+AC_ARG_WITH(fltk-exec-prefix,[  --with-fltk-exec-prefix=PFX Exec prefix where FLTK is installed (optional)], fltk_config_exec_prefix="$withval", fltk_config_exec_prefix="")
+
+  if test x$fltk_config_exec_prefix != x ; then
+     fltk_config_args="$fltk_config_args"
+     if test x${FLTK_CONFIG+set} != xset ; then
+        FLTK_CONFIG=$fltk_config_exec_prefix/bin/fltk-config
+     fi
+  fi
+  if test x$fltk_config_prefix != x ; then
+     fltk_config_args="$fltk_config_args"
+     if test x${FLTK_CONFIG+set} != xset ; then
+        FLTK_CONFIG=$fltk_config_prefix/bin/fltk-config
+     fi
+  fi
+
+  AC_PATH_PROG(FLTK_CONFIG, fltk-config, no)
+  min_fltk_version=ifelse([$1], ,1.1.0,$1)
+  AC_MSG_CHECKING(for FLTK - version >= $min_fltk_version)
+  no_fltk=""
+  if test "$FLTK_CONFIG" = "no" ; then
+    no_fltk=yes
+    FLTK_VERSION=""
+  else
+    FLTK_CFLAGS=`$FLTK_CONFIG $fltk_config_args --cflags`
+    FLTK_LIBS=`$FLTK_CONFIG $fltk_config_args --ldflags`
+    FLTK_VERSION=`$FLTK_CONFIG $fltk_config_args --version`
+  fi
+  if test "x$no_fltk" = x ; then
+     AC_MSG_RESULT(yes (version $FLTK_VERSION))
+     ifelse([$2], , :, [$2])
+  else
+     if test "x$FLTK_VERSION" = x; then
+        AC_MSG_RESULT(no)
+     else
+        AC_MSG_RESULT(no (version $FLTK_VERSION))
+     fi	
+     FLTK_CFLAGS=""
+     FLTK_LIBS=""
+     ifelse([$3], , :, [$3])
+  fi
+  AC_SUBST(FLTK_CFLAGS)
+  AC_SUBST(FLTK_LIBS)
+])  


Property changes on: trunk/misc/control/fltk.m4
___________________________________________________________________
Name: svn:keywords
   + Author Date Id Revision
Name: svn:mergeinfo
   + 
Name: svn:eol-style
   + native

Deleted: trunk/misc/control/myserver-configure.cpp
===================================================================
--- trunk/myserver/control/myserver-configure.cpp	2008-10-18 12:30:19 UTC (rev 2887)
+++ trunk/misc/control/myserver-configure.cpp	2008-10-23 20:50:14 UTC (rev 2900)
@@ -1,400 +0,0 @@
-/*
-MyServer
-Copyright (C) 2002, 2003, 2004, 2006, 2008 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
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program.  If not, see <http://www.gnu.org/licenses/>.
-*/
-
-#ifdef WIN32
-# include <windows.h>
-# include <io.h>
-#endif
-
-#include <Fl/Fl.H>
-#include <Fl/fl_ask.H>
-
-#include "language.h"
-#include <include/base/string/stringutils.h>
-#include <include/base/xml/xml_parser.h>
-#include <include/base/file/file.h>
-#include <include/base/file/files_utility.h>
-#include "vector.h"
-#include "fltkconfig.h"
-#include "language.h"
-
-#include <include/base/find_data/find_data.h>
-
-extern "C"
-{
-#include <stdio.h>
-#ifdef WIN32
-# include <direct.h>
-#elif HAVE_DL
-# include <dlfcn.h>
-# define HMODULE void *
-#else
-# define HMODULE void *
-#endif
-}
-
-#ifndef intptr_t
-# define intptr_t int
-#endif
-
-typedef char* (*registerNamePROC)(char*,int);
-
-static void GetDynamicProtocols(const char *, Vector &);
-
-///
-/// Main function.
-/// Intilize all supporting libraries and windows.
-/// Gets the list of dynamic protocols and language files.
-/// Loads the first avaible configuration.
-/// Displays the main dialog.
-/// Waits for FLTK to quit and dose clean up.
-///
-int main(int argc, char * argv[])
-{
-   char languages_path[MAX_PATH];
-   char main_configuration_file[MAX_PATH];
-   int conf_location = 0;
-   XmlParser xmlFile;
-   FindData fd;
-   int fd_ret;
-   bool langFound = true;
-   bool confFound = true;
-   int ret;
-
-  LanguageXMLinit();
-   /*! Initialize the SSL library. */
-#ifndef DO_NOT_USE_SSL
-   SSL_library_init();
-   SSL_load_error_strings();
-#endif
-
-#ifdef WIN32	
-	/*!
-   *Under windows we need to initialize the socket library before use it.
-   */
-	WSADATA wsaData;
-	WSAStartup(MAKEWORD( 1, 1), &wsaData);
-
-   // Find the language files:
-   strncpy(languages_path, "languages/", MAX_PATH);
-   fd_ret=fd.findfirst("languages/");
-#else
-   if(FilesUtility::fileExists("languages"))
-     {
-	strncpy(languages_path, "languages/", MAX_PATH);
-     }
-   else
-     {
-# ifdef PREFIX
-	snprintf(languages_path, MAX_PATH, "%s/share/myserver/languages/", PREFIX);
-# else
-	strncpy(languages_path, "/usr/share/myserver/languages/", MAX_PATH);
-# endif
-     }
-   if(!(FilesUtility::fileExists(languages_path)))
-     {
-	fl_alert("Languages directory not found.");
-	langFound = false;
-     }
-   if(langFound)
-     fd_ret=fd.findfirst(languages_path);
-#endif
-
-   // Search for myserver.xml
-   /* Under an *nix environment look for .xml files in the following order.
-    * 1) myserver executable working directory
-    * 2) ~/.myserver/
-    * 3) /etc/myserver/
-    * 4) default files will be copied in myserver executable working
-    */
-#ifndef WIN32
-   // just a little hack
-   snprintf(main_configuration_file, MAX_PATH, "%s/.myserver/myserver.xml", getenv("HOME"));
-#endif
-   if(FilesUtility::fileExists("myserver.xml"))
-     {
-	conf_location = 1;
-	strncpy(main_configuration_file,"myserver.xml", MAX_PATH);
-     }
-#ifndef WIN32
-   else if(FilesUtility::fileExists(main_configuration_file))
-     {
-	conf_location = 2;
-     }
-   else if(FilesUtility::fileExists("/etc/myserver/myserver.xml"))
-     {
-	conf_location = 3;
-	strncpy(main_configuration_file,"/etc/myserver/myserver.xml", MAX_PATH);
-     }
-#endif
-     /*
-      * If the myserver.xml files doesn't exist copy it from the default one.
-      */
-   else
-     {
-	conf_location = 1;
-	strncpy(main_configuration_file,"myserver.xml", MAX_PATH);
-	File inputF;
-	File outputF;
-	if(!FilesUtility::fileExists("myserver.xml.default"))
-	  {  // no configuration files found
-	     fl_alert("Default configuration files not found.  Loading empty values.");
-	     confFound = false;
-	     conf_location = 0;
-	  }
-	else
-	  {  // Copy the default files
-	     char buffer[512];
-	     u_long nbr, nbw;
-	     fl_alert("Configuration files not found.  Loading default files.");
-	     inputF.openFile("myserver.xml.default", File::MYSERVER_OPEN_READ|File::MYSERVER_OPEN_IFEXISTS);
-	     outputF.openFile("myserver.xml", File::MYSERVER_OPEN_WRITE|File::MYSERVER_OPEN_ALWAYS);
-	     for(;;)
-	       {
-		  inputF.readFromFile(buffer, 512, &nbr );
-		  if(nbr==0)
-		    break;
-		  outputF.writeToFile(buffer, nbr, &nbw);
-	       }
-	     inputF.close();
-	     outputF.close();
-
-	     if(FilesUtility::fileExists("MIMEtypes.xml.default"))
-	       {
-		  char buffer[512];
-		  u_long nbr, nbw;
-		  inputF.openFile("MIMEtypes.xml.default", File::MYSERVER_OPEN_READ|File::MYSERVER_OPEN_IFEXISTS);
-		  outputF.openFile("MIMEtypes.xml", File::MYSERVER_OPEN_WRITE|File::MYSERVER_OPEN_ALWAYS);
-		  for(;;)
-		    {
-		       inputF.readFromFile(buffer, 512, &nbr );
-		       if(nbr==0)
-			 break;
-		       outputF.writeToFile(buffer, nbr, &nbw);
-		    }
-		  inputF.close();
-		  outputF.close();
-	       }
-
-	     if(FilesUtility::fileExists("virtualhosts.xml.default"))
-	       {
-		  char buffer[512];
-		  u_long nbr, nbw;
-		  inputF.openFile("virtualhosts.xml.default", File::MYSERVER_OPEN_READ|
-											File::MYSERVER_OPEN_IFEXISTS);
-		  outputF.openFile("virtualhosts.xml", File::MYSERVER_OPEN_WRITE| 
-											 File::MYSERVER_OPEN_ALWAYS);
-		  for(;;)
-		    {
-		       inputF.readFromFile(buffer, 512, &nbr );
-		       if(nbr==0)
-			 break;
-		       outputF.writeToFile(buffer, nbr, &nbw);
-		    }
-		  inputF.close();
-		  outputF.close();
-	       }
-	  }
-     }
-
-   // Initilize APIs
-   XmlParser::startXML();
-   // LanguageXMLinit handeled internaly
-
-   // Load the language file for configure
-   // Handeled internaly
-
-
-   // Initilize the Dialogs
-   MainDlg Configure;
-   Configure.make_window();
-   Configure.make_about();
-   Configure.make_type();
-   Configure.make_login();
-   Configure.make_status();
-   Configure.make_connections();
-   Configure.make_regask();
-   
-   // Show the main window
-   Configure.ConfDlg->show(argc, argv);
-
-   // Load the language file names
-   Configure.Language->clear();
-   if(langFound)
-     {
-	do
-	  {
-	     char dir[MAX_PATH];
-	     char filename[MAX_PATH];
-	     if(fd.name[0] == '.')
-	       continue;
-	     FilesUtility::splitPath(fd.name,dir,filename);
-	     if(strcmpi(&(filename[strlen(filename) - 3]), "xml") == 0)
-	       Configure.Language->add(filename, 0, 0, 0, 0);
-	  }
-	while(!fd.findnext());
-	fd.findclose();
-     }
-   
-   // Load the dynamic protocol names
-   Vector list;
-   if(FilesUtility::fileExists("plugins/protocols"))
-     {
-	GetDynamicProtocols("plugins/protocols", list);
-     }
-#ifndef WIN32
-#ifdef PREFIX
-   else if(FilesUtility::fileExists(PREFIX "/lib/myserver/plugins/protocols"))
-     {
-	GetDynamicProtocols(PREFIX "/lib/myserver/plugins/protocols", list);
-     }
-#else
-   else if(FilesUtility::fileExists("/usr/lib/myserver/plugins/protocols"))
-     {
-	GetDynamicProtocols("/usr/lib/myserver/plugins/protocols", list);
-     }
-#endif
-#endif
-   Configure.setDynamic(list);
-   list.clear();
-
-   // Load, if found, fist avaible configuration
-   Configure.ConfType = conf_location;
-   switch(conf_location)
-     {
-      case 1 :
-	Configure.ConfTypeDlgLocal->setonly();
-	break;
-      case 2 :
-	Configure.ConfTypeDlgUser->setonly();
-	break;
-      case 3 :
-	Configure.ConfTypeDlgGlobal->setonly();
-	break;
-      default :
-	break;
-     }
-   Configure.load_config();
-
-   // Start the app
-   ret = Fl::run();
-
-   // Close the language xml file
-   LanguageXMLclose();
-
-   // Cleanup
-   LanguageXMLend();
-   XmlParser::cleanXML();
-
-   // Exit
-   return ret;
-}
-
-///
-/// Get the local dynamic protocols.
-/// Parts taken from protocols_manager.cpp
-/// 
-static void GetDynamicProtocols(const char * folder, Vector & list)
-{
-   list.clear();
-
-   HMODULE module;
-   registerNamePROC name;
-
-   FindData fd;
-   int fd_ret;   
-   int filenamelen = 0;
-   char *filename = 0;
-#ifdef WIN32
-   filenamelen=strlen(folder)+6;
-   filename=new char[filenamelen];
-   if(filename == 0)
-     return;
-   snprintf(filename,filenamelen,"%s/*.*",folder);
-#endif
-#ifdef NOT_WIN
-   filenamelen=strlen(folder)+2;
-   filename=new char[filenamelen];
-   if(filename == 0)
-     return;
-   strncpy(filename,folder, filenamelen);
-#endif
-
-   fd_ret=fd.findfirst(filename);
-   if(fd_ret==-1)
-       {
-	  delete [] filename;
-	  filename = 0;
-	  return;
-       }
-   char *completeFileName = 0;
-   int completeFileNameLen = 0;
-   do
-     {
-	if(fd.name[0]=='.')
-	  continue;
-	/*
-	 *Do not consider file other than dynamic libraries.
-	 */
-#ifdef WIN32
-	if(!strstr(fd.name,".dll"))
-#endif
-#ifdef NOT_WIN
-	  if(!strstr(fd.name,".so"))
-#endif
-	    continue;
-	completeFileNameLen = strlen(folder) + strlen(fd.name) + 2;
-	completeFileName = new char[completeFileNameLen];
-	if(completeFileName == 0)
-	  {
-	     delete [] filename;
-	     filename = 0;
-	     return;
-	  }
-	snprintf(completeFileName,completeFileNameLen,"%s/%s",folder,fd.name);
-#ifdef WIN32
-	module = LoadLibrary(completeFileName);
-#endif
-#ifdef HAVE_DL
-	module = dlopen(completeFileName, RTLD_LAZY);
-#endif
-	if(module != NULL)
-	  {
-#ifdef WIN32
-	     name = (registerNamePROC)GetProcAddress((HMODULE)module, "registerName");
-#endif
-#ifdef HAVE_DL
-	     name = (registerNamePROC)dlsym(module, "registerName");
-#endif
-	     if(name != NULL)
-	       {
-		  list.add(name(NULL, 0));
-	       }
-	  }
-#ifdef WIN32
-	FreeLibrary((HMODULE)module);
-#endif
-#ifdef HAVE_DL
-	dlclose(module);
-#endif
-	delete [] completeFileName;
-     }
-   while(!fd.findnext());
-   fd.findclose();
-   delete [] filename;
-   filename = 0;
-}

Copied: trunk/misc/control/myserver-configure.cpp (from rev 2894, trunk/myserver/control/myserver-configure.cpp)
===================================================================
--- trunk/misc/control/myserver-configure.cpp	                        (rev 0)
+++ trunk/misc/control/myserver-configure.cpp	2008-10-23 20:50:14 UTC (rev 2900)
@@ -0,0 +1,400 @@
+/*
+MyServer
+Copyright (C) 2002, 2003, 2004, 2006, 2008 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
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program.  If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#ifdef WIN32
+# include <windows.h>
+# include <io.h>
+#endif
+
+#include <Fl/Fl.H>
+#include <Fl/fl_ask.H>
+
+#include "language.h"
+#include <include/base/string/stringutils.h>
+#include <include/base/xml/xml_parser.h>
+#include <include/base/file/file.h>
+#include <include/base/file/files_utility.h>
+#include "vector.h"
+#include "fltkconfig.h"
+#include "language.h"
+
+#include <include/base/find_data/find_data.h>
+
+extern "C"
+{
+#include <stdio.h>
+#ifdef WIN32
+# include <direct.h>
+#elif HAVE_DL
+# include <dlfcn.h>
+# define HMODULE void *
+#else
+# define HMODULE void *
+#endif
+}
+
+#ifndef intptr_t
+# define intptr_t int
+#endif
+
+typedef char* (*registerNamePROC)(char*,int);
+
+static void GetDynamicProtocols(const char *, Vector &);
+
+///
+/// Main function.
+/// Intilize all supporting libraries and windows.
+/// Gets the list of dynamic protocols and language files.
+/// Loads the first avaible configuration.
+/// Displays the main dialog.
+/// Waits for FLTK to quit and dose clean up.
+///
+int main(int argc, char * argv[])
+{
+   char languages_path[MAX_PATH];
+   char main_configuration_file[MAX_PATH];
+   int conf_location = 0;
+   XmlParser xmlFile;
+   FindData fd;
+   int fd_ret;
+   bool langFound = true;
+   bool confFound = true;
+   int ret;
+
+  LanguageXMLinit();
+   /*! Initialize the SSL library. */
+#ifndef DO_NOT_USE_SSL
+   SSL_library_init();
+   SSL_load_error_strings();
+#endif
+
+#ifdef WIN32	
+	/*!
+   *Under windows we need to initialize the socket library before use it.
+   */
+	WSADATA wsaData;
+	WSAStartup(MAKEWORD( 1, 1), &wsaData);
+
+   // Find the language files:
+   strncpy(languages_path, "languages/", MAX_PATH);
+   fd_ret=fd.findfirst("languages/");
+#else
+   if(FilesUtility::fileExists("languages"))
+     {
+	strncpy(languages_path, "languages/", MAX_PATH);
+     }
+   else
+     {
+# ifdef PREFIX
+	snprintf(languages_path, MAX_PATH, "%s/share/myserver/languages/", PREFIX);
+# else
+	strncpy(languages_path, "/usr/share/myserver/languages/", MAX_PATH);
+# endif
+     }
+   if(!(FilesUtility::fileExists(languages_path)))
+     {
+	fl_alert("Languages directory not found.");
+	langFound = false;
+     }
+   if(langFound)
+     fd_ret=fd.findfirst(languages_path);
+#endif
+
+   // Search for myserver.xml
+   /* Under an *nix environment look for .xml files in the following order.
+    * 1) myserver executable working directory
+    * 2) ~/.myserver/
+    * 3) /etc/myserver/
+    * 4) default files will be copied in myserver executable working
+    */
+#ifndef WIN32
+   // just a little hack
+   snprintf(main_configuration_file, MAX_PATH, "%s/.myserver/myserver.xml", getenv("HOME"));
+#endif
+   if(FilesUtility::fileExists("myserver.xml"))
+     {
+	conf_location = 1;
+	strncpy(main_configuration_file,"myserver.xml", MAX_PATH);
+     }
+#ifndef WIN32
+   else if(FilesUtility::fileExists(main_configuration_file))
+     {
+	conf_location = 2;
+     }
+   else if(FilesUtility::fileExists("/etc/myserver/myserver.xml"))
+     {
+	conf_location = 3;
+	strncpy(main_configuration_file,"/etc/myserver/myserver.xml", MAX_PATH);
+     }
+#endif
+     /*
+      * If the myserver.xml files doesn't exist copy it from the default one.
+      */
+   else
+     {
+	conf_location = 1;
+	strncpy(main_configuration_file,"myserver.xml", MAX_PATH);
+	File inputF;
+	File outputF;
+	if(!FilesUtility::fileExists("myserver.xml.default"))
+	  {  // no configuration files found
+	     fl_alert("Default configuration files not found.  Loading empty values.");
+	     confFound = false;
+	     conf_location = 0;
+	  }
+	else
+	  {  // Copy the default files
+	     char buffer[512];
+	     u_long nbr, nbw;
+	     fl_alert("Configuration files not found.  Loading default files.");
+	     inputF.openFile("myserver.xml.default", File::MYSERVER_OPEN_READ|File::MYSERVER_OPEN_IFEXISTS);
+	     outputF.openFile("myserver.xml", File::MYSERVER_OPEN_WRITE|File::MYSERVER_OPEN_ALWAYS);
+	     for(;;)
+	       {
+		  inputF.read(buffer, 512, &nbr );
+		  if(nbr==0)
+		    break;
+		  outputF.writeToFile(buffer, nbr, &nbw);
+	       }
+	     inputF.close();
+	     outputF.close();
+
+	     if(FilesUtility::fileExists("MIMEtypes.xml.default"))
+	       {
+		  char buffer[512];
+		  u_long nbr, nbw;
+		  inputF.openFile("MIMEtypes.xml.default", File::MYSERVER_OPEN_READ|File::MYSERVER_OPEN_IFEXISTS);
+		  outputF.openFile("MIMEtypes.xml", File::MYSERVER_OPEN_WRITE|File::MYSERVER_OPEN_ALWAYS);
+		  for(;;)
+		    {
+		       inputF.read(buffer, 512, &nbr );
+		       if(nbr==0)
+			 break;
+		       outputF.writeToFile(buffer, nbr, &nbw);
+		    }
+		  inputF.close();
+		  outputF.close();
+	       }
+
+	     if(FilesUtility::fileExists("virtualhosts.xml.default"))
+	       {
+		  char buffer[512];
+		  u_long nbr, nbw;
+		  inputF.openFile("virtualhosts.xml.default", File::MYSERVER_OPEN_READ|
+											File::MYSERVER_OPEN_IFEXISTS);
+		  outputF.openFile("virtualhosts.xml", File::MYSERVER_OPEN_WRITE| 
+											 File::MYSERVER_OPEN_ALWAYS);
+		  for(;;)
+		    {
+		       inputF.read(buffer, 512, &nbr );
+		       if(nbr==0)
+			 break;
+		       outputF.writeToFile(buffer, nbr, &nbw);
+		    }
+		  inputF.close();
+		  outputF.close();
+	       }
+	  }
+     }
+
+   // Initilize APIs
+   XmlParser::startXML();
+   // LanguageXMLinit handeled internaly
+
+   // Load the language file for configure
+   // Handeled internaly
+
+
+   // Initilize the Dialogs
+   MainDlg Configure;
+   Configure.make_window();
+   Configure.make_about();
+   Configure.make_type();
+   Configure.make_login();
+   Configure.make_status();
+   Configure.make_connections();
+   Configure.make_regask();
+   
+   // Show the main window
+   Configure.ConfDlg->show(argc, argv);
+
+   // Load the language file names
+   Configure.Language->clear();
+   if(langFound)
+     {
+	do
+	  {
+	     char dir[MAX_PATH];
+	     char filename[MAX_PATH];
+	     if(fd.name[0] == '.')
+	       continue;
+	     FilesUtility::splitPath(fd.name,dir,filename);
+	     if(strcmpi(&(filename[strlen(filename) - 3]), "xml") == 0)
+	       Configure.Language->add(filename, 0, 0, 0, 0);
+	  }
+	while(!fd.findnext());
+	fd.findclose();
+     }
+   
+   // Load the dynamic protocol names
+   Vector list;
+   if(FilesUtility::fileExists("plugins/protocols"))
+     {
+	GetDynamicProtocols("plugins/protocols", list);
+     }
+#ifndef WIN32
+#ifdef PREFIX
+   else if(FilesUtility::fileExists(PREFIX "/lib/myserver/plugins/protocols"))
+     {
+	GetDynamicProtocols(PREFIX "/lib/myserver/plugins/protocols", list);
+     }
+#else
+   else if(FilesUtility::fileExists("/usr/lib/myserver/plugins/protocols"))
+     {
+	GetDynamicProtocols("/usr/lib/myserver/plugins/protocols", list);
+     }
+#endif
+#endif
+   Configure.setDynamic(list);
+   list.clear();
+
+   // Load, if found, fist avaible configuration
+   Configure.ConfType = conf_location;
+   switch(conf_location)
+     {
+      case 1 :
+	Configure.ConfTypeDlgLocal->setonly();
+	break;
+      case 2 :
+	Configure.ConfTypeDlgUser->setonly();
+	break;
+      case 3 :
+	Configure.ConfTypeDlgGlobal->setonly();
+	break;
+      default :
+	break;
+     }
+   Configure.load_config();
+
+   // Start the app
+   ret = Fl::run();
+
+   // Close the language xml file
+   LanguageXMLclose();
+
+   // Cleanup
+   LanguageXMLend();
+   XmlParser::cleanXML();
+
+   // Exit
+   return ret;
+}
+
+///
+/// Get the local dynamic protocols.
+/// Parts taken from protocols_manager.cpp
+/// 
+static void GetDynamicProtocols(const char * folder, Vector & list)
+{
+   list.clear();
+
+   HMODULE module;
+   registerNamePROC name;
+
+   FindData fd;
+   int fd_ret;   
+   int filenamelen = 0;
+   char *filename = 0;
+#ifdef WIN32
+   filenamelen=strlen(folder)+6;
+   filename=new char[filenamelen];
+   if(filename == 0)
+     return;
+   snprintf(filename,filenamelen,"%s/*.*",folder);
+#endif
+#ifdef NOT_WIN
+   filenamelen=strlen(folder)+2;
+   filename=new char[filenamelen];
+   if(filename == 0)
+     return;
+   strncpy(filename,folder, filenamelen);
+#endif
+
+   fd_ret=fd.findfirst(filename);
+   if(fd_ret==-1)
+       {
+	  delete [] filename;
+	  filename = 0;
+	  return;
+       }
+   char *completeFileName = 0;
+   int completeFileNameLen = 0;
+   do
+     {
+	if(fd.name[0]=='.')
+	  continue;
+	/*
+	 *Do not consider file other than dynamic libraries.
+	 */
+#ifdef WIN32
+	if(!strstr(fd.name,".dll"))
+#endif
+#ifdef NOT_WIN
+	  if(!strstr(fd.name,".so"))
+#endif
+	    continue;
+	completeFileNameLen = strlen(folder) + strlen(fd.name) + 2;
+	completeFileName = new char[completeFileNameLen];
+	if(completeFileName == 0)
+	  {
+	     delete [] filename;
+	     filename = 0;
+	     return;
+	  }
+	snprintf(completeFileName,completeFileNameLen,"%s/%s",folder,fd.name);
+#ifdef WIN32
+	module = LoadLibrary(completeFileName);
+#endif
+#ifdef HAVE_DL
+	module = dlopen(completeFileName, RTLD_LAZY);
+#endif
+	if(module != NULL)
+	  {
+#ifdef WIN32
+	     name = (registerNamePROC)GetProcAddress((HMODULE)module, "registerName");
+#endif
+#ifdef HAVE_DL
+	     name = (registerNamePROC)dlsym(module, "registerName");
+#endif
+	     if(name != NULL)
+	       {
+		  list.add(name(NULL, 0));
+	       }
+	  }
+#ifdef WIN32
+	FreeLibrary((HMODULE)module);
+#endif
+#ifdef HAVE_DL
+	dlclose(module);
+#endif
+	delete [] completeFileName;
+     }
+   while(!fd.findnext());
+   fd.findclose();
+   delete [] filename;
+   filename = 0;
+}

Modified: trunk/myserver/Makefile.am
===================================================================
--- trunk/myserver/Makefile.am	2008-10-22 21:07:55 UTC (rev 2899)
+++ trunk/myserver/Makefile.am	2008-10-23 20:50:14 UTC (rev 2900)
@@ -1,10 +1,6 @@
-# Makefile : Builds myserver, control, math_sum, and post
+# Makefile : Builds myserver, math_sum, and post
 #
 
-if BUILD_CONTROL
-CONTROL = control
-endif
-
 if BUILD_TESTS
 TESTS = tests
 endif
@@ -14,7 +10,7 @@
 endif
 
 am__aclocal_m4_deps = $(top_srcdir)/m4/gnome-pthread-check.m4 \
-        $(top_srcdir)/m4/fltk.m4 $(top_srcdir)/m4/libtool.m4 \
+        $(top_srcdir)/m4/libtool.m4 \
         $(top_srcdir)/m4/libxml.m4 $(top_srcdir)/m4/cppunit.m4 \
         $(top_srcdir)/configure.in
 

Modified: trunk/myserver/binaries/NSIS installer script.nsi
===================================================================
--- trunk/myserver/binaries/NSIS installer script.nsi	2008-10-22 21:07:55 UTC (rev 2899)
+++ trunk/myserver/binaries/NSIS installer script.nsi	2008-10-23 20:50:14 UTC (rev 2900)
@@ -258,14 +258,6 @@
   File "web\downloads\*.sh"
 SectionEnd
 
-Section "MyServer center" SecControl
-  DetailPrint "Control Center Application"
-  SetOutPath $INSTDIR
-  File "myserver-configure.exe"
-  File "myserver.ico"
-  CreateShortCut "$SMPROGRAMS\$STARTMENU_FOLDER\Control Center.lnk" "$INSTDIR\Myserver Configure.exe"
-SectionEnd
-
 Section "Documentation" SecDocumentation
   SetOutPath "$INSTDIR\web\documentation"
   File "..\documentation\myserver\*.html"
@@ -297,7 +289,6 @@
 !insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
   !insertmacro MUI_DESCRIPTION_TEXT ${SecCore} "Install the MyServer core application(this element is required)"
   !insertmacro MUI_DESCRIPTION_TEXT ${SecDocumentation} "Install the MyServer documentation"
-  !insertmacro MUI_DESCRIPTION_TEXT ${SecControl} "Install the Control Center application(the installation of this element is highly recommended)"
   !insertmacro MUI_DESCRIPTION_TEXT ${SecLanguages} "Copy all the languages files(by default only the english language is copied)"
   !insertmacro MUI_DESCRIPTION_TEXT ${SecWebEx} "Install some web examples"
   !insertmacro MUI_DESCRIPTION_TEXT ${SecService} "Install MyServer like a service (loaded automatically on startup)"

Modified: trunk/myserver/binaries/clean_copy.sh
===================================================================
--- trunk/myserver/binaries/clean_copy.sh	2008-10-22 21:07:55 UTC (rev 2899)
+++ trunk/myserver/binaries/clean_copy.sh	2008-10-23 20:50:14 UTC (rev 2900)
@@ -8,7 +8,6 @@
 
 mkdir $1
 cp myserver $1
-cp myserver-configure $1
 cp myserver-daemon $1
 cp *.default $1
 cp readme.txt $1

Modified: trunk/myserver/configure.in
===================================================================
--- trunk/myserver/configure.in	2008-10-22 21:07:55 UTC (rev 2899)
+++ trunk/myserver/configure.in	2008-10-23 20:50:14 UTC (rev 2900)
@@ -61,8 +61,6 @@
 
 AC_ARG_WITH([root-prefix], [  --with-root-prefix=PREFIX override prefix variable for files to be placed in the root], root_prefix=$withval, root_prefix="\$(DESTDIR)")
 
-AC_ARG_ENABLE([control-gui], [ --disable-control-gui disable the myserver-configure GUI program], enable_control="no", enable_control="yes")
-
 AC_ARG_ENABLE([ipv6], [  --enable-ipv6 Build with IPv6 support], enable_ipv6="yes", enable_ipv6="")
 
 AC_ARG_ENABLE([mingw32], [ --enable-mingw32 Enable mingw32], enable_mingw32="yes", enable_mingw32="")
@@ -282,22 +280,7 @@
 
 AC_SUBST(ZLIB_LIB)
 
-if test x$enable_control == xyes; then
-     AC_CHECK_LIB(fltk, main, have_fltk=yes)
-    dnl Looking for FLTK
-    AM_PATH_FLTK(1.1.0, have_fltk=yes)
-    if test x$have_fltk != xyes; then
-        AC_MSG_WARN([
-*** Cannot find FLTK (www.fltk.org)
-*** control program will not be built
-])
-        MAKE_CONTROL=no
-    else
-        MAKE_CONTROL=yes
-    fi
-fi
 
-
 if test x$enable_ipv6 = xyes; then
     dnl Check for IPv6
     AC_MSG_CHECKING([for IPv6])
@@ -359,7 +342,6 @@
 AM_CONDITIONAL(BUILD_TESTS, test "$MAKE_TESTS" = "yes")
 
 AM_CONDITIONAL(BUILD_MSCGI, test "$MAKE_MSCGI" = "yes")
-AM_CONDITIONAL(BUILD_CONTROL, test "$MAKE_CONTROL" = "yes")
 AM_CONDITIONAL(BUILD_DOC, test "$MAKE_DOC" = "yes")
 
 dnl AC_CONFIG_SUBDIRS()
@@ -382,7 +364,6 @@
     binaries/system/errors/Makefile
     binaries/system/icons/Makefile
     binaries/system/icons/codes/Makefile
-    control/Makefile
     documentation/Makefile
     include/Makefile
     include/connection/Makefile

Deleted: trunk/myserver/m4/fltk.m4
===================================================================
--- trunk/myserver/m4/fltk.m4	2008-10-22 21:07:55 UTC (rev 2899)
+++ trunk/myserver/m4/fltk.m4	2008-10-23 20:50:14 UTC (rev 2900)
@@ -1,53 +0,0 @@
-# Config paths for fltk
-# Writen for MyServer
-# based on glib.m4
-
-dnl AM_PATH_FLTK([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
-
-AC_DEFUN([AM_PATH_FLTK],
-[
-AC_ARG_WITH(fltk-prefix,[  --with-fltk-prefix=PFX   Prefix where FLTK is installed (optional)],
-            fltk_config_prefix="$withval", fltk_config_prefix="")
-AC_ARG_WITH(fltk-exec-prefix,[  --with-fltk-exec-prefix=PFX Exec prefix where FLTK is installed (optional)], fltk_config_exec_prefix="$withval", fltk_config_exec_prefix="")
-
-  if test x$fltk_config_exec_prefix != x ; then
-     fltk_config_args="$fltk_config_args"
-     if test x${FLTK_CONFIG+set} != xset ; then
-        FLTK_CONFIG=$fltk_config_exec_prefix/bin/fltk-config
-     fi
-  fi
-  if test x$fltk_config_prefix != x ; then
-     fltk_config_args="$fltk_config_args"
-     if test x${FLTK_CONFIG+set} != xset ; then
-        FLTK_CONFIG=$fltk_config_prefix/bin/fltk-config
-     fi
-  fi
-
-  AC_PATH_PROG(FLTK_CONFIG, fltk-config, no)
-  min_fltk_version=ifelse([$1], ,1.1.0,$1)
-  AC_MSG_CHECKING(for FLTK - version >= $min_fltk_version)
-  no_fltk=""
-  if test "$FLTK_CONFIG" = "no" ; then
-    no_fltk=yes
-    FLTK_VERSION=""
-  else
-    FLTK_CFLAGS=`$FLTK_CONFIG $fltk_config_args --cflags`
-    FLTK_LIBS=`$FLTK_CONFIG $fltk_config_args --ldflags`
-    FLTK_VERSION=`$FLTK_CONFIG $fltk_config_args --version`
-  fi
-  if test "x$no_fltk" = x ; then
-     AC_MSG_RESULT(yes (version $FLTK_VERSION))
-     ifelse([$2], , :, [$2])
-  else
-     if test "x$FLTK_VERSION" = x; then
-        AC_MSG_RESULT(no)
-     else
-        AC_MSG_RESULT(no (version $FLTK_VERSION))
-     fi	
-     FLTK_CFLAGS=""
-     FLTK_LIBS=""
-     ifelse([$3], , :, [$3])
-  fi
-  AC_SUBST(FLTK_CFLAGS)
-  AC_SUBST(FLTK_LIBS)
-])  





From MAILER-DAEMON Fri Oct 24 16:59:28 2008
Received: from mailman by lists.gnu.org with archive (Exim 4.43)
	id 1KtTkm-0005rP-Kg
	for mharc-myserver-commit@gnu.org; Fri, 24 Oct 2008 16:59:28 -0400
Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43)
	id 1KtTkk-0005r5-7Z
	for myserver-commit@gnu.org; Fri, 24 Oct 2008 16:59:26 -0400
Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43)
	id 1KtTkh-0005pO-1A
	for myserver-commit@gnu.org; Fri, 24 Oct 2008 16:59:24 -0400
Received: from [199.232.76.173] (port=34257 helo=monty-python.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.43) id 1KtTkg-0005pD-OG
	for myserver-commit@gnu.org; Fri, 24 Oct 2008 16:59:22 -0400
Received: from savannah.gnu.org ([199.232.41.3]:42759 helo=sv.gnu.org)
	by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32)
	(Exim 4.60) (envelope-from <INVALID.NOREPLY@gnu.org>)
	id 1KtTkg-0006iI-BZ
	for myserver-commit@gnu.org; Fri, 24 Oct 2008 16:59:22 -0400
Received: from cvs.savannah.gnu.org ([199.232.41.69])
	by sv.gnu.org with esmtp (Exim 4.63)
	(envelope-from <INVALID.NOREPLY@gnu.org>) id 1KtTkf-0000aW-OO
	for myserver-commit@gnu.org; Fri, 24 Oct 2008 20:59:21 +0000
Received: from gscrivano by cvs.savannah.gnu.org with local (Exim 4.63)
	(envelope-from <gscrivano@savannah.gnu.org>) id 1KtTkf-0000aR-Fk
	for myserver-commit@gnu.org; Fri, 24 Oct 2008 20:59:21 +0000
MIME-Version: 1.0
Errors-To: gscrivano
To: myserver-commit@gnu.org
X-Mailer: SVN::Notify 2.64: http://search.cpan.org/dist/SVN-Notify/
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
From: Giuseppe Scrivano <gscrivano@gnu.org>
Message-Id: <E1KtTkf-0000aR-Fk@cvs.savannah.gnu.org>
Date: Fri, 24 Oct 2008 20:59:21 +0000
X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 3)
Subject: [myserver-commit] [2901] Refactoring for the `MimeManager' class.
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/pipermail/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, 24 Oct 2008 20:59:26 -0000

Revision: 2901
          http://svn.sv.gnu.org/viewvc/?view=rev&root=myserver&revision=2901
Author:   gscrivano
Date:     2008-10-24 20:59:20 +0000 (Fri, 24 Oct 2008)

Log Message:
-----------
Refactoring for the `MimeManager' class.

Modified Paths:
--------------
    trunk/myserver/include/conf/mime/mime_manager.h
    trunk/myserver/src/conf/mime/mime_manager.cpp

Modified: trunk/myserver/include/conf/mime/mime_manager.h
===================================================================
--- trunk/myserver/include/conf/mime/mime_manager.h	2008-10-23 20:50:14 UTC (rev 2900)
+++ trunk/myserver/include/conf/mime/mime_manager.h	2008-10-24 20:59:20 UTC (rev 2901)
@@ -22,7 +22,9 @@
 #include <include/base/utility.h>
 #include <include/base/hash_map/hash_map.h>
 #include <include/base/sync/mutex.h>
+#include <include/base/xml/xml_parser.h>
 
+
 #ifdef WIN32
 #include <windows.h>
 #endif
@@ -39,6 +41,7 @@
 
 #include <string>
 #include <map>
+#include <vector>
 #include <list>
 
 using namespace std;
@@ -50,11 +53,9 @@
 	string mimeType;
 	string cmdName;
 	string cgiManager;
-	MimeRecord()
-	{filters.clear(); extension.assign(""); 
-		mimeType.assign(""); cgiManager.assign(""); cmdName.assign("");}
+	MimeRecord();
 	MimeRecord(MimeRecord&);
-	int addFilter(const char*, int acceptDuplicate = 1);
+	int addFilter(const char*, bool acceptDuplicate = true);
 	~MimeRecord();
 	void clear();
 };
@@ -73,20 +74,21 @@
 	MimeRecord* getMIME(const char* ext);
   MimeRecord* getMIME(string const &ext);
 
-  int isLoaded();
+  bool isLoaded();
 	void clean();
 
 protected:
+  MimeRecord *readRecord (xmlNodePtr node);
 	const char *getFilename();
-	int addRecord(MimeRecord& record);
+	int addRecord(MimeRecord *record);
 	void removeAllRecords();
-	void removeRecord(const string& ext);
 private:
-  int loaded;
-  HashMap<string, MimeRecord*> *data;
+  bool loaded;
+  HashMap<string, int> extIndex;
+  vector <MimeRecord*> records;
+
 	u_long numMimeTypesLoaded;
 	string *filename;
-	Mutex mutex;
 };
 
 #endif 

Modified: trunk/myserver/src/conf/mime/mime_manager.cpp
===================================================================
--- trunk/myserver/src/conf/mime/mime_manager.cpp	2008-10-23 20:50:14 UTC (rev 2900)
+++ trunk/myserver/src/conf/mime/mime_manager.cpp	2008-10-24 20:59:20 UTC (rev 2901)
@@ -19,7 +19,6 @@
 #include <include/conf/mime/mime_manager.h>
 #include <include/base/file/file.h>
 #include <include/base/string/stringutils.h>
-#include <include/base/xml/xml_parser.h>
 #include <include/server/server.h>
 #include <include/base/file/files_utility.h>
 
@@ -32,6 +31,15 @@
 
 using namespace std;
 
+MimeRecord::MimeRecord()
+{
+  filters.clear();
+  extension.assign(""); 
+  mimeType.assign("");
+  cgiManager.assign("");
+  cmdName.assign("");
+}
+
 /*!
  *Destroy the object.
  */
@@ -44,7 +52,7 @@
  *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, int acceptDuplicate) 
+int MimeRecord::addFilter(const char* n, bool acceptDuplicate) 
 {
   if(!acceptDuplicate)
   {
@@ -101,6 +109,53 @@
 }
 
 /*!
+ *Read a MIME record from a XML node.
+ */
+MimeRecord *MimeManager::readRecord (xmlNodePtr node)
+{
+  xmlNodePtr lcur = node->children;
+  xmlAttr *attrs;
+
+  if(xmlStrcmp(node->name, (const xmlChar *)"MIME"))
+    return NULL;
+
+
+  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 *)"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)
+          rc->extension.assign ((const char*)attrs->children->content);
+      }
+    }
+
+    if(lcur->name && !xmlStrcmp(lcur->name, (const xmlChar *)"FILTER"))
+    {
+      if(lcur->children->content)
+        rc->addFilter((const char*)lcur->children->content);
+    }
+  }
+
+  return rc;
+}
+
+/*!
  *Load the MIME types from a XML file. Returns the number of
  *MIME types loaded successfully.
  */
@@ -109,90 +164,41 @@
   XmlParser parser;
   xmlNodePtr node;
   xmlDocPtr doc;
-  int retSize;
+
   if(!fn)
     return -1;
 
-  mutex.lock();
-
   if(filename)
     delete filename;
 
   filename = new string(fn);
 
-  if(data)
-    delete data;
-
-  data = new HashMap<string, MimeRecord*>();
-
   if(parser.open (fn))
   {
-    mutex.unlock ();
     return -1;
   }
 
   removeAllRecords();
 
+  /* The first record is not used to store information.  */
+  records.push_back (NULL);
+
   doc = parser.getDoc();
   node = doc->children->children;
 
   for(; node; node = node->next )
   {
-    xmlNodePtr lcur = node->children;
-    xmlAttr *attrs;
-    MimeRecord rc;
-    if(xmlStrcmp(node->name, (const xmlChar *)"MIME"))
-      continue;
+    MimeRecord *rc = readRecord (node);
 
-    rc.clear();
-
-    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 *)"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)
-            rc.extension.assign ((const char*)attrs->children->content);
-        }
-      }
-
-      if(lcur->name && !xmlStrcmp(lcur->name, (const xmlChar *)"FILTER"))
-      {
-        if(lcur->children->content)
-          rc.addFilter((const char*)lcur->children->content);
-      }
-    }
-
-    if(addRecord(rc))
-    {
-      clean();
-      mutex.unlock ();
-      return 0;
-    }
+    if (rc)
+      addRecord (rc);
   }
   parser.close();
   
   /*! Store the loaded status. */
-  loaded = 1;
+  loaded = true;
 
-  retSize = data->size();
-
-  mutex.unlock ();
-
-  return retSize;
+  return getNumMIMELoaded ();
 }
 
 /*!
@@ -210,15 +216,11 @@
 {
   if(loaded)
   {
-    mutex.lock ();
-    loaded = 0;
+    loaded = false;
     if(filename) 
       delete filename;
     filename = 0;
     removeAllRecords();
-    delete data;
-    data = 0;
-    mutex.unlock ();
   }
 }
 
@@ -227,83 +229,55 @@
  */
 MimeManager::MimeManager()
 {
-  data = 0;
   filename = 0;
-  loaded = 0;
-  mutex.init ();
+  loaded = false;
 }
 
 /*!
- *Add a new record. Returns zero on success.
+ *Add a new record.
+ *\return Return the position for the new record.
  */
-int MimeManager::addRecord(MimeRecord& mr)
+int MimeManager::addRecord (MimeRecord *mr)
 {
-  /*!
-   *If the MIME type already exists remove it.
-   */
-  MimeRecord *nmr = 0;
-  try
-  {
-    MimeRecord *old;
+  u_long position = records.size ();
 
 #ifdef MIME_LOWER_CASE
-    transform(mr.extension.begin(), mr.extension.end(), mr.extension.begin(), ::tolower);
+  transform (mr->extension.begin(), mr->extension.end(), mr->extension.begin(), ::tolower);
 #endif
-    nmr = new MimeRecord(mr);
-    if(!nmr)  
-      return 1;
+  
+  records.push_back (mr);
 
-    old = data->put(nmr->extension, nmr);
-    if(old)
-    {
-      string error;
-      error.assign("Warning: multiple MIME types registered for the extension " );
-      error.append(nmr->extension);
-
-      Server::getInstance()->logWriteln(error.c_str(), ERROR);
-      delete old;
-    }
-  }
-  catch(...)
-  {
-    if(nmr)
-      delete nmr;
-    return 1;
-  };
+  extIndex.put (mr->extension, position);
   
-  return 0;
+  return position;
 }
 
 /*!
- *Remove a record by the extension of the MIME type.
- */
-void MimeManager::removeRecord(const string& ext)
-{
-  MimeRecord *rec = data->remove(ext.c_str());
-  if(rec)
-    delete rec;
-}
-
-/*!
  *Remove all records from the linked list.
  */
-void MimeManager::removeAllRecords()
+void MimeManager::removeAllRecords ()
 {
-  HashMap<string, MimeRecord*>::Iterator it = data->begin();
-  for(; it != data->end(); it++)
+  vector <MimeRecord*>::iterator i = records.begin ();
+
+  while (i != records.end ())
   {
-    MimeRecord *rec = *it;
-    if(rec)
-      delete rec;
+    MimeRecord *r = *i;
+
+    if (r)
+      delete r;
+    
+    i++;
   }
 
-  data->clear();
+  records.clear ();
+
+  extIndex.clear ();
 }
 
 /*!
- *Get a pointer to an existing record passing its extension.
+ *Get a pointer to a MIME record by its extension.
  */
-MimeRecord *MimeManager::getMIME(const char *ext)
+MimeRecord *MimeManager::getMIME (const char *ext)
 {
   string str (ext);
   return getMIME (str);
@@ -312,39 +286,28 @@
 /*!
  *Get a pointer to an existing record passing its extension.
  */
-MimeRecord *MimeManager::getMIME(string const &ext)
+MimeRecord *MimeManager::getMIME (string const &ext)
 {
-  MimeRecord* mr;
+  u_long pos = extIndex.get (ext.c_str ());
 
-  mutex.lock ();
+  if (pos)
+    return records [pos];
 
-  mr = data ? data->get(ext.c_str()) : 0;
-
-  mutex.unlock ();
-
-  return mr;
+  return NULL;
 }
 
 /*!
  *Returns the number of MIME types loaded.
  */
-u_long MimeManager::getNumMIMELoaded()
+u_long MimeManager::getNumMIMELoaded ()
 {
-  u_long ret;
-
-  mutex.lock ();
-
-  ret = data ? data->size() : 0;
-
-  mutex.unlock ();
-
-  return ret;
+  return records.size () -1;
 }
 
 /*!
  *Check if the MIME manager is loaded.
  */
-int MimeManager::isLoaded()
+bool MimeManager::isLoaded ()
 {
   return loaded;
 }





From MAILER-DAEMON Sat Oct 25 06:21:24 2008
Received: from mailman by lists.gnu.org with archive (Exim 4.43)
	id 1KtgGq-0006r4-Ey
	for mharc-myserver-commit@gnu.org; Sat, 25 Oct 2008 06:21:24 -0400
Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43)
	id 1KtgGm-0006qM-No
	for myserver-commit@gnu.org; Sat, 25 Oct 2008 06:21:20 -0400
Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43)
	id 1KtgGk-0006q6-Vr
	for myserver-commit@gnu.org; Sat, 25 Oct 2008 06:21:19 -0400
Received: from [199.232.76.173] (port=33521 helo=monty-python.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.43) id 1KtgGk-0006q1-Pw
	for myserver-commit@gnu.org; Sat, 25 Oct 2008 06:21:18 -0400
Received: from savannah.gnu.org ([199.232.41.3]:51442 helo=sv.gnu.org)
	by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32)
	(Exim 4.60) (envelope-from <INVALID.NOREPLY@gnu.org>)
	id 1KtgGk-00021N-CO
	for myserver-commit@gnu.org; Sat, 25 Oct 2008 06:21:18 -0400
Received: from cvs.savannah.gnu.org ([199.232.41.69])
	by sv.gnu.org with esmtp (Exim 4.63)
	(envelope-from <INVALID.NOREPLY@gnu.org>) id 1KtgGi-0001er-JG
	for myserver-commit@gnu.org; Sat, 25 Oct 2008 10:21:17 +0000
Received: from gscrivano by cvs.savannah.gnu.org with local (Exim 4.63)
	(envelope-from <gscrivano@savannah.gnu.org>) id 1KtgGh-0001ei-Iv
	for myserver-commit@gnu.org; Sat, 25 Oct 2008 10:21:16 +0000
MIME-Version: 1.0
Errors-To: gscrivano
To: myserver-commit@gnu.org
X-Mailer: SVN::Notify 2.64: http://search.cpan.org/dist/SVN-Notify/
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
From: Giuseppe Scrivano <gscrivano@gnu.org>
Message-Id: <E1KtgGh-0001ei-Iv@cvs.savannah.gnu.org>
Date: Sat, 25 Oct 2008 10:21:15 +0000
X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 3)
Subject: [myserver-commit] [2902] Added tests for the `MimeManager' class
	and updated documentation.
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/pipermail/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, 25 Oct 2008 10:21:21 -0000

Revision: 2902
          http://svn.sv.gnu.org/viewvc/?view=rev&root=myserver&revision=2902
Author:   gscrivano
Date:     2008-10-25 10:21:13 +0000 (Sat, 25 Oct 2008)

Log Message:
-----------
Added tests for the `MimeManager' class and updated documentation.

Modified Paths:
--------------
    trunk/myserver/documentation/mime_types.texi
    trunk/myserver/include/conf/mime/mime_manager.h
    trunk/myserver/src/conf/mime/mime_manager.cpp
    trunk/myserver/tests/Makefile.am

Added Paths:
-----------
    trunk/myserver/tests/test_mime_manager.cpp

Modified: trunk/myserver/documentation/mime_types.texi
===================================================================
--- trunk/myserver/documentation/mime_types.texi	2008-10-24 20:59:20 UTC (rev 2901)
+++ trunk/myserver/documentation/mime_types.texi	2008-10-25 10:21:13 UTC (rev 2902)
@@ -3,74 +3,47 @@
 @file{MIMEtypes.xml}. The following is an example of this file: 
 
 @example
-<MIMETYPES>
+<?xml version ="1.0"?>
+<MIME mime="text/html" handler="SEND" param="">
+<EXTENSION value="html"/>
+</MIME>
 
-  <MIMETYPE defaultAction="DENY">
-    <EXT>htm</EXT>
-    <MIME>text/html</MIME>
-    <CMD>SEND</CMD>
-    <ACTION name="Host" value="localhost">ALLOW</ACTION>
-    <FILTER>gzip</FILTER>
-    <MANAGER>NONE</MANAGER>
-  </MIMETYPE>
-
-</MIMETYPES>
+<MIME mime="text/html" handler="RUNCGI" param="/usr/bin/perl">
+<FILTER value="gzip"/>
+<EXTENSION value="pl"/>
+</MIME>
 @end example
 
 @itemize
 Each block describes a different MIME type.
 
-@item EXT
-is the type of file
+@item mime
+the MIME attribute specifies the MIME name.
 
-@item MIME
-is the Mime type.
+@item extension
+the MIME type will be used by any file with this extension.
 
-@item CMD
-is the way to send the file to the client.
-@end itemize
+@item filter
+this directive registers a filter to use with MIME type.
 
-@noindent @code{<ACTION name="Host" value="localhost">ALLOW</ACTION>}
-will allow access to the desired MIME Type if the Host is
-"localhost".
-In the line @code{<MIMETYPE defaultAction="DENY">} we declare that 
-the MIME type will DENY access from any host we don't set in the
-proper ACTION tag (so, it will have to exist in the
-configuration). Also, the property defaultAction is optional (when
-it's omitted, it's set to "ALLOW"). In the above example, HTML files
-will be accessed only through the hostname "localhost".
+@item handler
+specifies the way the file is handled by the server.
 
-The tag @code{<ACTION>} is optional, unless you specify "DENY" for
-your defaultAction in your MIME Type.
+@item param
+specifies additional params for the handler.
 
-@code{<FILTER>} defines a filter for that MIME type. The data will
-pass through the filter before being sent to the user. In the example
-above, the data would be sent gzipped to the user. It means Gzip works
-as a filter in MyServer. you can define Gzip to automatically run for
-every file based in its size, setting the @code{<GZIP_THRESHOLD>}, in
-@file{myserver.xml} file. For obvious reasons, data will be sent
-gzipped only if the client supports gzip - otherwise he'd receive a
-lot of weird characters instead of the site requested.
+@end itemize
 
-In general, filters can also be applied to dynamic data - like CGI,
-ISAPI, FastCGI - but they need to be filters that don't modify the
-contents of the page to be shown to the user.
+@code{<FILTER>} defines a filter for the MIME type.  The data will
+pass through the filter before being sent to the user.  
+In the example above, the data would be sent gzipped to the user.
+It is possible to specify multiple filters for the same MIME type,
+they will be applied in the specified order.
 
-@code{<MANAGER>} completes the @code{<CMD>} command specifying, if
-necessary for the command, an external application to use.
-For example using the RUNCGI command, it will be necessary to specify
-an external process to execute the CGI command, MANAGER under
-GNU/Linux will be something like this:
+The same MIME type can have several extensions, you will need to
+specify a different @code{<EXTENSION>} element for each extension.
 
-@example
-<MANAGER>/usr/bin/php-cgi</MANAGER>
-or under Windows:
-<MANAGER>c:\php\php-cgi.exe</MANAGER>
-@end example
-
-
-The following values for sending the file to the client are valid in
-the @code{<CMD>} section:
+These are valid HTTP handlers:
 @enumerate
 @item SEND
 Send the file statically as is.  This command is used for files

Modified: trunk/myserver/include/conf/mime/mime_manager.h
===================================================================
--- trunk/myserver/include/conf/mime/mime_manager.h	2008-10-24 20:59:20 UTC (rev 2901)
+++ trunk/myserver/include/conf/mime/mime_manager.h	2008-10-25 10:21:13 UTC (rev 2902)
@@ -49,46 +49,47 @@
 struct MimeRecord
 {
 	list<string> filters;
-	string extension;
+	list<string> extensions;
 	string mimeType;
 	string cmdName;
 	string cgiManager;
-	MimeRecord();
-	MimeRecord(MimeRecord&);
-	int addFilter(const char*, bool acceptDuplicate = true);
-	~MimeRecord();
-	void clear();
+	MimeRecord ();
+	MimeRecord (MimeRecord&);
+	int addFilter (const char*, bool acceptDuplicate = true);
+	~MimeRecord ();
+	void clear ();
 };
 
 class MimeManager
 {
 public:
-	MimeManager();
-  ~MimeManager();
-	u_long getNumMIMELoaded();
+	MimeManager ();
+  ~MimeManager ();
+	u_long getNumMIMELoaded ();
 
-	int loadXML(const char *filename);
-	int loadXML(string &filename)
-    {return loadXML(filename.c_str());}
+  u_long loadXML (XmlParser* parser);
+	u_long loadXML (const char *filename);
+	u_long loadXML (string &filename)
+    {return loadXML (filename.c_str ());}
 
-	MimeRecord* getMIME(const char* ext);
-  MimeRecord* getMIME(string const &ext);
+	MimeRecord* getMIME (const char *ext);
+  MimeRecord* getMIME (string const &ext);
 
-  bool isLoaded();
-	void clean();
+  bool isLoaded ();
+	void clean ();
+	int addRecord (MimeRecord *record);
 
 protected:
   MimeRecord *readRecord (xmlNodePtr node);
-	const char *getFilename();
-	int addRecord(MimeRecord *record);
-	void removeAllRecords();
+	const char *getFilename ();
+	void clearRecords ();
 private:
   bool loaded;
   HashMap<string, int> extIndex;
   vector <MimeRecord*> records;
 
 	u_long numMimeTypesLoaded;
-	string *filename;
+	string filename;
 };
 
 #endif 

Modified: trunk/myserver/src/conf/mime/mime_manager.cpp
===================================================================
--- trunk/myserver/src/conf/mime/mime_manager.cpp	2008-10-24 20:59:20 UTC (rev 2901)
+++ trunk/myserver/src/conf/mime/mime_manager.cpp	2008-10-25 10:21:13 UTC (rev 2902)
@@ -31,28 +31,28 @@
 
 using namespace std;
 
-MimeRecord::MimeRecord()
+MimeRecord::MimeRecord ()
 {
-  filters.clear();
-  extension.assign(""); 
-  mimeType.assign("");
-  cgiManager.assign("");
-  cmdName.assign("");
+  filters.clear ();
+  extensions.clear ();
+  mimeType.assign ("");
+  cgiManager.assign ("");
+  cmdName.assign ("");
 }
 
 /*!
  *Destroy the object.
  */
-MimeRecord::~MimeRecord()
+MimeRecord::~MimeRecord ()
 {
-  clear();
+  clear ();
 }
 
 /*!
  *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) 
+int MimeRecord::addFilter (const char* n, bool acceptDuplicate) 
 {
   if(!acceptDuplicate)
   {
@@ -70,42 +70,49 @@
 /*!
  *Copy constructor.
  */
-MimeRecord::MimeRecord(MimeRecord& m)
+MimeRecord::MimeRecord (MimeRecord& m)
 {
-  list<string>::iterator i = m.filters.begin();
+  list<string>::iterator i = m.filters.begin ();
 
-  filters.clear(); 
+  filters.clear (); 
 
-  for( ; i != m.filters.end(); i++)
+  for( ; i != m.filters.end (); i++)
   {
-    filters.push_back(*i);
+    filters.push_back (*i);
   }
-  extension.assign(m.extension); 
-  mimeType.assign(m.mimeType);
-  cmdName.assign(m.cmdName);
-  cgiManager.assign(m.cgiManager);
+
+  i = m.extensions.begin ();
+
+  extensions.clear (); 
+
+  for( ; i != m.extensions.end (); i++)
+  {
+    filters.push_back (*i);
+  }
+
+  mimeType.assign (m.mimeType);
+  cmdName.assign (m.cmdName);
+  cgiManager.assign (m.cgiManager);
 } 
 
 /*!
   *Clear the used memory.
   */
-void MimeRecord::clear()
+void MimeRecord::clear ()
 {
-  filters.clear();
-  extension.assign(""); 
-  mimeType.assign(""); 
-  cmdName.assign("");
-  cgiManager.assign("");
+  filters.clear ();
+  extensions.clear ();
+  mimeType.assign (""); 
+  cmdName.assign ("");
+  cgiManager.assign ("");
 }  
 
 /*!
  *Get the name of the file opened by the class.
  */
-const char *MimeManager::getFilename()
+const char *MimeManager::getFilename ()
 {
-  if(filename == 0)
-    return "";
-  return filename->c_str();
+  return filename.c_str();
 }
 
 /*!
@@ -133,22 +140,31 @@
       rc->cgiManager.assign ((const char*)attrs->children->content);
   }
 
-  for( ;lcur; lcur = lcur->next)
+  for ( ;lcur; lcur = lcur->next)
   {
-    if(lcur->name && !xmlStrcmp(lcur->name, (const xmlChar *)"EXTENSION"))
+    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)
-          rc->extension.assign ((const char*)attrs->children->content);
+        {
+          string ext ((const char*)attrs->children->content);
+          rc->extensions.push_back (ext);
+        }
       }
     }
 
-    if(lcur->name && !xmlStrcmp(lcur->name, (const xmlChar *)"FILTER"))
+    if (lcur->name && !xmlStrcmp(lcur->name, (const xmlChar *)"FILTER"))
     {
-      if(lcur->children->content)
-        rc->addFilter((const char*)lcur->children->content);
+      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);
+        }
+      }
     }
   }
 
@@ -159,31 +175,37 @@
  *Load the MIME types from a XML file. Returns the number of
  *MIME types loaded successfully.
  */
-int MimeManager::loadXML(const char *fn)
+u_long MimeManager::loadXML (const char *fn)
 {
   XmlParser parser;
-  xmlNodePtr node;
-  xmlDocPtr doc;
+  u_long ret = 0;
 
-  if(!fn)
-    return -1;
-
-  if(filename)
-    delete filename;
-
-  filename = new string(fn);
-
   if(parser.open (fn))
   {
     return -1;
   }
 
-  removeAllRecords();
+  filename.assign (fn);
 
-  /* The first record is not used to store information.  */
-  records.push_back (NULL);
+  ret = loadXML (&parser);
+  
+  parser.close ();
+  
+  return ret;
+}
 
-  doc = parser.getDoc();
+/*!
+ *Load the MIME types from a XML parser object. Returns the number 
+ *of MIME types loaded successfully.
+ */
+u_long MimeManager::loadXML (XmlParser* parser)
+{
+  xmlNodePtr node;
+  xmlDocPtr doc;
+
+  clearRecords ();
+
+  doc = parser->getDoc();
   node = doc->children->children;
 
   for(; node; node = node->next )
@@ -193,7 +215,6 @@
     if (rc)
       addRecord (rc);
   }
-  parser.close();
   
   /*! Store the loaded status. */
   loaded = true;
@@ -204,7 +225,7 @@
 /*!
  *Destroy the object.
  */
-MimeManager::~MimeManager()
+MimeManager::~MimeManager ()
 {
   clean();
 }
@@ -212,24 +233,21 @@
 /*!
  *Clean the memory allocated by the structure.
  */
-void MimeManager::clean()
+void MimeManager::clean ()
 {
   if(loaded)
   {
     loaded = false;
-    if(filename) 
-      delete filename;
-    filename = 0;
-    removeAllRecords();
+    filename.assign ("");
+    clearRecords ();
   }
 }
 
 /*!
  *Constructor of the class.
  */
-MimeManager::MimeManager()
+MimeManager::MimeManager ()
 {
-  filename = 0;
   loaded = false;
 }
 
@@ -241,21 +259,26 @@
 {
   u_long position = records.size ();
 
+  records.push_back (mr);
+
+  for (list<string>::iterator it = mr->extensions.begin (); it != mr->extensions.end (); it++)
+  {
+    string &ext = *it;
+
 #ifdef MIME_LOWER_CASE
-  transform (mr->extension.begin(), mr->extension.end(), mr->extension.begin(), ::tolower);
+    transform (ext.begin(), ext.end(), ext.begin(), ::tolower);
 #endif
-  
-  records.push_back (mr);
 
-  extIndex.put (mr->extension, position);
+    extIndex.put (ext, position);
+  }
   
   return position;
 }
 
 /*!
- *Remove all records from the linked list.
+ *Remove all the stored records.
  */
-void MimeManager::removeAllRecords ()
+void MimeManager::clearRecords ()
 {
   vector <MimeRecord*>::iterator i = records.begin ();
 
@@ -272,6 +295,9 @@
   records.clear ();
 
   extIndex.clear ();
+
+  /* The first record is not used to store information.  */
+  records.push_back (NULL);
 }
 
 /*!

Modified: trunk/myserver/tests/Makefile.am
===================================================================
--- trunk/myserver/tests/Makefile.am	2008-10-24 20:59:20 UTC (rev 2901)
+++ trunk/myserver/tests/Makefile.am	2008-10-25 10:21:13 UTC (rev 2902)
@@ -2,5 +2,5 @@
 #
 
 bin_PROGRAMS = tests_suite
-tests_suite_SOURCES = main.cpp test_connection.cpp test_ftp.cpp test_log_manager.cpp test_mutex.cpp test_security_domain.cpp test_validator.cpp test_auth_domain.cpp test_connections_scheduler.cpp test_gzip.cpp test_log_stream_factory.cpp test_pipe.cpp test_security_manager.cpp test_validator_factory.cpp test_base64.cpp test_file_stream.cpp test_hashmap.cpp test_md5.cpp test_recursive_mutex.cpp test_semaphore.cpp test_xml.cpp test_cached_file_buffer.cpp test_file_stream_creator.cpp test_homedir.cpp test_mem_buff.cpp test_regex.cpp test_socket_stream_creator.cpp test_cached_file.cpp test_files_utility.cpp test_http_request.cpp test_http_req_security_domain.cpp test_mem_stream.cpp test_safetime.cpp test_thread.cpp test_cached_file_factory.cpp test_filter_chain.cpp test_http_response.cpp test_multicast.cpp test_security_cache.cpp test_security_token.cpp test_utility.cpp  test_xml_validator.cpp
+tests_suite_SOURCES = main.cpp test_connection.cpp test_ftp.cpp test_log_manager.cpp test_mime_manager.cpp test_mutex.cpp test_security_domain.cpp test_validator.cpp test_auth_domain.cpp test_connections_scheduler.cpp test_gzip.cpp test_log_stream_factory.cpp test_pipe.cpp test_security_manager.cpp test_validator_factory.cpp test_base64.cpp test_file_stream.cpp test_hashmap.cpp test_md5.cpp test_recursive_mutex.cpp test_semaphore.cpp test_xml.cpp test_cached_file_buffer.cpp test_file_stream_creator.cpp test_homedir.cpp test_mem_buff.cpp test_regex.cpp test_socket_stream_creator.cpp test_cached_file.cpp test_files_utility.cpp test_http_request.cpp test_http_req_security_domain.cpp test_mem_stream.cpp test_safetime.cpp test_thread.cpp test_cached_file_factory.cpp test_filter_chain.cpp test_http_response.cpp test_multicast.cpp test_security_cache.cpp test_security_token.cpp test_utility.cpp  test_xml_validator.cpp
 tests_suite_LDADD = ../src/libmyserver.a $(CPPUNIT_LDFLAGS) $(PTHREAD_LIB) $(IDN_LIB) $(XNET_LIB) $(EVENT_LIB) $(DL_LIB) $(OPENSSL_LIB) $(ZLIB_LIB) $(XML_LIBS) $(LDFLAGS)

Added: trunk/myserver/tests/test_mime_manager.cpp
===================================================================
--- trunk/myserver/tests/test_mime_manager.cpp	                        (rev 0)
+++ trunk/myserver/tests/test_mime_manager.cpp	2008-10-25 10:21:13 UTC (rev 2902)
@@ -0,0 +1,102 @@
+/*
+ MyServer
+ Copyright (C) 2008 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
+ (at your option) any later version.
+ 
+ This program is distributed in the hope that it will be useful, 
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ GNU General Public License for more details.
+ 
+ You should have received a copy of the GNU General Public License
+ along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include <ctype.h>
+
+#include <cppunit/CompilerOutputter.h>
+#include <cppunit/extensions/TestFactoryRegistry.h>
+#include <cppunit/ui/text/TestRunner.h>
+#include <cppunit/extensions/HelperMacros.h>
+
+#include <include/conf/mime/mime_manager.h>
+
+#include <string.h>
+
+#include <iostream>
+using namespace std;
+
+
+class TestMimeManager : public CppUnit::TestFixture
+{
+  CPPUNIT_TEST_SUITE ( TestMimeManager );
+  CPPUNIT_TEST ( testLoadXML );
+  CPPUNIT_TEST_SUITE_END ();
+
+  MimeManager *mm;
+public:
+  void setUp ()
+  {
+    mm = new MimeManager;
+  }
+
+  void tearDown ()
+  {
+    delete mm;
+  }
+
+  void testLoadXML ()
+  {
+    XmlParser *parser = getTestParser ();
+
+    CPPUNIT_ASSERT_EQUAL (mm->isLoaded(), false);
+
+    CPPUNIT_ASSERT_EQUAL (mm->loadXML (parser), 2ul);
+    CPPUNIT_ASSERT_EQUAL (mm->getNumMIMELoaded(), 2ul);
+
+    CPPUNIT_ASSERT_EQUAL (mm->isLoaded(), true);
+    
+    delete parser;
+  }
+
+  void testAddRecord ()
+  {
+    XmlParser *parser = getTestParser ();
+    MimeRecord mr;
+    mm->loadXML (parser);
+
+    CPPUNIT_ASSERT_EQUAL (mm->getNumMIMELoaded(), 2ul);
+
+    mm->addRecord (&mr);
+
+    CPPUNIT_ASSERT_EQUAL (mm->getNumMIMELoaded(), 3ul);
+    
+    delete parser;
+  }
+
+private:
+
+  //Returns a XML object with 2 MIME.
+  XmlParser *getTestParser ()
+  {
+    MemBuf mb;
+    XmlParser *parser = new XmlParser ();
+
+    const char *buffer = "<?xml version=\"1.0\"?>\n<MIMES>\n\
+       <MIME mime=\"text/html\" handler=\"SEND\" param=\"\">\n                 \
+       <EXTENSION value=\"htm\"/>\n<EXTENSION value=\"html\"/>\n\
+       </MIME>\n<MIME mime=\"text/html\" handler=\"SEND\" param=\"\">\n\
+       <EXTENSION value=\"txt\"/>\n</MIME>\n</MIMES>\n";
+
+    mb.addBuffer (buffer, strlen (buffer));
+    parser->openMemBuf(mb);
+
+    return parser;
+  }
+};
+
+
+CPPUNIT_TEST_SUITE_REGISTRATION( TestMimeManager );





From MAILER-DAEMON Sat Oct 25 09:53:07 2008
Received: from mailman by lists.gnu.org with archive (Exim 4.43)
	id 1KtjZj-0004XR-MA
	for mharc-myserver-commit@gnu.org; Sat, 25 Oct 2008 09:53:07 -0400
Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43)
	id 1KtjZi-0004XM-93
	for myserver-commit@gnu.org; Sat, 25 Oct 2008 09:53:06 -0400
Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43)
	id 1KtjZg-0004X3-Lm
	for myserver-commit@gnu.org; Sat, 25 Oct 2008 09:53:05 -0400
Received: from [199.232.76.173] (port=43993 helo=monty-python.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.43) id 1KtjZg-0004X0-HO
	for myserver-commit@gnu.org; Sat, 25 Oct 2008 09:53:04 -0400
Received: from savannah.gnu.org ([199.232.41.3]:59060 helo=sv.gnu.org)
	by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32)
	(Exim 4.60) (envelope-from <INVALID.NOREPLY@gnu.org>)
	id 1KtjZb-0002sd-Hy
	for myserver-commit@gnu.org; Sat, 25 Oct 2008 09:53:03 -0400
Received: from cvs.savannah.gnu.org ([199.232.41.69])
	by sv.gnu.org with esmtp (Exim 4.63)
	(envelope-from <INVALID.NOREPLY@gnu.org>) id 1KtjZS-00064n-3X
	for myserver-commit@gnu.org; Sat, 25 Oct 2008 13:52:50 +0000
Received: from ignacy by cvs.savannah.gnu.org with local (Exim 4.63)
	(envelope-from <ignacy@savannah.gnu.org>) id 1KtjZR-00064i-S2
	for myserver-commit@gnu.org; Sat, 25 Oct 2008 13:52:50 +0000
MIME-Version: 1.0
Errors-To: ignacy
To: myserver-commit@gnu.org
X-Mailer: SVN::Notify 2.64: http://search.cpan.org/dist/SVN-Notify/
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
From: Ignacy Moryc <imoryc@gmail.com>
Message-Id: <E1KtjZR-00064i-S2@cvs.savannah.gnu.org>
Date: Sat, 25 Oct 2008 13:52:49 +0000
X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 3)
Subject: [myserver-commit] [2903] Added tabs on Host window
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/pipermail/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, 25 Oct 2008 13:53:06 -0000

Revision: 2903
          http://svn.sv.gnu.org/viewvc/?view=rev&root=myserver&revision=2903
Author:   ignacy
Date:     2008-10-25 13:52:49 +0000 (Sat, 25 Oct 2008)

Log Message:
-----------
Added tabs on Host window

Modified Paths:
--------------
    trunk/misc/PyGTK_Control/ConfigGUI.py
    trunk/misc/PyGTK_Control/XMLGui.glade

Added Paths:
-----------
    trunk/misc/PyGTK_Control/MyServer Configure.ico

Modified: trunk/misc/PyGTK_Control/ConfigGUI.py
===================================================================
--- trunk/misc/PyGTK_Control/ConfigGUI.py	2008-10-25 10:21:13 UTC (rev 2902)
+++ trunk/misc/PyGTK_Control/ConfigGUI.py	2008-10-25 13:52:49 UTC (rev 2903)
@@ -66,6 +66,32 @@
 
         self.treeview.show()
 
+        # Create treeview widget structure (one column) for host names
+        self.treeviewHost=self.wTree.get_widget("treeviewHost")
+        self.treemodelHost=gtk.TreeStore(gobject.TYPE_STRING)
+        self.treeviewHost.set_model(self.treemodelHost)
+
+        renderer=gtk.CellRendererText()
+        column=gtk.TreeViewColumn("Host:",renderer, text=0)
+        column.set_resizable(True)
+        self.treeviewHost.append_column(column)
+        renderer=gtk.CellRendererText()
+        self.treeviewHost.show()
+
+        # Create treeview widget structure (one column) for IP addresses
+        self.treeviewIP=self.wTree.get_widget("treeviewIP")
+        self.treemodelIP=gtk.TreeStore(gobject.TYPE_STRING)
+        self.treeviewIP.set_model(self.treemodelIP)
+
+        renderer=gtk.CellRendererText()
+        column=gtk.TreeViewColumn("IP:",renderer, text=0)
+        column.set_resizable(True)
+        self.treeviewIP.append_column(column)
+        renderer=gtk.CellRendererText()
+        self.treeviewIP.show()
+
+
+
         self.store2 = gtk.ListStore(gobject.TYPE_STRING)
         #populate
         self.store2.append(["Every HTTP connection"])
@@ -127,13 +153,26 @@
                     self.filechooserbutton2_file_set,
                 "on_filechooserbutton1_file_set" : \
                     self.filechooserbutton1_file_set,
+                "on_filechooserbutton4_file_set" : \
+                    self.filechooserbutton4_file_set,
+                "on_filechooserbutton3_file_set" : \
+                    self.filechooserbutton3_file_set,
                 "on_btnRemoveMIMEExtension_clicked" : \
                     self.buttonRemoveMIMEExtension_clicked,
                 "on_btnAddHostName_clicked" : \
                     self.buttonAddHostName_clicked,
                 "on_btnRemoveHostName_clicked" : \
-                    self.buttonRemoveHostName_clicked
+                    self.buttonRemoveHostName_clicked,
+                "on_btnAddHost_clicked" : \
+                    self.btnAddHost_clicked,
+                "on_btnAddIP_clicked" : \
+                    self.btnAddIP_clicked,
+                "on_btnRemoveHost_clicked" : \
+                    self.btnRemoveHost_clicked,
+                "on_btnRemoveIP_clicked" : \
+                    self.btnRemoveIP_clicked
                 }
+
         # Connect signals
         self.wTree.signal_autoconnect (dic)
 
@@ -156,6 +195,22 @@
         model, selected = selection.get_selected()
         model.remove(selected)
 
+    def btnAddHost_clicked(self, button):
+        """ Add new host name to treeview """
+        self.insert_row(self.treemodelHost,None, self.ShowDialogBox("Add new host name"))
+
+    def btnRemoveHost_clicked(self, button):
+        """ Removes selected file name """
+        self.delete_rows(self.treeviewHost)
+
+    def btnAddIP_clicked(self, button):
+        """ Add new IP address to trreview """
+        self.insert_row(self.treemodelIP,None, self.ShowDialogBox("Add new IP address"))
+
+    def btnRemoveIP_clicked(self, button):
+        """ Removes selected file name """
+        self.delete_rows(self.treeviewIP)
+
     def buttonAddMIMEType_clicked(self, button):
         """ Add new MIME type to list """
         self.store.append([self.ShowDialogBox("Add new MIME type")])
@@ -188,6 +243,14 @@
         """ Place file path in entry field """
         self.wTree.get_widget("enManager").set_text(self.wTree.get_widget("filechooserbutton2").get_filename())
 
+    def filechooserbutton4_file_set(self, widget):
+        """ Place file path in entry field """
+        self.wTree.get_widget("enSystemFolder").set_text(self.wTree.get_widget("filechooserbutton4").get_filename())
+
+    def filechooserbutton3_file_set(self, widget):
+        """ Place file path in entry field """
+        self.wTree.get_widget("enDocummentRoot").set_text(self.wTree.get_widget("filechooserbutton3").get_filename())
+
     def filechooserbutton1_file_set(self, widget):
         """ Place file path in entry field """
         self.wTree.get_widget("enStylesheet").set_text(self.wTree.get_widget("filechooserbutton1").get_filename())

Added: trunk/misc/PyGTK_Control/MyServer Configure.ico
===================================================================
(Binary files differ)


Property changes on: trunk/misc/PyGTK_Control/MyServer Configure.ico
___________________________________________________________________
Name: svn:executable
   + *
Name: svn:mime-type
   + application/octet-stream

Modified: trunk/misc/PyGTK_Control/XMLGui.glade
===================================================================
--- trunk/misc/PyGTK_Control/XMLGui.glade	2008-10-25 10:21:13 UTC (rev 2902)
+++ trunk/misc/PyGTK_Control/XMLGui.glade	2008-10-25 13:52:49 UTC (rev 2903)
@@ -5,6 +5,7 @@
   <widget class="GtkWindow" id="ConfigUI">
     <property name="visible">True</property>
     <property name="title" translatable="yes">Myserver configuration tool</property>
+    <property name="icon">MyServer Configure.ico</property>
     <child>
       <widget class="GtkVBox" id="vbox1">
         <property name="visible">True</property>
@@ -287,155 +288,155 @@
                         <property name="n_rows">6</property>
                         <property name="n_columns">2</property>
                         <child>
-                          <widget class="GtkLabel" id="label7">
+                          <widget class="GtkComboBox" id="combobox2">
                             <property name="visible">True</property>
-                            <property name="label" translatable="yes">Memory buffer (in bytes):</property>
-                            <property name="justify">GTK_JUSTIFY_RIGHT</property>
+                            <property name="items" translatable="yes">german.xml
+itliano.xml
+russian_koi8r.xml
+brazilian.xml
+french.xml
+russian.xml
+english.xml
+romnaa.xml
+spnish.xml
+
+</property>
                           </widget>
+                          <packing>
+                            <property name="left_attach">1</property>
+                            <property name="right_attach">2</property>
+                            <property name="top_attach">5</property>
+                            <property name="bottom_attach">6</property>
+                            <property name="y_options"></property>
+                          </packing>
                         </child>
                         <child>
-                          <widget class="GtkLabel" id="label8">
+                          <widget class="GtkComboBox" id="cbVerbosityLevel">
                             <property name="visible">True</property>
-                            <property name="label" translatable="yes">Verbosity level:</property>
-                            <property name="justify">GTK_JUSTIFY_RIGHT</property>
+                            <property name="items" translatable="yes">None
+Normal
+Higher
+Highest</property>
                           </widget>
                           <packing>
+                            <property name="left_attach">1</property>
+                            <property name="right_attach">2</property>
                             <property name="top_attach">1</property>
                             <property name="bottom_attach">2</property>
+                            <property name="y_options"></property>
                           </packing>
                         </child>
                         <child>
-                          <widget class="GtkLabel" id="label9">
+                          <widget class="GtkEntry" id="enMaximumNumberOfThreads">
                             <property name="visible">True</property>
-                            <property name="label" translatable="yes">Max log file size (in bytes):</property>
-                            <property name="justify">GTK_JUSTIFY_RIGHT</property>
+                            <property name="can_focus">True</property>
+                            <property name="text" translatable="yes">200</property>
                           </widget>
                           <packing>
-                            <property name="top_attach">2</property>
-                            <property name="bottom_attach">3</property>
+                            <property name="left_attach">1</property>
+                            <property name="right_attach">2</property>
+                            <property name="top_attach">4</property>
+                            <property name="bottom_attach">5</property>
                           </packing>
                         </child>
                         <child>
-                          <widget class="GtkLabel" id="label10">
+                          <widget class="GtkEntry" id="enAlwysActiveThreads">
                             <property name="visible">True</property>
-                            <property name="label" translatable="yes">Always active threads:</property>
-                            <property name="justify">GTK_JUSTIFY_RIGHT</property>
+                            <property name="can_focus">True</property>
+                            <property name="text" translatable="yes">5</property>
                           </widget>
                           <packing>
+                            <property name="left_attach">1</property>
+                            <property name="right_attach">2</property>
                             <property name="top_attach">3</property>
                             <property name="bottom_attach">4</property>
                           </packing>
                         </child>
                         <child>
-                          <widget class="GtkLabel" id="label11">
+                          <widget class="GtkEntry" id="enMaxLogFileSize">
                             <property name="visible">True</property>
-                            <property name="label" translatable="yes">Maximum number of threads:</property>
-                            <property name="justify">GTK_JUSTIFY_RIGHT</property>
+                            <property name="can_focus">True</property>
+                            <property name="text" translatable="yes">1048576</property>
                           </widget>
                           <packing>
-                            <property name="top_attach">4</property>
-                            <property name="bottom_attach">5</property>
+                            <property name="left_attach">1</property>
+                            <property name="right_attach">2</property>
+                            <property name="top_attach">2</property>
+                            <property name="bottom_attach">3</property>
                           </packing>
                         </child>
                         <child>
-                          <widget class="GtkLabel" id="label12">
+                          <widget class="GtkEntry" id="enMemoryBuffer">
                             <property name="visible">True</property>
-                            <property name="label" translatable="yes">Language:</property>
-                            <property name="justify">GTK_JUSTIFY_RIGHT</property>
+                            <property name="can_focus">True</property>
+                            <property name="text" translatable="yes">102400</property>
                           </widget>
                           <packing>
-                            <property name="top_attach">5</property>
-                            <property name="bottom_attach">6</property>
+                            <property name="left_attach">1</property>
+                            <property name="right_attach">2</property>
                           </packing>
                         </child>
                         <child>
-                          <widget class="GtkEntry" id="enMemoryBuffer">
+                          <widget class="GtkLabel" id="label12">
                             <property name="visible">True</property>
-                            <property name="can_focus">True</property>
-                            <property name="text" translatable="yes">102400</property>
+                            <property name="label" translatable="yes">Language:</property>
+                            <property name="justify">GTK_JUSTIFY_RIGHT</property>
                           </widget>
                           <packing>
-                            <property name="left_attach">1</property>
-                            <property name="right_attach">2</property>
+                            <property name="top_attach">5</property>
+                            <property name="bottom_attach">6</property>
                           </packing>
                         </child>
                         <child>
-                          <widget class="GtkEntry" id="enMaxLogFileSize">
+                          <widget class="GtkLabel" id="label11">
                             <property name="visible">True</property>
-                            <property name="can_focus">True</property>
-                            <property name="text" translatable="yes">1048576</property>
+                            <property name="label" translatable="yes">Maximum number of threads:</property>
+                            <property name="justify">GTK_JUSTIFY_RIGHT</property>
                           </widget>
                           <packing>
-                            <property name="left_attach">1</property>
-                            <property name="right_attach">2</property>
-                            <property name="top_attach">2</property>
-                            <property name="bottom_attach">3</property>
+                            <property name="top_attach">4</property>
+                            <property name="bottom_attach">5</property>
                           </packing>
                         </child>
                         <child>
-                          <widget class="GtkEntry" id="enAlwysActiveThreads">
+                          <widget class="GtkLabel" id="label10">
                             <property name="visible">True</property>
-                            <property name="can_focus">True</property>
-                            <property name="text" translatable="yes">5</property>
+                            <property name="label" translatable="yes">Always active threads:</property>
+                            <property name="justify">GTK_JUSTIFY_RIGHT</property>
                           </widget>
                           <packing>
-                            <property name="left_attach">1</property>
-                            <property name="right_attach">2</property>
                             <property name="top_attach">3</property>
                             <property name="bottom_attach">4</property>
                           </packing>
                         </child>
                         <child>
-                          <widget class="GtkEntry" id="enMaximumNumberOfThreads">
+                          <widget class="GtkLabel" id="label9">
                             <property name="visible">True</property>
-                            <property name="can_focus">True</property>
-                            <property name="text" translatable="yes">200</property>
+                            <property name="label" translatable="yes">Max log file size (in bytes):</property>
+                            <property name="justify">GTK_JUSTIFY_RIGHT</property>
                           </widget>
                           <packing>
-                            <property name="left_attach">1</property>
-                            <property name="right_attach">2</property>
-                            <property name="top_attach">4</property>
-                            <property name="bottom_attach">5</property>
+                            <property name="top_attach">2</property>
+                            <property name="bottom_attach">3</property>
                           </packing>
                         </child>
                         <child>
-                          <widget class="GtkComboBox" id="cbVerbosityLevel">
+                          <widget class="GtkLabel" id="label8">
                             <property name="visible">True</property>
-                            <property name="items" translatable="yes">None
-Normal
-Higher
-Highest</property>
+                            <property name="label" translatable="yes">Verbosity level:</property>
+                            <property name="justify">GTK_JUSTIFY_RIGHT</property>
                           </widget>
                           <packing>
-                            <property name="left_attach">1</property>
-                            <property name="right_attach">2</property>
                             <property name="top_attach">1</property>
                             <property name="bottom_attach">2</property>
-                            <property name="y_options"></property>
                           </packing>
                         </child>
                         <child>
-                          <widget class="GtkComboBox" id="combobox2">
+                          <widget class="GtkLabel" id="label7">
                             <property name="visible">True</property>
-                            <property name="items" translatable="yes">german.xml
-itliano.xml
-russian_koi8r.xml
-brazilian.xml
-french.xml
-russian.xml
-english.xml
-romnaa.xml
-spnish.xml
-
-</property>
+                            <property name="label" translatable="yes">Memory buffer (in bytes):</property>
+                            <property name="justify">GTK_JUSTIFY_RIGHT</property>
                           </widget>
-                          <packing>
-                            <property name="left_attach">1</property>
-                            <property name="right_attach">2</property>
-                            <property name="top_attach">5</property>
-                            <property name="bottom_attach">6</property>
-                            <property name="y_options"></property>
-                          </packing>
                         </child>
                       </widget>
                       <packing>
@@ -479,59 +480,50 @@
                           <placeholder/>
                         </child>
                         <child>
-                          <widget class="GtkFileChooserButton" id="filechooserbutton1">
+                          <widget class="GtkLabel" id="label13">
                             <property name="visible">True</property>
-                            <property name="title" translatable="yes">Browse..</property>
-                            <property name="width_chars">7</property>
-                            <signal name="file_set" handler="on_filechooserbutton1_file_set"/>
+                            <property name="label" translatable="yes">Connection time-out (in sec):</property>
                           </widget>
+                        </child>
+                        <child>
+                          <widget class="GtkLabel" id="label14">
+                            <property name="visible">True</property>
+                            <property name="label" translatable="yes">Max connections:</property>
+                          </widget>
                           <packing>
-                            <property name="left_attach">2</property>
-                            <property name="right_attach">3</property>
-                            <property name="top_attach">3</property>
-                            <property name="bottom_attach">4</property>
+                            <property name="top_attach">1</property>
+                            <property name="bottom_attach">2</property>
                           </packing>
                         </child>
                         <child>
-                          <widget class="GtkCheckButton" id="checkbutton1">
+                          <widget class="GtkLabel" id="label15">
                             <property name="visible">True</property>
-                            <property name="can_focus">True</property>
-                            <property name="label" translatable="yes">Personalized error pages:</property>
-                            <property name="use_underline">True</property>
-                            <property name="response_id">0</property>
-                            <property name="draw_indicator">True</property>
+                            <property name="label" translatable="yes">Gzip compression threshold (in bytes):</property>
                           </widget>
                           <packing>
-                            <property name="left_attach">1</property>
-                            <property name="right_attach">2</property>
-                            <property name="top_attach">4</property>
-                            <property name="bottom_attach">5</property>
+                            <property name="top_attach">2</property>
+                            <property name="bottom_attach">3</property>
                           </packing>
                         </child>
                         <child>
-                          <widget class="GtkEntry" id="enStylesheet">
+                          <widget class="GtkLabel" id="label16">
                             <property name="visible">True</property>
-                            <property name="can_focus">True</property>
-                            <property name="text" translatable="yes">/sys/css/browsestyle.css</property>
+                            <property name="label" translatable="yes">Stylesheet</property>
                           </widget>
                           <packing>
-                            <property name="left_attach">1</property>
-                            <property name="right_attach">2</property>
                             <property name="top_attach">3</property>
                             <property name="bottom_attach">4</property>
                           </packing>
                         </child>
                         <child>
-                          <widget class="GtkEntry" id="enGzipCompressionThreshold">
+                          <widget class="GtkEntry" id="enConnectionTimeOut">
                             <property name="visible">True</property>
                             <property name="can_focus">True</property>
-                            <property name="text" translatable="yes">1048576</property>
+                            <property name="text" translatable="yes">60</property>
                           </widget>
                           <packing>
                             <property name="left_attach">1</property>
                             <property name="right_attach">2</property>
-                            <property name="top_attach">2</property>
-                            <property name="bottom_attach">3</property>
                           </packing>
                         </child>
                         <child>
@@ -548,52 +540,61 @@
                           </packing>
                         </child>
                         <child>
-                          <widget class="GtkEntry" id="enConnectionTimeOut">
+                          <widget class="GtkEntry" id="enGzipCompressionThreshold">
                             <property name="visible">True</property>
                             <property name="can_focus">True</property>
-                            <property name="text" translatable="yes">60</property>
+                            <property name="text" translatable="yes">1048576</property>
                           </widget>
                           <packing>
                             <property name="left_attach">1</property>
                             <property name="right_attach">2</property>
+                            <property name="top_attach">2</property>
+                            <property name="bottom_attach">3</property>
                           </packing>
                         </child>
                         <child>
-                          <widget class="GtkLabel" id="label16">
+                          <widget class="GtkEntry" id="enStylesheet">
                             <property name="visible">True</property>
-                            <property name="label" translatable="yes">Stylesheet</property>
+                            <property name="can_focus">True</property>
+                            <property name="text" translatable="yes">/sys/css/browsestyle.css</property>
                           </widget>
                           <packing>
+                            <property name="left_attach">1</property>
+                            <property name="right_attach">2</property>
                             <property name="top_attach">3</property>
                             <property name="bottom_attach">4</property>
                           </packing>
                         </child>
                         <child>
-                          <widget class="GtkLabel" id="label15">
+                          <widget class="GtkCheckButton" id="checkbutton1">
                             <property name="visible">True</property>
-                            <property name="label" translatable="yes">Gzip compression threshold (in bytes):</property>
+                            <property name="can_focus">True</property>
+                            <property name="label" translatable="yes">Personalized error pages:</property>
+                            <property name="use_underline">True</property>
+                            <property name="response_id">0</property>
+                            <property name="draw_indicator">True</property>
                           </widget>
                           <packing>
-                            <property name="top_attach">2</property>
-                            <property name="bottom_attach">3</property>
+                            <property name="left_attach">1</property>
+                            <property name="right_attach">2</property>
+                            <property name="top_attach">4</property>
+                            <property name="bottom_attach">5</property>
                           </packing>
                         </child>
                         <child>
-                          <widget class="GtkLabel" id="label14">
+                          <widget class="GtkFileChooserButton" id="filechooserbutton1">
                             <property name="visible">True</property>
-                            <property name="label" translatable="yes">Max connections:</property>
+                            <property name="title" translatable="yes">Browse..</property>
+                            <property name="width_chars">7</property>
+                            <signal name="file_set" handler="on_filechooserbutton1_file_set"/>
                           </widget>
                           <packing>
-                            <property name="top_attach">1</property>
-                            <property name="bottom_attach">2</property>
+                            <property name="left_attach">2</property>
+                            <property name="right_attach">3</property>
+                            <property name="top_attach">3</property>
+                            <property name="bottom_attach">4</property>
                           </packing>
                         </child>
-                        <child>
-                          <widget class="GtkLabel" id="label13">
-                            <property name="visible">True</property>
-                            <property name="label" translatable="yes">Connection time-out (in sec):</property>
-                          </widget>
-                        </child>
                       </widget>
                     </child>
                     <child>
@@ -609,6 +610,7 @@
                               <widget class="GtkTreeView" id="treeview1">
                                 <property name="visible">True</property>
                                 <property name="can_focus">True</property>
+                                <property name="extension_events">GDK_EXTENSION_EVENTS_CURSOR</property>
                                 <property name="headers_visible">False</property>
                               </widget>
                             </child>
@@ -744,51 +746,51 @@
                           <placeholder/>
                         </child>
                         <child>
-                          <widget class="GtkButton" id="btnAddMIMEType">
+                          <widget class="GtkEntry" id="enManager">
                             <property name="visible">True</property>
                             <property name="can_focus">True</property>
-                            <property name="label">gtk-add</property>
-                            <property name="use_stock">True</property>
-                            <property name="response_id">0</property>
-                            <signal name="clicked" handler="on_btnAddMIMEType_clicked"/>
+                            <property name="text" translatable="yes">NONE</property>
                           </widget>
                           <packing>
                             <property name="left_attach">1</property>
                             <property name="right_attach">2</property>
-                            <property name="top_attach">1</property>
-                            <property name="bottom_attach">2</property>
-                            <property name="x_options"></property>
-                            <property name="y_options"></property>
+                            <property name="top_attach">3</property>
+                            <property name="bottom_attach">4</property>
                           </packing>
                         </child>
                         <child>
-                          <widget class="GtkFileChooserButton" id="filechooserbutton2">
+                          <widget class="GtkLabel" id="label21">
                             <property name="visible">True</property>
-                            <property name="title" translatable="yes">Browse..</property>
-                            <property name="width_chars">7</property>
-                            <signal name="file_set" handler="on_filechooserbutton2_file_set"/>
+                            <property name="label" translatable="yes">Manager:</property>
                           </widget>
                           <packing>
-                            <property name="top_attach">4</property>
-                            <property name="bottom_attach">5</property>
-                            <property name="x_options"></property>
-                            <property name="y_options"></property>
+                            <property name="top_attach">3</property>
+                            <property name="bottom_attach">4</property>
                           </packing>
                         </child>
                         <child>
-                          <widget class="GtkLabel" id="label19">
+                          <widget class="GtkComboBox" id="cbAction">
                             <property name="visible">True</property>
-                            <property name="label" translatable="yes">MIME Type:</property>
-                          </widget>
-                        </child>
-                        <child>
-                          <widget class="GtkComboBox" id="combobox3">
-                            <property name="visible">True</property>
+                            <property name="row_span_column">1</property>
                             <property name="active">0</property>
+                            <property name="items" translatable="yes">Send the file
+URL link
+Run as CGI
+Run as FastCGI
+Run as SCGI
+Run as ISAPI
+Run as MSCGI
+Run as WINCGI
+Execute
+Execute as an ISAPI module
+Execute self contined FastCGI
+Run self contained SCGI</property>
                           </widget>
                           <packing>
                             <property name="left_attach">1</property>
                             <property name="right_attach">2</property>
+                            <property name="top_attach">2</property>
+                            <property name="bottom_attach">3</property>
                             <property name="y_options"></property>
                           </packing>
                         </child>
@@ -803,52 +805,52 @@
                           </packing>
                         </child>
                         <child>
-                          <widget class="GtkComboBox" id="cbAction">
+                          <widget class="GtkComboBox" id="combobox3">
                             <property name="visible">True</property>
-                            <property name="row_span_column">1</property>
                             <property name="active">0</property>
-                            <property name="items" translatable="yes">Send the file
-URL link
-Run as CGI
-Run as FastCGI
-Run as SCGI
-Run as ISAPI
-Run as MSCGI
-Run as WINCGI
-Execute
-Execute as an ISAPI module
-Execute self contined FastCGI
-Run self contained SCGI</property>
                           </widget>
                           <packing>
                             <property name="left_attach">1</property>
                             <property name="right_attach">2</property>
-                            <property name="top_attach">2</property>
-                            <property name="bottom_attach">3</property>
                             <property name="y_options"></property>
                           </packing>
                         </child>
                         <child>
-                          <widget class="GtkLabel" id="label21">
+                          <widget class="GtkLabel" id="label19">
                             <property name="visible">True</property>
-                            <property name="label" translatable="yes">Manager:</property>
+                            <property name="label" translatable="yes">MIME Type:</property>
                           </widget>
+                        </child>
+                        <child>
+                          <widget class="GtkFileChooserButton" id="filechooserbutton2">
+                            <property name="visible">True</property>
+                            <property name="title" translatable="yes">Browse..</property>
+                            <property name="width_chars">7</property>
+                            <signal name="file_set" handler="on_filechooserbutton2_file_set"/>
+                          </widget>
                           <packing>
-                            <property name="top_attach">3</property>
-                            <property name="bottom_attach">4</property>
+                            <property name="top_attach">4</property>
+                            <property name="bottom_attach">5</property>
+                            <property name="x_options"></property>
+                            <property name="y_options"></property>
                           </packing>
                         </child>
                         <child>
-                          <widget class="GtkEntry" id="enManager">
+                          <widget class="GtkButton" id="btnAddMIMEType">
                             <property name="visible">True</property>
                             <property name="can_focus">True</property>
-                            <property name="text" translatable="yes">NONE</property>
+                            <property name="label">gtk-add</property>
+                            <property name="use_stock">True</property>
+                            <property name="response_id">0</property>
+                            <signal name="clicked" handler="on_btnAddMIMEType_clicked"/>
                           </widget>
                           <packing>
                             <property name="left_attach">1</property>
                             <property name="right_attach">2</property>
-                            <property name="top_attach">3</property>
-                            <property name="bottom_attach">4</property>
+                            <property name="top_attach">1</property>
+                            <property name="bottom_attach">2</property>
+                            <property name="x_options"></property>
+                            <property name="y_options"></property>
                           </packing>
                         </child>
                       </widget>
@@ -879,6 +881,7 @@
                       <widget class="GtkHBox" id="hbox4">
                         <property name="height_request">30</property>
                         <property name="visible">True</property>
+                        <property name="homogeneous">True</property>
                         <child>
                           <widget class="GtkVBox" id="vbox13">
                             <property name="visible">True</property>
@@ -975,6 +978,15 @@
                       </packing>
                     </child>
                     <child>
+                      <widget class="GtkHSeparator" id="hseparator1">
+                        <property name="visible">True</property>
+                      </widget>
+                      <packing>
+                        <property name="expand">False</property>
+                        <property name="position">1</property>
+                      </packing>
+                    </child>
+                    <child>
                       <widget class="GtkNotebook" id="notebook2">
                         <property name="visible">True</property>
                         <property name="can_focus">True</property>
@@ -1037,7 +1049,165 @@
                           </packing>
                         </child>
                         <child>
-                          <placeholder/>
+                          <widget class="GtkHBox" id="hbox3">
+                            <property name="visible">True</property>
+                            <child>
+                              <widget class="GtkVBox" id="vbox12">
+                                <property name="visible">True</property>
+                                <child>
+                                  <placeholder/>
+                                </child>
+                                <child>
+                                  <widget class="GtkTreeView" id="treeviewHost">
+                                    <property name="visible">True</property>
+                                    <property name="app_paintable">True</property>
+                                    <property name="can_focus">True</property>
+                                    <property name="headers_clickable">True</property>
+                                  </widget>
+                                  <packing>
+                                    <property name="position">1</property>
+                                  </packing>
+                                </child>
+                                <child>
+                                  <widget class="GtkHBox" id="hbox8">
+                                    <property name="visible">True</property>
+                                    <property name="homogeneous">True</property>
+                                    <child>
+                                      <widget class="GtkButton" id="btnAddHost">
+                                        <property name="visible">True</property>
+                                        <property name="can_focus">True</property>
+                                        <property name="receives_default">True</property>
+                                        <property name="label" translatable="yes">Add..</property>
+                                        <property name="response_id">0</property>
+                                        <signal name="clicked" handler="on_btnAddHost_clicked"/>
+                                      </widget>
+                                      <packing>
+                                        <property name="expand">False</property>
+                                      </packing>
+                                    </child>
+                                    <child>
+                                      <widget class="GtkButton" id="btnRemoveHost">
+                                        <property name="visible">True</property>
+                                        <property name="can_focus">True</property>
+                                        <property name="receives_default">True</property>
+                                        <property name="label" translatable="yes">Remove</property>
+                                        <property name="response_id">0</property>
+                                        <signal name="clicked" handler="on_btnRemoveHost_clicked"/>
+                                      </widget>
+                                      <packing>
+                                        <property name="expand">False</property>
+                                        <property name="position">1</property>
+                                      </packing>
+                                    </child>
+                                  </widget>
+                                  <packing>
+                                    <property name="position">2</property>
+                                  </packing>
+                                </child>
+                              </widget>
+                            </child>
+                            <child>
+                              <widget class="GtkVBox" id="vbox15">
+                                <property name="visible">True</property>
+                                <child>
+                                  <placeholder/>
+                                </child>
+                                <child>
+                                  <widget class="GtkTreeView" id="treeviewIP">
+                                    <property name="visible">True</property>
+                                    <property name="can_focus">True</property>
+                                    <property name="headers_clickable">True</property>
+                                  </widget>
+                                  <packing>
+                                    <property name="position">1</property>
+                                  </packing>
+                                </child>
+                                <child>
+                                  <widget class="GtkHBox" id="hbox9">
+                                    <property name="visible">True</property>
+                                    <property name="homogeneous">True</property>
+                                    <child>
+                                      <widget class="GtkButton" id="btnAddIP">
+                                        <property name="visible">True</property>
+                                        <property name="can_focus">True</property>
+                                        <property name="receives_default">True</property>
+                                        <property name="label" translatable="yes">Add..</property>
+                                        <property name="response_id">0</property>
+                                        <signal name="clicked" handler="on_btnAddIP_clicked"/>
+                                      </widget>
+                                      <packing>
+                                        <property name="expand">False</property>
+                                      </packing>
+                                    </child>
+                                    <child>
+                                      <widget class="GtkButton" id="btnRemoveIP">
+                                        <property name="visible">True</property>
+                                        <property name="can_focus">True</property>
+                                        <property name="receives_default">True</property>
+                                        <property name="label" translatable="yes">Remove</property>
+                                        <property name="response_id">0</property>
+                                        <signal name="clicked" handler="on_btnRemoveIP_clicked"/>
+                                      </widget>
+                                      <packing>
+                                        <property name="expand">False</property>
+                                        <property name="position">1</property>
+                                      </packing>
+                                    </child>
+                                  </widget>
+                                  <packing>
+                                    <property name="position">2</property>
+                                  </packing>
+                                </child>
+                              </widget>
+                              <packing>
+                                <property name="position">1</property>
+                              </packing>
+                            </child>
+                            <child>
+                              <widget class="GtkHBox" id="hbox10">
+                                <property name="visible">True</property>
+                                <child>
+                                  <widget class="GtkVBox" id="vbox16">
+                                    <property name="visible">True</property>
+                                    <child>
+                                      <widget class="GtkLabel" id="label34">
+                                        <property name="visible">True</property>
+                                        <property name="label" translatable="yes">Port:</property>
+                                      </widget>
+                                    </child>
+                                    <child>
+                                      <placeholder/>
+                                    </child>
+                                  </widget>
+                                </child>
+                                <child>
+                                  <widget class="GtkVBox" id="vbox17">
+                                    <property name="visible">True</property>
+                                    <child>
+                                      <widget class="GtkEntry" id="enPortNumber">
+                                        <property name="visible">True</property>
+                                        <property name="can_focus">True</property>
+                                        <property name="max_length">5</property>
+                                        <property name="text" translatable="yes">8080</property>
+                                      </widget>
+                                    </child>
+                                    <child>
+                                      <placeholder/>
+                                    </child>
+                                  </widget>
+                                  <packing>
+                                    <property name="position">1</property>
+                                  </packing>
+                                </child>
+                              </widget>
+                              <packing>
+                                <property name="position">2</property>
+                              </packing>
+                            </child>
+                          </widget>
+                          <packing>
+                            <property name="position">1</property>
+                          </packing>
                         </child>
                         <child>
                           <widget class="GtkLabel" id="label25">
@@ -1051,7 +1221,148 @@
                           </packing>
                         </child>
                         <child>
-                          <placeholder/>
+                          <widget class="GtkVBox" id="vbox18">
+                            <property name="visible">True</property>
+                            <child>
+                              <widget class="GtkLabel" id="label18">
+                                <property name="visible">True</property>
+                                <property name="label" translatable="yes">Enable:</property>
+                              </widget>
+                              <packing>
+                                <property name="expand">False</property>
+                                <property name="fill">False</property>
+                              </packing>
+                            </child>
+                            <child>
+                              <widget class="GtkHBox" id="hbox11">
+                                <property name="visible">True</property>
+                                <child>
+                                  <widget class="GtkVBox" id="vbox19">
+                                    <property name="visible">True</property>
+                                    <child>
+                                      <widget class="GtkCheckButton" id="checkbutton8">
+                                        <property name="visible">True</property>
+                                        <property name="can_focus">True</property>
+                                        <property name="label" translatable="yes">CGI</property>
+                                        <property name="response_id">0</property>
+                                        <property name="draw_indicator">True</property>
+                                      </widget>
+                                    </child>
+                                    <child>
+                                      <widget class="GtkCheckButton" id="checkbutton9">
+                                        <property name="visible">True</property>
+                                        <property name="can_focus">True</property>
+                                        <property name="label" translatable="yes">ISAPI</property>
+                                        <property name="response_id">0</property>
+                                        <property name="draw_indicator">True</property>
+                                      </widget>
+                                      <packing>
+                                        <property name="position">1</property>
+                                      </packing>
+                                    </child>
+                                    <child>
+                                      <widget class="GtkCheckButton" id="checkbutton10">
+                                        <property name="visible">True</property>
+                                        <property name="can_focus">True</property>
+                                        <property name="label" translatable="yes">MSCGI</property>
+                                        <property name="response_id">0</property>
+                                        <property name="draw_indicator">True</property>
+                                      </widget>
+                                      <packing>
+                                        <property name="position">2</property>
+                                      </packing>
+                                    </child>
+                                    <child>
+                                      <widget class="GtkCheckButton" id="checkbutton11">
+                                        <property name="visible">True</property>
+                                        <property name="can_focus">True</property>
+                                        <property name="label" translatable="yes">WINCGI</property>
+                                        <property name="response_id">0</property>
+                                        <property name="draw_indicator">True</property>
+                                      </widget>
+                                      <packing>
+                                        <property name="position">3</property>
+                                      </packing>
+                                    </child>
+                                    <child>
+                                      <widget class="GtkCheckButton" id="checkbutton12">
+                                        <property name="visible">True</property>
+                                        <property name="can_focus">True</property>
+                                        <property name="label" translatable="yes">FASTCGI</property>
+                                        <property name="response_id">0</property>
+                                        <property name="draw_indicator">True</property>
+                                      </widget>
+                                      <packing>
+                                        <property name="position">4</property>
+                                      </packing>
+                                    </child>
+                                  </widget>
+                                </child>
+                                <child>
+                                  <widget class="GtkVBox" id="vbox20">
+                                    <property name="visible">True</property>
+                                    <child>
+                                      <widget class="GtkCheckButton" id="checkbutton13">
+                                        <property name="visible">True</property>
+                                        <property name="can_focus">True</property>
+                                        <property name="label" translatable="yes">SCGI</property>
+                                        <property name="response_id">0</property>
+                                        <property name="draw_indicator">True</property>
+                                      </widget>
+                                    </child>
+                                    <child>
+                                      <widget class="GtkCheckButton" id="checkbutton14">
+                                        <property name="visible">True</property>
+                                        <property name="can_focus">True</property>
+                                        <property name="label" translatable="yes">SEND LINK</property>
+                                        <property name="response_id">0</property>
+                                        <property name="draw_indicator">True</property>
+                                      </widget>
+                                      <packing>
+                                        <property name="position">1</property>
+                                      </packing>
+                                    </child>
+                                    <child>
+                                      <widget class="GtkCheckButton" id="checkbutton15">
+                                        <property name="visible">True</property>
+                                        <property name="can_focus">True</property>
+                                        <property name="label" translatable="yes">EXTERNAL COMMANDS</property>
+                                        <property name="response_id">0</property>
+                                        <property name="draw_indicator">True</property>
+                                      </widget>
+                                      <packing>
+                                        <property name="position">2</property>
+                                      </packing>
+                                    </child>
+                                    <child>
+                                      <widget class="GtkCheckButton" id="checkbutton16">
+                                        <property name="visible">True</property>
+                                        <property name="can_focus">True</property>
+                                        <property name="label" translatable="yes">SEND FILE</property>
+                                        <property name="response_id">0</property>
+                                        <property name="draw_indicator">True</property>
+                                      </widget>
+                                      <packing>
+                                        <property name="position">3</property>
+                                      </packing>
+                                    </child>
+                                    <child>
+                                      <placeholder/>
+                                    </child>
+                                  </widget>
+                                  <packing>
+                                    <property name="position">1</property>
+                                  </packing>
+                                </child>
+                              </widget>
+                              <packing>
+                                <property name="position">1</property>
+                              </packing>
+                            </child>
+                          </widget>
+                          <packing>
+                            <property name="position">2</property>
+                          </packing>
                         </child>
                         <child>
                           <widget class="GtkLabel" id="label26">
@@ -1065,7 +1376,61 @@
                           </packing>
                         </child>
                         <child>
-                          <placeholder/>
+                          <widget class="GtkVBox" id="vbox21">
+                            <property name="visible">True</property>
+                            <child>
+                              <widget class="GtkHBox" id="hbox12">
+                                <property name="visible">True</property>
+                                <child>
+                                  <widget class="GtkLabel" id="label22">
+                                    <property name="visible">True</property>
+                                    <property name="label" translatable="yes">Documment root:</property>
+                                  </widget>
+                                </child>
+                                <child>
+                                  <placeholder/>
+                                </child>
+                                <child>
+                                  <widget class="GtkFileChooserButton" id="filechooserbutton3">
+                                    <property name="visible">True</property>
+                                    <property name="action">GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER</property>
+                                  </widget>
+                                  <packing>
+                                    <property name="position">2</property>
+                                  </packing>
+                                </child>
+                              </widget>
+                            </child>
+                            <child>
+                              <widget class="GtkHBox" id="hbox13">
+                                <property name="visible">True</property>
+                                <child>
+                                  <widget class="GtkLabel" id="label35">
+                                    <property name="visible">True</property>
+                                    <property name="label" translatable="yes">System folder:</property>
+                                  </widget>
+                                </child>
+                                <child>
+                                  <placeholder/>
+                                </child>
+                                <child>
+                                  <widget class="GtkFileChooserButton" id="filechooserbutton4">
+                                    <property name="visible">True</property>
+                                    <property name="action">GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER</property>
+                                  </widget>
+                                  <packing>
+                                    <property name="position">2</property>
+                                  </packing>
+                                </child>
+                              </widget>
+                              <packing>
+                                <property name="position">1</property>
+                              </packing>
+                            </child>
+                          </widget>
+                          <packing>
+                            <property name="position">3</property>
+                          </packing>
                         </child>
                         <child>
                           <widget class="GtkLabel" id="label27">
@@ -1094,7 +1459,7 @@
                         </child>
                       </widget>
                       <packing>
-                        <property name="position">1</property>
+                        <property name="position">2</property>
                       </packing>
                     </child>
                   </widget>
@@ -1122,29 +1487,38 @@
                       <placeholder/>
                     </child>
                     <child>
-                      <widget class="GtkLabel" id="label29">
+                      <widget class="GtkEntry" id="entry12">
                         <property name="visible">True</property>
-                        <property name="label" translatable="yes">Administrtor e-mail:</property>
+                        <property name="can_focus">True</property>
                       </widget>
+                      <packing>
+                        <property name="left_attach">1</property>
+                        <property name="right_attach">2</property>
+                        <property name="top_attach">2</property>
+                        <property name="bottom_attach">3</property>
+                      </packing>
                     </child>
                     <child>
-                      <widget class="GtkLabel" id="label30">
+                      <widget class="GtkEntry" id="entry11">
                         <property name="visible">True</property>
-                        <property name="label" translatable="yes">Administrator user name:</property>
+                        <property name="can_focus">True</property>
                       </widget>
                       <packing>
+                        <property name="left_attach">1</property>
+                        <property name="right_attach">2</property>
                         <property name="top_attach">1</property>
                         <property name="bottom_attach">2</property>
                       </packing>
                     </child>
                     <child>
-                      <widget class="GtkLabel" id="label31">
+                      <widget class="GtkEntry" id="entry10">
                         <property name="visible">True</property>
-                        <property name="label" translatable="yes">Administrtor password:</property>
+                        <property name="can_focus">True</property>
+                        <property name="text" translatable="yes">administrator@localhost</property>
                       </widget>
                       <packing>
-                        <property name="top_attach">2</property>
-                        <property name="bottom_attach">3</property>
+                        <property name="left_attach">1</property>
+                        <property name="right_attach">2</property>
                       </packing>
                     </child>
                     <child>
@@ -1164,39 +1538,30 @@
                       </packing>
                     </child>
                     <child>
-                      <widget class="GtkEntry" id="entry10">
+                      <widget class="GtkLabel" id="label31">
                         <property name="visible">True</property>
-                        <property name="can_focus">True</property>
-                        <property name="text" translatable="yes">administrator@localhost</property>
+                        <property name="label" translatable="yes">Administrtor password:</property>
                       </widget>
                       <packing>
-                        <property name="left_attach">1</property>
-                        <property name="right_attach">2</property>
+                        <property name="top_attach">2</property>
+                        <property name="bottom_attach">3</property>
                       </packing>
                     </child>
                     <child>
-                      <widget class="GtkEntry" id="entry11">
+                      <widget class="GtkLabel" id="label30">
                         <property name="visible">True</property>
-                        <property name="can_focus">True</property>
+                        <property name="label" translatable="yes">Administrator user name:</property>
                       </widget>
                       <packing>
-                        <property name="left_attach">1</property>
-                        <property name="right_attach">2</property>
                         <property name="top_attach">1</property>
                         <property name="bottom_attach">2</property>
                       </packing>
                     </child>
                     <child>
-                      <widget class="GtkEntry" id="entry12">
+                      <widget class="GtkLabel" id="label29">
                         <property name="visible">True</property>
-                        <property name="can_focus">True</property>
+                        <property name="label" translatable="yes">Administrtor e-mail:</property>
                       </widget>
-                      <packing>
-                        <property name="left_attach">1</property>
-                        <property name="right_attach">2</property>
-                        <property name="top_attach">2</property>
-                        <property name="bottom_attach">3</property>
-                      </packing>
                     </child>
                   </widget>
                   <packing>





From MAILER-DAEMON Sat Oct 25 11:41:29 2008
Received: from mailman by lists.gnu.org with archive (Exim 4.43)
	id 1KtlGb-0001Ve-Hx
	for mharc-myserver-commit@gnu.org; Sat, 25 Oct 2008 11:41:29 -0400
Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43)
	id 1KtlGY-0001Tw-UO
	for myserver-commit@gnu.org; Sat, 25 Oct 2008 11:41:27 -0400
Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43)
	id 1KtlGY-0001T1-1Y
	for myserver-commit@gnu.org; Sat, 25 Oct 2008 11:41:26 -0400
Received: from [199.232.76.173] (port=51178 helo=monty-python.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.43) id 1KtlGX-0001Sp-O5
	for myserver-commit@gnu.org; Sat, 25 Oct 2008 11:41:25 -0400
Received: from savannah.gnu.org ([199.232.41.3]:48692 helo=sv.gnu.org)
	by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32)
	(Exim 4.60) (envelope-from <INVALID.NOREPLY@gnu.org>)
	id 1KtlGX-0005Mi-Gs
	for myserver-commit@gnu.org; Sat, 25 Oct 2008 11:41:25 -0400
Received: from cvs.savannah.gnu.org ([199.232.41.69])
	by sv.gnu.org with esmtp (Exim 4.63)
	(envelope-from <INVALID.NOREPLY@gnu.org>) id 1KtlGW-0003Z3-MS
	for myserver-commit@gnu.org; Sat, 25 Oct 2008 15:41:24 +0000
Received: from ignacy by cvs.savannah.gnu.org with local (Exim 4.63)
	(envelope-from <ignacy@savannah.gnu.org>) id 1KtlGW-0003Yz-E4
	for myserver-commit@gnu.org; Sat, 25 Oct 2008 15:41:24 +0000
MIME-Version: 1.0
Errors-To: ignacy
To: myserver-commit@gnu.org
X-Mailer: SVN::Notify 2.64: http://search.cpan.org/dist/SVN-Notify/
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
From: Ignacy Moryc <imoryc@gmail.com>
Message-Id: <E1KtlGW-0003Yz-E4@cvs.savannah.gnu.org>
Date: Sat, 25 Oct 2008 15:41:24 +0000
X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 3)
Subject: [myserver-commit] [2904] Added Host/Protocol tab
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/pipermail/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, 25 Oct 2008 15:41:27 -0000

Revision: 2904
          http://svn.sv.gnu.org/viewvc/?view=rev&root=myserver&revision=2904
Author:   ignacy
Date:     2008-10-25 15:41:23 +0000 (Sat, 25 Oct 2008)

Log Message:
-----------
Added Host/Protocol tab

Modified Paths:
--------------
    trunk/misc/PyGTK_Control/XMLGui.glade

Modified: trunk/misc/PyGTK_Control/XMLGui.glade
===================================================================
--- trunk/misc/PyGTK_Control/XMLGui.glade	2008-10-25 13:52:49 UTC (rev 2903)
+++ trunk/misc/PyGTK_Control/XMLGui.glade	2008-10-25 15:41:23 UTC (rev 2904)
@@ -144,14 +144,6 @@
                             <property name="use_stock">True</property>
                           </widget>
                         </child>
-                        <child>
-                          <widget class="GtkImageMenuItem" id="imagemenuitem4">
-                            <property name="visible">True</property>
-                            <property name="label">gtk-open</property>
-                            <property name="use_underline">True</property>
-                            <property name="use_stock">True</property>
-                          </widget>
-                        </child>
                       </widget>
                     </child>
                   </widget>
@@ -991,51 +983,115 @@
                         <property name="visible">True</property>
                         <property name="can_focus">True</property>
                         <child>
-                          <widget class="GtkVBox" id="vbox9">
+                          <widget class="GtkVBox" id="vbox22">
                             <property name="visible">True</property>
                             <child>
-                              <widget class="GtkHBox" id="hbox6">
+                              <widget class="GtkHBox" id="hbox14">
                                 <property name="visible">True</property>
+                                <property name="homogeneous">True</property>
                                 <child>
-                                  <widget class="GtkLabel" id="label32">
+                                  <widget class="GtkLabel" id="label36">
                                     <property name="visible">True</property>
-                                    <property name="label" translatable="yes">Accesses log file:</property>
+                                    <property name="label" translatable="yes">Protocol:</property>
                                   </widget>
                                 </child>
                                 <child>
-                                  <widget class="GtkEntry" id="entry13">
+                                  <widget class="GtkComboBox" id="ddProtocol">
                                     <property name="visible">True</property>
-                                    <property name="can_focus">True</property>
+                                    <property name="items">HTTP
+FTP
+</property>
                                   </widget>
                                   <packing>
                                     <property name="position">1</property>
                                   </packing>
                                 </child>
+                                <child>
+                                  <placeholder/>
+                                </child>
                               </widget>
                             </child>
                             <child>
-                              <widget class="GtkHBox" id="hbox7">
+                              <widget class="GtkHBox" id="hbox15">
                                 <property name="visible">True</property>
+                                <property name="homogeneous">True</property>
                                 <child>
-                                  <widget class="GtkLabel" id="label33">
+                                  <widget class="GtkLabel" id="label37">
                                     <property name="visible">True</property>
-                                    <property name="label" translatable="yes">Wrning log file:</property>
+                                    <property name="label" translatable="yes">SSL Private Key:</property>
                                   </widget>
                                 </child>
                                 <child>
-                                  <widget class="GtkEntry" id="entry14">
+                                  <widget class="GtkFileChooserButton" id="filechooserbutton5">
                                     <property name="visible">True</property>
-                                    <property name="can_focus">True</property>
+                                    <property name="preview_widget_active">False</property>
                                   </widget>
                                   <packing>
                                     <property name="position">1</property>
                                   </packing>
                                 </child>
+                                <child>
+                                  <placeholder/>
+                                </child>
                               </widget>
                               <packing>
                                 <property name="position">1</property>
                               </packing>
                             </child>
+                            <child>
+                              <widget class="GtkHBox" id="hbox16">
+                                <property name="visible">True</property>
+                                <property name="homogeneous">True</property>
+                                <child>
+                                  <widget class="GtkLabel" id="label38">
+                                    <property name="visible">True</property>
+                                    <property name="label" translatable="yes">SSL Certyfikate:</property>
+                                  </widget>
+                                </child>
+                                <child>
+                                  <widget class="GtkFileChooserButton" id="filechooserbutton6">
+                                    <property name="visible">True</property>
+                                    <property name="preview_widget_active">False</property>
+                                  </widget>
+                                  <packing>
+                                    <property name="position">1</property>
+                                  </packing>
+                                </child>
+                                <child>
+                                  <placeholder/>
+                                </child>
+                              </widget>
+                              <packing>
+                                <property name="position">2</property>
+                              </packing>
+                            </child>
+                            <child>
+                              <widget class="GtkHBox" id="hbox17">
+                                <property name="visible">True</property>
+                                <property name="homogeneous">True</property>
+                                <child>
+                                  <widget class="GtkLabel" id="label39">
+                                    <property name="visible">True</property>
+                                    <property name="label" translatable="yes">SSL Password:</property>
+                                  </widget>
+                                </child>
+                                <child>
+                                  <widget class="GtkEntry" id="enPassword">
+                                    <property name="visible">True</property>
+                                    <property name="can_focus">True</property>
+                                  </widget>
+                                  <packing>
+                                    <property name="position">1</property>
+                                  </packing>
+                                </child>
+                                <child>
+                                  <placeholder/>
+                                </child>
+                              </widget>
+                              <packing>
+                                <property name="position">3</property>
+                              </packing>
+                            </child>
                           </widget>
                         </child>
                         <child>
@@ -1444,7 +1500,55 @@
                           </packing>
                         </child>
                         <child>
-                          <placeholder/>
+                          <widget class="GtkVBox" id="vbox9">
+                            <property name="visible">True</property>
+                            <child>
+                              <widget class="GtkHBox" id="hbox6">
+                                <property name="visible">True</property>
+                                <child>
+                                  <widget class="GtkLabel" id="label32">
+                                    <property name="visible">True</property>
+                                    <property name="label" translatable="yes">Accesses log file:</property>
+                                  </widget>
+                                </child>
+                                <child>
+                                  <widget class="GtkEntry" id="entry13">
+                                    <property name="visible">True</property>
+                                    <property name="can_focus">True</property>
+                                  </widget>
+                                  <packing>
+                                    <property name="position">1</property>
+                                  </packing>
+                                </child>
+                              </widget>
+                            </child>
+                            <child>
+                              <widget class="GtkHBox" id="hbox7">
+                                <property name="visible">True</property>
+                                <child>
+                                  <widget class="GtkLabel" id="label33">
+                                    <property name="visible">True</property>
+                                    <property name="label" translatable="yes">Wrning log file:</property>
+                                  </widget>
+                                </child>
+                                <child>
+                                  <widget class="GtkEntry" id="entry14">
+                                    <property name="visible">True</property>
+                                    <property name="can_focus">True</property>
+                                  </widget>
+                                  <packing>
+                                    <property name="position">1</property>
+                                  </packing>
+                                </child>
+                              </widget>
+                              <packing>
+                                <property name="position">1</property>
+                              </packing>
+                            </child>
+                          </widget>
+                          <packing>
+                            <property name="position">4</property>
+                          </packing>
                         </child>
                         <child>
                           <widget class="GtkLabel" id="label28">





From MAILER-DAEMON Sat Oct 25 13:35:53 2008
Received: from mailman by lists.gnu.org with archive (Exim 4.43)
	id 1Ktn3J-0001zW-2E
	for mharc-myserver-commit@gnu.org; Sat, 25 Oct 2008 13:35:53 -0400
Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43)
	id 1Ktn3H-0001yv-MB
	for myserver-commit@gnu.org; Sat, 25 Oct 2008 13:35:51 -0400
Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43)
	id 1Ktn3G-0001yA-8O
	for myserver-commit@gnu.org; Sat, 25 Oct 2008 13:35:51 -0400
Received: from [199.232.76.173] (port=45506 helo=monty-python.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.43) id 1Ktn3G-0001y7-0V
	for myserver-commit@gnu.org; Sat, 25 Oct 2008 13:35:50 -0400
Received: from savannah.gnu.org ([199.232.41.3]:57441 helo=sv.gnu.org)
	by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32)
	(Exim 4.60) (envelope-from <INVALID.NOREPLY@gnu.org>)
	id 1Ktn3G-00062M-3W
	for myserver-commit@gnu.org; Sat, 25 Oct 2008 13:35:50 -0400
Received: from cvs.savannah.gnu.org ([199.232.41.69])
	by sv.gnu.org with esmtp (Exim 4.63)
	(envelope-from <INVALID.NOREPLY@gnu.org>) id 1Ktn3F-0004hC-7L
	for myserver-commit@gnu.org; Sat, 25 Oct 2008 17:35:49 +0000
Received: from gscrivano by cvs.savannah.gnu.org with local (Exim 4.63)
	(envelope-from <gscrivano@savannah.gnu.org>) id 1Ktn3E-0004h8-Uq
	for myserver-commit@gnu.org; Sat, 25 Oct 2008 17:35:49 +0000
MIME-Version: 1.0
Errors-To: gscrivano
To: myserver-commit@gnu.org
X-Mailer: SVN::Notify 2.64: http://search.cpan.org/dist/SVN-Notify/
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
From: Giuseppe Scrivano <gscrivano@gnu.org>
Message-Id: <E1Ktn3E-0004h8-Uq@cvs.savannah.gnu.org>
Date: Sat, 25 Oct 2008 17:35:48 +0000
X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 3)
Subject: [myserver-commit] [2905] Fixed typo.
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/pipermail/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, 25 Oct 2008 17:35:52 -0000

Revision: 2905
          http://svn.sv.gnu.org/viewvc/?view=rev&root=myserver&revision=2905
Author:   gscrivano
Date:     2008-10-25 17:35:48 +0000 (Sat, 25 Oct 2008)

Log Message:
-----------
Fixed typo.

Modified Paths:
--------------
    trunk/myserver/binaries/web/default.html

Modified: trunk/myserver/binaries/web/default.html
===================================================================
--- trunk/myserver/binaries/web/default.html	2008-10-25 15:41:23 UTC (rev 2904)
+++ trunk/myserver/binaries/web/default.html	2008-10-25 17:35:48 UTC (rev 2905)
@@ -45,8 +45,9 @@
 <br /><br />
 
 <div style="position: absolute; bottom: 30px; text-align: center; width:99%">
-If you report errors during the usage or need any please please register in our
-forum or use the mailing lists to post your messages.
+Please report any problem you may encounter with GNU MyServer to
+the <a href="mailto:bug-myserver@gnu.org">bug-myserver@gnu.org</a>
+mailing list.
 </div>
 <br />
 </body>





From MAILER-DAEMON Sat Oct 25 17:54:50 2008
Received: from mailman by lists.gnu.org with archive (Exim 4.43)
	id 1Ktr5u-0004I9-AY
	for mharc-myserver-commit@gnu.org; Sat, 25 Oct 2008 17:54:50 -0400
Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43)
	id 1Ktr5r-0004H8-F0
	for myserver-commit@gnu.org; Sat, 25 Oct 2008 17:54:47 -0400
Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43)
	id 1Ktr5q-0004Gj-0r
	for myserver-commit@gnu.org; Sat, 25 Oct 2008 17:54:46 -0400
Received: from [199.232.76.173] (port=42774 helo=monty-python.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.43) id 1Ktr5p-0004Gg-O8
	for myserver-commit@gnu.org; Sat, 25 Oct 2008 17:54:45 -0400
Received: from savannah.gnu.org ([199.232.41.3]:54871 helo=sv.gnu.org)
	by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32)
	(Exim 4.60) (envelope-from <INVALID.NOREPLY@gnu.org>)
	id 1Ktr5o-0007U8-HO
	for myserver-commit@gnu.org; Sat, 25 Oct 2008 17:54:45 -0400
Received: from cvs.savannah.gnu.org ([199.232.41.69])
	by sv.gnu.org with esmtp (Exim 4.63)
	(envelope-from <INVALID.NOREPLY@gnu.org>) id 1KtqvV-0001UC-PL
	for myserver-commit@gnu.org; Sat, 25 Oct 2008 21:44:05 +0000
Received: from ignacy by cvs.savannah.gnu.org with local (Exim 4.63)
	(envelope-from <ignacy@savannah.gnu.org>) id 1KtqvV-0001U8-DQ
	for myserver-commit@gnu.org; Sat, 25 Oct 2008 21:44:05 +0000
MIME-Version: 1.0
Errors-To: ignacy
To: myserver-commit@gnu.org
X-Mailer: SVN::Notify 2.64: http://search.cpan.org/dist/SVN-Notify/
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
From: Ignacy Moryc <imoryc@gmail.com>
Message-Id: <E1KtqvV-0001U8-DQ@cvs.savannah.gnu.org>
Date: Sat, 25 Oct 2008 21:44:05 +0000
X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 3)
Subject: [myserver-commit] [2906] Refactoring methods creating widgets
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/pipermail/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, 25 Oct 2008 21:54:48 -0000

Revision: 2906
          http://svn.sv.gnu.org/viewvc/?view=rev&root=myserver&revision=2906
Author:   ignacy
Date:     2008-10-25 21:44:04 +0000 (Sat, 25 Oct 2008)

Log Message:
-----------
Refactoring methods creating widgets

Modified Paths:
--------------
    trunk/misc/PyGTK_Control/ConfigGUI.py

Modified: trunk/misc/PyGTK_Control/ConfigGUI.py
===================================================================
--- trunk/misc/PyGTK_Control/ConfigGUI.py	2008-10-25 17:35:48 UTC (rev 2905)
+++ trunk/misc/PyGTK_Control/ConfigGUI.py	2008-10-25 21:44:04 UTC (rev 2906)
@@ -1,3 +1,5 @@
+#!/usr/bin/env python
+
 # MyServer
 # Copyright (C) 2002, 2003, 2004, 2007, 2008 The MyServer Team
 # This program is free software; you can redistribute it and/or modify
@@ -44,7 +46,16 @@
         if (self.window):
             self.window.connect("destroy", gtk.main_quit)
 
-        # Create treeview widget structure (one column) for default filenames
+        # Here we call the methods creating widgets with functionality
+        self.create_treeview_for_default_filenames
+        self.create_treeview_for_host_names
+        self.create_treeview_for_IP_addresses
+        self.create_a_combobox_for_connection_types
+        self.create_treeview_with_MIME_types
+        self.bind_signals
+
+    def create_treeview_for_default_filenames(self):
+        """ Create treeview widget structure (one column) for default filenames """
         self.treeview=self.wTree.get_widget("treeview1")
         self.treemodel=gtk.TreeStore(gobject.TYPE_STRING)
         self.treeview.set_model(self.treemodel)
@@ -66,7 +77,8 @@
 
         self.treeview.show()
 
-        # Create treeview widget structure (one column) for host names
+    def create_treeview_for_host_names(self):
+        """ Create treeview widget structure (one column) for host names """
         self.treeviewHost=self.wTree.get_widget("treeviewHost")
         self.treemodelHost=gtk.TreeStore(gobject.TYPE_STRING)
         self.treeviewHost.set_model(self.treemodelHost)
@@ -78,7 +90,8 @@
         renderer=gtk.CellRendererText()
         self.treeviewHost.show()
 
-        # Create treeview widget structure (one column) for IP addresses
+    def create_treeview_for_IP_addresses(self):
+        """ Create treeview widget structure (one column) for IP addresses """
         self.treeviewIP=self.wTree.get_widget("treeviewIP")
         self.treemodelIP=gtk.TreeStore(gobject.TYPE_STRING)
         self.treeviewIP.set_model(self.treemodelIP)
@@ -90,8 +103,8 @@
         renderer=gtk.CellRendererText()
         self.treeviewIP.show()
 
-
-
+    def create_a_combobox_for_connection_types(self):
+        """ Cretes a combobox with connection types """
         self.store2 = gtk.ListStore(gobject.TYPE_STRING)
         #populate
         self.store2.append(["Every HTTP connection"])
@@ -102,9 +115,10 @@
         self.cbHost.pack_start(cell, True)
         self.cbHost.add_attribute(cell, 'text',0)
 
-        # Add list items to tree view
-        # this types are parsed from xml file using helper class MIMEtpe
-        # the result is used to poulate the treeview and the combobox
+    def create_treeview_with_MIME_types(self):
+        """ Add list items to tree view. The types are parsed
+        from xml file using helper class MIMEtpe
+        the result is used to poulate the treeview and the combobox """
 
         from MIMEtypes import MIMEtype, ParseTypes
         TYPES = ParseTypes("MIMEtypes.xml")
@@ -138,41 +152,42 @@
             self.insert_row(self.treemodelEXT,None,element.ext)
         self.treeviewEXT.show()
 
+    def bind_signals(self):
+        """ This method creates a dictionary of pairs
+        signal naem : event, and then binds them
+        using signal_autoconnect method """
 
-        # dic - dictionary with pairs:
-        #        "signal name" : event
         dic = { "on_btnAddFileName_clicked" : \
-                    self.buttonAddefaultFileName_clicked,
+                self.buttonAddefaultFileName_clicked,
                 "on_btnRemoveFileName_clicked" : \
-                    self.buttonRemoveDefultFileName_clicked,
+                self.buttonRemoveDefultFileName_clicked,
                 "on_btnAddMIMEExtenesion_clicked" : \
-                    self.buttonAddMIMEExtension_clicked,
+                self.buttonAddMIMEExtension_clicked,
                 "on_btnAddMIMEType_clicked" : \
-                    self.buttonAddMIMEType_clicked,
+                self.buttonAddMIMEType_clicked,
                 "on_filechooserbutton2_file_set" : \
-                    self.filechooserbutton2_file_set,
+                self.filechooserbutton2_file_set,
                 "on_filechooserbutton1_file_set" : \
-                    self.filechooserbutton1_file_set,
+                self.filechooserbutton1_file_set,
                 "on_filechooserbutton4_file_set" : \
-                    self.filechooserbutton4_file_set,
+                self.filechooserbutton4_file_set,
                 "on_filechooserbutton3_file_set" : \
-                    self.filechooserbutton3_file_set,
+                self.filechooserbutton3_file_set,
                 "on_btnRemoveMIMEExtension_clicked" : \
-                    self.buttonRemoveMIMEExtension_clicked,
+                self.buttonRemoveMIMEExtension_clicked,
                 "on_btnAddHostName_clicked" : \
-                    self.buttonAddHostName_clicked,
+                self.buttonAddHostName_clicked,
                 "on_btnRemoveHostName_clicked" : \
-                    self.buttonRemoveHostName_clicked,
+                self.buttonRemoveHostName_clicked,
                 "on_btnAddHost_clicked" : \
-                    self.btnAddHost_clicked,
+                self.btnAddHost_clicked,
                 "on_btnAddIP_clicked" : \
-                    self.btnAddIP_clicked,
+                self.btnAddIP_clicked,
                 "on_btnRemoveHost_clicked" : \
-                    self.btnRemoveHost_clicked,
+                self.btnRemoveHost_clicked,
                 "on_btnRemoveIP_clicked" : \
-                    self.btnRemoveIP_clicked
+                self.btnRemoveIP_clicked
                 }
-
         # Connect signals
         self.wTree.signal_autoconnect (dic)
 





From MAILER-DAEMON Sun Oct 26 04:28:48 2008
Received: from mailman by lists.gnu.org with archive (Exim 4.43)
	id 1Ku0zQ-0005rZ-7Y
	for mharc-myserver-commit@gnu.org; Sun, 26 Oct 2008 04:28:48 -0400
Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43)
	id 1Ku0zN-0005q6-PI
	for myserver-commit@gnu.org; Sun, 26 Oct 2008 04:28:46 -0400
Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43)
	id 1Ku0zL-0005ou-78
	for myserver-commit@gnu.org; Sun, 26 Oct 2008 04:28:44 -0400
Received: from [199.232.76.173] (port=43136 helo=monty-python.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.43) id 1Ku0zL-0005on-0h
	for myserver-commit@gnu.org; Sun, 26 Oct 2008 04:28:43 -0400
Received: from savannah.gnu.org ([199.232.41.3]:35838 helo=sv.gnu.org)
	by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32)
	(Exim 4.60) (envelope-from <INVALID.NOREPLY@gnu.org>)
	id 1Ku0zJ-0003H5-NV
	for myserver-commit@gnu.org; Sun, 26 Oct 2008 04:28:42 -0400
Received: from cvs.savannah.gnu.org ([199.232.41.69])
	by sv.gnu.org with esmtp (Exim 4.63)
	(envelope-from <INVALID.NOREPLY@gnu.org>) id 1Ku0zI-0000jS-IQ
	for myserver-commit@gnu.org; Sun, 26 Oct 2008 08:28:40 +0000
Received: from ignacy by cvs.savannah.gnu.org with local (Exim 4.63)
	(envelope-from <ignacy@savannah.gnu.org>) id 1Ku0zI-0000jL-74
	for myserver-commit@gnu.org; Sun, 26 Oct 2008 08:28:40 +0000
MIME-Version: 1.0
Errors-To: ignacy
To: myserver-commit@gnu.org
X-Mailer: SVN::Notify 2.64: http://search.cpan.org/dist/SVN-Notify/
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
From: Ignacy Moryc <imoryc@gmail.com>
Message-Id: <E1Ku0zI-0000jL-74@cvs.savannah.gnu.org>
Date: Sun, 26 Oct 2008 08:28:40 +0000
X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 3)
Subject: [myserver-commit] [2907] Moved things a bit
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/pipermail/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, 26 Oct 2008 08:28:46 -0000

Revision: 2907
          http://svn.sv.gnu.org/viewvc/?view=rev&root=myserver&revision=2907
Author:   ignacy
Date:     2008-10-26 08:28:39 +0000 (Sun, 26 Oct 2008)

Log Message:
-----------
Moved things a bit

Modified Paths:
--------------
    trunk/misc/PyGTK_Control/ConfigGUI.py
    trunk/misc/PyGTK_Control/XMLGui.glade

Modified: trunk/misc/PyGTK_Control/ConfigGUI.py
===================================================================
--- trunk/misc/PyGTK_Control/ConfigGUI.py	2008-10-25 21:44:04 UTC (rev 2906)
+++ trunk/misc/PyGTK_Control/ConfigGUI.py	2008-10-26 08:28:39 UTC (rev 2907)
@@ -37,8 +37,8 @@
     def __init__(self):
 
         # Connect the Glade file
-        self.gladefile = "XMLGui.glade"
-        self.wTree = gtk.glade.XML(self.gladefile)
+        gladefile = "XMLGui.glade"
+        self.wTree = gtk.glade.XML(gladefile)
 
         # Bind main window
         self.window = self.wTree.get_widget("ConfigUI")
@@ -47,12 +47,12 @@
             self.window.connect("destroy", gtk.main_quit)
 
         # Here we call the methods creating widgets with functionality
-        self.create_treeview_for_default_filenames
-        self.create_treeview_for_host_names
-        self.create_treeview_for_IP_addresses
-        self.create_a_combobox_for_connection_types
-        self.create_treeview_with_MIME_types
-        self.bind_signals
+        self.create_treeview_for_default_filenames()
+        self.create_treeview_for_host_names()
+        self.create_treeview_for_IP_addresses()
+        self.create_a_combobox_for_connection_types()
+        self.create_treeview_with_MIME_types()
+        self.bind_signals()
 
     def create_treeview_for_default_filenames(self):
         """ Create treeview widget structure (one column) for default filenames """
@@ -287,6 +287,13 @@
         dia.destroy()
         return name
 
+    def run(self):
+        gtk.main()
+
+def main():
+    app = ConfigGUIGTK()
+    app.run()
+
 if __name__ == "__main__":
-    ConfigUI = ConfigGUIGTK()
-    gtk.main()
+    main()
+

Modified: trunk/misc/PyGTK_Control/XMLGui.glade
===================================================================
--- trunk/misc/PyGTK_Control/XMLGui.glade	2008-10-25 21:44:04 UTC (rev 2906)
+++ trunk/misc/PyGTK_Control/XMLGui.glade	2008-10-26 08:28:39 UTC (rev 2907)
@@ -5,6 +5,7 @@
   <widget class="GtkWindow" id="ConfigUI">
     <property name="visible">True</property>
     <property name="title" translatable="yes">Myserver configuration tool</property>
+    <property name="resizable">False</property>
     <property name="icon">MyServer Configure.ico</property>
     <child>
       <widget class="GtkVBox" id="vbox1">
@@ -280,155 +281,155 @@
                         <property name="n_rows">6</property>
                         <property name="n_columns">2</property>
                         <child>
-                          <widget class="GtkComboBox" id="combobox2">
+                          <widget class="GtkLabel" id="label7">
                             <property name="visible">True</property>
-                            <property name="items" translatable="yes">german.xml
-itliano.xml
-russian_koi8r.xml
-brazilian.xml
-french.xml
-russian.xml
-english.xml
-romnaa.xml
-spnish.xml
-
-</property>
+                            <property name="label" translatable="yes">Memory buffer (in bytes):</property>
+                            <property name="justify">GTK_JUSTIFY_RIGHT</property>
                           </widget>
-                          <packing>
-                            <property name="left_attach">1</property>
-                            <property name="right_attach">2</property>
-                            <property name="top_attach">5</property>
-                            <property name="bottom_attach">6</property>
-                            <property name="y_options"></property>
-                          </packing>
                         </child>
                         <child>
-                          <widget class="GtkComboBox" id="cbVerbosityLevel">
+                          <widget class="GtkLabel" id="label8">
                             <property name="visible">True</property>
-                            <property name="items" translatable="yes">None
-Normal
-Higher
-Highest</property>
+                            <property name="label" translatable="yes">Verbosity level:</property>
+                            <property name="justify">GTK_JUSTIFY_RIGHT</property>
                           </widget>
                           <packing>
-                            <property name="left_attach">1</property>
-                            <property name="right_attach">2</property>
                             <property name="top_attach">1</property>
                             <property name="bottom_attach">2</property>
-                            <property name="y_options"></property>
                           </packing>
                         </child>
                         <child>
-                          <widget class="GtkEntry" id="enMaximumNumberOfThreads">
+                          <widget class="GtkLabel" id="label9">
                             <property name="visible">True</property>
-                            <property name="can_focus">True</property>
-                            <property name="text" translatable="yes">200</property>
+                            <property name="label" translatable="yes">Max log file size (in bytes):</property>
+                            <property name="justify">GTK_JUSTIFY_RIGHT</property>
                           </widget>
                           <packing>
-                            <property name="left_attach">1</property>
-                            <property name="right_attach">2</property>
-                            <property name="top_attach">4</property>
-                            <property name="bottom_attach">5</property>
+                            <property name="top_attach">2</property>
+                            <property name="bottom_attach">3</property>
                           </packing>
                         </child>
                         <child>
-                          <widget class="GtkEntry" id="enAlwysActiveThreads">
+                          <widget class="GtkLabel" id="label10">
                             <property name="visible">True</property>
-                            <property name="can_focus">True</property>
-                            <property name="text" translatable="yes">5</property>
+                            <property name="label" translatable="yes">Always active threads:</property>
+                            <property name="justify">GTK_JUSTIFY_RIGHT</property>
                           </widget>
                           <packing>
-                            <property name="left_attach">1</property>
-                            <property name="right_attach">2</property>
                             <property name="top_attach">3</property>
                             <property name="bottom_attach">4</property>
                           </packing>
                         </child>
                         <child>
-                          <widget class="GtkEntry" id="enMaxLogFileSize">
+                          <widget class="GtkLabel" id="label11">
                             <property name="visible">True</property>
-                            <property name="can_focus">True</property>
-                            <property name="text" translatable="yes">1048576</property>
+                            <property name="label" translatable="yes">Maximum number of threads:</property>
+                            <property name="justify">GTK_JUSTIFY_RIGHT</property>
                           </widget>
                           <packing>
-                            <property name="left_attach">1</property>
-                            <property name="right_attach">2</property>
-                            <property name="top_attach">2</property>
-                            <property name="bottom_attach">3</property>
+                            <property name="top_attach">4</property>
+                            <property name="bottom_attach">5</property>
                           </packing>
                         </child>
                         <child>
-                          <widget class="GtkEntry" id="enMemoryBuffer">
+                          <widget class="GtkLabel" id="label12">
                             <property name="visible">True</property>
-                            <property name="can_focus">True</property>
-                            <property name="text" translatable="yes">102400</property>
+                            <property name="label" translatable="yes">Language:</property>
+                            <property name="justify">GTK_JUSTIFY_RIGHT</property>
                           </widget>
                           <packing>
-                            <property name="left_attach">1</property>
-                            <property name="right_attach">2</property>
+                            <property name="top_attach">5</property>
+                            <property name="bottom_attach">6</property>
                           </packing>
                         </child>
                         <child>
-                          <widget class="GtkLabel" id="label12">
+                          <widget class="GtkEntry" id="enMemoryBuffer">
                             <property name="visible">True</property>
-                            <property name="label" translatable="yes">Language:</property>
-                            <property name="justify">GTK_JUSTIFY_RIGHT</property>
+                            <property name="can_focus">True</property>
+                            <property name="text" translatable="yes">102400</property>
                           </widget>
                           <packing>
-                            <property name="top_attach">5</property>
-                            <property name="bottom_attach">6</property>
+                            <property name="left_attach">1</property>
+                            <property name="right_attach">2</property>
                           </packing>
                         </child>
                         <child>
-                          <widget class="GtkLabel" id="label11">
+                          <widget class="GtkEntry" id="enMaxLogFileSize">
                             <property name="visible">True</property>
-                            <property name="label" translatable="yes">Maximum number of threads:</property>
-                            <property name="justify">GTK_JUSTIFY_RIGHT</property>
+                            <property name="can_focus">True</property>
+                            <property name="text" translatable="yes">1048576</property>
                           </widget>
                           <packing>
-                            <property name="top_attach">4</property>
-                            <property name="bottom_attach">5</property>
+                            <property name="left_attach">1</property>
+                            <property name="right_attach">2</property>
+                            <property name="top_attach">2</property>
+                            <property name="bottom_attach">3</property>
                           </packing>
                         </child>
                         <child>
-                          <widget class="GtkLabel" id="label10">
+                          <widget class="GtkEntry" id="enAlwysActiveThreads">
                             <property name="visible">True</property>
-                            <property name="label" translatable="yes">Always active threads:</property>
-                            <property name="justify">GTK_JUSTIFY_RIGHT</property>
+                            <property name="can_focus">True</property>
+                            <property name="text" translatable="yes">5</property>
                           </widget>
                           <packing>
+                            <property name="left_attach">1</property>
+                            <property name="right_attach">2</property>
                             <property name="top_attach">3</property>
                             <property name="bottom_attach">4</property>
                           </packing>
                         </child>
                         <child>
-                          <widget class="GtkLabel" id="label9">
+                          <widget class="GtkEntry" id="enMaximumNumberOfThreads">
                             <property name="visible">True</property>
-                            <property name="label" translatable="yes">Max log file size (in bytes):</property>
-                            <property name="justify">GTK_JUSTIFY_RIGHT</property>
+                            <property name="can_focus">True</property>
+                            <property name="text" translatable="yes">200</property>
                           </widget>
                           <packing>
-                            <property name="top_attach">2</property>
-                            <property name="bottom_attach">3</property>
+                            <property name="left_attach">1</property>
+                            <property name="right_attach">2</property>
+                            <property name="top_attach">4</property>
+                            <property name="bottom_attach">5</property>
                           </packing>
                         </child>
                         <child>
-                          <widget class="GtkLabel" id="label8">
+                          <widget class="GtkComboBox" id="cbVerbosityLevel">
                             <property name="visible">True</property>
-                            <property name="label" translatable="yes">Verbosity level:</property>
-                            <property name="justify">GTK_JUSTIFY_RIGHT</property>
+                            <property name="items" translatable="yes">None
+Normal
+Higher
+Highest</property>
                           </widget>
                           <packing>
+                            <property name="left_attach">1</property>
+                            <property name="right_attach">2</property>
                             <property name="top_attach">1</property>
                             <property name="bottom_attach">2</property>
+                            <property name="y_options"></property>
                           </packing>
                         </child>
                         <child>
-                          <widget class="GtkLabel" id="label7">
+                          <widget class="GtkComboBox" id="combobox2">
                             <property name="visible">True</property>
-                            <property name="label" translatable="yes">Memory buffer (in bytes):</property>
-                            <property name="justify">GTK_JUSTIFY_RIGHT</property>
+                            <property name="items" translatable="yes">german.xml
+itliano.xml
+russian_koi8r.xml
+brazilian.xml
+french.xml
+russian.xml
+english.xml
+romnaa.xml
+spnish.xml
+
+</property>
                           </widget>
+                          <packing>
+                            <property name="left_attach">1</property>
+                            <property name="right_attach">2</property>
+                            <property name="top_attach">5</property>
+                            <property name="bottom_attach">6</property>
+                            <property name="y_options"></property>
+                          </packing>
                         </child>
                       </widget>
                       <packing>
@@ -472,50 +473,59 @@
                           <placeholder/>
                         </child>
                         <child>
-                          <widget class="GtkLabel" id="label13">
+                          <widget class="GtkFileChooserButton" id="filechooserbutton1">
                             <property name="visible">True</property>
-                            <property name="label" translatable="yes">Connection time-out (in sec):</property>
+                            <property name="title" translatable="yes">Browse..</property>
+                            <property name="width_chars">7</property>
+                            <signal name="file_set" handler="on_filechooserbutton1_file_set"/>
                           </widget>
-                        </child>
-                        <child>
-                          <widget class="GtkLabel" id="label14">
-                            <property name="visible">True</property>
-                            <property name="label" translatable="yes">Max connections:</property>
-                          </widget>
                           <packing>
-                            <property name="top_attach">1</property>
-                            <property name="bottom_attach">2</property>
+                            <property name="left_attach">2</property>
+                            <property name="right_attach">3</property>
+                            <property name="top_attach">3</property>
+                            <property name="bottom_attach">4</property>
                           </packing>
                         </child>
                         <child>
-                          <widget class="GtkLabel" id="label15">
+                          <widget class="GtkCheckButton" id="checkbutton1">
                             <property name="visible">True</property>
-                            <property name="label" translatable="yes">Gzip compression threshold (in bytes):</property>
+                            <property name="can_focus">True</property>
+                            <property name="label" translatable="yes">Personalized error pages:</property>
+                            <property name="use_underline">True</property>
+                            <property name="response_id">0</property>
+                            <property name="draw_indicator">True</property>
                           </widget>
                           <packing>
-                            <property name="top_attach">2</property>
-                            <property name="bottom_attach">3</property>
+                            <property name="left_attach">1</property>
+                            <property name="right_attach">2</property>
+                            <property name="top_attach">4</property>
+                            <property name="bottom_attach">5</property>
                           </packing>
                         </child>
                         <child>
-                          <widget class="GtkLabel" id="label16">
+                          <widget class="GtkEntry" id="enStylesheet">
                             <property name="visible">True</property>
-                            <property name="label" translatable="yes">Stylesheet</property>
+                            <property name="can_focus">True</property>
+                            <property name="text" translatable="yes">/sys/css/browsestyle.css</property>
                           </widget>
                           <packing>
+                            <property name="left_attach">1</property>
+                            <property name="right_attach">2</property>
                             <property name="top_attach">3</property>
                             <property name="bottom_attach">4</property>
                           </packing>
                         </child>
                         <child>
-                          <widget class="GtkEntry" id="enConnectionTimeOut">
+                          <widget class="GtkEntry" id="enGzipCompressionThreshold">
                             <property name="visible">True</property>
                             <property name="can_focus">True</property>
-                            <property name="text" translatable="yes">60</property>
+                            <property name="text" translatable="yes">1048576</property>
                           </widget>
                           <packing>
                             <property name="left_attach">1</property>
                             <property name="right_attach">2</property>
+                            <property name="top_attach">2</property>
+                            <property name="bottom_attach">3</property>
                           </packing>
                         </child>
                         <child>
@@ -532,61 +542,52 @@
                           </packing>
                         </child>
                         <child>
-                          <widget class="GtkEntry" id="enGzipCompressionThreshold">
+                          <widget class="GtkEntry" id="enConnectionTimeOut">
                             <property name="visible">True</property>
                             <property name="can_focus">True</property>
-                            <property name="text" translatable="yes">1048576</property>
+                            <property name="text" translatable="yes">60</property>
                           </widget>
                           <packing>
                             <property name="left_attach">1</property>
                             <property name="right_attach">2</property>
-                            <property name="top_attach">2</property>
-                            <property name="bottom_attach">3</property>
                           </packing>
                         </child>
                         <child>
-                          <widget class="GtkEntry" id="enStylesheet">
+                          <widget class="GtkLabel" id="label16">
                             <property name="visible">True</property>
-                            <property name="can_focus">True</property>
-                            <property name="text" translatable="yes">/sys/css/browsestyle.css</property>
+                            <property name="label" translatable="yes">Stylesheet</property>
                           </widget>
                           <packing>
-                            <property name="left_attach">1</property>
-                            <property name="right_attach">2</property>
                             <property name="top_attach">3</property>
                             <property name="bottom_attach">4</property>
                           </packing>
                         </child>
                         <child>
-                          <widget class="GtkCheckButton" id="checkbutton1">
+                          <widget class="GtkLabel" id="label15">
                             <property name="visible">True</property>
-                            <property name="can_focus">True</property>
-                            <property name="label" translatable="yes">Personalized error pages:</property>
-                            <property name="use_underline">True</property>
-                            <property name="response_id">0</property>
-                            <property name="draw_indicator">True</property>
+                            <property name="label" translatable="yes">Gzip compression threshold (in bytes):</property>
                           </widget>
                           <packing>
-                            <property name="left_attach">1</property>
-                            <property name="right_attach">2</property>
-                            <property name="top_attach">4</property>
-                            <property name="bottom_attach">5</property>
+                            <property name="top_attach">2</property>
+                            <property name="bottom_attach">3</property>
                           </packing>
                         </child>
                         <child>
-                          <widget class="GtkFileChooserButton" id="filechooserbutton1">
+                          <widget class="GtkLabel" id="label14">
                             <property name="visible">True</property>
-                            <property name="title" translatable="yes">Browse..</property>
-                            <property name="width_chars">7</property>
-                            <signal name="file_set" handler="on_filechooserbutton1_file_set"/>
+                            <property name="label" translatable="yes">Max connections:</property>
                           </widget>
                           <packing>
-                            <property name="left_attach">2</property>
-                            <property name="right_attach">3</property>
-                            <property name="top_attach">3</property>
-                            <property name="bottom_attach">4</property>
+                            <property name="top_attach">1</property>
+                            <property name="bottom_attach">2</property>
                           </packing>
                         </child>
+                        <child>
+                          <widget class="GtkLabel" id="label13">
+                            <property name="visible">True</property>
+                            <property name="label" translatable="yes">Connection time-out (in sec):</property>
+                          </widget>
+                        </child>
                       </widget>
                     </child>
                     <child>
@@ -738,51 +739,51 @@
                           <placeholder/>
                         </child>
                         <child>
-                          <widget class="GtkEntry" id="enManager">
+                          <widget class="GtkButton" id="btnAddMIMEType">
                             <property name="visible">True</property>
                             <property name="can_focus">True</property>
-                            <property name="text" translatable="yes">NONE</property>
+                            <property name="label">gtk-add</property>
+                            <property name="use_stock">True</property>
+                            <property name="response_id">0</property>
+                            <signal name="clicked" handler="on_btnAddMIMEType_clicked"/>
                           </widget>
                           <packing>
                             <property name="left_attach">1</property>
                             <property name="right_attach">2</property>
-                            <property name="top_attach">3</property>
-                            <property name="bottom_attach">4</property>
+                            <property name="top_attach">1</property>
+                            <property name="bottom_attach">2</property>
+                            <property name="x_options"></property>
+                            <property name="y_options"></property>
                           </packing>
                         </child>
                         <child>
-                          <widget class="GtkLabel" id="label21">
+                          <widget class="GtkFileChooserButton" id="filechooserbutton2">
                             <property name="visible">True</property>
-                            <property name="label" translatable="yes">Manager:</property>
+                            <property name="title" translatable="yes">Browse..</property>
+                            <property name="width_chars">7</property>
+                            <signal name="file_set" handler="on_filechooserbutton2_file_set"/>
                           </widget>
                           <packing>
-                            <property name="top_attach">3</property>
-                            <property name="bottom_attach">4</property>
+                            <property name="top_attach">4</property>
+                            <property name="bottom_attach">5</property>
+                            <property name="x_options"></property>
+                            <property name="y_options"></property>
                           </packing>
                         </child>
                         <child>
-                          <widget class="GtkComboBox" id="cbAction">
+                          <widget class="GtkLabel" id="label19">
                             <property name="visible">True</property>
-                            <property name="row_span_column">1</property>
+                            <property name="label" translatable="yes">MIME Type:</property>
+                          </widget>
+                        </child>
+                        <child>
+                          <widget class="GtkComboBox" id="combobox3">
+                            <property name="visible">True</property>
                             <property name="active">0</property>
-                            <property name="items" translatable="yes">Send the file
-URL link
-Run as CGI
-Run as FastCGI
-Run as SCGI
-Run as ISAPI
-Run as MSCGI
-Run as WINCGI
-Execute
-Execute as an ISAPI module
-Execute self contined FastCGI
-Run self contained SCGI</property>
                           </widget>
                           <packing>
                             <property name="left_attach">1</property>
                             <property name="right_attach">2</property>
-                            <property name="top_attach">2</property>
-                            <property name="bottom_attach">3</property>
                             <property name="y_options"></property>
                           </packing>
                         </child>
@@ -797,52 +798,52 @@
                           </packing>
                         </child>
                         <child>
-                          <widget class="GtkComboBox" id="combobox3">
+                          <widget class="GtkComboBox" id="cbAction">
                             <property name="visible">True</property>
+                            <property name="row_span_column">1</property>
                             <property name="active">0</property>
+                            <property name="items" translatable="yes">Send the file
+URL link
+Run as CGI
+Run as FastCGI
+Run as SCGI
+Run as ISAPI
+Run as MSCGI
+Run as WINCGI
+Execute
+Execute as an ISAPI module
+Execute self contined FastCGI
+Run self contained SCGI</property>
                           </widget>
                           <packing>
                             <property name="left_attach">1</property>
                             <property name="right_attach">2</property>
+                            <property name="top_attach">2</property>
+                            <property name="bottom_attach">3</property>
                             <property name="y_options"></property>
                           </packing>
                         </child>
                         <child>
-                          <widget class="GtkLabel" id="label19">
+                          <widget class="GtkLabel" id="label21">
                             <property name="visible">True</property>
-                            <property name="label" translatable="yes">MIME Type:</property>
+                            <property name="label" translatable="yes">Manager:</property>
                           </widget>
-                        </child>
-                        <child>
-                          <widget class="GtkFileChooserButton" id="filechooserbutton2">
-                            <property name="visible">True</property>
-                            <property name="title" translatable="yes">Browse..</property>
-                            <property name="width_chars">7</property>
-                            <signal name="file_set" handler="on_filechooserbutton2_file_set"/>
-                          </widget>
                           <packing>
-                            <property name="top_attach">4</property>
-                            <property name="bottom_attach">5</property>
-                            <property name="x_options"></property>
-                            <property name="y_options"></property>
+                            <property name="top_attach">3</property>
+                            <property name="bottom_attach">4</property>
                           </packing>
                         </child>
                         <child>
-                          <widget class="GtkButton" id="btnAddMIMEType">
+                          <widget class="GtkEntry" id="enManager">
                             <property name="visible">True</property>
                             <property name="can_focus">True</property>
-                            <property name="label">gtk-add</property>
-                            <property name="use_stock">True</property>
-                            <property name="response_id">0</property>
-                            <signal name="clicked" handler="on_btnAddMIMEType_clicked"/>
+                            <property name="text" translatable="yes">NONE</property>
                           </widget>
                           <packing>
                             <property name="left_attach">1</property>
                             <property name="right_attach">2</property>
-                            <property name="top_attach">1</property>
-                            <property name="bottom_attach">2</property>
-                            <property name="x_options"></property>
-                            <property name="y_options"></property>
+                            <property name="top_attach">3</property>
+                            <property name="bottom_attach">4</property>
                           </packing>
                         </child>
                       </widget>
@@ -1027,6 +1028,7 @@
                                     <property name="preview_widget_active">False</property>
                                   </widget>
                                   <packing>
+                                    <property name="expand">False</property>
                                     <property name="position">1</property>
                                   </packing>
                                 </child>
@@ -1054,6 +1056,7 @@
                                     <property name="preview_widget_active">False</property>
                                   </widget>
                                   <packing>
+                                    <property name="expand">False</property>
                                     <property name="position">1</property>
                                   </packing>
                                 </child>
@@ -1111,16 +1114,19 @@
                               <widget class="GtkVBox" id="vbox12">
                                 <property name="visible">True</property>
                                 <child>
-                                  <placeholder/>
-                                </child>
-                                <child>
                                   <widget class="GtkTreeView" id="treeviewHost">
                                     <property name="visible">True</property>
                                     <property name="app_paintable">True</property>
                                     <property name="can_focus">True</property>
                                     <property name="headers_clickable">True</property>
                                   </widget>
+                                </child>
+                                <child>
+                                  <widget class="GtkHSeparator" id="hseparator2">
+                                    <property name="visible">True</property>
+                                  </widget>
                                   <packing>
+                                    <property name="expand">False</property>
                                     <property name="position">1</property>
                                   </packing>
                                 </child>
@@ -1137,9 +1143,6 @@
                                         <property name="response_id">0</property>
                                         <signal name="clicked" handler="on_btnAddHost_clicked"/>
                                       </widget>
-                                      <packing>
-                                        <property name="expand">False</property>
-                                      </packing>
                                     </child>
                                     <child>
                                       <widget class="GtkButton" id="btnRemoveHost">
@@ -1151,7 +1154,7 @@
                                         <signal name="clicked" handler="on_btnRemoveHost_clicked"/>
                                       </widget>
                                       <packing>
-                                        <property name="expand">False</property>
+                                        <property name="pack_type">GTK_PACK_END</property>
                                         <property name="position">1</property>
                                       </packing>
                                     </child>
@@ -1166,15 +1169,18 @@
                               <widget class="GtkVBox" id="vbox15">
                                 <property name="visible">True</property>
                                 <child>
-                                  <placeholder/>
-                                </child>
-                                <child>
                                   <widget class="GtkTreeView" id="treeviewIP">
                                     <property name="visible">True</property>
                                     <property name="can_focus">True</property>
                                     <property name="headers_clickable">True</property>
                                   </widget>
+                                </child>
+                                <child>
+                                  <widget class="GtkHSeparator" id="hseparator3">
+                                    <property name="visible">True</property>
+                                  </widget>
                                   <packing>
+                                    <property name="expand">False</property>
                                     <property name="position">1</property>
                                   </packing>
                                 </child>
@@ -1452,6 +1458,8 @@
                                     <property name="action">GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER</property>
                                   </widget>
                                   <packing>
+                                    <property name="expand">False</property>
+                                    <property name="fill">False</property>
                                     <property name="position">2</property>
                                   </packing>
                                 </child>
@@ -1475,6 +1483,8 @@
                                     <property name="action">GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER</property>
                                   </widget>
                                   <packing>
+                                    <property name="expand">False</property>
+                                    <property name="fill">False</property>
                                     <property name="position">2</property>
                                   </packing>
                                 </child>
@@ -1591,38 +1601,29 @@
                       <placeholder/>
                     </child>
                     <child>
-                      <widget class="GtkEntry" id="entry12">
+                      <widget class="GtkLabel" id="label29">
                         <property name="visible">True</property>
-                        <property name="can_focus">True</property>
+                        <property name="label" translatable="yes">Administrtor e-mail:</property>
                       </widget>
-                      <packing>
-                        <property name="left_attach">1</property>
-                        <property name="right_attach">2</property>
-                        <property name="top_attach">2</property>
-                        <property name="bottom_attach">3</property>
-                      </packing>
                     </child>
                     <child>
-                      <widget class="GtkEntry" id="entry11">
+                      <widget class="GtkLabel" id="label30">
                         <property name="visible">True</property>
-                        <property name="can_focus">True</property>
+                        <property name="label" translatable="yes">Administrator user name:</property>
                       </widget>
                       <packing>
-                        <property name="left_attach">1</property>
-                        <property name="right_attach">2</property>
                         <property name="top_attach">1</property>
                         <property name="bottom_attach">2</property>
                       </packing>
                     </child>
                     <child>
-                      <widget class="GtkEntry" id="entry10">
+                      <widget class="GtkLabel" id="label31">
                         <property name="visible">True</property>
-                        <property name="can_focus">True</property>
-                        <property name="text" translatable="yes">administrator@localhost</property>
+                        <property name="label" translatable="yes">Administrtor password:</property>
                       </widget>
                       <packing>
-                        <property name="left_attach">1</property>
-                        <property name="right_attach">2</property>
+                        <property name="top_attach">2</property>
+                        <property name="bottom_attach">3</property>
                       </packing>
                     </child>
                     <child>
@@ -1642,30 +1643,39 @@
                       </packing>
                     </child>
                     <child>
-                      <widget class="GtkLabel" id="label31">
+                      <widget class="GtkEntry" id="entry10">
                         <property name="visible">True</property>
-                        <property name="label" translatable="yes">Administrtor password:</property>
+                        <property name="can_focus">True</property>
+                        <property name="text" translatable="yes">administrator@localhost</property>
                       </widget>
                       <packing>
-                        <property name="top_attach">2</property>
-                        <property name="bottom_attach">3</property>
+                        <property name="left_attach">1</property>
+                        <property name="right_attach">2</property>
                       </packing>
                     </child>
                     <child>
-                      <widget class="GtkLabel" id="label30">
+                      <widget class="GtkEntry" id="entry11">
                         <property name="visible">True</property>
-                        <property name="label" translatable="yes">Administrator user name:</property>
+                        <property name="can_focus">True</property>
                       </widget>
                       <packing>
+                        <property name="left_attach">1</property>
+                        <property name="right_attach">2</property>
                         <property name="top_attach">1</property>
                         <property name="bottom_attach">2</property>
                       </packing>
                     </child>
                     <child>
-                      <widget class="GtkLabel" id="label29">
+                      <widget class="GtkEntry" id="entry12">
                         <property name="visible">True</property>
-                        <property name="label" translatable="yes">Administrtor e-mail:</property>
+                        <property name="can_focus">True</property>
                       </widget>
+                      <packing>
+                        <property name="left_attach">1</property>
+                        <property name="right_attach">2</property>
+                        <property name="top_attach">2</property>
+                        <property name="bottom_attach">3</property>
+                      </packing>
                     </child>
                   </widget>
                   <packing>
@@ -1793,4 +1803,7 @@
       </widget>
     </child>
   </widget>
+  <widget class="GtkMenu" id="menu1">
+    <property name="visible">True</property>
+  </widget>
 </glade-interface>





From MAILER-DAEMON Sun Oct 26 06:59:28 2008
Received: from mailman by lists.gnu.org with archive (Exim 4.43)
	id 1Ku3LE-0005rt-Ho
	for mharc-myserver-commit@gnu.org; Sun, 26 Oct 2008 06:59:28 -0400
Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43)
	id 1Ku3LC-0005re-7x
	for myserver-commit@gnu.org; Sun, 26 Oct 2008 06:59:26 -0400
Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43)
	id 1Ku3LB-0005rK-MK
	for myserver-commit@gnu.org; Sun, 26 Oct 2008 06:59:25 -0400
Received: from [199.232.76.173] (port=56417 helo=monty-python.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.43) id 1Ku3LB-0005r9-9x
	for myserver-commit@gnu.org; Sun, 26 Oct 2008 06:59:25 -0400
Received: from savannah.gnu.org ([199.232.41.3]:35822 helo=sv.gnu.org)
	by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32)
	(Exim 4.60) (envelope-from <INVALID.NOREPLY@gnu.org>)
	id 1Ku3LB-0008By-2i
	for myserver-commit@gnu.org; Sun, 26 Oct 2008 06:59:25 -0400
Received: from cvs.savannah.gnu.org ([199.232.41.69])
	by sv.gnu.org with esmtp (Exim 4.63)
	(envelope-from <INVALID.NOREPLY@gnu.org>) id 1Ku3L9-0001je-L4
	for myserver-commit@gnu.org; Sun, 26 Oct 2008 10:59:24 +0000
Received: from ignacy by cvs.savannah.gnu.org with local (Exim 4.63)
	(envelope-from <ignacy@savannah.gnu.org>) id 1Ku3L9-0001jZ-55
	for myserver-commit@gnu.org; Sun, 26 Oct 2008 10:59:23 +0000
MIME-Version: 1.0
Errors-To: ignacy
To: myserver-commit@gnu.org
X-Mailer: SVN::Notify 2.64: http://search.cpan.org/dist/SVN-Notify/
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
From: Ignacy Moryc <imoryc@gmail.com>
Message-Id: <E1Ku3L9-0001jZ-55@cvs.savannah.gnu.org>
Date: Sun, 26 Oct 2008 10:59:23 +0000
X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 3)
Subject: [myserver-commit] [2908] Begining settings serialization
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/pipermail/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, 26 Oct 2008 10:59:26 -0000

Revision: 2908
          http://svn.sv.gnu.org/viewvc/?view=rev&root=myserver&revision=2908
Author:   ignacy
Date:     2008-10-26 10:59:22 +0000 (Sun, 26 Oct 2008)

Log Message:
-----------
Begining settings serialization

Modified Paths:
--------------
    trunk/misc/PyGTK_Control/ConfigGUI.py

Modified: trunk/misc/PyGTK_Control/ConfigGUI.py
===================================================================
--- trunk/misc/PyGTK_Control/ConfigGUI.py	2008-10-26 08:28:39 UTC (rev 2907)
+++ trunk/misc/PyGTK_Control/ConfigGUI.py	2008-10-26 10:59:22 UTC (rev 2908)
@@ -290,6 +290,20 @@
     def run(self):
         gtk.main()
 
+    # Here begins the functionality implementation
+    def get(self, name):
+        """ Helper/alias function returns widgetwith specified name """
+        return self.wTree.get_widget(name)
+
+    def serialize_config(self):
+        """ This function serializes the configurtion settings
+        and returns a dictionary with pairs:
+        name_of_setting: vlue """
+        settings = { 'LANGUGE' : self.get("combobox2").get_active_text().partition(".")[0].capitalize(), \
+                     'VERBOSITY' :  self.get("cbVerbosityLevel").get_active_text() }
+        return settings
+
+
 def main():
     app = ConfigGUIGTK()
     app.run()





From MAILER-DAEMON Sun Oct 26 08:01:48 2008
Received: from mailman by lists.gnu.org with archive (Exim 4.43)
	id 1Ku4JY-0004VT-2n
	for mharc-myserver-commit@gnu.org; Sun, 26 Oct 2008 08:01:48 -0400
Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43)
	id 1Ku4JV-0004Si-Vz
	for myserver-commit@gnu.org; Sun, 26 Oct 2008 08:01:46 -0400
Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43)
	id 1Ku4JT-0004P4-Ek
	for myserver-commit@gnu.org; Sun, 26 Oct 2008 08:01:45 -0400
Received: from [199.232.76.173] (port=51135 helo=monty-python.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.43) id 1Ku4JT-0004Os-8E
	for myserver-commit@gnu.org; Sun, 26 Oct 2008 08:01:43 -0400
Received: from savannah.gnu.org ([199.232.41.3]:60652 helo=sv.gnu.org)
	by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32)
	(Exim 4.60) (envelope-from <INVALID.NOREPLY@gnu.org>)
	id 1Ku4JS-0000AJ-FL
	for myserver-commit@gnu.org; Sun, 26 Oct 2008 08:01:42 -0400
Received: from cvs.savannah.gnu.org ([199.232.41.69])
	by sv.gnu.org with esmtp (Exim 4.63)
	(envelope-from <INVALID.NOREPLY@gnu.org>) id 1Ku4JR-0006sF-Nq
	for myserver-commit@gnu.org; Sun, 26 Oct 2008 12:01:41 +0000
Received: from gscrivano by cvs.savannah.gnu.org with local (Exim 4.63)
	(envelope-from <gscrivano@savannah.gnu.org>) id 1Ku4JR-0006s9-9y
	for myserver-commit@gnu.org; Sun, 26 Oct 2008 12:01:41 +0000
MIME-Version: 1.0
Errors-To: gscrivano
To: myserver-commit@gnu.org
X-Mailer: SVN::Notify 2.64: http://search.cpan.org/dist/SVN-Notify/
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
From: Giuseppe Scrivano <gscrivano@gnu.org>
Message-Id: <E1Ku4JR-0006s9-9y@cvs.savannah.gnu.org>
Date: Sun, 26 Oct 2008 12:01:41 +0000
X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 3)
Subject: [myserver-commit] [2909] Added possibility to register a handler on
	a specific URI.
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/pipermail/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, 26 Oct 2008 12:01:46 -0000

Revision: 2909
          http://svn.sv.gnu.org/viewvc/?view=rev&root=myserver&revision=2909
Author:   gscrivano
Date:     2008-10-26 12:01:40 +0000 (Sun, 26 Oct 2008)

Log Message:
-----------
Added possibility to register a handler on a specific URI.  It misses documentation.

Modified Paths:
--------------
    trunk/myserver/include/conf/mime/mime_manager.h
    trunk/myserver/include/conf/vhost/vhost.h
    trunk/myserver/include/conf/vhost/vhost_manager.h
    trunk/myserver/src/conf/mime/mime_manager.cpp
    trunk/myserver/src/conf/vhost/vhost.cpp
    trunk/myserver/src/conf/vhost/vhost_manager.cpp
    trunk/myserver/src/http_handler/cgi/cgi.cpp
    trunk/myserver/src/http_handler/fastcgi/fastcgi.cpp
    trunk/myserver/src/protocol/http/http.cpp

Modified: trunk/myserver/include/conf/mime/mime_manager.h
===================================================================
--- trunk/myserver/include/conf/mime/mime_manager.h	2008-10-26 10:59:22 UTC (rev 2908)
+++ trunk/myserver/include/conf/mime/mime_manager.h	2008-10-26 12:01:40 UTC (rev 2909)
@@ -79,8 +79,9 @@
 	void clean ();
 	int addRecord (MimeRecord *record);
 
+  static MimeRecord *readRecord (xmlNodePtr node);
+
 protected:
-  MimeRecord *readRecord (xmlNodePtr node);
 	const char *getFilename ();
 	void clearRecords ();
 private:

Modified: trunk/myserver/include/conf/vhost/vhost.h
===================================================================
--- trunk/myserver/include/conf/vhost/vhost.h	2008-10-26 10:59:22 UTC (rev 2908)
+++ trunk/myserver/include/conf/vhost/vhost.h	2008-10-26 12:01:40 UTC (rev 2909)
@@ -193,6 +193,8 @@
 
   /*! Set the protocol data. */
   void setProtocolData(VhostProtocolData* data){protocolData = data;}
+
+  MimeRecord* getLocationMime (string& loc){return locationsMime.get (loc);}
 private:
   VhostProtocolData*  protocolData;
   HashMap<string, string*> hashedData;
@@ -200,6 +202,8 @@
   Mutex refMutex;
   LogManager* logManager;
 
+  HashMap<string, MimeRecord*> locationsMime;
+
   MimeManager mimeManager;
 
   /*! The default priority for the connections scheduler.  */

Modified: trunk/myserver/include/conf/vhost/vhost_manager.h
===================================================================
--- trunk/myserver/include/conf/vhost/vhost_manager.h	2008-10-26 10:59:22 UTC (rev 2908)
+++ trunk/myserver/include/conf/vhost/vhost_manager.h	2008-10-26 12:01:40 UTC (rev 2909)
@@ -60,9 +60,6 @@
   /*! Load the virtual hosts list from a xml configuration file.  */
   int loadXMLConfigurationFile(const char *);
 	
-  /*! Save the virtual hosts list to a xml configuration file.  */
-  int saveXMLConfigurationFile(const char *);
-	
   /*! Set the right owner for the log locations.  */
   void changeLocationsOwner ();
 private:

Modified: trunk/myserver/src/conf/mime/mime_manager.cpp
===================================================================
--- trunk/myserver/src/conf/mime/mime_manager.cpp	2008-10-26 10:59:22 UTC (rev 2908)
+++ trunk/myserver/src/conf/mime/mime_manager.cpp	2008-10-26 12:01:40 UTC (rev 2909)
@@ -123,10 +123,6 @@
   xmlNodePtr lcur = node->children;
   xmlAttr *attrs;
 
-  if(xmlStrcmp(node->name, (const xmlChar *)"MIME"))
-    return NULL;
-
-
   MimeRecord *rc = new MimeRecord;
 
   for (attrs = node->properties; attrs; attrs = attrs->next)
@@ -210,6 +206,9 @@
 
   for(; node; node = node->next )
   {
+    if(xmlStrcmp(node->name, (const xmlChar *)"MIME"))
+      continue;
+
     MimeRecord *rc = readRecord (node);
 
     if (rc)

Modified: trunk/myserver/src/conf/vhost/vhost.cpp
===================================================================
--- trunk/myserver/src/conf/vhost/vhost.cpp	2008-10-26 10:59:22 UTC (rev 2908)
+++ trunk/myserver/src/conf/vhost/vhost.cpp	2008-10-26 12:01:40 UTC (rev 2909)
@@ -67,6 +67,16 @@
   clearIPList();
   freeSSL();
   freeHashedData();
+
+  HashMap<string, MimeRecord*>::Iterator it = locationsMime.begin ();
+
+  while (it != locationsMime.end ())
+    {
+      delete *it;
+      it++;
+    }
+
+
   refMutex.destroy();
   documentRoot.assign("");
   systemRoot.assign("");

Modified: trunk/myserver/src/conf/vhost/vhost_manager.cpp
===================================================================
--- trunk/myserver/src/conf/vhost/vhost_manager.cpp	2008-10-26 10:59:22 UTC (rev 2908)
+++ trunk/myserver/src/conf/vhost/vhost_manager.cpp	2008-10-26 12:01:40 UTC (rev 2909)
@@ -16,6 +16,7 @@
 */
 #include <include/conf/vhost/vhost_manager.h>
 #include <include/conf/vhost/vhost.h>
+#include <include/conf/mime/mime_manager.h>
 #include <include/server/server.h>
 #include <include/base/file/files_utility.h>
 
@@ -427,8 +428,7 @@
           if(!xmlStrcmp(lcur->name, (const xmlChar *)"HOST"))
             {
               int useRegex = 0;
-              xmlAttr *attrs = lcur->properties;
-              while(attrs)
+              for (xmlAttr *attrs = lcur->properties; attrs; attrs = attrs->next)
                 {
                   if(!xmlStrcmp(attrs->name, (const xmlChar *)"isRegex"))
                     {
@@ -439,7 +439,6 @@
                           useRegex = 1;
                         }
                     }
-                  attrs = attrs->next;
                 }
 
               vh->addHost((const char*)lcur->children->content, useRegex);
@@ -448,6 +447,18 @@
             {
               vh->setName((char*)lcur->children->content);
             }
+          else if(!xmlStrcmp(lcur->name, (const xmlChar *)"LOCATION"))
+            {
+              string loc (vh->getDocumentRoot ());
+              loc.append ("/");
+              for (xmlAttr *attrs = lcur->properties; attrs; attrs = attrs->next)
+                {
+                  if(!xmlStrcmp (attrs->name, (const xmlChar *)"path"))
+                    loc.append ((const char*) attrs->children->content);
+                }
+              MimeRecord *rc = MimeManager::readRecord (lcur);
+              vh->locationsMime.put (loc, rc);
+            }
           else if(!xmlStrcmp(lcur->name, (const xmlChar *)"SSL_PRIVATEKEY"))
             {
               string pk((char*)lcur->children->content);
@@ -624,143 +635,6 @@
 }
 
 /*!
- *Save the virtual hosts to a XML configuration file.
- *\param filename The filename where write the XML file.
- */
-int VhostManager::saveXMLConfigurationFile(const char *filename)
-{
-  File out;
-  u_long nbw;
-
-  mutex.lock();
-
-  if(extSource)
-    {
-      int ret = extSource->save();
-      mutex.unlock();
-      return ret;
-    }
-
-  out.openFile(filename, File::MYSERVER_CREATE_ALWAYS | File::MYSERVER_OPEN_WRITE);
-  out.writeToFile("<?xml version=\"1.0\"?>\r\n<VHOSTS>\r\n", 33, &nbw);
-
-  try
-    {
-      list<Vhost*>::iterator i = hostList.begin();
-      for( ; i != hostList.end() ; i++)
-        {
-          char port[6];
-          list<Vhost::StringRegex*>::iterator il = (*i)->getIpList()->begin();
-          list<Vhost::StringRegex*>::iterator hl = (*i)->getHostList()->begin();
-          out.writeToFile("<VHOST>\r\n",9,&nbw);
-      
-          out.writeToFile("<NAME>",6,&nbw);
-          out.writeToFile((*i)->getName(), strlen((*i)->getName()), &nbw);
-          out.writeToFile("</NAME>\r\n",9,&nbw);
-       
-          for(; il != (*i)->getIpList()->end(); il++)
-            {
-              string *n = &((*il)->name);
-              out.writeToFile("<IP>",4,&nbw);
-              out.writeToFile(n->c_str(), n->length(), &nbw);
-              out.writeToFile("</IP>\r\n",7,&nbw);
-            }
-
-          for(; hl != (*i)->getHostList()->end(); hl++)
-            {
-              string *n = &((*hl)->name);
-              out.writeToFile("<HOST>",6,&nbw);
-              out.writeToFile(n->c_str(), n->length(), &nbw);
-              out.writeToFile("</HOST>\r\n",9,&nbw);
-            }
-
-          out.writeToFile("<PORT>",6,&nbw);
-          sprintf(port,"%i", (*i)->getPort());
-          out.writeToFile(port,(u_long)strlen(port),&nbw);
-          out.writeToFile("</PORT>\r\n",9,&nbw);
-
-          if((*i)->getVhostSSLContext()->getPrivateKeyFile().length())
-            {
-              string &pk = (*i)->getVhostSSLContext()->getPrivateKeyFile();
-              out.writeToFile("<SSL_PRIVATEKEY>",16,&nbw);
-              out.writeToFile(pk.c_str(), pk.length(),&nbw);
-              out.writeToFile("</SSL_PRIVATEKEY>\r\n",19,&nbw);
-            }
-      
-          if((*i)->getVhostSSLContext()->getCertificateFile().length())
-            {
-              string &certificate = (*i)->getVhostSSLContext()->getCertificateFile();
-              out.writeToFile("<SSL_CERTIFICATE>", 17, &nbw);
-              out.writeToFile(certificate.c_str(), (u_long)certificate.length(), 
-                              &nbw);
-              out.writeToFile("</SSL_CERTIFICATE>\r\n", 20, &nbw);
-            }
-
-          if((*i)->getVhostSSLContext()->getPassword().length())
-            {
-              string& pw = (*i)->getVhostSSLContext()->getPassword();
-              out.writeToFile("<SSL_PASSWORD>", 14, &nbw);
-              out.writeToFile(pw.c_str(), pw.length(), &nbw);
-              out.writeToFile("</SSL_PASSWORD>\r\n", 17, &nbw);
-            }
-
-          out.writeToFile("<PROTOCOL>", 10, &nbw);
-          out.writeToFile((*i)->getProtocolName(), 
-                          strlen((*i)->getProtocolName()), &nbw);
-
-          out.writeToFile("</PROTOCOL>\r\n", 13, &nbw);
-      
-          out.writeToFile("<DOCROOT>", 9, &nbw);
-          out.writeToFile((*i)->getDocumentRoot().c_str(), 
-                          (*i)->getDocumentRoot().length(), &nbw);
-          out.writeToFile("</DOCROOT>\r\n", 12, &nbw);
-      
-          out.writeToFile("<SYSFOLDER>", 11, &nbw);
-          out.writeToFile((*i)->getSystemRoot().c_str(), 
-                          (*i)->getSystemRoot().length(), &nbw);
-      
-          out.writeToFile("</SYSFOLDER>\r\n", 14, &nbw);
-      
-          out.writeToFile("<ACCESSLOG>", 13, &nbw);
-
-          string accessData = saveXMLlogData ("ACCESSLOG", *i);
-          string warningData = saveXMLlogData ("WARNINGLOG", *i);
-
-          out.writeToFile (accessData.c_str (), accessData.size (), &nbw);
-          
-          out.writeToFile("</ACCESSLOG>\r\n", 16, &nbw);
-      
-          out.writeToFile("<WARNINGLOG>", 12, &nbw);
-
-          out.writeToFile (warningData.c_str (), warningData.size (), &nbw);
-          
-          out.writeToFile("</WARNINGLOG>\r\n", 15, &nbw);
-      
-          {
-            HashMap<string, string*>::Iterator it = (*i)->hashedData.begin();
-            for(; it != (*i)->hashedData.end(); it++)
-              {
-                ostringstream outString;
-                outString << "<" << it.getKey() << ">" << (*it)  << "</" 
-                          << it.getKey() << ">" << endl;
-                out.writeToFile(outString.str().c_str(),outString.str().size(),&nbw);
-              }
-            out.writeToFile("</VHOST>\r\n", 10, &nbw);
-          }
-        }
-      out.writeToFile("</VHOSTS>\r\n", 11, &nbw);
-      out.close();
-      mutex.unlock();
-    }
-  catch(...)
-    {
-      mutex.unlock();
-    };
-
-  return 0;
-}
-
-/*!
  *Get a virtual host by its position in the list.
  *Zero based list.
  *\param n The virtual host id.

Modified: trunk/myserver/src/http_handler/cgi/cgi.cpp
===================================================================
--- trunk/myserver/src/http_handler/cgi/cgi.cpp	2008-10-26 10:59:22 UTC (rev 2908)
+++ trunk/myserver/src/http_handler/cgi/cgi.cpp	2008-10-26 12:01:40 UTC (rev 2909)
@@ -197,18 +197,7 @@
       return td->http->raiseHTTPError(500);
 
     }
-    
 
-     /* Check if the CGI executable exists.  */
-    if(!FilesUtility::fileExists(tmpScriptPath.c_str()))
-    {
-      td->scriptPath.assign("");
-      td->scriptFile.assign("");
-      td->scriptDir.assign("");
-      chain.clearAllFilters(); 
-      return td->http->raiseHTTPError(500);
-    }
-
     spi.arg.assign(moreArg);
     spi.arg.append(" ");
     spi.arg.append(td->scriptFile);    
@@ -437,7 +426,8 @@
     
     term = stdOutFile.pipeTerminated();
 
-    if (stdOutFile.waitForData ((cgiTimeout - ticks) / 1000, (cgiTimeout - ticks) % 1000) == 0)
+    if (!term && 
+        stdOutFile.waitForData ((cgiTimeout - ticks) / 1000, (cgiTimeout - ticks) % 1000) == 0)
     {
       ostringstream msg;
       msg << "Cgi: timeout for process " << cgiProc.getPid ();
@@ -455,8 +445,9 @@
       
     if (nBytesRead == 0 && term)
     {
-      *ret = td->http->raiseHTTPError(500);
-      return 1;
+      headerCompleted = true;
+      headerSize = 0;
+      break;
     }
 
     headerOffset += nBytesRead;

Modified: trunk/myserver/src/http_handler/fastcgi/fastcgi.cpp
===================================================================
--- trunk/myserver/src/http_handler/fastcgi/fastcgi.cpp	2008-10-26 10:59:22 UTC (rev 2908)
+++ trunk/myserver/src/http_handler/fastcgi/fastcgi.cpp	2008-10-26 12:01:40 UTC (rev 2909)
@@ -772,9 +772,6 @@
     }
   }
 
-  if (headerSize == 0)
-    return 0;
-
   HttpHeaders::buildHTTPResponseHeaderStruct(con->td->buffer->getBuffer(),
                                              &con->td->response, 
                                              &(con->td->nBytesToRead));

Modified: trunk/myserver/src/protocol/http/http.cpp
===================================================================
--- trunk/myserver/src/protocol/http/http.cpp	2008-10-26 10:59:22 UTC (rev 2908)
+++ trunk/myserver/src/protocol/http/http.cpp	2008-10-26 12:01:40 UTC (rev 2909)
@@ -350,13 +350,13 @@
 int Http::getFilePermissions(string& filename, string& directory, string& file, 
                              string &filenamePath, int yetmapped, int* permissions)
 {
-  td->securityToken.setServer (Server::getInstance ());
-  td->securityToken.setSysDirectory ((string*)&(td->connection->host->getSystemRoot ()));
-
-  td->securityToken.setVhost (td->connection->host);
-
   try
   {
+    td->securityToken.setServer (Server::getInstance ());
+    td->securityToken.setSysDirectory ((string*)&(td->connection->host->getSystemRoot ()));
+    
+    td->securityToken.setVhost (td->connection->host);
+
     FilesUtility::splitPath (filename, directory, file);
     FilesUtility::completePath (directory);
 
@@ -369,9 +369,9 @@
      *systemrequest is 1 if the file is in the system directory.
      *If filename is already mapped on the file system don't map it again.
      */
-    if(yetmapped)
+    if (yetmapped)
     {
-      filenamePath.assign(filename);
+      filenamePath.assign (filename);
     }
     else
     {
@@ -380,39 +380,39 @@
        *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 (filename);
+      if ((filename[0] != '\0') &&
+          (FilesUtility::getPathRecursionLevel(filename) < 1))
       {
         return 401;
       }
 
-      ret = getPath(filenamePath, filename, 0);
+      ret = getPath (filenamePath, filename, 0);
 
-      if(ret != 200)
+      if (ret != 200)
         return ret;
     }
 
-    if(FilesUtility::isLink(td->filenamePath.c_str()))
+    if (FilesUtility::isLink (td->filenamePath.c_str()))
     {
       const char *perm = td->connection->host->getHashedData("FOLLOW_LINKS");
       if(!perm || strcmpi(perm, "YES"))
         return raiseHTTPError(401);
     }
 
-    if(FilesUtility::isDirectory(filenamePath.c_str()))
+    if (FilesUtility::isDirectory (filenamePath.c_str()))
     {
       directory.assign(filenamePath);
     }
     else
     {
-      FilesUtility::splitPath(filenamePath, directory, file);
+      FilesUtility::splitPath (filenamePath, directory, file);
     }
 
-    if(td->connection->protocolBuffer == 0)
+    if (td->connection->protocolBuffer == 0)
     {
       td->connection->protocolBuffer = new HttpUserData;
-      if(!td->connection->protocolBuffer)
+      if (!td->connection->protocolBuffer)
       {
         return 500;
       }
@@ -535,7 +535,7 @@
     if (ret != 200)
       return ret;
 
-    /*!
+    /*
      *Get the PATH_INFO value.
      *Use dirscan as a buffer for put temporary directory scan.
      *When an '/' character is present check if the path up to '/' character
@@ -546,9 +546,11 @@
     filenamePathLen = (int)td->filenamePath.length();
     dirscan.assign("");
 
-    for(u_long i = 0; i < filenamePathLen ; )
+    MimeRecord* mimeLoc = NULL;
+
+    for(u_long i = 0;; )
     {
-      /*!
+      /*
        *http://host/path/to/file/file.txt/PATH_INFO_VALUE?QUERY_INFO_VALUE
        *When a request has this form send the file file.txt with the
        *environment string PATH_INFO equals to PATH_INFO_VALUE and QUERY_INFO
@@ -559,12 +561,30 @@
 
       u_long next = td->filenamePath.find ('/', i + 1);
 
-      if (next == string::npos)
+      string curr = td->filenamePath.substr (0, next);
+
+      mimeLoc = td->connection->host ? td->connection->host->getLocationMime (curr) : NULL;
+
+      if(mimeLoc)
+      {
+        if (next != string::npos)
+        {
+          td->pathInfo.assign (&(td->filenamePath.c_str ()[next]));
+          td->filenamePath.erase (next);
+        }
+        else
+        {
+          td->pathInfo.assign ("");
+        }
+
         break;
+      }
 
-      const char *curr = td->filenamePath.substr (0, next).c_str ();
+      if (next >= filenamePathLen)
+        break;
 
-      if(!FilesUtility::isDirectory (curr))
+      if(mimeLoc ||
+         !FilesUtility::isDirectory (curr.c_str ()))
       {
         td->pathInfo.assign (&(td->filenamePath.c_str ()[next]));
         td->filenamePath.erase (next);
@@ -574,29 +594,27 @@
       i = next;
     }
 
-    /*!
-     *If there is a PATH_INFO value the get the PATH_TRANSLATED too.
+    /*
      *PATH_TRANSLATED is the local filesystem mapped version of PATH_INFO.
      */
-    if(td->pathInfo.length() > 1)
+    if(td->pathInfo.length () > 1)
     {
       int ret;
-      /*!
-       *Start from the second character because the first is a
-       *slash character.
-       */
-      ret = getPath(td->pathTranslated, &((td->pathInfo.c_str())[1]), 0);
+      /* Omit the first slash character.  */
+      ret = getPath (td->pathTranslated, &((td->pathInfo.c_str())[1]), 0);
 
-      if(ret != 200)
-        td->pathTranslated.assign("");
+      if (ret != 200)
+        td->pathTranslated.assign ("");
       else
-        FilesUtility::completePath(td->pathTranslated);
+        FilesUtility::completePath (td->pathTranslated);
     }
     else
     {
-      td->pathTranslated.assign("");
+      td->pathTranslated.assign ("");
     }
-    FilesUtility::completePath(td->filenamePath);
+    FilesUtility::completePath (td->filenamePath);
+
+    td->mime = mimeLoc ? mimeLoc : getMIME (td->filenamePath);
   }
   catch(...)
   {
@@ -792,7 +810,7 @@
      *2)We send the directory content.
      *3)We send an error.
      */
-    if(FilesUtility::isDirectory(td->filenamePath.c_str()))
+    if(!td->mime && FilesUtility::isDirectory(td->filenamePath.c_str()))
     {
       int i;
       if(!(permissions & MYSERVER_PERMISSION_BROWSE))
@@ -851,41 +869,24 @@
                            onlyHeader);
     }
 
-    if(!FilesUtility::fileExists(td->filenamePath.c_str()))
-    {
-      if(systemrequest)
-      {
-        string error;
-        error.assign("Http: cannot find system request file ");
-        error.append(td->filenamePath);
+    data.assign("");
 
-        td->connection->host->warningsLogWrite(error.c_str());
-      }
+    td->response.contentType[0] = '\0';
 
-      return raiseHTTPError(404);
+    /* If not specified differently, set the default content type to text/html.  */
+    if(td->mime)
+    {
+      td->response.contentType.assign(td->mime->mimeType);
+      data.assign(td->mime->cgiManager);
     }
-
-    /*!
-     *getMIME returns the type of command registered by the extension.
-     */
-    data.assign("");
+    else
     {
-      td->response.contentType[0] = '\0';
-      td->mime = getMIME(td->filenamePath);
-      /*! Set the default content type, this can be changed later. */
-      if(td->mime)
-      {
-        td->response.contentType.assign(td->mime->mimeType);
-        data.assign(td->mime->cgiManager);
-      }
-      else
-      {
-        td->response.contentType.assign("text/html");
-        data.assign("");
-      }
+      td->response.contentType.assign("text/html");
+      data.assign("");
     }
 
-    if(!td->mime->cmdName.compare ("RUNCGI"))
+
+    if(td->mime && !td->mime->cmdName.compare ("RUNCGI"))
     {
       int allowCgi = 1;
       const char *dataH = td->connection->host->getHashedData("ALLOW_CGI");
@@ -905,7 +906,7 @@
                       data.c_str(), 0,  onlyHeader);
       return ret;
     }
-    else if(!td->mime->cmdName.compare ("EXECUTE"))
+    else if(td->mime && !td->mime->cmdName.compare ("EXECUTE"))
     {
       int allowCgi = 1;
       const char *dataH = td->connection->host->getHashedData("ALLOW_CGI");
@@ -925,7 +926,7 @@
                       data.c_str(), 1, onlyHeader);
       return ret;
     }
-    else if(!td->mime->cmdName.compare ("RUNISAPI"))
+    else if(td->mime && !td->mime->cmdName.compare ("RUNISAPI"))
     {
       int allowIsapi = 1;
       const char *dataH = td->connection->host->getHashedData("ALLOW_ISAPI");
@@ -945,7 +946,7 @@
       return ret;
 
     }
-    else if(!td->mime->cmdName.compare ("EXECUTEISAPI"))
+    else if(td->mime && !td->mime->cmdName.compare ("EXECUTEISAPI"))
     {
       if(!(permissions & MYSERVER_PERMISSION_EXECUTE))
       {
@@ -955,7 +956,7 @@
                         data.c_str(), 1, onlyHeader);
       return ret;
     }
-    else if(!td->mime->cmdName.compare ("RUNMSGI"))
+    else if(td->mime && !td->mime->cmdName.compare ("RUNMSGI"))
     {
       char* target;
       int allowMscgi = 1;
@@ -981,7 +982,7 @@
                         target, 1, onlyHeader);
       return ret;
     }
-    else if(!td->mime->cmdName.compare ("EXECUTEWINCGI"))
+    else if(td->mime && !td->mime->cmdName.compare ("EXECUTEWINCGI"))
     {
       ostringstream cgipath;
       int allowWincgi = 1;
@@ -1010,7 +1011,7 @@
                          0, 1, onlyHeader);
       return ret;
     }
-    else if(!td->mime->cmdName.compare ("RUNFASTCGI"))
+    else if(td->mime && !td->mime->cmdName.compare ("RUNFASTCGI"))
     {
       int allowFastcgi = 1;
       const char *dataH = td->connection->host->getHashedData("ALLOW_FASTCGI");
@@ -1029,7 +1030,7 @@
                           data.c_str(), 0, onlyHeader);
       return ret;
     }
-    else if(!td->mime->cmdName.compare ("EXECUTEFASTCGI"))
+    else if(td->mime && !td->mime->cmdName.compare ("EXECUTEFASTCGI"))
     {
       int allowFastcgi = 1;
       const char *dataH = td->connection->host->getHashedData("ALLOW_FASTCGI");
@@ -1048,7 +1049,7 @@
                           data.c_str(), 1, onlyHeader);
       return ret;
     }
-    else if(!td->mime->cmdName.compare ("RUNSCGI"))
+    else if(td->mime && !td->mime->cmdName.compare ("RUNSCGI"))
     {
       int allowScgi = 1;
       const char *dataH = td->connection->host->getHashedData("ALLOW_SCGI");
@@ -1067,7 +1068,7 @@
                        data.c_str(), 0, onlyHeader);
       return ret;
     }
-    else if(!td->mime->cmdName.compare ("EXECUTESCGI"))
+    else if(td->mime && !td->mime->cmdName.compare ("EXECUTESCGI"))
     {
       int allowScgi = 1;
       const char *dataH = td->connection->host->getHashedData("ALLOW_SCGI");
@@ -1086,7 +1087,7 @@
                        data.c_str(), 1, onlyHeader);
       return ret;
     }
-    else if(!td->mime->cmdName.compare ("SENDLINK"))
+    else if(td->mime && !td->mime->cmdName.compare ("SENDLINK"))
     {
       u_long nbr;
       char* linkpath;
@@ -1162,7 +1163,7 @@
       delete [] pathInfo;
       return ret;
     }
-    else if ((manager = staticHttp.dynManagerList.getPlugin(td->mime->cmdName)))
+    else if (td->mime && (manager = staticHttp.dynManagerList.getPlugin(td->mime->cmdName)))
     {
       int allowExternal = 1;
       const char *dataH =
@@ -1203,7 +1204,6 @@
       }
     }
 
-    /*! By default try to send the file as it is.  */
     if(!(permissions & MYSERVER_PERMISSION_READ))
     {
       return sendAuth();
@@ -2141,7 +2141,7 @@
 int Http::getPath(HttpThreadContext* td, string& filenamePath, const char *filename,
                   int systemrequest)
 {
-  /*!
+  /*
    *If it is a system request, search the file in the system directory.
    */
   if(systemrequest)
@@ -2156,7 +2156,7 @@
       filenamePath.append("/");
     filenamePath.append(filename);
   }
-  /*!
+  /*
    *Else the file is in the web directory.
    */
   else
@@ -2164,7 +2164,7 @@
     if(filename[0])
     {
       const char *root;
-      /*!
+      /*
        *uri starting with a /sys/ will use the system directory as
        *the root path. Be sure to don't allow access to the system root
        *but only to subdirectories.
@@ -2173,7 +2173,7 @@
          && filename[3] == 's' && filename[4] == '/')
       {
         root = td->getVhostSys();
-        /*!
+        /*
          *Do not allow access to the system directory root but only
          *to subdirectories.
          */
@@ -2188,8 +2188,10 @@
         root = td->getVhostDir();
       }
       filenamePath.assign(root);
+
       if(filename[0] != '/')
         filenamePath.append("/");
+
       filenamePath.append(filename);
     }
     else





From MAILER-DAEMON Sun Oct 26 10:12:14 2008
Received: from mailman by lists.gnu.org with archive (Exim 4.43)
	id 1Ku6Lm-0005A9-5u
	for mharc-myserver-commit@gnu.org; Sun, 26 Oct 2008 10:12:14 -0400
Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43)
	id 1Ku6Lk-00059K-JJ
	for myserver-commit@gnu.org; Sun, 26 Oct 2008 10:12:12 -0400
Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43)
	id 1Ku6Lj-00058w-ML
	for myserver-commit@gnu.org; Sun, 26 Oct 2008 10:12:12 -0400
Received: from [199.232.76.173] (port=58827 helo=monty-python.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.43) id 1Ku6Lj-00058s-J6
	for myserver-commit@gnu.org; Sun, 26 Oct 2008 10:12:11 -0400
Received: from savannah.gnu.org ([199.232.41.3]:51901 helo=sv.gnu.org)
	by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32)
	(Exim 4.60) (envelope-from <INVALID.NOREPLY@gnu.org>)
	id 1Ku6Lj-0002rc-01
	for myserver-commit@gnu.org; Sun, 26 Oct 2008 10:12:11 -0400
Received: from cvs.savannah.gnu.org ([199.232.41.69])
	by sv.gnu.org with esmtp (Exim 4.63)
	(envelope-from <INVALID.NOREPLY@gnu.org>) id 1Ku6Li-0005gX-HH
	for myserver-commit@gnu.org; Sun, 26 Oct 2008 14:12:10 +0000
Received: from gscrivano by cvs.savannah.gnu.org with local (Exim 4.63)
	(envelope-from <gscrivano@savannah.gnu.org>) id 1Ku6Li-0005gS-33
	for myserver-commit@gnu.org; Sun, 26 Oct 2008 14:12:10 +0000
MIME-Version: 1.0
Errors-To: gscrivano
To: myserver-commit@gnu.org
X-Mailer: SVN::Notify 2.64: http://search.cpan.org/dist/SVN-Notify/
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
From: Giuseppe Scrivano <gscrivano@gnu.org>
Message-Id: <E1Ku6Li-0005gS-33@cvs.savannah.gnu.org>
Date: Sun, 26 Oct 2008 14:12:10 +0000
X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 3)
Subject: [myserver-commit] [2910] Cleaned HTTP managers interface,
 (EXECUTE|RUN)
 METHOD simplified to METHOD and an additional attribute in the MIME
 definition .
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/pipermail/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, 26 Oct 2008 14:12:12 -0000

Revision: 2910
          http://svn.sv.gnu.org/viewvc/?view=rev&root=myserver&revision=2910
Author:   gscrivano
Date:     2008-10-26 14:12:09 +0000 (Sun, 26 Oct 2008)

Log Message:
-----------
Cleaned HTTP managers interface, (EXECUTE|RUN)METHOD simplified to METHOD and an additional attribute in the MIME definition.

Modified Paths:
--------------
    trunk/myserver/binaries/MIMEtypes.xml.default
    trunk/myserver/binaries/MIMEtypes.xml.unix.default
    trunk/myserver/documentation/mime_types.texi
    trunk/myserver/include/conf/mime/mime_manager.h
    trunk/myserver/include/conf/vhost/vhost_manager.h
    trunk/myserver/include/plugin/http_manager/dyn_http_manager.h
    trunk/myserver/include/protocol/http/http.h
    trunk/myserver/src/conf/mime/mime_manager.cpp
    trunk/myserver/src/conf/vhost/vhost_manager.cpp
    trunk/myserver/src/plugin/http_manager/dyn_http_manager.cpp
    trunk/myserver/src/protocol/http/http.cpp

Modified: trunk/myserver/binaries/MIMEtypes.xml.default
===================================================================
--- trunk/myserver/binaries/MIMEtypes.xml.default	2008-10-26 12:01:40 UTC (rev 2909)
+++ trunk/myserver/binaries/MIMEtypes.xml.default	2008-10-26 14:12:09 UTC (rev 2910)
@@ -2,23 +2,23 @@
 
 <MIMES>
 
-<MIME mime="text/html" handler="RUNMSCGI" param="">
+<MIME mime="text/html" handler="MSCGI" param="">
 <EXTENSION value="mscgi"/>
 </MIME>
 
-<MIME mime="text/html" handler="EXECUTE" param="">
+<MIME mime="text/html" handler="CGI" self="YES" param="">
 <EXTENSION value="cgi"/>
 </MIME>
 
-<MIME mime="text/html" handler="EXECUTEISAPI" param="">
+<MIME mime="text/html" handler="ISAPI" param="">
 <EXTENSION value="isapi"/>
 </MIME>
 
-<MIME mime="text/html" handler="EXECUTEFASTCGI" param="">
+<MIME mime="text/html" handler="FASTCGI" param="">
 <EXTENSION value="fcgi"/>
 </MIME>
 
-<MIME mime="text/html" handler="EXECUTEWINCGI" param="">
+<MIME mime="text/html" handler="WINCGI" param="">
 <EXTENSION value="wincgi"/>
 </MIME>
 
@@ -562,4 +562,4 @@
 <EXTENSION value="html"/>
 </MIME>
 
-</MIMES>
\ No newline at end of file
+</MIMES>

Modified: trunk/myserver/binaries/MIMEtypes.xml.unix.default
===================================================================
--- trunk/myserver/binaries/MIMEtypes.xml.unix.default	2008-10-26 12:01:40 UTC (rev 2909)
+++ trunk/myserver/binaries/MIMEtypes.xml.unix.default	2008-10-26 14:12:09 UTC (rev 2910)
@@ -2,23 +2,23 @@
 
 <MIMES>
 
-<MIME mime="text/html" handler="RUNMSCGI" param="">
+<MIME mime="text/html" handler="MSCGI" param="">
 <EXTENSION value="mscgi"/>
 </MIME>
 
-<MIME mime="text/html" handler="EXECUTE" param="">
+<MIME mime="text/html" handler="CGI" self="YES" param="">
 <EXTENSION value="cgi"/>
 </MIME>
 
-<MIME mime="text/html" handler="EXECUTEISAPI" param="">
+<MIME mime="text/html" handler="ISAPI" param="">
 <EXTENSION value="isapi"/>
 </MIME>
 
-<MIME mime="text/html" handler="EXECUTEFASTCGI" param="">
+<MIME mime="text/html" handler="FASTCGI" param="">
 <EXTENSION value="fcgi"/>
 </MIME>
 
-<MIME mime="text/html" handler="EXECUTEWINCGI" param="">
+<MIME mime="text/html" handler="WINCGI" param="">
 <EXTENSION value="wincgi"/>
 </MIME>
 

Modified: trunk/myserver/documentation/mime_types.texi
===================================================================
--- trunk/myserver/documentation/mime_types.texi	2008-10-26 12:01:40 UTC (rev 2909)
+++ trunk/myserver/documentation/mime_types.texi	2008-10-26 14:12:09 UTC (rev 2910)
@@ -8,7 +8,7 @@
 <EXTENSION value="html"/>
 </MIME>
 
-<MIME mime="text/html" handler="RUNCGI" param="/usr/bin/perl">
+<MIME mime="text/html" handler="RUNCGI" param="/usr/bin/perl" selfExecuted="NO">
 <FILTER value="gzip"/>
 <EXTENSION value="pl"/>
 </MIME>
@@ -32,6 +32,13 @@
 @item param
 specifies additional params for the handler.
 
+@item selfExecuted
+where it is supported, lanuch the accessed resource as a process or a
+server.
+For example, there is need to use selfExecuted on the CGI protocol if
+the accessed resource can be used as a process.  Differently if it is
+not specified the resource mapped by the URI will be used as an
+argument to @code{param}.
 @end itemize
 
 @code{<FILTER>} defines a filter for the MIME type.  The data will
@@ -49,35 +56,20 @@
 Send the file statically as is.  This command is used for files
 extensions such as .html and .jpg that don't need any external
 intervention from the web server.
-@item RUNCGI
+@item CGI
 Run the CGI script indicated in the path.  It is used for file
 extensions such as .php and .pl that need to be processed before
 sending any data to the client.
-@item RUNFASTCGI
+@item FASTCGI
 Run the Fastcgi script.  This type will need a fastcgi parser
 downloaded (see the PHP page).  It is also used for file extensions
 such as .php and .pl.
-@item EXECUTEFASTCGI
-This also runs the Fastcgi script, but unlike the RUNFASTCGI above, it
-does not need a server to run the script, instead it acts as a self
-server.
-@item RUNSCGI
+@item SCGI
 Handle a specified mime type with this SCGI server.
-@item EXECUTESCGI
-Handle the file as a self SCGI process.
-@item RUNMSCGI
+@item MSCGI
 Run the MSCGI script. This library is only available for MyServer. It
 is used to build fast and efficient CGIs that needs to access MyServer
 internal data.
-@item EXECUTE
-Treat the file as an executable and send the output to the client. 
-@item SENDLINK
-Send the file that is contained in a link.
-@item EXECUTEWINCGI
-Send the file as a WinCGI
-@item RUNISAPI
+@item ISAPI
 Run the ISAPI script.  
-@item EXECUTEISAPI
-Run the ISAPI script but does not need a server to run. Instead, it
-acts as a self server.
 @end enumerate

Modified: trunk/myserver/include/conf/mime/mime_manager.h
===================================================================
--- trunk/myserver/include/conf/mime/mime_manager.h	2008-10-26 12:01:40 UTC (rev 2909)
+++ trunk/myserver/include/conf/mime/mime_manager.h	2008-10-26 14:12:09 UTC (rev 2910)
@@ -53,6 +53,7 @@
 	string mimeType;
 	string cmdName;
 	string cgiManager;
+  bool selfExecuted;
 	MimeRecord ();
 	MimeRecord (MimeRecord&);
 	int addFilter (const char*, bool acceptDuplicate = true);

Modified: trunk/myserver/include/conf/vhost/vhost_manager.h
===================================================================
--- trunk/myserver/include/conf/vhost/vhost_manager.h	2008-10-26 12:01:40 UTC (rev 2909)
+++ trunk/myserver/include/conf/vhost/vhost_manager.h	2008-10-26 14:12:09 UTC (rev 2910)
@@ -64,7 +64,6 @@
   void changeLocationsOwner ();
 private:
   void loadXMLlogData (string, Vhost*, xmlNode*);
-  string saveXMLlogData (string, Vhost*);
   ListenThreads* listenThreads;
   Mutex mutex;
   VhostSource* extSource;

Modified: trunk/myserver/include/plugin/http_manager/dyn_http_manager.h
===================================================================
--- trunk/myserver/include/plugin/http_manager/dyn_http_manager.h	2008-10-26 12:01:40 UTC (rev 2909)
+++ trunk/myserver/include/plugin/http_manager/dyn_http_manager.h	2008-10-26 14:12:09 UTC (rev 2910)
@@ -1,7 +1,7 @@
 /* -*- mode: c++ -*- */
 /*
 MyServer
-Copyright (C) 2005 Free Software Foundation, Inc.
+Copyright (C) 2005, 2008 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
@@ -38,7 +38,7 @@
 	DynamicHttpManager();
 	virtual ~DynamicHttpManager();
 	virtual int send(HttpThreadContext*, ConnectionPtr s, const char *filenamePath,
-                   const char* cgi, int onlyHeader = 0);
+                   const char* cgi, int selfExecuted, int onlyHeader = 0);
 
 };
 

Modified: trunk/myserver/include/protocol/http/http.h
===================================================================
--- trunk/myserver/include/protocol/http/http.h	2008-10-26 12:01:40 UTC (rev 2909)
+++ trunk/myserver/include/protocol/http/http.h	2008-10-26 14:12:09 UTC (rev 2910)
@@ -190,6 +190,9 @@
   SecurityToken *getSecurityToken (){return &(td->securityToken);}
 
 protected:
+
+  int processDefaultFile (string& uri, int permissions, int onlyHeader);
+
   HttpDataHandler* mscgi;
   HttpDataHandler* wincgi;
   HttpDataHandler* isapi;

Modified: trunk/myserver/src/conf/mime/mime_manager.cpp
===================================================================
--- trunk/myserver/src/conf/mime/mime_manager.cpp	2008-10-26 12:01:40 UTC (rev 2909)
+++ trunk/myserver/src/conf/mime/mime_manager.cpp	2008-10-26 14:12:09 UTC (rev 2910)
@@ -38,6 +38,7 @@
   mimeType.assign ("");
   cgiManager.assign ("");
   cmdName.assign ("");
+  selfExecuted = false;
 }
 
 /*!
@@ -90,6 +91,7 @@
     filters.push_back (*i);
   }
 
+  selfExecuted = m.selfExecuted;
   mimeType.assign (m.mimeType);
   cmdName.assign (m.cmdName);
   cgiManager.assign (m.cgiManager);
@@ -130,7 +132,12 @@
     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 *)"param") && 
         attrs->children && attrs->children->content)
       rc->cgiManager.assign ((const char*)attrs->children->content);

Modified: trunk/myserver/src/conf/vhost/vhost_manager.cpp
===================================================================
--- trunk/myserver/src/conf/vhost/vhost_manager.cpp	2008-10-26 12:01:40 UTC (rev 2909)
+++ trunk/myserver/src/conf/vhost/vhost_manager.cpp	2008-10-26 14:12:09 UTC (rev 2910)
@@ -200,13 +200,10 @@
        *Change the log files owner if a different user or group
        *identifier is specified.
        */
-      for(int i = 0; ; i++)
+      for(list<Vhost*>::iterator it = hostList.begin (); it != hostList.end (); it++)
         {
           int err;
-          Vhost* vh = getVHostByNumber(i);
-          /* Break if we reach the end of the list.  */
-          if(!vh)
-            break;
+          Vhost* vh = *it;
 
           /* Chown the log files.  */
           err = logManager->chown (vh, "ACCESSLOG", uid, gid);
@@ -235,48 +232,10 @@
   return hostList.size();
 }
 
-string
-VhostManager::saveXMLlogData (string name, Vhost* vh)
-{
-  list<string> l;
-  ostringstream oss;
-  if (!logManager->get (vh, name, &l))
-    {
-      list<string>::iterator it;
-      oss << "<STREAMS>\r\n";
-      for (it = l.begin (); it != l.end (); it++)
-        {
-          oss << "<STREAM>\r\n";
-          oss << "<LOCATION>";
-          oss << *it;
-          oss << "</LOCATION>\r\n";
-          u_long cycle = 0;
-          if (!logManager->getCycle (*it, &cycle))
-            {
-              oss << "<CYCLE>";
-              oss << cycle;
-              oss << "</CYCLE>\r\n";
-            }
-          list<string> f;
-          if (!logManager->getFilters (*it, &f))
-            {
-              oss << "<FILTERS>\r\n";
-              list<string>::iterator it_1;
-              for (it_1 = f.begin (); it_1 != f.end (); it_1++)
-                {
-                  oss << "<FILTER>";
-                  oss << *it_1;
-                  oss << "</FILTER>\r\n";
-                }
-              oss << "</FILTERS>\r\n";
-            }
-          oss << "</STREAM>\r\n";
-        }
-      oss << "</STREAMS>\r\n";
-    }
-  return oss.str ();
-}
 
+/*!
+ *Load a log XML node.
+ */
 void
 VhostManager::loadXMLlogData (string name, Vhost* vh, xmlNode* lcur)
 {

Modified: trunk/myserver/src/plugin/http_manager/dyn_http_manager.cpp
===================================================================
--- trunk/myserver/src/plugin/http_manager/dyn_http_manager.cpp	2008-10-26 12:01:40 UTC (rev 2909)
+++ trunk/myserver/src/plugin/http_manager/dyn_http_manager.cpp	2008-10-26 14:12:09 UTC (rev 2910)
@@ -23,7 +23,7 @@
 #include <string>
 
 typedef int (*sendManagerPROC)(volatile void*, volatile void*, const char*, 
-                               const char*, int); 
+                               const char*, int, int); 
 
 
 /*!
@@ -47,11 +47,11 @@
  */
 int DynamicHttpManager::send(HttpThreadContext* context, ConnectionPtr s, 
                              const char *filenamePath, const char* cgi, 
-                             int onlyHeader)
+                             int selfExecuted, int onlyHeader)
 {
   sendManagerPROC control = (sendManagerPROC)hinstLib.getProc("sendManager");
   if(control)
-    return control(context, s, filenamePath, cgi, onlyHeader);
+    return control(context, s, filenamePath, cgi, selfExecuted, onlyHeader);
   else
     return 0;
 }

Modified: trunk/myserver/src/protocol/http/http.cpp
===================================================================
--- trunk/myserver/src/protocol/http/http.cpp	2008-10-26 12:01:40 UTC (rev 2909)
+++ trunk/myserver/src/protocol/http/http.cpp	2008-10-26 14:12:09 UTC (rev 2910)
@@ -778,7 +778,7 @@
   string tmpTime;
   string directory;
   string file;
-  DynamicHttpManager* manager;
+  DynamicHttpManager *manager;
 
   /*! By default allows only few actions. */
   permissions = MYSERVER_PERMISSION_READ | MYSERVER_PERMISSION_BROWSE ;
@@ -804,69 +804,9 @@
         return raiseHTTPError(ret);
     }
 
-    /*!
-     *If there are not any extension then we do one of this in order:
-     *1)We send the default files in the directory in order.
-     *2)We send the directory content.
-     *3)We send an error.
-     */
     if(!td->mime && FilesUtility::isDirectory(td->filenamePath.c_str()))
     {
-      int i;
-      if(!(permissions & MYSERVER_PERMISSION_BROWSE))
-      {
-        return sendAuth();
-      }
-      for(i = 0;; i++)
-      {
-        const char *defaultFileNamePath = getDefaultFilenamePath(i);
-        ostringstream defaultFileName;
-        defaultFileName.clear();
-        if(defaultFileNamePath)
-        {
-          defaultFileName << td->filenamePath << "/" << defaultFileNamePath;
-        }
-        else
-        {
-          break;
-        }
-
-        if(FilesUtility::fileExists(defaultFileName.str().c_str()))
-        {
-          ostringstream nUrl;
-
-          if(td->request.uriEndsWithSlash)
-          {
-            nUrl << defaultFileNamePath;
-          }
-          else
-          {
-            u_long lastSlashOffset = uri.length();
-            while(lastSlashOffset && uri[lastSlashOffset] != '/')
-              --lastSlashOffset;
-
-            nUrl << &(uri.c_str()[lastSlashOffset < uri.length() ?
-                                  lastSlashOffset + 1 : 0])
-                 << "/" << defaultFileNamePath;
-          }
-
-          if(td->pathInfo.length())
-            nUrl << "/" << td->pathInfo;
-
-
-          if(td->request.uriOpts.length())
-            nUrl << "?" << td->request.uriOpts;
-
-          /*! Send a redirect to the new location.  */
-          if(sendHTTPRedirect(nUrl.str().c_str()))
-            ret = 1;
-          else
-            ret = 0;
-          return ret;
-        }
-      }
-      return httpDir->send(td, td->connection, td->filenamePath.c_str(), 0,
-                           onlyHeader);
+      return processDefaultFile (uri, permissions, onlyHeader);
     }
 
     data.assign("");
@@ -886,7 +826,7 @@
     }
 
 
-    if(td->mime && !td->mime->cmdName.compare ("RUNCGI"))
+    if(td->mime && !td->mime->cmdName.compare ("CGI"))
     {
       int allowCgi = 1;
       const char *dataH = td->connection->host->getHashedData("ALLOW_CGI");
@@ -903,31 +843,11 @@
         return sendAuth();
       }
       ret = cgi->send(td, td->connection, td->filenamePath.c_str(),
-                      data.c_str(), 0,  onlyHeader);
+                      data.c_str(), td->mime->selfExecuted,  onlyHeader);
       return ret;
     }
-    else if(td->mime && !td->mime->cmdName.compare ("EXECUTE"))
+    else if(td->mime && !td->mime->cmdName.compare ("ISAPI"))
     {
-      int allowCgi = 1;
-      const char *dataH = td->connection->host->getHashedData("ALLOW_CGI");
-      if(dataH)
-      {
-        if(!strcmpi(dataH, "YES"))
-          allowCgi = 1;
-        else
-          allowCgi = 0;
-      }
-
-      if(!allowCgi || !(permissions & MYSERVER_PERMISSION_EXECUTE))
-      {
-        return sendAuth();
-      }
-      ret = cgi->send(td, td->connection, td->filenamePath.c_str(),
-                      data.c_str(), 1, onlyHeader);
-      return ret;
-    }
-    else if(td->mime && !td->mime->cmdName.compare ("RUNISAPI"))
-    {
       int allowIsapi = 1;
       const char *dataH = td->connection->host->getHashedData("ALLOW_ISAPI");
       if(dataH)
@@ -942,22 +862,11 @@
         return sendAuth();
       }
       ret = isapi->send(td, td->connection, td->filenamePath.c_str(),
-                        data.c_str(), 0, onlyHeader);
+                        data.c_str(), td->mime->selfExecuted, onlyHeader);
       return ret;
-
     }
-    else if(td->mime && !td->mime->cmdName.compare ("EXECUTEISAPI"))
+    else if(td->mime && !td->mime->cmdName.compare ("MSGI"))
     {
-      if(!(permissions & MYSERVER_PERMISSION_EXECUTE))
-      {
-        return sendAuth();
-      }
-      ret = isapi->send(td, td->connection, td->filenamePath.c_str(),
-                        data.c_str(), 1, onlyHeader);
-      return ret;
-    }
-    else if(td->mime && !td->mime->cmdName.compare ("RUNMSGI"))
-    {
       char* target;
       int allowMscgi = 1;
       const char *dataH = td->connection->host->getHashedData("ALLOW_MSCGI");
@@ -979,10 +888,10 @@
         target = (char*)td->request.uriOpts.c_str();
 
       ret = mscgi->send(td, td->connection, td->filenamePath.c_str(),
-                        target, 1, onlyHeader);
+                        target, td->mime->selfExecuted, onlyHeader);
       return ret;
     }
-    else if(td->mime && !td->mime->cmdName.compare ("EXECUTEWINCGI"))
+    else if(td->mime && !td->mime->cmdName.compare ("WINCGI"))
     {
       ostringstream cgipath;
       int allowWincgi = 1;
@@ -1008,10 +917,10 @@
         cgipath << td->filenamePath;
       }
       ret = wincgi->send(td, td->connection, cgipath.str().c_str(),
-                         0, 1, onlyHeader);
+                         0, td->mime->selfExecuted, onlyHeader);
       return ret;
     }
-    else if(td->mime && !td->mime->cmdName.compare ("RUNFASTCGI"))
+    else if(td->mime && !td->mime->cmdName.compare ("FASTCGI"))
     {
       int allowFastcgi = 1;
       const char *dataH = td->connection->host->getHashedData("ALLOW_FASTCGI");
@@ -1027,30 +936,11 @@
         return sendAuth();
       }
       ret = fastcgi->send(td, td->connection, td->filenamePath.c_str(),
-                          data.c_str(), 0, onlyHeader);
+                          data.c_str(), td->mime->selfExecuted, onlyHeader);
       return ret;
     }
-    else if(td->mime && !td->mime->cmdName.compare ("EXECUTEFASTCGI"))
+    else if(td->mime && !td->mime->cmdName.compare ("SCGI"))
     {
-      int allowFastcgi = 1;
-      const char *dataH = td->connection->host->getHashedData("ALLOW_FASTCGI");
-      if(dataH)
-      {
-        if(!strcmpi(dataH, "YES"))
-          allowFastcgi = 1;
-        else
-          allowFastcgi = 0;
-      }
-      if(!allowFastcgi || !(permissions & MYSERVER_PERMISSION_EXECUTE))
-      {
-        return sendAuth();
-      }
-      ret = fastcgi->send(td, td->connection, td->filenamePath.c_str(),
-                          data.c_str(), 1, onlyHeader);
-      return ret;
-    }
-    else if(td->mime && !td->mime->cmdName.compare ("RUNSCGI"))
-    {
       int allowScgi = 1;
       const char *dataH = td->connection->host->getHashedData("ALLOW_SCGI");
       if(dataH)
@@ -1065,109 +955,14 @@
         return sendAuth();
       }
       ret = scgi->send(td, td->connection, td->filenamePath.c_str(),
-                       data.c_str(), 0, onlyHeader);
+                       data.c_str(), td->mime->selfExecuted, onlyHeader);
       return ret;
     }
-    else if(td->mime && !td->mime->cmdName.compare ("EXECUTESCGI"))
+    else if (td->mime && (manager = staticHttp.dynManagerList.getPlugin (td->mime->cmdName)))
     {
-      int allowScgi = 1;
-      const char *dataH = td->connection->host->getHashedData("ALLOW_SCGI");
-      if(dataH)
-      {
-        if(!strcmpi(dataH, "YES"))
-          allowScgi = 1;
-        else
-          allowScgi = 0;
-      }
-      if(!allowScgi || !(permissions & MYSERVER_PERMISSION_EXECUTE))
-      {
-        return sendAuth();
-      }
-      ret = scgi->send(td, td->connection, td->filenamePath.c_str(),
-                       data.c_str(), 1, onlyHeader);
-      return ret;
-    }
-    else if(td->mime && !td->mime->cmdName.compare ("SENDLINK"))
-    {
-      u_long nbr;
-      char* linkpath;
-      char* pathInfo;
-      int linkpathSize;
-      File h;
-      int allowSendlink = 1;
-      const char *dataH =
-        td->connection->host->getHashedData("ALLOW_SEND_LINK");
-
-      if(dataH)
-      {
-        if(!strcmpi(dataH, "YES"))
-          allowSendlink = 1;
-        else
-          allowSendlink = 0;
-      }
-
-      if(!allowSendlink || !(permissions & MYSERVER_PERMISSION_READ))
-      {
-        return sendAuth();
-      }
-
-      if(h.openFile(td->filenamePath.c_str(),
-                    File::MYSERVER_OPEN_IFEXISTS|File::MYSERVER_OPEN_READ))
-      {
-        return raiseHTTPError(500);
-      }
-
-      linkpathSize = h.getFileSize() + td->pathInfo.length() + 1;
-
-      if(linkpathSize > MYSERVER_KB(10))
-        linkpathSize = MYSERVER_KB(10);
-
-      linkpath=new char[linkpathSize];
-
-      if(linkpath == 0)
-      {
-        return sendHTTPhardError500();
-      }
-
-      if(h.read(linkpath, linkpathSize, &nbr))
-      {
-        h.close();
-        delete [] linkpath;
-        return raiseHTTPError(500);/*!Internal server error*/
-      }
-
-      h.close();
-      linkpath[nbr]='\0';
-
-      pathInfo = new char[td->pathInfo.length() + 1];
-
-      if(pathInfo == 0)
-      {
-        delete [] linkpath;
-        return raiseHTTPError(500);/*!Internal server error*/
-      }
-      strcpy(pathInfo, td->pathInfo.c_str());
-      translateEscapeString(pathInfo);
-      strncat(linkpath, pathInfo,strlen(linkpath));
-
-      if(nbr)
-      {
-        string uri;
-        uri.assign(linkpath);
-        ret = sendHTTPResource(uri, systemrequest, onlyHeader, 1);
-      }
-      else
-        ret = raiseHTTPError(404);
-
-      delete [] linkpath;
-      delete [] pathInfo;
-      return ret;
-    }
-    else if (td->mime && (manager = staticHttp.dynManagerList.getPlugin(td->mime->cmdName)))
-    {
       int allowExternal = 1;
       const char *dataH =
-        td->connection->host->getHashedData("ALLOW_EXTERNAL_COMMANDS");
+        td->connection->host->getHashedData ("ALLOW_EXTERNAL_COMMANDS");
 
       if(dataH)
       {
@@ -1180,28 +975,30 @@
       if(allowExternal && td->mime)
       {
         if(manager)
-          return manager->send(td, td->connection, td->filenamePath.c_str(),
-                               data.c_str(), onlyHeader);
+          return manager->send(td,
+                               td->connection,
+                               td->filenamePath.c_str(),
+                               data.c_str(),
+                               td->mime->selfExecuted,
+                               onlyHeader);
         else
           return raiseHTTPError(501);
       }
+    }
 
+    int allowSend = 1;
+    const char *data = td->connection->host->getHashedData("ALLOW_SEND_FILE");
+    if(data)
+    {
+      if(!strcmpi(data, "YES"))
+        allowSend = 1;
+      else
+        allowSend = 0;
     }
 
+    if(!allowSend)
     {
-      int allowSend = 1;
-      const char *data = td->connection->host->getHashedData("ALLOW_SEND_FILE");
-      if(data)
-      {
-        if(!strcmpi(data, "YES"))
-          allowSend = 1;
-        else
-          allowSend = 0;
-      }
-      if(!allowSend)
-      {
-        return sendAuth();
-      }
+      return sendAuth();
     }
 
     if(!(permissions & MYSERVER_PERMISSION_READ))
@@ -2203,7 +2000,77 @@
   return 200;
 }
 
+
+
 /*!
+ *If a directory is accessed try in order:
+ *
+ *1) The default files in order.
+ *2) The directory content.
+ *3) An error.
+ *
+ *\param uri The accessed URI.
+ *\param permissions The permission mask for the client.
+ *\param onlyHeader specify if the client requested only the header.
+ */
+int Http::processDefaultFile (string& uri, int permissions, int onlyHeader)
+{
+  int i;
+  int ret;
+
+  if( !(permissions & MYSERVER_PERMISSION_BROWSE) )
+    {
+      return sendAuth();
+    }
+
+  for(i = 0;; i++)
+    {
+      const char *defaultFileNamePath = getDefaultFilenamePath(i);
+      ostringstream defaultFileName;
+      defaultFileName.clear();
+      if(defaultFileNamePath)
+        {
+          defaultFileName << td->filenamePath << "/" << defaultFileNamePath;
+        }
+      else
+          break;
+      
+      if(FilesUtility::fileExists(defaultFileName.str().c_str()))
+        {
+          ostringstream nUrl;
+          
+          if(td->request.uriEndsWithSlash)
+              nUrl << defaultFileNamePath;
+          else
+            {
+              u_long lastSlashOffset = uri.length();
+              while(lastSlashOffset && uri[lastSlashOffset] != '/')
+                --lastSlashOffset;
+              
+              nUrl << &(uri.c_str()[lastSlashOffset < uri.length() ?
+                                    lastSlashOffset + 1 : 0])
+                   << "/" << defaultFileNamePath;
+            }
+          
+          if(td->pathInfo.length())
+            nUrl << "/" << td->pathInfo;
+
+          if(td->request.uriOpts.length())
+            nUrl << "?" << td->request.uriOpts;
+
+          /*! Send a redirect to the new location.  */
+          if(sendHTTPRedirect(nUrl.str().c_str()))
+            ret = 1;
+          else
+            ret = 0;
+          return ret;
+        }
+    }
+  return httpDir->send(td, td->connection, td->filenamePath.c_str(), 0,
+                       onlyHeader);
+}
+
+/*!
  *Get the CSS file used in a browsed directory.
  */
 const char* Http::getBrowseDirCSSFile()





From MAILER-DAEMON Sun Oct 26 11:49:24 2008
Received: from mailman by lists.gnu.org with archive (Exim 4.43)
	id 1Ku7ro-0003mM-5f
	for mharc-myserver-commit@gnu.org; Sun, 26 Oct 2008 11:49:24 -0400
Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43)
	id 1Ku7rl-0003le-RE
	for myserver-commit@gnu.org; Sun, 26 Oct 2008 11:49:21 -0400
Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43)
	id 1Ku7ri-0003kP-OQ
	for myserver-commit@gnu.org; Sun, 26 Oct 2008 11:49:21 -0400
Received: from [199.232.76.173] (port=56058 helo=monty-python.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.43) id 1Ku7ri-0003kK-FP
	for myserver-commit@gnu.org; Sun, 26 Oct 2008 11:49:18 -0400
Received: from savannah.gnu.org ([199.232.41.3]:49073 helo=sv.gnu.org)
	by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32)
	(Exim 4.60) (envelope-from <INVALID.NOREPLY@gnu.org>)
	id 1Ku7rg-0006ot-Ue
	for myserver-commit@gnu.org; Sun, 26 Oct 2008 11:49:18 -0400
Received: from cvs.savannah.gnu.org ([199.232.41.69])
	by sv.gnu.org with esmtp (Exim 4.63)
	(envelope-from <INVALID.NOREPLY@gnu.org>) id 1Ku7rf-00030m-Mk
	for myserver-commit@gnu.org; Sun, 26 Oct 2008 15:49:15 +0000
Received: from dperrone by cvs.savannah.gnu.org with local (Exim 4.63)
	(envelope-from <dperrone@savannah.gnu.org>) id 1Ku7rf-00030h-9B
	for myserver-commit@gnu.org; Sun, 26 Oct 2008 15:49:15 +0000
MIME-Version: 1.0
Errors-To: dperrone
To: myserver-commit@gnu.org
X-Mailer: SVN::Notify 2.64: http://search.cpan.org/dist/SVN-Notify/
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
From: Daniele Perrone <dperrone@it.gnu.org>
Message-Id: <E1Ku7rf-00030h-9B@cvs.savannah.gnu.org>
Date: Sun, 26 Oct 2008 15:49:15 +0000
X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 3)
Subject: [myserver-commit] [2911] Refactored plugins management,
 left only generic plugin, 
 all different kind of plugins are been removed.
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/pipermail/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, 26 Oct 2008 15:49:22 -0000

Revision: 2911
          http://svn.sv.gnu.org/viewvc/?view=rev&root=myserver&revision=2911
Author:   dperrone
Date:     2008-10-26 15:49:14 +0000 (Sun, 26 Oct 2008)

Log Message:
-----------
Refactored plugins management, left only generic plugin, all different kind of plugins are been removed.

Modified Paths:
--------------
    trunk/myserver/include/plugin/Makefile.am
    trunk/myserver/include/plugin/plugins_manager.h
    trunk/myserver/include/protocol/http/Makefile.am
    trunk/myserver/include/protocol/http/http.h
    trunk/myserver/include/protocol/http/http_data_read.h
    trunk/myserver/include/server/server.h
    trunk/myserver/src/plugin/Makefile.am
    trunk/myserver/src/plugin/plugins_manager.cpp
    trunk/myserver/src/protocol/Makefile.am
    trunk/myserver/src/protocol/control/control_protocol.cpp
    trunk/myserver/src/protocol/http/Makefile.am
    trunk/myserver/src/protocol/http/http.cpp
    trunk/myserver/src/server/server.cpp

Added Paths:
-----------
    trunk/myserver/include/protocol/Makefile
    trunk/myserver/include/protocol/Makefile.in
    trunk/myserver/include/protocol/http/dyn_http_command.h
    trunk/myserver/include/protocol/http/dyn_http_command_manager.h
    trunk/myserver/include/protocol/http/dyn_http_manager.h
    trunk/myserver/include/protocol/http/dyn_http_manager_list.h
    trunk/myserver/include/protocol/protocols_manager.h
    trunk/myserver/src/protocol/http/dyn_http_command.cpp
    trunk/myserver/src/protocol/http/dyn_http_command_manager.cpp
    trunk/myserver/src/protocol/http/dyn_http_manager.cpp
    trunk/myserver/src/protocol/http/dyn_http_manager_list.cpp
    trunk/myserver/src/protocol/protocols_manager.cpp

Removed Paths:
-------------
    trunk/myserver/binaries/plugins/executors/
    trunk/myserver/binaries/plugins/filters/
    trunk/myserver/binaries/plugins/generics/
    trunk/myserver/binaries/plugins/http_commands/
    trunk/myserver/binaries/plugins/http_managers/
    trunk/myserver/binaries/plugins/protocols/
    trunk/myserver/include/plugin/executor/
    trunk/myserver/include/plugin/filter/
    trunk/myserver/include/plugin/generic_plugins_manager.h
    trunk/myserver/include/plugin/http_command/
    trunk/myserver/include/plugin/http_manager/
    trunk/myserver/include/plugin/plugins_namespace.h
    trunk/myserver/include/plugin/plugins_namespace_manager.h
    trunk/myserver/include/plugin/protocol/
    trunk/myserver/src/plugin/executor/
    trunk/myserver/src/plugin/filter/
    trunk/myserver/src/plugin/generic_plugins_manager.cpp
    trunk/myserver/src/plugin/http_command/
    trunk/myserver/src/plugin/http_manager/
    trunk/myserver/src/plugin/plugins_namespace.cpp
    trunk/myserver/src/plugin/plugins_namespace_manager.cpp
    trunk/myserver/src/plugin/protocol/

Modified: trunk/myserver/include/plugin/Makefile.am
===================================================================
--- trunk/myserver/include/plugin/Makefile.am	2008-10-26 14:12:09 UTC (rev 2910)
+++ trunk/myserver/include/plugin/Makefile.am	2008-10-26 15:49:14 UTC (rev 2911)
@@ -1,4 +1,4 @@
 pluginincludedir=$(includedir)/myserver/include/plugin
-plugininclude_HEADERS = generic_plugins_manager.h plugin.h plugins_manager.h plugins_namespace.h plugins_namespace_manager.h
-SUBDIRS = executor filter http_command http_manager protocol
+plugininclude_HEADERS =  plugin.h plugins_manager.h 
 
+

Deleted: trunk/myserver/include/plugin/generic_plugins_manager.h
===================================================================
--- trunk/myserver/include/plugin/generic_plugins_manager.h	2008-10-26 14:12:09 UTC (rev 2910)
+++ trunk/myserver/include/plugin/generic_plugins_manager.h	2008-10-26 15:49:14 UTC (rev 2911)
@@ -1,33 +0,0 @@
-/* -*- mode: c++ -*- */
-/*
-MyServer
-Copyright (C) 2007 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
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program.  If not, see <http://www.gnu.org/licenses/>.
-*/
-
-#ifndef GENERIC_PLUGINS_MANAGER_H
-#define GENERIC_PLUGINS_MANAGER_H
-
-#include "stdafx.h"
-#include <include/plugin/plugins_namespace_manager.h>
-
-using namespace std;
-
-class GenericPluginsManager : public PluginsNamespaceManager
-{
-public:
-	GenericPluginsManager();
-};
-
-#endif

Modified: trunk/myserver/include/plugin/plugins_manager.h
===================================================================
--- trunk/myserver/include/plugin/plugins_manager.h	2008-10-26 14:12:09 UTC (rev 2910)
+++ trunk/myserver/include/plugin/plugins_manager.h	2008-10-26 15:49:14 UTC (rev 2911)
@@ -21,7 +21,6 @@
 
 #include "stdafx.h"
 #include <include/plugin/plugin.h>
-#include <include/plugin/plugins_namespace.h>
 #include <include/base/dynamic_lib/dynamiclib.h>
 #include <include/base/hash_map/hash_map.h>
 #include <string>
@@ -33,18 +32,43 @@
 class PluginsManager
 {
 public:
-	Plugin* getPlugin(string& namespacename, string& plugin);
-	Plugin* getPlugin(string& fullname);
+
+	struct PluginOption
+	{
+		PluginOption(PluginOption& po){enabled = po.enabled; global = po.global;}
+		PluginOption(){enabled = true; global = false;}
+		bool enabled;
+    	bool global;
+	};
 	
+	
+	
+	HashMap<string, Plugin*>::Iterator begin(){return plugins.begin();}
+	HashMap<string, Plugin*>::Iterator end(){return plugins.end();}
+	
+	Plugin* getPlugin(string& name);
+	
 	int preLoad(Server *server, XmlParser* languageFile, string& resource);
 	int load(Server *server, XmlParser* languageFile, string& resource);
 	int postLoad(Server *server, XmlParser* languageFile);
 	int unLoad(Server *server, XmlParser* languageFile);
-	void addNamespace(PluginsNamespace* namespacename);
-	PluginsNamespace* getNamespace(string &name);
-	PluginsNamespace* removeNamespace(string& name);
+
+	virtual void removePlugin(string& name);
+
+	virtual int addPluginOption(string&, PluginOption&);
+	virtual PluginOption* getPluginOption(string&);
+	
+	virtual Plugin* createPluginObject();
+	
+	PluginsManager();
+	~PluginsManager();
+	
 private:
-	HashMap<char*, PluginsNamespace*> namespaces;
+	HashMap<string, PluginOption*> pluginsOptions;
+	HashMap<string, Plugin*> plugins;
+	int loadOptions(Server *server, XmlParser* languageFile);
+	int addPlugin(string& file, Server* server, 
+                XmlParser* languageFile, bool global);
 };
 
 #endif

Deleted: trunk/myserver/include/plugin/plugins_namespace.h
===================================================================
--- trunk/myserver/include/plugin/plugins_namespace.h	2008-10-26 14:12:09 UTC (rev 2910)
+++ trunk/myserver/include/plugin/plugins_namespace.h	2008-10-26 15:49:14 UTC (rev 2911)
@@ -1,70 +0,0 @@
-/* -*- mode: c++ -*- */
-/*
-MyServer
-Copyright (C) 2007, 2008 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
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program.  If not, see <http://www.gnu.org/licenses/>.
-*/
-
-#ifndef PLUGINS_NAMESPACE_H
-#define PLUGINS_NAMESPACE_H
-
-#include "stdafx.h"
-#include <include/connection/connection.h>
-#include <include/plugin/plugin.h>
-#include <include/base/hash_map/hash_map.h>
-#include <string>
-using namespace std;
-
-class XmlParser;
-class Server;
-
-class PluginsNamespace
-{
-public:
-	struct PluginOption
-	{
-		PluginOption(PluginOption& po){enabled = po.enabled; global = po.global;}
-		PluginOption(){enabled = true; global = false;}
-		bool enabled;
-    bool global;
-	};
-
-	HashMap<string, Plugin*>::Iterator begin(){return plugins.begin();}
-	HashMap<string, Plugin*>::Iterator end(){return plugins.end();}
-	string& getName();
-	PluginsNamespace(string name);
-	PluginsNamespace(string& name, PluginsNamespace& clone);
-	Plugin* getPlugin(string& name);
-	virtual int preLoad(Server* server, XmlParser* languageFile, 
-											string& resource) = 0;
-	virtual int load(Server* server, XmlParser* languageFile, 
-									 string& resource) = 0;
-	virtual int postLoad(Server* server, XmlParser* languageFile);
-	virtual int unLoad(XmlParser* languageFile);
-	virtual ~PluginsNamespace();
-	virtual int addPreloadedPlugin(Plugin*);
-	virtual void removePlugin(string& name);
-	bool isLoaded(){return loaded;}
-
-	virtual int addPluginOption(string&, PluginOption&);
-	virtual PluginOption* getPluginOption(string&);
-protected:
-	HashMap<string, Plugin*> plugins;
-	HashMap<string, PluginOption*> pluginsOptions;
-	void setName(string& name);
-private:
-	bool loaded;
-	string name;
-};
-#endif

Deleted: trunk/myserver/include/plugin/plugins_namespace_manager.h
===================================================================
--- trunk/myserver/include/plugin/plugins_namespace_manager.h	2008-10-26 14:12:09 UTC (rev 2910)
+++ trunk/myserver/include/plugin/plugins_namespace_manager.h	2008-10-26 15:49:14 UTC (rev 2911)
@@ -1,45 +0,0 @@
-/* -*- mode: c++ -*- */
-/*
-MyServer
-Copyright (C) 2007, 2008 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
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program.  If not, see <http://www.gnu.org/licenses/>.
-*/
-
-#ifndef PLUGINS_NAMESPACE_MANAGER_H
-#define PLUGINS_NAMESPACE_MANAGER_H
-
-#include "stdafx.h"
-#include <include/plugin/plugins_namespace.h>
-
-using namespace std;
-
-class PluginsNamespaceManager : public PluginsNamespace
-{
-public:
-	PluginsNamespaceManager(string name);
-
-	virtual int preLoad(Server* server, XmlParser* languageFile, 
-											string& resource);
-	virtual int load(Server* server, XmlParser* languageFile, 
-									 string& resource);
-
-protected:
-	virtual Plugin* createPluginObject();
-private:
-	int addPlugin(string& file, Server* server, 
-                XmlParser* languageFile, bool global);
-
-};
-
-#endif

Added: trunk/myserver/include/protocol/Makefile
===================================================================
--- trunk/myserver/include/protocol/Makefile	                        (rev 0)
+++ trunk/myserver/include/protocol/Makefile	2008-10-26 15:49:14 UTC (rev 2911)
@@ -0,0 +1,547 @@
+# Makefile.in generated by automake 1.10.1 from Makefile.am.
+# include/protocol/Makefile.  Generated from Makefile.in by configure.
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006, 2007, 2008  Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+
+
+
+pkgdatadir = $(datadir)/myserver
+pkglibdir = $(libdir)/myserver
+pkgincludedir = $(includedir)/myserver
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = i686-pc-linux-gnu
+host_triplet = i686-pc-linux-gnu
+target_triplet = i686-pc-linux-gnu
+subdir = include/protocol
+DIST_COMMON = $(protocolinclude_HEADERS) $(srcdir)/Makefile.am \
+	$(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/m4/cppunit.m4 \
+	$(top_srcdir)/m4/gnome-pthread-check.m4 \
+	$(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/libxml.m4 \
+	$(top_srcdir)/configure.in
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+	$(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/config.h
+CONFIG_CLEAN_FILES =
+SOURCES =
+DIST_SOURCES =
+RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
+	html-recursive info-recursive install-data-recursive \
+	install-dvi-recursive install-exec-recursive \
+	install-html-recursive install-info-recursive \
+	install-pdf-recursive install-ps-recursive install-recursive \
+	installcheck-recursive installdirs-recursive pdf-recursive \
+	ps-recursive uninstall-recursive
+am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
+am__vpath_adj = case $$p in \
+    $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
+    *) f=$$p;; \
+  esac;
+am__strip_dir = `echo $$p | sed -e 's|^.*/||'`;
+am__installdirs = "$(DESTDIR)$(protocolincludedir)"
+protocolincludeHEADERS_INSTALL = $(INSTALL_HEADER)
+HEADERS = $(protocolinclude_HEADERS)
+RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive	\
+  distclean-recursive maintainer-clean-recursive
+ETAGS = etags
+CTAGS = ctags
+DIST_SUBDIRS = $(SUBDIRS)
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = ${SHELL} /home/dany/srcprojects/myserver/myserver/missing --run aclocal-1.10
+AMTAR = ${SHELL} /home/dany/srcprojects/myserver/myserver/missing --run tar
+AR = ar
+AUTOCONF = ${SHELL} /home/dany/srcprojects/myserver/myserver/missing --run autoconf
+AUTOHEADER = ${SHELL} /home/dany/srcprojects/myserver/myserver/missing --run autoheader
+AUTOMAKE = ${SHELL} /home/dany/srcprojects/myserver/myserver/missing --run automake-1.10
+AWK = gawk
+CC = gcc
+CCDEPMODE = depmode=gcc3
+CFLAGS =   -fPIC -DPIC -I/usr/include/openssl -DHAVE_SSL
+CPP = gcc -E
+CPPFLAGS =  -I/usr/include/libxml2
+CPPUNIT_CFLAGS = 
+CPPUNIT_CONFIG = /usr/bin/cppunit-config
+CPPUNIT_LDFLAGS = -lcppunit
+CPPUNIT_LIBS = -lcppunit -ldl
+CXFLAGS = 
+CXX = g++
+CXXCPP = g++ -E
+CXXDEPMODE = depmode=gcc3
+CXXFLAGS =   -fPIC -DPIC -I/usr/include/openssl -DHAVE_SSL
+CYGPATH_W = echo
+DEFS = -DHAVE_CONFIG_H
+DEPDIR = .deps
+DL_LIB = -ldl
+ECHO = echo
+ECHO_C = 
+ECHO_N = -n
+ECHO_T = 
+EGREP = /bin/grep -E
+EVENT_LIB = -levent
+EXEEXT = 
+F77 = 
+FFLAGS = 
+GREP = /bin/grep
+HAVE_SSL = yes
+IDN_LIB = 
+INSTALL = /usr/bin/install -c
+INSTALL_DATA = ${INSTALL} -m 644
+INSTALL_PROGRAM = ${INSTALL}
+INSTALL_SCRIPT = ${INSTALL}
+INSTALL_STRIP_PROGRAM = $(install_sh) -c -s
+LDFLAGS =   -fPIC -DPIC -L/usr/lib
+LEX = ${SHELL} /home/dany/srcprojects/myserver/myserver/missing --run flex
+LEXLIB = 
+LEX_OUTPUT_ROOT = 
+LIBOBJS = 
+LIBS = 
+LIBTOOL = $(SHELL) $(top_builddir)/libtool
+LN_S = ln -s
+LTLIBOBJS = 
+MAKEINFO = ${SHELL} /home/dany/srcprojects/myserver/myserver/missing --run makeinfo
+MKDIR_P = /bin/mkdir -p
+MYSERVER_VERSION = 0.9.0-rc2
+OBJEXT = o
+OPENSSL_LIB = -lssl -lcrypto
+PACKAGE = myserver
+PACKAGE_BUGREPORT = bug-myserver@gnu.org
+PACKAGE_NAME = GNU MyServer
+PACKAGE_STRING = 0.9.0-rc2
+PACKAGE_TARNAME = myserver
+PACKAGE_VERSION = 0.9.0-rc2
+PATH_SEPARATOR = :
+PTHREAD_LIB = -lpthread
+RANLIB = ranlib
+SET_MAKE = 
+SHELL = /bin/bash
+STRIP = strip
+VERSION = 0.9.0-rc2
+XML2_CONFIG = /usr/bin/xml2-config
+XML_CPPFLAGS = -I/usr/include/libxml2
+XML_LIBS = -lxml2
+XNET_LIB = 
+YACC = yacc
+YFLAGS = 
+ZLIB_LIB = -lz
+abs_builddir = /home/dany/srcprojects/myserver/myserver/include/protocol
+abs_srcdir = /home/dany/srcprojects/myserver/myserver/include/protocol
+abs_top_builddir = /home/dany/srcprojects/myserver/myserver
+abs_top_srcdir = /home/dany/srcprojects/myserver/myserver
+ac_ct_CC = gcc
+ac_ct_CXX = g++
+ac_ct_F77 = 
+am__include = include
+am__leading_dot = .
+am__quote = 
+am__tar = ${AMTAR} chof - "$$tardir"
+am__untar = ${AMTAR} xf -
+bindir = ${exec_prefix}/bin
+build = i686-pc-linux-gnu
+build_alias = 
+build_cpu = i686
+build_os = linux-gnu
+build_vendor = pc
+builddir = .
+datadir = ${datarootdir}
+datarootdir = ${prefix}/share
+docdir = ${datarootdir}/doc/${PACKAGE_TARNAME}
+dvidir = ${docdir}
+exec_prefix = ${prefix}
+host = i686-pc-linux-gnu
+host_alias = 
+host_cpu = i686
+host_os = linux-gnu
+host_vendor = pc
+htmldir = ${docdir}
+includedir = ${prefix}/include
+infodir = ${datarootdir}/info
+install_sh = $(SHELL) /home/dany/srcprojects/myserver/myserver/install-sh
+libdir = ${exec_prefix}/lib
+libexecdir = ${exec_prefix}/libexec
+localedir = ${datarootdir}/locale
+localstatedir = ${prefix}/var
+make_info = yes
+mandir = ${datarootdir}/man
+mkdir_p = /bin/mkdir -p
+oldincludedir = /usr/include
+pdfdir = ${docdir}
+prefix = /usr/local
+program_transform_name = s,x,x,
+psdir = ${docdir}
+root_bindir = ${root_prefix}/bin
+root_prefix = $(DESTDIR)
+root_sbindir = ${root_prefix}/sbin
+root_sysconfdir = ${root_prefix}/etc
+sbindir = ${exec_prefix}/sbin
+sharedstatedir = ${prefix}/com
+srcdir = .
+sysconfdir = ${prefix}/etc
+target = i686-pc-linux-gnu
+target_alias = 
+target_cpu = i686
+target_os = linux-gnu
+target_vendor = pc
+top_builddir = ../..
+top_srcdir = ../..
+protocolincludedir = $(includedir)/myserver/include/protocol
+protocolinclude_HEADERS = protocol_buffer.h protocol.h
+SUBDIRS = control ftp http https
+all: all-recursive
+
+.SUFFIXES:
+$(srcdir)/Makefile.in:  $(srcdir)/Makefile.am  $(am__configure_deps)
+	@for dep in $?; do \
+	  case '$(am__configure_deps)' in \
+	    *$$dep*) \
+	      cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+		&& exit 0; \
+	      exit 1;; \
+	  esac; \
+	done; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu  include/protocol/Makefile'; \
+	cd $(top_srcdir) && \
+	  $(AUTOMAKE) --gnu  include/protocol/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+	@case '$?' in \
+	  *config.status*) \
+	    cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+	  *) \
+	    echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+	    cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+	esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure:  $(am__configure_deps)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4):  $(am__aclocal_m4_deps)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+mostlyclean-libtool:
+	-rm -f *.lo
+
+clean-libtool:
+	-rm -rf .libs _libs
+install-protocolincludeHEADERS: $(protocolinclude_HEADERS)
+	@$(NORMAL_INSTALL)
+	test -z "$(protocolincludedir)" || $(MKDIR_P) "$(DESTDIR)$(protocolincludedir)"
+	@list='$(protocolinclude_HEADERS)'; for p in $$list; do \
+	  if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+	  f=$(am__strip_dir) \
+	  echo " $(protocolincludeHEADERS_INSTALL) '$$d$$p' '$(DESTDIR)$(protocolincludedir)/$$f'"; \
+	  $(protocolincludeHEADERS_INSTALL) "$$d$$p" "$(DESTDIR)$(protocolincludedir)/$$f"; \
+	done
+
+uninstall-protocolincludeHEADERS:
+	@$(NORMAL_UNINSTALL)
+	@list='$(protocolinclude_HEADERS)'; for p in $$list; do \
+	  f=$(am__strip_dir) \
+	  echo " rm -f '$(DESTDIR)$(protocolincludedir)/$$f'"; \
+	  rm -f "$(DESTDIR)$(protocolincludedir)/$$f"; \
+	done
+
+# This directory's subdirectories are mostly independent; you can cd
+# into them and run `make' without going through this Makefile.
+# To change the values of `make' variables: instead of editing Makefiles,
+# (1) if the variable is set in `config.status', edit `config.status'
+#     (which will cause the Makefiles to be regenerated when you run `make');
+# (2) otherwise, pass the desired values on the `make' command line.
+$(RECURSIVE_TARGETS):
+	@failcom='exit 1'; \
+	for f in x $$MAKEFLAGS; do \
+	  case $$f in \
+	    *=* | --[!k]*);; \
+	    *k*) failcom='fail=yes';; \
+	  esac; \
+	done; \
+	dot_seen=no; \
+	target=`echo $@ | sed s/-recursive//`; \
+	list='$(SUBDIRS)'; for subdir in $$list; do \
+	  echo "Making $$target in $$subdir"; \
+	  if test "$$subdir" = "."; then \
+	    dot_seen=yes; \
+	    local_target="$$target-am"; \
+	  else \
+	    local_target="$$target"; \
+	  fi; \
+	  (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+	  || eval $$failcom; \
+	done; \
+	if test "$$dot_seen" = "no"; then \
+	  $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
+	fi; test -z "$$fail"
+
+$(RECURSIVE_CLEAN_TARGETS):
+	@failcom='exit 1'; \
+	for f in x $$MAKEFLAGS; do \
+	  case $$f in \
+	    *=* | --[!k]*);; \
+	    *k*) failcom='fail=yes';; \
+	  esac; \
+	done; \
+	dot_seen=no; \
+	case "$@" in \
+	  distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
+	  *) list='$(SUBDIRS)' ;; \
+	esac; \
+	rev=''; for subdir in $$list; do \
+	  if test "$$subdir" = "."; then :; else \
+	    rev="$$subdir $$rev"; \
+	  fi; \
+	done; \
+	rev="$$rev ."; \
+	target=`echo $@ | sed s/-recursive//`; \
+	for subdir in $$rev; do \
+	  echo "Making $$target in $$subdir"; \
+	  if test "$$subdir" = "."; then \
+	    local_target="$$target-am"; \
+	  else \
+	    local_target="$$target"; \
+	  fi; \
+	  (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+	  || eval $$failcom; \
+	done && test -z "$$fail"
+tags-recursive:
+	list='$(SUBDIRS)'; for subdir in $$list; do \
+	  test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
+	done
+ctags-recursive:
+	list='$(SUBDIRS)'; for subdir in $$list; do \
+	  test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
+	done
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+	list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+	unique=`for i in $$list; do \
+	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+	  done | \
+	  $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \
+	      END { if (nonempty) { for (i in files) print i; }; }'`; \
+	mkid -fID $$unique
+tags: TAGS
+
+TAGS: tags-recursive $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
+		$(TAGS_FILES) $(LISP)
+	tags=; \
+	here=`pwd`; \
+	if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
+	  include_option=--etags-include; \
+	  empty_fix=.; \
+	else \
+	  include_option=--include; \
+	  empty_fix=; \
+	fi; \
+	list='$(SUBDIRS)'; for subdir in $$list; do \
+	  if test "$$subdir" = .; then :; else \
+	    test ! -f $$subdir/TAGS || \
+	      tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \
+	  fi; \
+	done; \
+	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
+	unique=`for i in $$list; do \
+	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+	  done | \
+	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+	      END { if (nonempty) { for (i in files) print i; }; }'`; \
+	if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+	  test -n "$$unique" || unique=$$empty_fix; \
+	  $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+	    $$tags $$unique; \
+	fi
+ctags: CTAGS
+CTAGS: ctags-recursive $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
+		$(TAGS_FILES) $(LISP)
+	tags=; \
+	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
+	unique=`for i in $$list; do \
+	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+	  done | \
+	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+	      END { if (nonempty) { for (i in files) print i; }; }'`; \
+	test -z "$(CTAGS_ARGS)$$tags$$unique" \
+	  || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+	     $$tags $$unique
+
+GTAGS:
+	here=`$(am__cd) $(top_builddir) && pwd` \
+	  && cd $(top_srcdir) \
+	  && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+	-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+	@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+	topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+	list='$(DISTFILES)'; \
+	  dist_files=`for file in $$list; do echo $$file; done | \
+	  sed -e "s|^$$srcdirstrip/||;t" \
+	      -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+	case $$dist_files in \
+	  */*) $(MKDIR_P) `echo "$$dist_files" | \
+			   sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+			   sort -u` ;; \
+	esac; \
+	for file in $$dist_files; do \
+	  if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+	  if test -d $$d/$$file; then \
+	    dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+	    if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+	      cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+	    fi; \
+	    cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+	  else \
+	    test -f $(distdir)/$$file \
+	    || cp -p $$d/$$file $(distdir)/$$file \
+	    || exit 1; \
+	  fi; \
+	done
+	list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
+	  if test "$$subdir" = .; then :; else \
+	    test -d "$(distdir)/$$subdir" \
+	    || $(MKDIR_P) "$(distdir)/$$subdir" \
+	    || exit 1; \
+	    distdir=`$(am__cd) $(distdir) && pwd`; \
+	    top_distdir=`$(am__cd) $(top_distdir) && pwd`; \
+	    (cd $$subdir && \
+	      $(MAKE) $(AM_MAKEFLAGS) \
+	        top_distdir="$$top_distdir" \
+	        distdir="$$distdir/$$subdir" \
+		am__remove_distdir=: \
+		am__skip_length_check=: \
+	        distdir) \
+	      || exit 1; \
+	  fi; \
+	done
+check-am: all-am
+check: check-recursive
+all-am: Makefile $(HEADERS)
+installdirs: installdirs-recursive
+installdirs-am:
+	for dir in "$(DESTDIR)$(protocolincludedir)"; do \
+	  test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+	done
+install: install-recursive
+install-exec: install-exec-recursive
+install-data: install-data-recursive
+uninstall: uninstall-recursive
+
+install-am: all-am
+	@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-recursive
+install-strip:
+	$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	  install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	  `test -z '$(STRIP)' || \
+	    echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+	-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+	@echo "This command is intended for maintainers to use"
+	@echo "it deletes files that may require special tools to rebuild."
+clean: clean-recursive
+
+clean-am: clean-generic clean-libtool mostlyclean-am
+
+distclean: distclean-recursive
+	-rm -f Makefile
+distclean-am: clean-am distclean-generic distclean-tags
+
+dvi: dvi-recursive
+
+dvi-am:
+
+html: html-recursive
+
+info: info-recursive
+
+info-am:
+
+install-data-am: install-protocolincludeHEADERS
+
+install-dvi: install-dvi-recursive
+
+install-exec-am:
+
+install-html: install-html-recursive
+
+install-info: install-info-recursive
+
+install-man:
+
+install-pdf: install-pdf-recursive
+
+install-ps: install-ps-recursive
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-recursive
+	-rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-recursive
+
+mostlyclean-am: mostlyclean-generic mostlyclean-libtool
+
+pdf: pdf-recursive
+
+pdf-am:
+
+ps: ps-recursive
+
+ps-am:
+
+uninstall-am: uninstall-protocolincludeHEADERS
+
+.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) install-am \
+	install-strip
+
+.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \
+	all all-am check check-am clean clean-generic clean-libtool \
+	ctags ctags-recursive distclean distclean-generic \
+	distclean-libtool distclean-tags distdir dvi dvi-am html \
+	html-am info info-am install install-am install-data \
+	install-data-am install-dvi install-dvi-am install-exec \
+	install-exec-am install-html install-html-am install-info \
+	install-info-am install-man install-pdf install-pdf-am \
+	install-protocolincludeHEADERS install-ps install-ps-am \
+	install-strip installcheck installcheck-am installdirs \
+	installdirs-am maintainer-clean maintainer-clean-generic \
+	mostlyclean mostlyclean-generic mostlyclean-libtool pdf pdf-am \
+	ps ps-am tags tags-recursive uninstall uninstall-am \
+	uninstall-protocolincludeHEADERS
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:

Added: trunk/myserver/include/protocol/Makefile.in
===================================================================
--- trunk/myserver/include/protocol/Makefile.in	                        (rev 0)
+++ trunk/myserver/include/protocol/Makefile.in	2008-10-26 15:49:14 UTC (rev 2911)
@@ -0,0 +1,547 @@
+# Makefile.in generated by automake 1.10.1 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006, 2007, 2008  Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+target_triplet = @target@
+subdir = include/protocol
+DIST_COMMON = $(protocolinclude_HEADERS) $(srcdir)/Makefile.am \
+	$(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/m4/cppunit.m4 \
+	$(top_srcdir)/m4/gnome-pthread-check.m4 \
+	$(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/libxml.m4 \
+	$(top_srcdir)/configure.in
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+	$(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/config.h
+CONFIG_CLEAN_FILES =
+SOURCES =
+DIST_SOURCES =
+RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
+	html-recursive info-recursive install-data-recursive \
+	install-dvi-recursive install-exec-recursive \
+	install-html-recursive install-info-recursive \
+	install-pdf-recursive install-ps-recursive install-recursive \
+	installcheck-recursive installdirs-recursive pdf-recursive \
+	ps-recursive uninstall-recursive
+am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
+am__vpath_adj = case $$p in \
+    $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
+    *) f=$$p;; \
+  esac;
+am__strip_dir = `echo $$p | sed -e 's|^.*/||'`;
+am__installdirs = "$(DESTDIR)$(protocolincludedir)"
+protocolincludeHEADERS_INSTALL = $(INSTALL_HEADER)
+HEADERS = $(protocolinclude_HEADERS)
+RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive	\
+  distclean-recursive maintainer-clean-recursive
+ETAGS = etags
+CTAGS = ctags
+DIST_SUBDIRS = $(SUBDIRS)
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+AMTAR = @AMTAR@
+AR = @AR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CPPUNIT_CFLAGS = @CPPUNIT_CFLAGS@
+CPPUNIT_CONFIG = @CPPUNIT_CONFIG@
+CPPUNIT_LDFLAGS = @CPPUNIT_LDFLAGS@
+CPPUNIT_LIBS = @CPPUNIT_LIBS@
+CXFLAGS = @CXFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DL_LIB = @DL_LIB@
+ECHO = @ECHO@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EVENT_LIB = @EVENT_LIB@
+EXEEXT = @EXEEXT@
+F77 = @F77@
+FFLAGS = @FFLAGS@
+GREP = @GREP@
+HAVE_SSL = @HAVE_SSL@
+IDN_LIB = @IDN_LIB@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LDFLAGS = @LDFLAGS@
+LEX = @LEX@
+LEXLIB = @LEXLIB@
+LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAKEINFO = @MAKEINFO@
+MKDIR_P = @MKDIR_P@
+MYSERVER_VERSION = @MYSERVER_VERSION@
+OBJEXT = @OBJEXT@
+OPENSSL_LIB = @OPENSSL_LIB@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PTHREAD_LIB = @PTHREAD_LIB@
+RANLIB = @RANLIB@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRIP = @STRIP@
+VERSION = @VERSION@
+XML2_CONFIG = @XML2_CONFIG@
+XML_CPPFLAGS = @XML_CPPFLAGS@
+XML_LIBS = @XML_LIBS@
+XNET_LIB = @XNET_LIB@
+YACC = @YACC@
+YFLAGS = @YFLAGS@
+ZLIB_LIB = @ZLIB_LIB@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_F77 = @ac_ct_F77@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+make_info = @make_info@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+root_bindir = @root_bindir@
+root_prefix = @root_prefix@
+root_sbindir = @root_sbindir@
+root_sysconfdir = @root_sysconfdir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target = @target@
+target_alias = @target_alias@
+target_cpu = @target_cpu@
+target_os = @target_os@
+target_vendor = @target_vendor@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+protocolincludedir = $(includedir)/myserver/include/protocol
+protocolinclude_HEADERS = protocol_buffer.h protocol.h
+SUBDIRS = control ftp http https
+all: all-recursive
+
+.SUFFIXES:
+$(srcdir)/Makefile.in:  $(srcdir)/Makefile.am  $(am__configure_deps)
+	@for dep in $?; do \
+	  case '$(am__configure_deps)' in \
+	    *$$dep*) \
+	      cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+		&& exit 0; \
+	      exit 1;; \
+	  esac; \
+	done; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu  include/protocol/Makefile'; \
+	cd $(top_srcdir) && \
+	  $(AUTOMAKE) --gnu  include/protocol/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+	@case '$?' in \
+	  *config.status*) \
+	    cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+	  *) \
+	    echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+	    cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+	esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure:  $(am__configure_deps)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4):  $(am__aclocal_m4_deps)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+mostlyclean-libtool:
+	-rm -f *.lo
+
+clean-libtool:
+	-rm -rf .libs _libs
+install-protocolincludeHEADERS: $(protocolinclude_HEADERS)
+	@$(NORMAL_INSTALL)
+	test -z "$(protocolincludedir)" || $(MKDIR_P) "$(DESTDIR)$(protocolincludedir)"
+	@list='$(protocolinclude_HEADERS)'; for p in $$list; do \
+	  if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+	  f=$(am__strip_dir) \
+	  echo " $(protocolincludeHEADERS_INSTALL) '$$d$$p' '$(DESTDIR)$(protocolincludedir)/$$f'"; \
+	  $(protocolincludeHEADERS_INSTALL) "$$d$$p" "$(DESTDIR)$(protocolincludedir)/$$f"; \
+	done
+
+uninstall-protocolincludeHEADERS:
+	@$(NORMAL_UNINSTALL)
+	@list='$(protocolinclude_HEADERS)'; for p in $$list; do \
+	  f=$(am__strip_dir) \
+	  echo " rm -f '$(DESTDIR)$(protocolincludedir)/$$f'"; \
+	  rm -f "$(DESTDIR)$(protocolincludedir)/$$f"; \
+	done
+
+# This directory's subdirectories are mostly independent; you can cd
+# into them and run `make' without going through this Makefile.
+# To change the values of `make' variables: instead of editing Makefiles,
+# (1) if the variable is set in `config.status', edit `config.status'
+#     (which will cause the Makefiles to be regenerated when you run `make');
+# (2) otherwise, pass the desired values on the `make' command line.
+$(RECURSIVE_TARGETS):
+	@failcom='exit 1'; \
+	for f in x $$MAKEFLAGS; do \
+	  case $$f in \
+	    *=* | --[!k]*);; \
+	    *k*) failcom='fail=yes';; \
+	  esac; \
+	done; \
+	dot_seen=no; \
+	target=`echo $@ | sed s/-recursive//`; \
+	list='$(SUBDIRS)'; for subdir in $$list; do \
+	  echo "Making $$target in $$subdir"; \
+	  if test "$$subdir" = "."; then \
+	    dot_seen=yes; \
+	    local_target="$$target-am"; \
+	  else \
+	    local_target="$$target"; \
+	  fi; \
+	  (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+	  || eval $$failcom; \
+	done; \
+	if test "$$dot_seen" = "no"; then \
+	  $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
+	fi; test -z "$$fail"
+
+$(RECURSIVE_CLEAN_TARGETS):
+	@failcom='exit 1'; \
+	for f in x $$MAKEFLAGS; do \
+	  case $$f in \
+	    *=* | --[!k]*);; \
+	    *k*) failcom='fail=yes';; \
+	  esac; \
+	done; \
+	dot_seen=no; \
+	case "$@" in \
+	  distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
+	  *) list='$(SUBDIRS)' ;; \
+	esac; \
+	rev=''; for subdir in $$list; do \
+	  if test "$$subdir" = "."; then :; else \
+	    rev="$$subdir $$rev"; \
+	  fi; \
+	done; \
+	rev="$$rev ."; \
+	target=`echo $@ | sed s/-recursive//`; \
+	for subdir in $$rev; do \
+	  echo "Making $$target in $$subdir"; \
+	  if test "$$subdir" = "."; then \
+	    local_target="$$target-am"; \
+	  else \
+	    local_target="$$target"; \
+	  fi; \
+	  (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+	  || eval $$failcom; \
+	done && test -z "$$fail"
+tags-recursive:
+	list='$(SUBDIRS)'; for subdir in $$list; do \
+	  test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
+	done
+ctags-recursive:
+	list='$(SUBDIRS)'; for subdir in $$list; do \
+	  test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
+	done
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+	list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+	unique=`for i in $$list; do \
+	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+	  done | \
+	  $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \
+	      END { if (nonempty) { for (i in files) print i; }; }'`; \
+	mkid -fID $$unique
+tags: TAGS
+
+TAGS: tags-recursive $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
+		$(TAGS_FILES) $(LISP)
+	tags=; \
+	here=`pwd`; \
+	if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
+	  include_option=--etags-include; \
+	  empty_fix=.; \
+	else \
+	  include_option=--include; \
+	  empty_fix=; \
+	fi; \
+	list='$(SUBDIRS)'; for subdir in $$list; do \
+	  if test "$$subdir" = .; then :; else \
+	    test ! -f $$subdir/TAGS || \
+	      tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \
+	  fi; \
+	done; \
+	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
+	unique=`for i in $$list; do \
+	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+	  done | \
+	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+	      END { if (nonempty) { for (i in files) print i; }; }'`; \
+	if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+	  test -n "$$unique" || unique=$$empty_fix; \
+	  $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+	    $$tags $$unique; \
+	fi
+ctags: CTAGS
+CTAGS: ctags-recursive $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
+		$(TAGS_FILES) $(LISP)
+	tags=; \
+	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
+	unique=`for i in $$list; do \
+	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+	  done | \
+	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+	      END { if (nonempty) { for (i in files) print i; }; }'`; \
+	test -z "$(CTAGS_ARGS)$$tags$$unique" \
+	  || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+	     $$tags $$unique
+
+GTAGS:
+	here=`$(am__cd) $(top_builddir) && pwd` \
+	  && cd $(top_srcdir) \
+	  && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+	-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+	@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+	topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+	list='$(DISTFILES)'; \
+	  dist_files=`for file in $$list; do echo $$file; done | \
+	  sed -e "s|^$$srcdirstrip/||;t" \
+	      -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+	case $$dist_files in \
+	  */*) $(MKDIR_P) `echo "$$dist_files" | \
+			   sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+			   sort -u` ;; \
+	esac; \
+	for file in $$dist_files; do \
+	  if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+	  if test -d $$d/$$file; then \
+	    dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+	    if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+	      cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+	    fi; \
+	    cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+	  else \
+	    test -f $(distdir)/$$file \
+	    || cp -p $$d/$$file $(distdir)/$$file \
+	    || exit 1; \
+	  fi; \
+	done
+	list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
+	  if test "$$subdir" = .; then :; else \
+	    test -d "$(distdir)/$$subdir" \
+	    || $(MKDIR_P) "$(distdir)/$$subdir" \
+	    || exit 1; \
+	    distdir=`$(am__cd) $(distdir) && pwd`; \
+	    top_distdir=`$(am__cd) $(top_distdir) && pwd`; \
+	    (cd $$subdir && \
+	      $(MAKE) $(AM_MAKEFLAGS) \
+	        top_distdir="$$top_distdir" \
+	        distdir="$$distdir/$$subdir" \
+		am__remove_distdir=: \
+		am__skip_length_check=: \
+	        distdir) \
+	      || exit 1; \
+	  fi; \
+	done
+check-am: all-am
+check: check-recursive
+all-am: Makefile $(HEADERS)
+installdirs: installdirs-recursive
+installdirs-am:
+	for dir in "$(DESTDIR)$(protocolincludedir)"; do \
+	  test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+	done
+install: install-recursive
+install-exec: install-exec-recursive
+install-data: install-data-recursive
+uninstall: uninstall-recursive
+
+install-am: all-am
+	@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-recursive
+install-strip:
+	$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	  install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	  `test -z '$(STRIP)' || \
+	    echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+	-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+	@echo "This command is intended for maintainers to use"
+	@echo "it deletes files that may require special tools to rebuild."
+clean: clean-recursive
+
+clean-am: clean-generic clean-libtool mostlyclean-am
+
+distclean: distclean-recursive
+	-rm -f Makefile
+distclean-am: clean-am distclean-generic distclean-tags
+
+dvi: dvi-recursive
+
+dvi-am:
+
+html: html-recursive
+
+info: info-recursive
+
+info-am:
+
+install-data-am: install-protocolincludeHEADERS
+
+install-dvi: install-dvi-recursive
+
+install-exec-am:
+
+install-html: install-html-recursive
+
+install-info: install-info-recursive
+
+install-man:
+
+install-pdf: install-pdf-recursive
+
+install-ps: install-ps-recursive
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-recursive
+	-rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-recursive
+
+mostlyclean-am: mostlyclean-generic mostlyclean-libtool
+
+pdf: pdf-recursive
+
+pdf-am:
+
+ps: ps-recursive
+
+ps-am:
+
+uninstall-am: uninstall-protocolincludeHEADERS
+
+.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) install-am \
+	install-strip
+
+.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \
+	all all-am check check-am clean clean-generic clean-libtool \
+	ctags ctags-recursive distclean distclean-generic \
+	distclean-libtool distclean-tags distdir dvi dvi-am html \
+	html-am info info-am install install-am install-data \
+	install-data-am install-dvi install-dvi-am install-exec \
+	install-exec-am install-html install-html-am install-info \
+	install-info-am install-man install-pdf install-pdf-am \
+	install-protocolincludeHEADERS install-ps install-ps-am \
+	install-strip installcheck installcheck-am installdirs \
+	installdirs-am maintainer-clean maintainer-clean-generic \
+	mostlyclean mostlyclean-generic mostlyclean-libtool pdf pdf-am \
+	ps ps-am tags tags-recursive uninstall uninstall-am \
+	uninstall-protocolincludeHEADERS
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:

Modified: trunk/myserver/include/protocol/http/Makefile.am
===================================================================
--- trunk/myserver/include/protocol/http/Makefile.am	2008-10-26 14:12:09 UTC (rev 2910)
+++ trunk/myserver/include/protocol/http/Makefile.am	2008-10-26 15:49:14 UTC (rev 2911)
@@ -1,4 +1,4 @@
 httpincludedir=$(includedir)/myserver/include/protocol/http
-httpinclude_HEADERS = http_data_handler.h http_data_read.h http_errors.h http.h http_header.h http_headers.h http_request.h http_req_security_domain.h http_response.h http_thread_context.h
+httpinclude_HEADERS = dyn_http_command.h dyn_http_command_manager.h dyn_http_manager.h dyn_http_manager_list.h http_data_handler.h http_data_read.h http_errors.h http.h http_header.h http_headers.h http_request.h http_req_security_domain.h http_response.h http_thread_context.h
 SUBDIRS = env
 

Copied: trunk/myserver/include/protocol/http/dyn_http_command.h (from rev 2900, trunk/myserver/include/plugin/http_command/dyn_http_command.h)
===================================================================
--- trunk/myserver/include/protocol/http/dyn_http_command.h	                        (rev 0)
+++ trunk/myserver/include/protocol/http/dyn_http_command.h	2008-10-26 15:49:14 UTC (rev 2911)
@@ -0,0 +1,46 @@
+/* -*- mode: c++ -*- */
+/*
+MyServer
+Copyright (C) 2005, 2007 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
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program.  If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef DYN_HTTP_COMMAND_H
+#define DYN_HTTP_COMMAND_H
+
+#include "stdafx.h"
+#include <include/base/xml/xml_parser.h>
+#include <include/protocol/protocol.h>
+#include <include/connection/connection.h>
+#include <include/base/dynamic_lib/dynamiclib.h>
+#include <include/protocol/http/http_headers.h>
+#include <include/base/hash_map/hash_map.h>
+#include <string>
+using namespace std;
+
+class DynamicHttpCommand 
+{
+public:
+  DynamicHttpCommand(string&);
+  virtual ~DynamicHttpCommand();
+  string getName();
+  virtual int acceptData() = 0;
+  virtual int send(HttpThreadContext* context, ConnectionPtr lpconnection, 
+									 string& Uri, int systemrequest = 0, 
+									 int OnlyHeader = 0, int yetmapped = 0) = 0;
+private:
+  string name;
+};
+
+#endif

Copied: trunk/myserver/include/protocol/http/dyn_http_command_manager.h (from rev 2900, trunk/myserver/include/plugin/http_command/dyn_http_command_manager.h)
===================================================================
--- trunk/myserver/include/protocol/http/dyn_http_command_manager.h	                        (rev 0)
+++ trunk/myserver/include/protocol/http/dyn_http_command_manager.h	2008-10-26 15:49:14 UTC (rev 2911)
@@ -0,0 +1,58 @@
+/* -*- mode: c++ -*- */
+/*
+MyServer
+Copyright (C) 2005, 2007 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
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program.  If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef DYN_HTTP_COMMAND_MANAGER_H
+#define DYN_HTTP_COMMAND_MANAGER_H
+
+#include "stdafx.h"
+#include <include/base/xml/xml_parser.h>
+#include <include/protocol/protocol.h>
+#include <include/connection/connection.h>
+#include <include/base/dynamic_lib/dynamiclib.h>
+#include <include/protocol/http/http_headers.h>
+#include <include/base/hash_map/hash_map.h>
+#include <string>
+
+class DynamicHttpCommand;
+
+using namespace std;
+
+class DynHttpCommandManager 
+{
+public:
+  DynHttpCommandManager();
+  virtual ~DynHttpCommandManager();
+  
+  DynamicHttpCommand* getHttpCommand(string& name);
+  
+  HashMap<string, DynamicHttpCommand*>::Iterator begin(){return dynamicHttpCommands.begin();}
+  HashMap<string, DynamicHttpCommand*>::Iterator end(){return dynamicHttpCommands.end();}
+  
+  
+  void addHttpCommand(string& name, DynamicHttpCommand* httpCommand);
+
+  void addHttpCommand(char* name, DynamicHttpCommand* httpCommand)
+  {
+   	string strName(name);
+   	addHttpCommand(strName, httpCommand);
+  }
+private:
+	HashMap<string, DynamicHttpCommand*> dynamicHttpCommands;
+};
+
+#endif

Copied: trunk/myserver/include/protocol/http/dyn_http_manager.h (from rev 2899, trunk/myserver/include/plugin/http_manager/dyn_http_manager.h)
===================================================================
--- trunk/myserver/include/protocol/http/dyn_http_manager.h	                        (rev 0)
+++ trunk/myserver/include/protocol/http/dyn_http_manager.h	2008-10-26 15:49:14 UTC (rev 2911)
@@ -0,0 +1,43 @@
+/* -*- mode: c++ -*- */
+/*
+MyServer
+Copyright (C) 2005 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
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program.  If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef DYN_HTTP_MANAGER_H
+#define DYN_HTTP_MANAGER_H
+
+#include "stdafx.h"
+#include <include/base/xml/xml_parser.h>
+#include <include/protocol/protocol.h>
+#include <include/connection/connection.h>
+#include <include/base/dynamic_lib/dynamiclib.h>
+#include <include/protocol/http/http_headers.h>
+#include <include/base/hash_map/hash_map.h>
+#include <string>
+using namespace std;
+
+
+class DynamicHttpManager 
+{
+public:
+	DynamicHttpManager();
+	virtual ~DynamicHttpManager();
+	virtual int send(HttpThreadContext*, ConnectionPtr s, const char *filenamePath,
+                   const char* cgi, int selfExecuted, int onlyHeader = 0) = 0;
+
+};
+
+#endif

Copied: trunk/myserver/include/protocol/http/dyn_http_manager_list.h (from rev 2899, trunk/myserver/include/plugin/http_manager/dyn_http_manager_list.h)
===================================================================
--- trunk/myserver/include/protocol/http/dyn_http_manager_list.h	                        (rev 0)
+++ trunk/myserver/include/protocol/http/dyn_http_manager_list.h	2008-10-26 15:49:14 UTC (rev 2911)
@@ -0,0 +1,56 @@
+/* -*- mode: c++ -*- */
+/*
+MyServer
+Copyright (C) 2005, 2007 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
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program.  If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef DYN_HTTP_MANAGER_LIST_H
+#define DYN_HTTP_MANAGER_LIST_H
+
+#include "stdafx.h"
+#include <include/base/xml/xml_parser.h>
+#include <include/protocol/protocol.h>
+#include <include/connection/connection.h>
+#include <include/base/dynamic_lib/dynamiclib.h>
+#include <include/protocol/http/http_headers.h>
+#include <include/base/hash_map/hash_map.h>
+#include <string>
+using namespace std;
+
+class DynamicHttpManager;
+
+class DynHttpManagerList
+{
+public:
+  DynamicHttpManager* getHttpManager(string& name);
+
+  HashMap<string, DynamicHttpManager*>::Iterator begin(){return dynamicHttpManagers.begin();}
+  HashMap<string, DynamicHttpManager*>::Iterator end(){return dynamicHttpManagers.end();}
+
+  void addHttpManager(string& name, DynamicHttpManager* httpManager);
+
+  void addHttpManager(char* name, DynamicHttpManager* httpManager)
+  {
+   	string strName(name);
+   	addHttpManager(strName, httpManager);
+  }
+
+  DynHttpManagerList();
+  ~DynHttpManagerList();
+private:
+	HashMap<string, DynamicHttpManager*> dynamicHttpManagers;
+};
+
+#endif

Modified: trunk/myserver/include/protocol/http/http.h
===================================================================
--- trunk/myserver/include/protocol/http/http.h	2008-10-26 14:12:09 UTC (rev 2910)
+++ trunk/myserver/include/protocol/http/http.h	2008-10-26 15:49:14 UTC (rev 2911)
@@ -26,10 +26,10 @@
 #include <include/base/xml/xml_parser.h>
 #include <include/base/thread/thread.h>
 #include <include/base/sync/mutex.h>
-#include <include/plugin/http_command/dyn_http_command_manager.h>
-#include <include/plugin/http_command/dyn_http_command.h>
-#include <include/plugin/http_manager/dyn_http_manager_list.h>
-#include <include/plugin/http_manager/dyn_http_manager.h>
+#include <include/protocol/http/dyn_http_command_manager.h>
+#include <include/protocol/http/dyn_http_command.h>
+#include <include/protocol/http/dyn_http_manager_list.h>
+#include <include/protocol/http/dyn_http_manager.h>
 #include <include/base/multicast/multicast.h>
 #include <include/protocol/http/http_data_handler.h>
 #include <include/base/string/securestr.h>

Modified: trunk/myserver/include/protocol/http/http_data_read.h
===================================================================
--- trunk/myserver/include/protocol/http/http_data_read.h	2008-10-26 14:12:09 UTC (rev 2910)
+++ trunk/myserver/include/protocol/http/http_data_read.h	2008-10-26 15:49:14 UTC (rev 2911)
@@ -26,10 +26,10 @@
 #include <include/base/xml/xml_parser.h>
 #include <include/base/thread/thread.h>
 #include <include/base/sync/mutex.h>
-#include <include/plugin/http_command/dyn_http_command_manager.h>
-#include <include/plugin/http_command/dyn_http_command.h>
-#include <include/plugin/http_manager/dyn_http_manager_list.h>
-#include <include/plugin/http_manager/dyn_http_manager.h>
+#include <include/protocol/http/dyn_http_command_manager.h>
+#include <include/protocol/http/dyn_http_command.h>
+#include <include/protocol/http/dyn_http_manager_list.h>
+#include <include/protocol/http/dyn_http_manager.h>
 #include <include/base/multicast/multicast.h>
 #include <include/protocol/http/http_data_handler.h>
 #include <string>

Copied: trunk/myserver/include/protocol/protocols_manager.h (from rev 2899, trunk/myserver/include/plugin/protocol/protocols_manager.h)
===================================================================
--- trunk/myserver/include/protocol/protocols_manager.h	                        (rev 0)
+++ trunk/myserver/include/protocol/protocols_manager.h	2008-10-26 15:49:14 UTC (rev 2911)
@@ -0,0 +1,54 @@
+/* -*- mode: c++ -*- */
+/*
+MyServer
+Copyright (C) 2002, 2003, 2004, 2007, 2008 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
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program.  If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef PROTOCOLS_MANAGER_H
+#define PROTOCOLS_MANAGER_H
+#include "stdafx.h"
+#include <include/base/xml/xml_parser.h>
+#include <include/protocol/protocol.h>
+#include <include/connection/connection.h>
+#include <include/base/dynamic_lib/dynamiclib.h>
+#include <include/plugin/plugin.h>
+#include <include/base/hash_map/hash_map.h>
+#include <list>
+#include <string>
+
+using namespace std;
+
+class ProtocolsManager 
+{
+public:
+	ProtocolsManager();
+	~ProtocolsManager();
+
+  Protocol* getProtocol(string& name);
+
+  void addProtocol(string& name, Protocol* protocol);
+
+  void addProtocol(char* name, Protocol* protocol)
+  {
+    string strName(name);
+    addProtocol(strName, protocol);
+  }
+
+protected:
+  list<Protocol*> staticProtocolsList;
+  HashMap<string, Protocol*> staticProtocols;
+};
+
+#endif

Modified: trunk/myserver/include/server/server.h
===================================================================
--- trunk/myserver/include/server/server.h	2008-10-26 14:12:09 UTC (rev 2910)
+++ trunk/myserver/include/server/server.h	2008-10-26 15:49:14 UTC (rev 2911)
@@ -29,18 +29,17 @@
 #include <include/base/sync/event.h>
 #include <include/conf/mime/mime_manager.h>
 #include <include/conf/vhost/vhost_manager.h>
-#include <include/plugin/protocol/protocols_manager.h>
+#include <include/protocol/protocols_manager.h>
 #include <include/connection/connection.h>
 #include <include/log/log_manager.h>
 #include <include/filter/filters_factory.h>
 #include <include/plugin/plugins_manager.h>
-#include <include/plugin/filter/dyn_filters_manager.h>
-#include <include/plugin/filter/dyn_filter.h>
-#include <include/plugin/executor/dyn_executor_manager.h>
+//#include <include/plugin/filter/dyn_filters_manager.h>
+//#include <include/plugin/filter/dyn_filter.h>
+//#include <include/plugin/executor/dyn_executor_manager.h>
 #include <include/base/hash_map/hash_map.h>
 #include <include/base/home_dir/home_dir.h>
 #include <include/base/files_cache/cached_file_factory.h>
-#include <include/plugin/generic_plugins_manager.h>
 #include <include/base/process/process_server_manager.h>
 #include <include/connections_scheduler/listen_threads.h>
 #include <include/base/multicast/multicast.h>
@@ -201,8 +200,8 @@
   HashMap<string, string*> hashedData;
   HashMap<string, void*> globalData;
   FiltersFactory filtersFactory;
-  DynamicFiltersManager filters;
-  DynExecutorManager executors;
+  //DynamicFiltersManager filters;
+  //DynExecutorManager executors;
   u_long uid;
   u_long gid;
   int currentThreadID;
@@ -259,7 +258,6 @@
   string* vhostConfigurationFile;
   string* mimeConfigurationFile;
   PluginsManager pluginsManager;
-  GenericPluginsManager genericPluginsManager;
   ProcessServerManager processServerManager;
   ConnectionsScheduler connectionsScheduler;
   ListenThreads listenThreads;

Modified: trunk/myserver/src/plugin/Makefile.am
===================================================================
--- trunk/myserver/src/plugin/Makefile.am	2008-10-26 14:12:09 UTC (rev 2910)
+++ trunk/myserver/src/plugin/Makefile.am	2008-10-26 15:49:14 UTC (rev 2911)
@@ -1,5 +1,4 @@
 lib_LIBRARIES = libplugin.a
-libplugin_a_SOURCES = generic_plugins_manager.cpp plugin.cpp plugins_manager.cpp plugins_namespace.cpp plugins_namespace_manager.cpp
-SUBDIRS = executor filter http_command http_manager protocol
+libplugin_a_SOURCES =  plugin.cpp plugins_manager.cpp 
 INCLUDES = $(all_includes)
 

Deleted: trunk/myserver/src/plugin/generic_plugins_manager.cpp
===================================================================
--- trunk/myserver/src/plugin/generic_plugins_manager.cpp	2008-10-26 14:12:09 UTC (rev 2910)
+++ trunk/myserver/src/plugin/generic_plugins_manager.cpp	2008-10-26 15:49:14 UTC (rev 2911)
@@ -1,32 +0,0 @@
-/*
-MyServer
-Copyright (C) 2007, 2008 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
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program.  If not, see <http://www.gnu.org/licenses/>.
-*/
-
-#include "stdafx.h"
-#include <include/plugin/generic_plugins_manager.h>
-#include <include/base/xml/xml_parser.h>
-#include <include/server/server.h>
-#include <string>
-using namespace std;
-
-/*!
- *Constructor for the class.
- */
-GenericPluginsManager::GenericPluginsManager() : 
-  PluginsNamespaceManager("generics")
-{
-
-}

Modified: trunk/myserver/src/plugin/plugins_manager.cpp
===================================================================
--- trunk/myserver/src/plugin/plugins_manager.cpp	2008-10-26 14:12:09 UTC (rev 2910)
+++ trunk/myserver/src/plugin/plugins_manager.cpp	2008-10-26 15:49:14 UTC (rev 2911)
@@ -18,56 +18,49 @@
 #include "stdafx.h"
 #include <include/plugin/plugins_manager.h>
 #include <include/base/xml/xml_parser.h>
+#include <include/base/find_data/find_data.h>
 #include <include/server/server.h>
 
 #include <string>
 using namespace std;
 
 /*!
- *Get a plugin trough its namespace and its name.
- *\param namespacename The namespace name to use.
- *\param plugin The plugin name.
+ *Default constructor.
  */
-Plugin* PluginsManager::getPlugin(string& namespacename, string& plugin)
+PluginsManager::PluginsManager()
 {
-  PluginsNamespace* pn = namespaces.get((char*)namespacename.c_str());
+	
+}
 
-  if(pn)
-    return pn->getPlugin(plugin);
-  return 0;
+/*!
+ *Destroy the object.
+ */
+PluginsManager::~PluginsManager()
+{
+	
 }
+
 /*!
- *Get a plugin trough its namespace and its name namespace-plugin.
- *\param fullname The plugin complete name.
+ *Get a plugin trough  its name plugin.
+ *\param name The plugin name.
  */
-Plugin* PluginsManager::getPlugin(string& fullname)
+Plugin* PluginsManager::getPlugin(string& name)
 {
-  size_t sep = fullname.find('-', 0);
-  if(sep != string::npos)
-  {
-    string namespacename(fullname.substr(0, sep - 1));
-    string plugin(fullname.substr(sep + 1, fullname.length()));
-    
-    return getPlugin(namespacename, plugin);
-  }
-  return 0;
+  return plugins.get(name);
 }
   
 /*!
- *Preload the plugins.
+ *Load the plugin soptions.
  *\param server The server object to use.
  *\param languageFile The language file to use to get errors and warnings 
  *messages.
- *\param resource The resource to use to load plugins.
  */
-int PluginsManager::preLoad(Server *server, XmlParser* languageFile, 
-                            string& resource)
+int PluginsManager::loadOptions(Server *server, XmlParser* languageFile)
 {
   xmlDocPtr xmlDoc;
   int ret = 0;
   XmlParser* configuration;
-  HashMap<char*, PluginsNamespace*>::Iterator it = namespaces.begin();
-
+  
   configuration = server->getConfiguration();
   
   xmlDoc = configuration->getDoc();
@@ -79,7 +72,7 @@
         {
           string namespaceName;
           string pluginName;
-          PluginsNamespace::PluginOption po;
+          PluginsManager::PluginOption po;
           
           if(!xmlStrcmp(node->name, (const xmlChar *)"PLUGIN"))
           {
@@ -92,13 +85,6 @@
                 if(properties->children && properties->children->content)
                   pluginName.assign((char*)properties->children->content);
               }
-        
-              if(!xmlStrcmp(properties->name, (const xmlChar *)"namespace"))
-              {
-                if(properties->children && properties->children->content)
-                  namespaceName.assign((char*)properties->children->content);
-              }
-              
               properties = properties->next;
             }
             
@@ -110,39 +96,168 @@
                 po.global = strcmpi("YES", (const char*)internal->children->content) ? false : true;
             }
 
-            if(!namespaceName.length() || !pluginName.length())
+            if(!pluginName.length())
             {
               string error;
-              error.assign("Warning: invalid namespace or plugin name in PLUGIN block");
-              server->logWriteln(error.c_str(), ERROR);     
+              error.assign("Warning: invalid plugin name in PLUGIN block");
+              server->logWriteln(error.c_str(), ERROR);   
+              ret = -1;  
             }
             else
             {
-              PluginsNamespace* ns = getNamespace(namespaceName);
-              if(!ns)
-              {
-                string error;
-                error.assign("Warning: invalid namespace name");
-                server->logWriteln(error.c_str(), ERROR);     
-              }
-              else
-                ns->addPluginOption(pluginName, po);
-
+                addPluginOption(pluginName, po);
             }
 
           }
         }
 
-  while(it != namespaces.end())
+  return ret;
+  
+}
+
+
+/*!
+ *Preload sequence, called when all the plugins are not yet loaded.
+ *\param server The server object to use.
+ *\param languageFile The language file to use to retrieve warnings/errors 
+ *messages.
+ *\param resource The resource location to use to load plugins, in this 
+ *implementation it is a directory name.
+ */
+int PluginsManager::preLoad(Server* server, XmlParser* languageFile, 
+                                     string& resource)
+{
+  FindData fdir;
+  FindData flib;
+  string filename;
+  string completeFileName;  
+  int ret;
+
+  loadOptions(server,languageFile);
+  
+  filename.assign(resource);
+
+  
+
+  ret = fdir.findfirst(filename.c_str());  
+  
+  if(ret == -1)
   {
-    ret |= (*it)->preLoad(server, languageFile, resource);
-    it++;
+    return ret;  
   }
+
+  ret = 0;
+
+  do
+  {  
+  	string dirname(filename);
+  	
+  	dirname.append("/");
+  	dirname.append(fdir.name);
+    if(fdir.name[0]=='.')
+      continue;
+      
+    
+    ret = flib.findfirst(dirname.c_str());  
+  
+  	if(ret == -1)
+  	  continue;
+  	
+  	do
+  	{
+  	  string name(flib.name);
+      PluginsManager::PluginOption *po;
+      if(flib.name[0]=='.')
+      	continue;
+          /*!
+     *Do not consider file other than dynamic libraries.
+     */
+#ifdef WIN32
+      if(!strstr(flib.name,".dll"))
+#endif
+#ifdef NOT_WIN
+      if(!strstr(flib.name,".so"))
+#endif    
+        continue;
+      completeFileName.assign(filename);
+      
+      if((fdir.name[0] != '/') && (fdir.name[0] != '\\')) 
+        completeFileName.append("/");
+      completeFileName.append(fdir.name);
+      
+      if((flib.name[0] != '/') && (flib.name[0] != '\\')) 
+        completeFileName.append("/");
+      completeFileName.append(flib.name);
+
+#ifdef WIN32
+      name = name.substr(0, name.length() - 4);
+#endif
+#ifdef NOT_WIN
+      name = name.substr(0, name.length() - 3);
+#endif
+      po = getPluginOption(name);
+    
+       if(!po || po->enabled)
+         ret |= addPlugin(completeFileName, server, languageFile, po && po->global);
+
+     }while(!flib.findnext());
+   }while(!fdir.findnext());
+  fdir.findclose();
+  flib.findclose();
   return ret;
-  
 }
 
 /*!
+ *Create the appropriate object to keep a plugin.
+ */
+Plugin* PluginsManager::createPluginObject()
+{
+  return new Plugin();
+}
+
+/*!
+ *Add a plugin.
+ *\param file The plugin file name.
+ *\param server The server object to use.
+ *\param languageFile The language file to use to retrieve warnings/errors 
+ *messages.
+ *\param global Specify if the library should be loaded globally.
+ */
+int PluginsManager::addPlugin(string& file, Server* server, 
+                                       XmlParser* languageFile, bool global)
+{
+  Plugin *plugin = createPluginObject();
+  string logBuf;
+  string name;
+  const char* namePtr;
+
+  if(plugin->preLoad(file, server, languageFile, global))
+  {
+    delete plugin;
+    return 1;
+  }
+  namePtr = plugin->getName(0, 0);
+
+  if(namePtr)
+    name.assign(namePtr);
+  else
+  {
+    delete plugin;
+    return 1;
+  }
+    
+  plugins.put(name, plugin);
+
+  logBuf.assign(languageFile->getValue("MSG_LOADED"));
+  logBuf.append(" ");
+  logBuf.append(file);
+  logBuf.append(" --> ");
+  logBuf.append(name);
+  server->logWriteln( logBuf.c_str() );
+  return 0;
+}
+
+/*!
  *Load the plugins.
  *\param server The server object to use.
  *\param languageFile The language file to use to get errors and warnings 
@@ -152,15 +267,13 @@
 int PluginsManager::load(Server *server, XmlParser* languageFile, 
                          string& resource)
 {
-  int ret = 0;
-  HashMap<char*, PluginsNamespace*>::Iterator it = namespaces.begin();
-
-  while(it != namespaces.end())
+  HashMap<string, Plugin*>::Iterator it = plugins.begin();
+  while(it != plugins.end())
   {
-    ret |= (*it)->load(server, languageFile, resource);
+    (*it)->load(resource, server, languageFile);
     it++;
   }
-  return ret;
+  return 0;
   
 }
 
@@ -172,16 +285,13 @@
  */
 int PluginsManager::postLoad(Server *server, XmlParser* languageFile)
 {
-  int ret = 0;
-  HashMap<char*, PluginsNamespace*>::Iterator it = namespaces.begin();
-
-  while(it != namespaces.end())
+  HashMap<string, Plugin*>::Iterator it = plugins.begin();
+  while(it != plugins.end())
   {
-    ret |= (*it)->postLoad(server, languageFile);
+    (*it)->postLoad(server, languageFile);
     it++;
   }
-
-  return ret;
+  return 0;
 }
 
 /*!
@@ -192,44 +302,57 @@
  */
 int PluginsManager::unLoad(Server *server, XmlParser* languageFile)
 {
-  int ret = 0;
+  HashMap<string, Plugin*>::Iterator it = plugins.begin();
+  HashMap<string, PluginOption*>::Iterator poit = pluginsOptions.begin();
 
-  HashMap<char*, PluginsNamespace*>::Iterator it = namespaces.begin();
-
-  while(it != namespaces.end())
+  while(it != plugins.end())
   {
-    ret |= (*it)->unLoad(languageFile);
+    (*it)->unLoad(languageFile);
+    delete *it;
     it++;
   }
 
-  namespaces.clear();
-  return ret;
+  while(poit != pluginsOptions.end())
+  {
+    delete *poit;
+    poit++;
+  }
+
+  plugins.clear();
+  pluginsOptions.clear();
+  return 0;
 }
 
 /*!
- *Add a new namespace to the plugins system.
- *\param newnamespace The namespace to add.
+ *Remove a plugin  without clean it.
+ *\param name The plugin to remove.
  */
-void PluginsManager::addNamespace(PluginsNamespace* newnamespace)
+void PluginsManager::removePlugin(string& name)
 {
-  removeNamespace(newnamespace->getName());
-  namespaces.put((char*)newnamespace->getName().c_str(), newnamespace);
+  plugins.remove(name);
 }
 
 /*!
- *Get a namespace by its name.
- *\param name The namespace name.
+ *Add a plugin option structure.
+ *\param plugin The plugin name.
+ *\param po The options for the plugin.
  */
-PluginsNamespace* PluginsManager::getNamespace(string &name)
+int PluginsManager::addPluginOption(string& plugin, PluginOption& po)
 {
-  return namespaces.get((char*)name.c_str());
+  PluginOption* newPo = new PluginOption(po);
+  PluginOption* oldPo = pluginsOptions.put(plugin, newPo);
+
+  if(oldPo)
+    delete oldPo;
+
+  return 0;
 }
 
 /*!
- *Remove a namespace by its name.
- *\param name The namespace name.
+ *Return a pluginOption.
+ *\param name The plugin name.
  */
-PluginsNamespace* PluginsManager::removeNamespace(string& name)
+PluginsManager::PluginOption* PluginsManager::getPluginOption(string& plugin)
 {
-  return namespaces.remove((char*)name.c_str());
-}
+  return pluginsOptions.get(plugin);
+}
\ No newline at end of file

Deleted: trunk/myserver/src/plugin/plugins_namespace.cpp
===================================================================
--- trunk/myserver/src/plugin/plugins_namespace.cpp	2008-10-26 14:12:09 UTC (rev 2910)
+++ trunk/myserver/src/plugin/plugins_namespace.cpp	2008-10-26 15:49:14 UTC (rev 2911)
@@ -1,180 +0,0 @@
-/*
-MyServer
-Copyright (C) 2007, 2008 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
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program.  If not, see <http://www.gnu.org/licenses/>.
-*/
-
-#include "stdafx.h"
-#include <include/plugin/plugins_namespace.h>
-#include <string>
-using namespace std;
-
-/*!
- *Constructor for the class.
- *\param name A name for the namespace.
- */
-PluginsNamespace::PluginsNamespace(string name)
-{
-  this->name.assign(name);
-  loaded = false;
-}
-
-/*!
- *Destroy the object.
- */
-PluginsNamespace::~PluginsNamespace()
-{
-  unLoad(0);
-  loaded = false;
-}
-
-
-/*!
- *Constructor for the class.
- *\param name A name for the namespace.
- *\param clone Another namespace to copy plugins from.  
- *A plugin can exist only in a namespace at once, this constructor will clean 
- *up automatically the clone namespace.
- */
-PluginsNamespace::PluginsNamespace(string& name, PluginsNamespace& clone) 
-{
-  this->name.assign(name);
-  HashMap<string, Plugin*>::Iterator it = clone.plugins.begin();
-  while(it != clone.plugins.end())
-  {
-    string name((*it)->getName(0, 0));
-    plugins.put(name, *it);
-    it++;
-  }
-  loaded = clone.loaded;
-
-}
-
-/*!
- *Get the namespace name.
- */
-string& PluginsNamespace::getName()
-{
-  return name;
-}
-
-/*!
- *Get a plugin by its name.
- *\param name The plugin name.
- */
-Plugin* PluginsNamespace::getPlugin(string &name)
-{
-  return plugins.get((char*)name.c_str());
-}
-
-/*!
- *Post load sequence, called when all the plugins are loaded.
- *\param server The server object to use.
- *\param languageFile The language file to use to retrieve warnings/errors 
- *messages.
- */
-int PluginsNamespace::postLoad(Server* server, XmlParser* languageFile)
-{
-  HashMap<string, Plugin*>::Iterator it = plugins.begin();
-  while(it != plugins.end())
-  {
-    (*it)->postLoad(server, languageFile);
-    it++;
-  }
-  loaded = true;
-  return 0;
-}
-
-/*!
- *Unload the namespace.
- *\param languageFile The language file to use to retrieve warnings/errors 
- *messages.
- */
-int PluginsNamespace::unLoad(XmlParser* languageFile)
-{
-  HashMap<string, Plugin*>::Iterator it = plugins.begin();
-  HashMap<string, PluginOption*>::Iterator poit = pluginsOptions.begin();
-
-  while(it != plugins.end())
-  {
-    (*it)->unLoad(languageFile);
-    delete *it;
-    it++;
-  }
-
-  while(poit != pluginsOptions.end())
-  {
-    delete *poit;
-    poit++;
-  }
-
-  loaded = false;
-  plugins.clear();
-  pluginsOptions.clear();
-  return 0;
-}
-
-/*!
- *Set a name for the namespace.
- *\param name The new name for the namespace.
- */
-void PluginsNamespace::setName(string& name)
-{
-  this->name.assign(name);
-}
-
-/*!
- *Add a plugin that is already preloaded to the namespace.
- *\param plugin The plugin to add.
- */
-int PluginsNamespace::addPreloadedPlugin(Plugin* plugin)
-{
-  string name(plugin->getName(0, 0));
-  plugins.put(name, plugin);
-  return 0;
-}
-
-/*!
- *Remove a plugin from the namespace without clean it.
- *\param name The plugin to remove.
- */
-void PluginsNamespace::removePlugin(string& name)
-{
-  plugins.remove(name);
-}
-
-/*!
- *Add a plugin option structure to the namespace.
- *\param plugin The plugin name.
- *\param po The options for the plugin.
- */
-int PluginsNamespace::addPluginOption(string& plugin, PluginOption& po)
-{
-  PluginOption* newPo = new PluginOption(po);
-  PluginOption* oldPo = pluginsOptions.put(plugin, newPo);
-
-  if(oldPo)
-    delete oldPo;
-
-  return 0;
-}
-
-/*!
- *Remove a plugin from the namespace without clean it.
- *\param name The plugin to remove.
- */
-PluginsNamespace::PluginOption* PluginsNamespace::getPluginOption(string& plugin)
-{
-  return pluginsOptions.get(plugin);
-}

Deleted: trunk/myserver/src/plugin/plugins_namespace_manager.cpp
===================================================================
--- trunk/myserver/src/plugin/plugins_namespace_manager.cpp	2008-10-26 14:12:09 UTC (rev 2910)
+++ trunk/myserver/src/plugin/plugins_namespace_manager.cpp	2008-10-26 15:49:14 UTC (rev 2911)
@@ -1,176 +0,0 @@
-/*
-MyServer
-Copyright (C) 2007, 2008 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
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program.  If not, see <http://www.gnu.org/licenses/>.
-*/
-
-#include "stdafx.h"
-#include <include/plugin/plugins_namespace_manager.h>
-#include <include/base/find_data/find_data.h>
-#include <include/base/xml/xml_parser.h>
-#include <include/server/server.h>
-#include <string>
-using namespace std;
-
-/*!
- *Constructor for the class.
- *\param name The name for this namespace.
- */
-PluginsNamespaceManager::PluginsNamespaceManager(string name) : 
-  PluginsNamespace(name)
-{
-
-}
-
-/*!
- *Create the appropriate object to keep a plugin.
- */
-Plugin* PluginsNamespaceManager::createPluginObject()
-{
-  return new Plugin();
-}
-
-/*!
- *Add a plugin to the namespace.
- *\param file The plugin file name.
- *\param server The server object to use.
- *\param languageFile The language file to use to retrieve warnings/errors 
- *messages.
- *\param global Specify if the library should be loaded globally.
- */
-int PluginsNamespaceManager::addPlugin(string& file, Server* server, 
-                                       XmlParser* languageFile, bool global)
-{
-  Plugin *plugin = createPluginObject();
-  string logBuf;
-  string name;
-  const char* namePtr;
-
-  if(plugin->preLoad(file, server, languageFile, global))
-  {
-    delete plugin;
-    return 1;
-  }
-  namePtr = plugin->getName(0, 0);
-
-  if(namePtr)
-    name.assign(namePtr);
-  else
-  {
-    delete plugin;
-    return 1;
-  }
-    
-  plugins.put(name, plugin);
-
-  logBuf.assign(languageFile->getValue("MSG_LOADED"));
-  logBuf.append(" ");
-  logBuf.append(file);
-  logBuf.append(" --> ");
-  logBuf.append(name);
-  server->logWriteln( logBuf.c_str() );
-  return 0;
-}
-
-
-/*!
- *Preload sequence, called when all the plugins are not yet loaded.
- *\param server The server object to use.
- *\param languageFile The language file to use to retrieve warnings/errors 
- *messages.
- *\param resource The resource location to use to load plugins, in this 
- *implementation it is a directory name.
- */
-int PluginsNamespaceManager::preLoad(Server* server, XmlParser* languageFile, 
-                                     string& resource)
-{
-  FindData fd;
-  string filename;
-  string completeFileName;  
-  int ret;
-
-  filename.assign(resource);
-  filename.append("/");
-  filename.append(getName());
-
-  ret = fd.findfirst(filename.c_str());  
-  
-  if(ret == -1)
-  {
-    return ret;  
-  }
-
-  ret = 0;
-
-  do
-  {  
-    string name(fd.name);
-    PluginsNamespace::PluginOption *po;
-
-    if(fd.name[0]=='.')
-      continue;
-    /*!
-     *Do not consider file other than dynamic libraries.
-     */
-#ifdef WIN32
-    if(!strstr(fd.name,".dll"))
-#endif
-#ifdef NOT_WIN
-    if(!strstr(fd.name,".so"))
-#endif    
-      continue;
-
-    completeFileName.assign(filename);
-    if((fd.name[0] != '/') && (fd.name[0] != '\\')) 
-      completeFileName.append("/");
-    completeFileName.append(fd.name);
-
-#ifdef WIN32
-    name = name.substr(0, name.length() - 4);
-#endif
-#ifdef NOT_WIN
-    name = name.substr(0, name.length() - 3);
-#endif
-
-    po = getPluginOption(name);
-    
-    if(!po || po->enabled)
-      ret |= addPlugin(completeFileName, server, languageFile, po && po->global);
-  }while(!fd.findnext());
-  fd.findclose();
-
-  return ret;
-}
-
-/*!
- *Load sequence, called when all the plugins are loaded.
- *\param server The server object to use.
- *\param languageFile The language file to use to retrieve warnings/errors 
- *messages.
- *\param resource The resource location to use to load plugins, in this 
- *implementation it is a directory name.
- */
-int PluginsNamespaceManager::load(Server* server, XmlParser* languageFile, 
-                                     string& resource)
-{
-  HashMap<string, Plugin*>::Iterator it = plugins.begin();
-  while(it != plugins.end())
-  {
-    (*it)->load(resource, server, languageFile);
-    it++;
-  }
-  return 0;
-
-
-}

Modified: trunk/myserver/src/protocol/Makefile.am
===================================================================
--- trunk/myserver/src/protocol/Makefile.am	2008-10-26 14:12:09 UTC (rev 2910)
+++ trunk/myserver/src/protocol/Makefile.am	2008-10-26 15:49:14 UTC (rev 2911)
@@ -1,5 +1,5 @@
 lib_LIBRARIES = libprotocol.a
-libprotocol_a_SOURCES = protocol_buffer.cpp protocol.cpp
+libprotocol_a_SOURCES = protocol_buffer.cpp protocol.cpp protocols_manager.cpp
 SUBDIRS = control ftp http https
 INCLUDES = $(all_includes)
 

Modified: trunk/myserver/src/protocol/control/control_protocol.cpp
===================================================================
--- trunk/myserver/src/protocol/control/control_protocol.cpp	2008-10-26 14:12:09 UTC (rev 2910)
+++ trunk/myserver/src/protocol/control/control_protocol.cpp	2008-10-26 15:49:14 UTC (rev 2911)
@@ -22,7 +22,6 @@
 #include <include/server/server.h>
 #include <include/base/find_data/find_data.h>
 #include <include/base/string/securestr.h>
-#include <include/plugin/protocol/protocols_manager.h>
 #include <include/protocol/control/control_errors.h>
 #include <include/base/string/stringutils.h>
 #include <include/base/file/files_utility.h>
@@ -517,11 +516,6 @@
     knownCommand = 1;
     ret = showLanguageFiles(a, Ofile, b1, bs1, header);
   }
-  else if(!strcmp(command, "SHOWDYNAMICPROTOCOLS"))
-  {
-    knownCommand = 1;
-    ret = showDynamicProtocols(a, Ofile, b1, bs1, header);
-  }
   else if(!strcmp(command, "VERSION"))
   {
     knownCommand = 1;
@@ -811,40 +805,8 @@
   return 0;
 }
 
-/*!
- *List all the dynamic protocols used by the server.
- */
-int ControlProtocol::showDynamicProtocols(ConnectionPtr a, File* out, 
-                                          char *b1,int bs1, ControlHeader& header)
-{
-  int i = 0;
-  u_long nbw;
-  int ret;
-  HashMap<string, Plugin*>::Iterator it = 
-    Server::getInstance()->getProtocolsManager()->begin();
 
-  for(; it != Server::getInstance()->getProtocolsManager()->end(); it++)
-  {
-    DynamicProtocol* dp = (DynamicProtocol*) *it;
-#ifdef HAVE_SNPRINTF
-    snprintf(b1, bs1, "%s\r\n", dp->getName(0, 0) );
 
-#else
-    sprintf(b1, "%s\r\n", dp->getName(0, 0) );
-#endif
-   
-    ret = out->writeToFile(b1, strlen(b1), &nbw);
-    if(ret)
-    {
-      strcpy(b1, "Control: Error while writing to file");
-      addToErrorLog(a, b1, strlen(b1), header);
-      return CONTROL_INTERNAL;
-    }
-    i++;
-  }
-  return 0;
-}
-
 /*!
  *Return the requested file to the client.
  */

Modified: trunk/myserver/src/protocol/http/Makefile.am
===================================================================
--- trunk/myserver/src/protocol/http/Makefile.am	2008-10-26 14:12:09 UTC (rev 2910)
+++ trunk/myserver/src/protocol/http/Makefile.am	2008-10-26 15:49:14 UTC (rev 2911)
@@ -1,5 +1,5 @@
 lib_LIBRARIES = libhttp.a
-libhttp_a_SOURCES = http.cpp http_data_handler.cpp http_data_read.cpp http_errors.cpp http_headers.cpp http_request.cpp http_req_security_domain.cpp http_response.cpp http_thread_context.cpp
+libhttp_a_SOURCES = http.cpp http_data_handler.cpp http_data_read.cpp http_errors.cpp http_headers.cpp http_request.cpp http_req_security_domain.cpp http_response.cpp http_thread_context.cpp dyn_http_manager.cpp dyn_http_manager_list.cpp dyn_http_command.cpp dyn_http_command_manager.cpp
 SUBDIRS = env
 INCLUDES = $(all_includes)
 

Copied: trunk/myserver/src/protocol/http/dyn_http_command.cpp (from rev 2900, trunk/myserver/src/plugin/http_command/dyn_http_command.cpp)
===================================================================
--- trunk/myserver/src/protocol/http/dyn_http_command.cpp	                        (rev 0)
+++ trunk/myserver/src/protocol/http/dyn_http_command.cpp	2008-10-26 15:49:14 UTC (rev 2911)
@@ -0,0 +1,45 @@
+/*
+MyServer
+Copyright (C) 2005, 2006, 2008 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
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program.  If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#include <include/protocol/http/dyn_http_command.h>
+#include <include/server/server.h>
+
+
+
+/*!
+ *Default constructor.
+ */
+DynamicHttpCommand::DynamicHttpCommand(string& name) 
+{
+  this->name = name;
+}
+
+/*!
+ *Default constructor.
+ */
+string DynamicHttpCommand::getName() 
+{
+  return name;
+}
+
+/*!
+ *Destroy the object.
+ */
+DynamicHttpCommand::~DynamicHttpCommand()
+{
+}
+

Copied: trunk/myserver/src/protocol/http/dyn_http_command_manager.cpp (from rev 2900, trunk/myserver/src/plugin/http_command/dyn_http_command_manager.cpp)
===================================================================
--- trunk/myserver/src/protocol/http/dyn_http_command_manager.cpp	                        (rev 0)
+++ trunk/myserver/src/protocol/http/dyn_http_command_manager.cpp	2008-10-26 15:49:14 UTC (rev 2911)
@@ -0,0 +1,58 @@
+/*
+MyServer
+Copyright (C) 2005, 2006, 2007, 2008 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
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program.  If not, see <http://www.gnu.org/licenses/>.
+*/
+
+
+#include <include/protocol/http/dyn_http_command_manager.h>
+#include <include/protocol/http/dyn_http_command.h>
+
+#include <string>
+
+
+/*!
+ *Initialize the object.
+ */
+DynHttpCommandManager::DynHttpCommandManager()
+{
+
+}
+
+/*!
+ *Destroy the object.
+ */
+DynHttpCommandManager::~DynHttpCommandManager()
+{
+
+}
+
+/*!
+ *Get the DynamicHttpCommand.
+ *\param name http command name.
+ */
+DynamicHttpCommand* DynHttpCommandManager::getHttpCommand(string& name)
+{
+  return dynamicHttpCommands.get(name);
+}
+
+/*!
+ *Add the DynamicHttpCommand.
+ *\param name http command name.
+ *\param httpManager http command to add.
+ */
+void DynHttpCommandManager::addHttpCommand(string& name, DynamicHttpCommand* httpCommand)
+{
+  dynamicHttpCommands.put(name,httpCommand);
+}
\ No newline at end of file

Copied: trunk/myserver/src/protocol/http/dyn_http_manager.cpp (from rev 2899, trunk/myserver/src/plugin/http_manager/dyn_http_manager.cpp)
===================================================================
--- trunk/myserver/src/protocol/http/dyn_http_manager.cpp	                        (rev 0)
+++ trunk/myserver/src/protocol/http/dyn_http_manager.cpp	2008-10-26 15:49:14 UTC (rev 2911)
@@ -0,0 +1,42 @@
+/*
+MyServer
+Copyright (C) 2005, 2007, 2008 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
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program.  If not, see <http://www.gnu.org/licenses/>.
+*/
+
+
+#include <include/protocol/http/dyn_http_manager.h>
+#include <include/base/xml/xml_parser.h>
+#include <include/server/server.h>
+
+#include <string>
+
+
+/*!
+ *Default constructor.
+ */
+DynamicHttpManager::DynamicHttpManager() 
+{
+
+}
+
+/*!
+ *Destroy the object.
+ */
+DynamicHttpManager::~DynamicHttpManager()
+{
+
+}
+
+

Copied: trunk/myserver/src/protocol/http/dyn_http_manager_list.cpp (from rev 2899, trunk/myserver/src/plugin/http_manager/dyn_http_manager_list.cpp)
===================================================================
--- trunk/myserver/src/protocol/http/dyn_http_manager_list.cpp	                        (rev 0)
+++ trunk/myserver/src/protocol/http/dyn_http_manager_list.cpp	2008-10-26 15:49:14 UTC (rev 2911)
@@ -0,0 +1,60 @@
+/*
+MyServer
+Copyright (C) 2005, 2007, 2008 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
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program.  If not, see <http://www.gnu.org/licenses/>.
+*/
+
+
+#include <include/protocol/http/dyn_http_manager_list.h>
+#include <include/protocol/http/dyn_http_manager.h>
+#include <include/server/server.h>
+
+#include <string>
+
+
+/*!
+ *Initialize the object.
+ */
+DynHttpManagerList::DynHttpManagerList() 
+{
+
+}
+
+/*!
+ *Destroy the object.
+ */
+DynHttpManagerList::~DynHttpManagerList()
+{
+
+}
+
+/*!
+ *Get the DynamicHttpManagers.
+ *\param name http manager name.
+ */
+DynamicHttpManager* DynHttpManagerList::getHttpManager(string& name)
+{
+  return dynamicHttpManagers.get(name);
+}
+
+/*!
+ *Add the DynamicHttpManagers.
+ *\param name http manager name.
+ *\param httpManager http manager to add.
+ */
+void DynHttpManagerList::addHttpManager(string& name, DynamicHttpManager* httpManager)
+{
+  dynamicHttpManagers.put(name,httpManager);
+}
+

Modified: trunk/myserver/src/protocol/http/http.cpp
===================================================================
--- trunk/myserver/src/protocol/http/http.cpp	2008-10-26 14:12:09 UTC (rev 2910)
+++ trunk/myserver/src/protocol/http/http.cpp	2008-10-26 15:49:14 UTC (rev 2911)
@@ -86,11 +86,11 @@
     HttpRequestHeader::Entry *connection = td->request.other.get("Connection");
     string methods("OPTIONS, GET, POST, HEAD, DELETE, PUT");
 
-    HashMap<string, Plugin*>::Iterator it = staticHttp.dynCmdManager.begin();
+    HashMap<string, DynamicHttpCommand*>::Iterator it = staticHttp.dynCmdManager.begin();
     while(it != staticHttp.dynCmdManager.end())
     {
       methods.append(", ");
-      methods.append((*it)->getName(0, 0));
+      methods.append((*it)->getName());
       it++;
     }
 
@@ -958,8 +958,103 @@
                        data.c_str(), td->mime->selfExecuted, onlyHeader);
       return ret;
     }
-    else if (td->mime && (manager = staticHttp.dynManagerList.getPlugin (td->mime->cmdName)))
+    else if (td->mime && (manager = staticHttp.dynManagerList.getHttpManager (td->mime->cmdName)))
     {
+      int allowScgi = 1;
+      const char *dataH = td->connection->host->getHashedData("ALLOW_SCGI");
+      if(dataH)
+      {
+        if(!strcmpi(dataH, "YES"))
+          allowScgi = 1;
+        else
+          allowScgi = 0;
+      }
+      if(!allowScgi || !(permissions & MYSERVER_PERMISSION_EXECUTE))
+      {
+        return sendAuth();
+      }
+      ret = scgi->send(td, td->connection, td->filenamePath.c_str(),
+                       data.c_str(), 1, onlyHeader);
+      return ret;
+    }
+    else if(!td->mime->cmdName.compare ("SENDLINK"))
+    {
+      u_long nbr;
+      char* linkpath;
+      char* pathInfo;
+      int linkpathSize;
+      File h;
+      int allowSendlink = 1;
+      const char *dataH =
+        td->connection->host->getHashedData("ALLOW_SEND_LINK");
+
+      if(dataH)
+      {
+        if(!strcmpi(dataH, "YES"))
+          allowSendlink = 1;
+        else
+          allowSendlink = 0;
+      }
+
+      if(!allowSendlink || !(permissions & MYSERVER_PERMISSION_READ))
+      {
+        return sendAuth();
+      }
+
+      if(h.openFile(td->filenamePath.c_str(),
+                    File::MYSERVER_OPEN_IFEXISTS|File::MYSERVER_OPEN_READ))
+      {
+        return raiseHTTPError(500);
+      }
+
+      linkpathSize = h.getFileSize() + td->pathInfo.length() + 1;
+
+      if(linkpathSize > MYSERVER_KB(10))
+        linkpathSize = MYSERVER_KB(10);
+
+      linkpath=new char[linkpathSize];
+
+      if(linkpath == 0)
+      {
+        return sendHTTPhardError500();
+      }
+
+      if(h.read(linkpath, linkpathSize, &nbr))
+      {
+        h.close();
+        delete [] linkpath;
+        return raiseHTTPError(500);/*!Internal server error*/
+      }
+
+      h.close();
+      linkpath[nbr]='\0';
+
+      pathInfo = new char[td->pathInfo.length() + 1];
+
+      if(pathInfo == 0)
+      {
+        delete [] linkpath;
+        return raiseHTTPError(500);/*!Internal server error*/
+      }
+      strcpy(pathInfo, td->pathInfo.c_str());
+      translateEscapeString(pathInfo);
+      strncat(linkpath, pathInfo,strlen(linkpath));
+
+      if(nbr)
+      {
+        string uri;
+        uri.assign(linkpath);
+        ret = sendHTTPResource(uri, systemrequest, onlyHeader, 1);
+      }
+      else
+        ret = raiseHTTPError(404);
+
+      delete [] linkpath;
+      delete [] pathInfo;
+      return ret;
+    }
+    else if ((manager = staticHttp.dynManagerList.getHttpManager(td->mime->cmdName)))
+    {
       int allowExternal = 1;
       const char *dataH =
         td->connection->host->getHashedData ("ALLOW_EXTERNAL_COMMANDS");
@@ -1250,7 +1345,7 @@
     FilesUtility::temporaryFileName(td->id, td->inputDataPath);
     FilesUtility::temporaryFileName(td->id, td->outputDataPath);
 
-    dynamicCommand = staticHttp.dynCmdManager.getPlugin(td->request.cmd);
+    dynamicCommand = staticHttp.dynCmdManager.getHttpCommand(td->request.cmd);
 
     /* If the used method supports POST data, read it.  */
     if((!td->request.cmd.compare("POST")) ||
@@ -2201,9 +2296,6 @@
   HttpFile::load(configurationFileManager);
   HttpDir::load(configurationFileManager);
 
-  Server::getInstance()->getPluginsManager()->addNamespace(&staticHttp.dynCmdManager);
-  Server::getInstance()->getPluginsManager()->addNamespace(&staticHttp.dynManagerList);
-
   /*! Determine the min file size that will use GZIP compression.  */
   data = configurationFileManager->getValue("GZIP_THRESHOLD");
   if(data)

Copied: trunk/myserver/src/protocol/protocols_manager.cpp (from rev 2899, trunk/myserver/src/plugin/protocol/protocols_manager.cpp)
===================================================================
--- trunk/myserver/src/protocol/protocols_manager.cpp	                        (rev 0)
+++ trunk/myserver/src/protocol/protocols_manager.cpp	2008-10-26 15:49:14 UTC (rev 2911)
@@ -0,0 +1,66 @@
+/*
+MyServer
+Copyright (C) 2002, 2003, 2004, 2007, 2008 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
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program.  If not, see <http://www.gnu.org/licenses/>.
+*/
+
+
+#include <include/protocol/protocols_manager.h>
+#include <include/base/xml/xml_parser.h>
+#include <include/server/server.h>
+#include <string>
+#include <algorithm>
+#include <cctype> 
+
+
+
+/*!
+ *Class constructor.
+ */
+ProtocolsManager::ProtocolsManager() 
+{
+
+}
+
+/*!
+ *Class destructor.
+ */
+ProtocolsManager::~ProtocolsManager()
+{
+
+}
+
+/*!
+ *Return a protocol by its name.
+ */
+Protocol* ProtocolsManager::getProtocol(string& name)
+{
+  return staticProtocols.get(name);
+}
+
+/*!
+ *Add a static protocol to the list.
+ */
+void ProtocolsManager::addProtocol(string& name, Protocol* protocol)
+{
+  std::transform(name.begin(),
+                 name.end(),
+                 name.begin(),
+                 static_cast < int(*)(int) > (tolower) );
+
+  staticProtocols.put(name, protocol);
+  staticProtocolsList.push_back(protocol);
+}
+
+

Modified: trunk/myserver/src/server/server.cpp
===================================================================
--- trunk/myserver/src/server/server.cpp	2008-10-26 14:12:09 UTC (rev 2910)
+++ trunk/myserver/src/server/server.cpp	2008-10-26 15:49:14 UTC (rev 2911)
@@ -526,10 +526,10 @@
   }
 
 
-  getPluginsManager()->addNamespace(&executors);
-  getPluginsManager()->addNamespace(&protocols);
-  getPluginsManager()->addNamespace(&filters);
-  getPluginsManager()->addNamespace(&genericPluginsManager);
+  //getPluginsManager()->addNamespace(&executors);
+  //getPluginsManager()->addNamespace(&protocols);
+  //getPluginsManager()->addNamespace(&filters);
+  //getPluginsManager()->addNamespace(&genericPluginsManager);
 
   getPluginsManager()->preLoad(this, &languageParser, *externalPath);
   getPluginsManager()->load(this, &languageParser, *externalPath);





From MAILER-DAEMON Sun Oct 26 11:53:47 2008
Received: from mailman by lists.gnu.org with archive (Exim 4.43)
	id 1Ku7w3-0007eq-FZ
	for mharc-myserver-commit@gnu.org; Sun, 26 Oct 2008 11:53:47 -0400
Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43)
	id 1Ku7w1-0007cX-5l
	for myserver-commit@gnu.org; Sun, 26 Oct 2008 11:53:45 -0400
Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43)
	id 1Ku7vz-0007Yy-OT
	for myserver-commit@gnu.org; Sun, 26 Oct 2008 11:53:44 -0400
Received: from [199.232.76.173] (port=56125 helo=monty-python.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.43) id 1Ku7vz-0007Yl-IC
	for myserver-commit@gnu.org; Sun, 26 Oct 2008 11:53:43 -0400
Received: from savannah.gnu.org ([199.232.41.3]:38641 helo=sv.gnu.org)
	by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32)
	(Exim 4.60) (envelope-from <INVALID.NOREPLY@gnu.org>)
	id 1Ku7vy-0008V4-Ns
	for myserver-commit@gnu.org; Sun, 26 Oct 2008 11:53:43 -0400
Received: from cvs.savannah.gnu.org ([199.232.41.69])
	by sv.gnu.org with esmtp (Exim 4.63)
	(envelope-from <INVALID.NOREPLY@gnu.org>) id 1Ku7vw-0003OZ-E1
	for myserver-commit@gnu.org; Sun, 26 Oct 2008 15:53:40 +0000
Received: from dperrone by cvs.savannah.gnu.org with local (Exim 4.63)
	(envelope-from <dperrone@savannah.gnu.org>) id 1Ku7vw-0003OV-3U
	for myserver-commit@gnu.org; Sun, 26 Oct 2008 15:53:40 +0000
MIME-Version: 1.0
Errors-To: dperrone
To: myserver-commit@gnu.org
X-Mailer: SVN::Notify 2.64: http://search.cpan.org/dist/SVN-Notify/
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
From: Daniele Perrone <dperrone@it.gnu.org>
Message-Id: <E1Ku7vw-0003OV-3U@cvs.savannah.gnu.org>
Date: Sun, 26 Oct 2008 15:53:40 +0000
X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 3)
Subject: [myserver-commit] [2912] Refactored plugins management,
 left only generic plugin, 
 all different kind of plugins are been removed.
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/pipermail/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, 26 Oct 2008 15:53:45 -0000

Revision: 2912
          http://svn.sv.gnu.org/viewvc/?view=rev&root=myserver&revision=2912
Author:   dperrone
Date:     2008-10-26 15:53:39 +0000 (Sun, 26 Oct 2008)

Log Message:
-----------
Refactored plugins management, left only generic plugin, all different kind of plugins are been removed. (Step 2)

Modified Paths:
--------------
    trunk/myserver/configure.in

Removed Paths:
-------------
    trunk/myserver/include/protocol/Makefile
    trunk/myserver/include/protocol/Makefile.in

Modified: trunk/myserver/configure.in
===================================================================
--- trunk/myserver/configure.in	2008-10-26 15:49:14 UTC (rev 2911)
+++ trunk/myserver/configure.in	2008-10-26 15:53:39 UTC (rev 2912)
@@ -413,11 +413,6 @@
     include/filter/Makefile
     include/filter/gzip/Makefile
     include/plugin/Makefile
-    include/plugin/executor/Makefile
-    include/plugin/http_manager/Makefile
-    include/plugin/protocol/Makefile
-    include/plugin/filter/Makefile
-    include/plugin/http_command/Makefile
     include/server/Makefile
     src/Makefile
     src/connection/Makefile
@@ -467,11 +462,6 @@
     src/filter/Makefile
     src/filter/gzip/Makefile
     src/plugin/Makefile
-    src/plugin/executor/Makefile
-    src/plugin/http_manager/Makefile
-    src/plugin/protocol/Makefile
-    src/plugin/filter/Makefile
-    src/plugin/http_command/Makefile
     src/server/Makefile
     tests/Makefile
     ])

Deleted: trunk/myserver/include/protocol/Makefile
===================================================================
--- trunk/myserver/include/protocol/Makefile	2008-10-26 15:49:14 UTC (rev 2911)
+++ trunk/myserver/include/protocol/Makefile	2008-10-26 15:53:39 UTC (rev 2912)
@@ -1,547 +0,0 @@
-# Makefile.in generated by automake 1.10.1 from Makefile.am.
-# include/protocol/Makefile.  Generated from Makefile.in by configure.
-
-# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006, 2007, 2008  Free Software Foundation, Inc.
-# This Makefile.in is free software; the Free Software Foundation
-# gives unlimited permission to copy and/or distribute it,
-# with or without modifications, as long as this notice is preserved.
-
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
-# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
-# PARTICULAR PURPOSE.
-
-
-
-
-pkgdatadir = $(datadir)/myserver
-pkglibdir = $(libdir)/myserver
-pkgincludedir = $(includedir)/myserver
-am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
-install_sh_DATA = $(install_sh) -c -m 644
-install_sh_PROGRAM = $(install_sh) -c
-install_sh_SCRIPT = $(install_sh) -c
-INSTALL_HEADER = $(INSTALL_DATA)
-transform = $(program_transform_name)
-NORMAL_INSTALL = :
-PRE_INSTALL = :
-POST_INSTALL = :
-NORMAL_UNINSTALL = :
-PRE_UNINSTALL = :
-POST_UNINSTALL = :
-build_triplet = i686-pc-linux-gnu
-host_triplet = i686-pc-linux-gnu
-target_triplet = i686-pc-linux-gnu
-subdir = include/protocol
-DIST_COMMON = $(protocolinclude_HEADERS) $(srcdir)/Makefile.am \
-	$(srcdir)/Makefile.in
-ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/m4/cppunit.m4 \
-	$(top_srcdir)/m4/gnome-pthread-check.m4 \
-	$(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/libxml.m4 \
-	$(top_srcdir)/configure.in
-am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
-	$(ACLOCAL_M4)
-mkinstalldirs = $(install_sh) -d
-CONFIG_HEADER = $(top_builddir)/config.h
-CONFIG_CLEAN_FILES =
-SOURCES =
-DIST_SOURCES =
-RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
-	html-recursive info-recursive install-data-recursive \
-	install-dvi-recursive install-exec-recursive \
-	install-html-recursive install-info-recursive \
-	install-pdf-recursive install-ps-recursive install-recursive \
-	installcheck-recursive installdirs-recursive pdf-recursive \
-	ps-recursive uninstall-recursive
-am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
-am__vpath_adj = case $$p in \
-    $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
-    *) f=$$p;; \
-  esac;
-am__strip_dir = `echo $$p | sed -e 's|^.*/||'`;
-am__installdirs = "$(DESTDIR)$(protocolincludedir)"
-protocolincludeHEADERS_INSTALL = $(INSTALL_HEADER)
-HEADERS = $(protocolinclude_HEADERS)
-RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive	\
-  distclean-recursive maintainer-clean-recursive
-ETAGS = etags
-CTAGS = ctags
-DIST_SUBDIRS = $(SUBDIRS)
-DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
-ACLOCAL = ${SHELL} /home/dany/srcprojects/myserver/myserver/missing --run aclocal-1.10
-AMTAR = ${SHELL} /home/dany/srcprojects/myserver/myserver/missing --run tar
-AR = ar
-AUTOCONF = ${SHELL} /home/dany/srcprojects/myserver/myserver/missing --run autoconf
-AUTOHEADER = ${SHELL} /home/dany/srcprojects/myserver/myserver/missing --run autoheader
-AUTOMAKE = ${SHELL} /home/dany/srcprojects/myserver/myserver/missing --run automake-1.10
-AWK = gawk
-CC = gcc
-CCDEPMODE = depmode=gcc3
-CFLAGS =   -fPIC -DPIC -I/usr/include/openssl -DHAVE_SSL
-CPP = gcc -E
-CPPFLAGS =  -I/usr/include/libxml2
-CPPUNIT_CFLAGS = 
-CPPUNIT_CONFIG = /usr/bin/cppunit-config
-CPPUNIT_LDFLAGS = -lcppunit
-CPPUNIT_LIBS = -lcppunit -ldl
-CXFLAGS = 
-CXX = g++
-CXXCPP = g++ -E
-CXXDEPMODE = depmode=gcc3
-CXXFLAGS =   -fPIC -DPIC -I/usr/include/openssl -DHAVE_SSL
-CYGPATH_W = echo
-DEFS = -DHAVE_CONFIG_H
-DEPDIR = .deps
-DL_LIB = -ldl
-ECHO = echo
-ECHO_C = 
-ECHO_N = -n
-ECHO_T = 
-EGREP = /bin/grep -E
-EVENT_LIB = -levent
-EXEEXT = 
-F77 = 
-FFLAGS = 
-GREP = /bin/grep
-HAVE_SSL = yes
-IDN_LIB = 
-INSTALL = /usr/bin/install -c
-INSTALL_DATA = ${INSTALL} -m 644
-INSTALL_PROGRAM = ${INSTALL}
-INSTALL_SCRIPT = ${INSTALL}
-INSTALL_STRIP_PROGRAM = $(install_sh) -c -s
-LDFLAGS =   -fPIC -DPIC -L/usr/lib
-LEX = ${SHELL} /home/dany/srcprojects/myserver/myserver/missing --run flex
-LEXLIB = 
-LEX_OUTPUT_ROOT = 
-LIBOBJS = 
-LIBS = 
-LIBTOOL = $(SHELL) $(top_builddir)/libtool
-LN_S = ln -s
-LTLIBOBJS = 
-MAKEINFO = ${SHELL} /home/dany/srcprojects/myserver/myserver/missing --run makeinfo
-MKDIR_P = /bin/mkdir -p
-MYSERVER_VERSION = 0.9.0-rc2
-OBJEXT = o
-OPENSSL_LIB = -lssl -lcrypto
-PACKAGE = myserver
-PACKAGE_BUGREPORT = bug-myserver@gnu.org
-PACKAGE_NAME = GNU MyServer
-PACKAGE_STRING = 0.9.0-rc2
-PACKAGE_TARNAME = myserver
-PACKAGE_VERSION = 0.9.0-rc2
-PATH_SEPARATOR = :
-PTHREAD_LIB = -lpthread
-RANLIB = ranlib
-SET_MAKE = 
-SHELL = /bin/bash
-STRIP = strip
-VERSION = 0.9.0-rc2
-XML2_CONFIG = /usr/bin/xml2-config
-XML_CPPFLAGS = -I/usr/include/libxml2
-XML_LIBS = -lxml2
-XNET_LIB = 
-YACC = yacc
-YFLAGS = 
-ZLIB_LIB = -lz
-abs_builddir = /home/dany/srcprojects/myserver/myserver/include/protocol
-abs_srcdir = /home/dany/srcprojects/myserver/myserver/include/protocol
-abs_top_builddir = /home/dany/srcprojects/myserver/myserver
-abs_top_srcdir = /home/dany/srcprojects/myserver/myserver
-ac_ct_CC = gcc
-ac_ct_CXX = g++
-ac_ct_F77 = 
-am__include = include
-am__leading_dot = .
-am__quote = 
-am__tar = ${AMTAR} chof - "$$tardir"
-am__untar = ${AMTAR} xf -
-bindir = ${exec_prefix}/bin
-build = i686-pc-linux-gnu
-build_alias = 
-build_cpu = i686
-build_os = linux-gnu
-build_vendor = pc
-builddir = .
-datadir = ${datarootdir}
-datarootdir = ${prefix}/share
-docdir = ${datarootdir}/doc/${PACKAGE_TARNAME}
-dvidir = ${docdir}
-exec_prefix = ${prefix}
-host = i686-pc-linux-gnu
-host_alias = 
-host_cpu = i686
-host_os = linux-gnu
-host_vendor = pc
-htmldir = ${docdir}
-includedir = ${prefix}/include
-infodir = ${datarootdir}/info
-install_sh = $(SHELL) /home/dany/srcprojects/myserver/myserver/install-sh
-libdir = ${exec_prefix}/lib
-libexecdir = ${exec_prefix}/libexec
-localedir = ${datarootdir}/locale
-localstatedir = ${prefix}/var
-make_info = yes
-mandir = ${datarootdir}/man
-mkdir_p = /bin/mkdir -p
-oldincludedir = /usr/include
-pdfdir = ${docdir}
-prefix = /usr/local
-program_transform_name = s,x,x,
-psdir = ${docdir}
-root_bindir = ${root_prefix}/bin
-root_prefix = $(DESTDIR)
-root_sbindir = ${root_prefix}/sbin
-root_sysconfdir = ${root_prefix}/etc
-sbindir = ${exec_prefix}/sbin
-sharedstatedir = ${prefix}/com
-srcdir = .
-sysconfdir = ${prefix}/etc
-target = i686-pc-linux-gnu
-target_alias = 
-target_cpu = i686
-target_os = linux-gnu
-target_vendor = pc
-top_builddir = ../..
-top_srcdir = ../..
-protocolincludedir = $(includedir)/myserver/include/protocol
-protocolinclude_HEADERS = protocol_buffer.h protocol.h
-SUBDIRS = control ftp http https
-all: all-recursive
-
-.SUFFIXES:
-$(srcdir)/Makefile.in:  $(srcdir)/Makefile.am  $(am__configure_deps)
-	@for dep in $?; do \
-	  case '$(am__configure_deps)' in \
-	    *$$dep*) \
-	      cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
-		&& exit 0; \
-	      exit 1;; \
-	  esac; \
-	done; \
-	echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu  include/protocol/Makefile'; \
-	cd $(top_srcdir) && \
-	  $(AUTOMAKE) --gnu  include/protocol/Makefile
-.PRECIOUS: Makefile
-Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
-	@case '$?' in \
-	  *config.status*) \
-	    cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
-	  *) \
-	    echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
-	    cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
-	esac;
-
-$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
-	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
-
-$(top_srcdir)/configure:  $(am__configure_deps)
-	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
-$(ACLOCAL_M4):  $(am__aclocal_m4_deps)
-	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
-
-mostlyclean-libtool:
-	-rm -f *.lo
-
-clean-libtool:
-	-rm -rf .libs _libs
-install-protocolincludeHEADERS: $(protocolinclude_HEADERS)
-	@$(NORMAL_INSTALL)
-	test -z "$(protocolincludedir)" || $(MKDIR_P) "$(DESTDIR)$(protocolincludedir)"
-	@list='$(protocolinclude_HEADERS)'; for p in $$list; do \
-	  if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
-	  f=$(am__strip_dir) \
-	  echo " $(protocolincludeHEADERS_INSTALL) '$$d$$p' '$(DESTDIR)$(protocolincludedir)/$$f'"; \
-	  $(protocolincludeHEADERS_INSTALL) "$$d$$p" "$(DESTDIR)$(protocolincludedir)/$$f"; \
-	done
-
-uninstall-protocolincludeHEADERS:
-	@$(NORMAL_UNINSTALL)
-	@list='$(protocolinclude_HEADERS)'; for p in $$list; do \
-	  f=$(am__strip_dir) \
-	  echo " rm -f '$(DESTDIR)$(protocolincludedir)/$$f'"; \
-	  rm -f "$(DESTDIR)$(protocolincludedir)/$$f"; \
-	done
-
-# This directory's subdirectories are mostly independent; you can cd
-# into them and run `make' without going through this Makefile.
-# To change the values of `make' variables: instead of editing Makefiles,
-# (1) if the variable is set in `config.status', edit `config.status'
-#     (which will cause the Makefiles to be regenerated when you run `make');
-# (2) otherwise, pass the desired values on the `make' command line.
-$(RECURSIVE_TARGETS):
-	@failcom='exit 1'; \
-	for f in x $$MAKEFLAGS; do \
-	  case $$f in \
-	    *=* | --[!k]*);; \
-	    *k*) failcom='fail=yes';; \
-	  esac; \
-	done; \
-	dot_seen=no; \
-	target=`echo $@ | sed s/-recursive//`; \
-	list='$(SUBDIRS)'; for subdir in $$list; do \
-	  echo "Making $$target in $$subdir"; \
-	  if test "$$subdir" = "."; then \
-	    dot_seen=yes; \
-	    local_target="$$target-am"; \
-	  else \
-	    local_target="$$target"; \
-	  fi; \
-	  (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
-	  || eval $$failcom; \
-	done; \
-	if test "$$dot_seen" = "no"; then \
-	  $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
-	fi; test -z "$$fail"
-
-$(RECURSIVE_CLEAN_TARGETS):
-	@failcom='exit 1'; \
-	for f in x $$MAKEFLAGS; do \
-	  case $$f in \
-	    *=* | --[!k]*);; \
-	    *k*) failcom='fail=yes';; \
-	  esac; \
-	done; \
-	dot_seen=no; \
-	case "$@" in \
-	  distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
-	  *) list='$(SUBDIRS)' ;; \
-	esac; \
-	rev=''; for subdir in $$list; do \
-	  if test "$$subdir" = "."; then :; else \
-	    rev="$$subdir $$rev"; \
-	  fi; \
-	done; \
-	rev="$$rev ."; \
-	target=`echo $@ | sed s/-recursive//`; \
-	for subdir in $$rev; do \
-	  echo "Making $$target in $$subdir"; \
-	  if test "$$subdir" = "."; then \
-	    local_target="$$target-am"; \
-	  else \
-	    local_target="$$target"; \
-	  fi; \
-	  (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
-	  || eval $$failcom; \
-	done && test -z "$$fail"
-tags-recursive:
-	list='$(SUBDIRS)'; for subdir in $$list; do \
-	  test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
-	done
-ctags-recursive:
-	list='$(SUBDIRS)'; for subdir in $$list; do \
-	  test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
-	done
-
-ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
-	list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
-	unique=`for i in $$list; do \
-	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
-	  done | \
-	  $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \
-	      END { if (nonempty) { for (i in files) print i; }; }'`; \
-	mkid -fID $$unique
-tags: TAGS
-
-TAGS: tags-recursive $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
-		$(TAGS_FILES) $(LISP)
-	tags=; \
-	here=`pwd`; \
-	if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
-	  include_option=--etags-include; \
-	  empty_fix=.; \
-	else \
-	  include_option=--include; \
-	  empty_fix=; \
-	fi; \
-	list='$(SUBDIRS)'; for subdir in $$list; do \
-	  if test "$$subdir" = .; then :; else \
-	    test ! -f $$subdir/TAGS || \
-	      tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \
-	  fi; \
-	done; \
-	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
-	unique=`for i in $$list; do \
-	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
-	  done | \
-	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
-	      END { if (nonempty) { for (i in files) print i; }; }'`; \
-	if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
-	  test -n "$$unique" || unique=$$empty_fix; \
-	  $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
-	    $$tags $$unique; \
-	fi
-ctags: CTAGS
-CTAGS: ctags-recursive $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
-		$(TAGS_FILES) $(LISP)
-	tags=; \
-	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
-	unique=`for i in $$list; do \
-	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
-	  done | \
-	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
-	      END { if (nonempty) { for (i in files) print i; }; }'`; \
-	test -z "$(CTAGS_ARGS)$$tags$$unique" \
-	  || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
-	     $$tags $$unique
-
-GTAGS:
-	here=`$(am__cd) $(top_builddir) && pwd` \
-	  && cd $(top_srcdir) \
-	  && gtags -i $(GTAGS_ARGS) $$here
-
-distclean-tags:
-	-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
-
-distdir: $(DISTFILES)
-	@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
-	topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
-	list='$(DISTFILES)'; \
-	  dist_files=`for file in $$list; do echo $$file; done | \
-	  sed -e "s|^$$srcdirstrip/||;t" \
-	      -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
-	case $$dist_files in \
-	  */*) $(MKDIR_P) `echo "$$dist_files" | \
-			   sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
-			   sort -u` ;; \
-	esac; \
-	for file in $$dist_files; do \
-	  if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
-	  if test -d $$d/$$file; then \
-	    dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
-	    if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
-	      cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
-	    fi; \
-	    cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
-	  else \
-	    test -f $(distdir)/$$file \
-	    || cp -p $$d/$$file $(distdir)/$$file \
-	    || exit 1; \
-	  fi; \
-	done
-	list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
-	  if test "$$subdir" = .; then :; else \
-	    test -d "$(distdir)/$$subdir" \
-	    || $(MKDIR_P) "$(distdir)/$$subdir" \
-	    || exit 1; \
-	    distdir=`$(am__cd) $(distdir) && pwd`; \
-	    top_distdir=`$(am__cd) $(top_distdir) && pwd`; \
-	    (cd $$subdir && \
-	      $(MAKE) $(AM_MAKEFLAGS) \
-	        top_distdir="$$top_distdir" \
-	        distdir="$$distdir/$$subdir" \
-		am__remove_distdir=: \
-		am__skip_length_check=: \
-	        distdir) \
-	      || exit 1; \
-	  fi; \
-	done
-check-am: all-am
-check: check-recursive
-all-am: Makefile $(HEADERS)
-installdirs: installdirs-recursive
-installdirs-am:
-	for dir in "$(DESTDIR)$(protocolincludedir)"; do \
-	  test -z "$$dir" || $(MKDIR_P) "$$dir"; \
-	done
-install: install-recursive
-install-exec: install-exec-recursive
-install-data: install-data-recursive
-uninstall: uninstall-recursive
-
-install-am: all-am
-	@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
-
-installcheck: installcheck-recursive
-install-strip:
-	$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
-	  install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
-	  `test -z '$(STRIP)' || \
-	    echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
-mostlyclean-generic:
-
-clean-generic:
-
-distclean-generic:
-	-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
-
-maintainer-clean-generic:
-	@echo "This command is intended for maintainers to use"
-	@echo "it deletes files that may require special tools to rebuild."
-clean: clean-recursive
-
-clean-am: clean-generic clean-libtool mostlyclean-am
-
-distclean: distclean-recursive
-	-rm -f Makefile
-distclean-am: clean-am distclean-generic distclean-tags
-
-dvi: dvi-recursive
-
-dvi-am:
-
-html: html-recursive
-
-info: info-recursive
-
-info-am:
-
-install-data-am: install-protocolincludeHEADERS
-
-install-dvi: install-dvi-recursive
-
-install-exec-am:
-
-install-html: install-html-recursive
-
-install-info: install-info-recursive
-
-install-man:
-
-install-pdf: install-pdf-recursive
-
-install-ps: install-ps-recursive
-
-installcheck-am:
-
-maintainer-clean: maintainer-clean-recursive
-	-rm -f Makefile
-maintainer-clean-am: distclean-am maintainer-clean-generic
-
-mostlyclean: mostlyclean-recursive
-
-mostlyclean-am: mostlyclean-generic mostlyclean-libtool
-
-pdf: pdf-recursive
-
-pdf-am:
-
-ps: ps-recursive
-
-ps-am:
-
-uninstall-am: uninstall-protocolincludeHEADERS
-
-.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) install-am \
-	install-strip
-
-.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \
-	all all-am check check-am clean clean-generic clean-libtool \
-	ctags ctags-recursive distclean distclean-generic \
-	distclean-libtool distclean-tags distdir dvi dvi-am html \
-	html-am info info-am install install-am install-data \
-	install-data-am install-dvi install-dvi-am install-exec \
-	install-exec-am install-html install-html-am install-info \
-	install-info-am install-man install-pdf install-pdf-am \
-	install-protocolincludeHEADERS install-ps install-ps-am \
-	install-strip installcheck installcheck-am installdirs \
-	installdirs-am maintainer-clean maintainer-clean-generic \
-	mostlyclean mostlyclean-generic mostlyclean-libtool pdf pdf-am \
-	ps ps-am tags tags-recursive uninstall uninstall-am \
-	uninstall-protocolincludeHEADERS
-
-# Tell versions [3.59,3.63) of GNU make to not export all variables.
-# Otherwise a system limit (for SysV at least) may be exceeded.
-.NOEXPORT:

Deleted: trunk/myserver/include/protocol/Makefile.in
===================================================================
--- trunk/myserver/include/protocol/Makefile.in	2008-10-26 15:49:14 UTC (rev 2911)
+++ trunk/myserver/include/protocol/Makefile.in	2008-10-26 15:53:39 UTC (rev 2912)
@@ -1,547 +0,0 @@
-# Makefile.in generated by automake 1.10.1 from Makefile.am.
-# @configure_input@
-
-# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006, 2007, 2008  Free Software Foundation, Inc.
-# This Makefile.in is free software; the Free Software Foundation
-# gives unlimited permission to copy and/or distribute it,
-# with or without modifications, as long as this notice is preserved.
-
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
-# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
-# PARTICULAR PURPOSE.
-
-@SET_MAKE@
-
-VPATH = @srcdir@
-pkgdatadir = $(datadir)/@PACKAGE@
-pkglibdir = $(libdir)/@PACKAGE@
-pkgincludedir = $(includedir)/@PACKAGE@
-am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
-install_sh_DATA = $(install_sh) -c -m 644
-install_sh_PROGRAM = $(install_sh) -c
-install_sh_SCRIPT = $(install_sh) -c
-INSTALL_HEADER = $(INSTALL_DATA)
-transform = $(program_transform_name)
-NORMAL_INSTALL = :
-PRE_INSTALL = :
-POST_INSTALL = :
-NORMAL_UNINSTALL = :
-PRE_UNINSTALL = :
-POST_UNINSTALL = :
-build_triplet = @build@
-host_triplet = @host@
-target_triplet = @target@
-subdir = include/protocol
-DIST_COMMON = $(protocolinclude_HEADERS) $(srcdir)/Makefile.am \
-	$(srcdir)/Makefile.in
-ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/m4/cppunit.m4 \
-	$(top_srcdir)/m4/gnome-pthread-check.m4 \
-	$(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/libxml.m4 \
-	$(top_srcdir)/configure.in
-am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
-	$(ACLOCAL_M4)
-mkinstalldirs = $(install_sh) -d
-CONFIG_HEADER = $(top_builddir)/config.h
-CONFIG_CLEAN_FILES =
-SOURCES =
-DIST_SOURCES =
-RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
-	html-recursive info-recursive install-data-recursive \
-	install-dvi-recursive install-exec-recursive \
-	install-html-recursive install-info-recursive \
-	install-pdf-recursive install-ps-recursive install-recursive \
-	installcheck-recursive installdirs-recursive pdf-recursive \
-	ps-recursive uninstall-recursive
-am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
-am__vpath_adj = case $$p in \
-    $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
-    *) f=$$p;; \
-  esac;
-am__strip_dir = `echo $$p | sed -e 's|^.*/||'`;
-am__installdirs = "$(DESTDIR)$(protocolincludedir)"
-protocolincludeHEADERS_INSTALL = $(INSTALL_HEADER)
-HEADERS = $(protocolinclude_HEADERS)
-RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive	\
-  distclean-recursive maintainer-clean-recursive
-ETAGS = etags
-CTAGS = ctags
-DIST_SUBDIRS = $(SUBDIRS)
-DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
-ACLOCAL = @ACLOCAL@
-AMTAR = @AMTAR@
-AR = @AR@
-AUTOCONF = @AUTOCONF@
-AUTOHEADER = @AUTOHEADER@
-AUTOMAKE = @AUTOMAKE@
-AWK = @AWK@
-CC = @CC@
-CCDEPMODE = @CCDEPMODE@
-CFLAGS = @CFLAGS@
-CPP = @CPP@
-CPPFLAGS = @CPPFLAGS@
-CPPUNIT_CFLAGS = @CPPUNIT_CFLAGS@
-CPPUNIT_CONFIG = @CPPUNIT_CONFIG@
-CPPUNIT_LDFLAGS = @CPPUNIT_LDFLAGS@
-CPPUNIT_LIBS = @CPPUNIT_LIBS@
-CXFLAGS = @CXFLAGS@
-CXX = @CXX@
-CXXCPP = @CXXCPP@
-CXXDEPMODE = @CXXDEPMODE@
-CXXFLAGS = @CXXFLAGS@
-CYGPATH_W = @CYGPATH_W@
-DEFS = @DEFS@
-DEPDIR = @DEPDIR@
-DL_LIB = @DL_LIB@
-ECHO = @ECHO@
-ECHO_C = @ECHO_C@
-ECHO_N = @ECHO_N@
-ECHO_T = @ECHO_T@
-EGREP = @EGREP@
-EVENT_LIB = @EVENT_LIB@
-EXEEXT = @EXEEXT@
-F77 = @F77@
-FFLAGS = @FFLAGS@
-GREP = @GREP@
-HAVE_SSL = @HAVE_SSL@
-IDN_LIB = @IDN_LIB@
-INSTALL = @INSTALL@
-INSTALL_DATA = @INSTALL_DATA@
-INSTALL_PROGRAM = @INSTALL_PROGRAM@
-INSTALL_SCRIPT = @INSTALL_SCRIPT@
-INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
-LDFLAGS = @LDFLAGS@
-LEX = @LEX@
-LEXLIB = @LEXLIB@
-LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@
-LIBOBJS = @LIBOBJS@
-LIBS = @LIBS@
-LIBTOOL = @LIBTOOL@
-LN_S = @LN_S@
-LTLIBOBJS = @LTLIBOBJS@
-MAKEINFO = @MAKEINFO@
-MKDIR_P = @MKDIR_P@
-MYSERVER_VERSION = @MYSERVER_VERSION@
-OBJEXT = @OBJEXT@
-OPENSSL_LIB = @OPENSSL_LIB@
-PACKAGE = @PACKAGE@
-PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
-PACKAGE_NAME = @PACKAGE_NAME@
-PACKAGE_STRING = @PACKAGE_STRING@
-PACKAGE_TARNAME = @PACKAGE_TARNAME@
-PACKAGE_VERSION = @PACKAGE_VERSION@
-PATH_SEPARATOR = @PATH_SEPARATOR@
-PTHREAD_LIB = @PTHREAD_LIB@
-RANLIB = @RANLIB@
-SET_MAKE = @SET_MAKE@
-SHELL = @SHELL@
-STRIP = @STRIP@
-VERSION = @VERSION@
-XML2_CONFIG = @XML2_CONFIG@
-XML_CPPFLAGS = @XML_CPPFLAGS@
-XML_LIBS = @XML_LIBS@
-XNET_LIB = @XNET_LIB@
-YACC = @YACC@
-YFLAGS = @YFLAGS@
-ZLIB_LIB = @ZLIB_LIB@
-abs_builddir = @abs_builddir@
-abs_srcdir = @abs_srcdir@
-abs_top_builddir = @abs_top_builddir@
-abs_top_srcdir = @abs_top_srcdir@
-ac_ct_CC = @ac_ct_CC@
-ac_ct_CXX = @ac_ct_CXX@
-ac_ct_F77 = @ac_ct_F77@
-am__include = @am__include@
-am__leading_dot = @am__leading_dot@
-am__quote = @am__quote@
-am__tar = @am__tar@
-am__untar = @am__untar@
-bindir = @bindir@
-build = @build@
-build_alias = @build_alias@
-build_cpu = @build_cpu@
-build_os = @build_os@
-build_vendor = @build_vendor@
-builddir = @builddir@
-datadir = @datadir@
-datarootdir = @datarootdir@
-docdir = @docdir@
-dvidir = @dvidir@
-exec_prefix = @exec_prefix@
-host = @host@
-host_alias = @host_alias@
-host_cpu = @host_cpu@
-host_os = @host_os@
-host_vendor = @host_vendor@
-htmldir = @htmldir@
-includedir = @includedir@
-infodir = @infodir@
-install_sh = @install_sh@
-libdir = @libdir@
-libexecdir = @libexecdir@
-localedir = @localedir@
-localstatedir = @localstatedir@
-make_info = @make_info@
-mandir = @mandir@
-mkdir_p = @mkdir_p@
-oldincludedir = @oldincludedir@
-pdfdir = @pdfdir@
-prefix = @prefix@
-program_transform_name = @program_transform_name@
-psdir = @psdir@
-root_bindir = @root_bindir@
-root_prefix = @root_prefix@
-root_sbindir = @root_sbindir@
-root_sysconfdir = @root_sysconfdir@
-sbindir = @sbindir@
-sharedstatedir = @sharedstatedir@
-srcdir = @srcdir@
-sysconfdir = @sysconfdir@
-target = @target@
-target_alias = @target_alias@
-target_cpu = @target_cpu@
-target_os = @target_os@
-target_vendor = @target_vendor@
-top_builddir = @top_builddir@
-top_srcdir = @top_srcdir@
-protocolincludedir = $(includedir)/myserver/include/protocol
-protocolinclude_HEADERS = protocol_buffer.h protocol.h
-SUBDIRS = control ftp http https
-all: all-recursive
-
-.SUFFIXES:
-$(srcdir)/Makefile.in:  $(srcdir)/Makefile.am  $(am__configure_deps)
-	@for dep in $?; do \
-	  case '$(am__configure_deps)' in \
-	    *$$dep*) \
-	      cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
-		&& exit 0; \
-	      exit 1;; \
-	  esac; \
-	done; \
-	echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu  include/protocol/Makefile'; \
-	cd $(top_srcdir) && \
-	  $(AUTOMAKE) --gnu  include/protocol/Makefile
-.PRECIOUS: Makefile
-Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
-	@case '$?' in \
-	  *config.status*) \
-	    cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
-	  *) \
-	    echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
-	    cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
-	esac;
-
-$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
-	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
-
-$(top_srcdir)/configure:  $(am__configure_deps)
-	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
-$(ACLOCAL_M4):  $(am__aclocal_m4_deps)
-	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
-
-mostlyclean-libtool:
-	-rm -f *.lo
-
-clean-libtool:
-	-rm -rf .libs _libs
-install-protocolincludeHEADERS: $(protocolinclude_HEADERS)
-	@$(NORMAL_INSTALL)
-	test -z "$(protocolincludedir)" || $(MKDIR_P) "$(DESTDIR)$(protocolincludedir)"
-	@list='$(protocolinclude_HEADERS)'; for p in $$list; do \
-	  if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
-	  f=$(am__strip_dir) \
-	  echo " $(protocolincludeHEADERS_INSTALL) '$$d$$p' '$(DESTDIR)$(protocolincludedir)/$$f'"; \
-	  $(protocolincludeHEADERS_INSTALL) "$$d$$p" "$(DESTDIR)$(protocolincludedir)/$$f"; \
-	done
-
-uninstall-protocolincludeHEADERS:
-	@$(NORMAL_UNINSTALL)
-	@list='$(protocolinclude_HEADERS)'; for p in $$list; do \
-	  f=$(am__strip_dir) \
-	  echo " rm -f '$(DESTDIR)$(protocolincludedir)/$$f'"; \
-	  rm -f "$(DESTDIR)$(protocolincludedir)/$$f"; \
-	done
-
-# This directory's subdirectories are mostly independent; you can cd
-# into them and run `make' without going through this Makefile.
-# To change the values of `make' variables: instead of editing Makefiles,
-# (1) if the variable is set in `config.status', edit `config.status'
-#     (which will cause the Makefiles to be regenerated when you run `make');
-# (2) otherwise, pass the desired values on the `make' command line.
-$(RECURSIVE_TARGETS):
-	@failcom='exit 1'; \
-	for f in x $$MAKEFLAGS; do \
-	  case $$f in \
-	    *=* | --[!k]*);; \
-	    *k*) failcom='fail=yes';; \
-	  esac; \
-	done; \
-	dot_seen=no; \
-	target=`echo $@ | sed s/-recursive//`; \
-	list='$(SUBDIRS)'; for subdir in $$list; do \
-	  echo "Making $$target in $$subdir"; \
-	  if test "$$subdir" = "."; then \
-	    dot_seen=yes; \
-	    local_target="$$target-am"; \
-	  else \
-	    local_target="$$target"; \
-	  fi; \
-	  (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
-	  || eval $$failcom; \
-	done; \
-	if test "$$dot_seen" = "no"; then \
-	  $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
-	fi; test -z "$$fail"
-
-$(RECURSIVE_CLEAN_TARGETS):
-	@failcom='exit 1'; \
-	for f in x $$MAKEFLAGS; do \
-	  case $$f in \
-	    *=* | --[!k]*);; \
-	    *k*) failcom='fail=yes';; \
-	  esac; \
-	done; \
-	dot_seen=no; \
-	case "$@" in \
-	  distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
-	  *) list='$(SUBDIRS)' ;; \
-	esac; \
-	rev=''; for subdir in $$list; do \
-	  if test "$$subdir" = "."; then :; else \
-	    rev="$$subdir $$rev"; \
-	  fi; \
-	done; \
-	rev="$$rev ."; \
-	target=`echo $@ | sed s/-recursive//`; \
-	for subdir in $$rev; do \
-	  echo "Making $$target in $$subdir"; \
-	  if test "$$subdir" = "."; then \
-	    local_target="$$target-am"; \
-	  else \
-	    local_target="$$target"; \
-	  fi; \
-	  (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
-	  || eval $$failcom; \
-	done && test -z "$$fail"
-tags-recursive:
-	list='$(SUBDIRS)'; for subdir in $$list; do \
-	  test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
-	done
-ctags-recursive:
-	list='$(SUBDIRS)'; for subdir in $$list; do \
-	  test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
-	done
-
-ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
-	list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
-	unique=`for i in $$list; do \
-	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
-	  done | \
-	  $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \
-	      END { if (nonempty) { for (i in files) print i; }; }'`; \
-	mkid -fID $$unique
-tags: TAGS
-
-TAGS: tags-recursive $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
-		$(TAGS_FILES) $(LISP)
-	tags=; \
-	here=`pwd`; \
-	if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
-	  include_option=--etags-include; \
-	  empty_fix=.; \
-	else \
-	  include_option=--include; \
-	  empty_fix=; \
-	fi; \
-	list='$(SUBDIRS)'; for subdir in $$list; do \
-	  if test "$$subdir" = .; then :; else \
-	    test ! -f $$subdir/TAGS || \
-	      tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \
-	  fi; \
-	done; \
-	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
-	unique=`for i in $$list; do \
-	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
-	  done | \
-	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
-	      END { if (nonempty) { for (i in files) print i; }; }'`; \
-	if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
-	  test -n "$$unique" || unique=$$empty_fix; \
-	  $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
-	    $$tags $$unique; \
-	fi
-ctags: CTAGS
-CTAGS: ctags-recursive $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
-		$(TAGS_FILES) $(LISP)
-	tags=; \
-	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
-	unique=`for i in $$list; do \
-	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
-	  done | \
-	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
-	      END { if (nonempty) { for (i in files) print i; }; }'`; \
-	test -z "$(CTAGS_ARGS)$$tags$$unique" \
-	  || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
-	     $$tags $$unique
-
-GTAGS:
-	here=`$(am__cd) $(top_builddir) && pwd` \
-	  && cd $(top_srcdir) \
-	  && gtags -i $(GTAGS_ARGS) $$here
-
-distclean-tags:
-	-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
-
-distdir: $(DISTFILES)
-	@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
-	topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
-	list='$(DISTFILES)'; \
-	  dist_files=`for file in $$list; do echo $$file; done | \
-	  sed -e "s|^$$srcdirstrip/||;t" \
-	      -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
-	case $$dist_files in \
-	  */*) $(MKDIR_P) `echo "$$dist_files" | \
-			   sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
-			   sort -u` ;; \
-	esac; \
-	for file in $$dist_files; do \
-	  if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
-	  if test -d $$d/$$file; then \
-	    dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
-	    if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
-	      cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
-	    fi; \
-	    cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
-	  else \
-	    test -f $(distdir)/$$file \
-	    || cp -p $$d/$$file $(distdir)/$$file \
-	    || exit 1; \
-	  fi; \
-	done
-	list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
-	  if test "$$subdir" = .; then :; else \
-	    test -d "$(distdir)/$$subdir" \
-	    || $(MKDIR_P) "$(distdir)/$$subdir" \
-	    || exit 1; \
-	    distdir=`$(am__cd) $(distdir) && pwd`; \
-	    top_distdir=`$(am__cd) $(top_distdir) && pwd`; \
-	    (cd $$subdir && \
-	      $(MAKE) $(AM_MAKEFLAGS) \
-	        top_distdir="$$top_distdir" \
-	        distdir="$$distdir/$$subdir" \
-		am__remove_distdir=: \
-		am__skip_length_check=: \
-	        distdir) \
-	      || exit 1; \
-	  fi; \
-	done
-check-am: all-am
-check: check-recursive
-all-am: Makefile $(HEADERS)
-installdirs: installdirs-recursive
-installdirs-am:
-	for dir in "$(DESTDIR)$(protocolincludedir)"; do \
-	  test -z "$$dir" || $(MKDIR_P) "$$dir"; \
-	done
-install: install-recursive
-install-exec: install-exec-recursive
-install-data: install-data-recursive
-uninstall: uninstall-recursive
-
-install-am: all-am
-	@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
-
-installcheck: installcheck-recursive
-install-strip:
-	$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
-	  install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
-	  `test -z '$(STRIP)' || \
-	    echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
-mostlyclean-generic:
-
-clean-generic:
-
-distclean-generic:
-	-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
-
-maintainer-clean-generic:
-	@echo "This command is intended for maintainers to use"
-	@echo "it deletes files that may require special tools to rebuild."
-clean: clean-recursive
-
-clean-am: clean-generic clean-libtool mostlyclean-am
-
-distclean: distclean-recursive
-	-rm -f Makefile
-distclean-am: clean-am distclean-generic distclean-tags
-
-dvi: dvi-recursive
-
-dvi-am:
-
-html: html-recursive
-
-info: info-recursive
-
-info-am:
-
-install-data-am: install-protocolincludeHEADERS
-
-install-dvi: install-dvi-recursive
-
-install-exec-am:
-
-install-html: install-html-recursive
-
-install-info: install-info-recursive
-
-install-man:
-
-install-pdf: install-pdf-recursive
-
-install-ps: install-ps-recursive
-
-installcheck-am:
-
-maintainer-clean: maintainer-clean-recursive
-	-rm -f Makefile
-maintainer-clean-am: distclean-am maintainer-clean-generic
-
-mostlyclean: mostlyclean-recursive
-
-mostlyclean-am: mostlyclean-generic mostlyclean-libtool
-
-pdf: pdf-recursive
-
-pdf-am:
-
-ps: ps-recursive
-
-ps-am:
-
-uninstall-am: uninstall-protocolincludeHEADERS
-
-.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) install-am \
-	install-strip
-
-.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \
-	all all-am check check-am clean clean-generic clean-libtool \
-	ctags ctags-recursive distclean distclean-generic \
-	distclean-libtool distclean-tags distdir dvi dvi-am html \
-	html-am info info-am install install-am install-data \
-	install-data-am install-dvi install-dvi-am install-exec \
-	install-exec-am install-html install-html-am install-info \
-	install-info-am install-man install-pdf install-pdf-am \
-	install-protocolincludeHEADERS install-ps install-ps-am \
-	install-strip installcheck installcheck-am installdirs \
-	installdirs-am maintainer-clean maintainer-clean-generic \
-	mostlyclean mostlyclean-generic mostlyclean-libtool pdf pdf-am \
-	ps ps-am tags tags-recursive uninstall uninstall-am \
-	uninstall-protocolincludeHEADERS
-
-# Tell versions [3.59,3.63) of GNU make to not export all variables.
-# Otherwise a system limit (for SysV at least) may be exceeded.
-.NOEXPORT:





From MAILER-DAEMON Sun Oct 26 15:37:44 2008
Received: from mailman by lists.gnu.org with archive (Exim 4.43)
	id 1KuBQm-0000EJ-EO
	for mharc-myserver-commit@gnu.org; Sun, 26 Oct 2008 15:37:44 -0400
Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43)
	id 1KuBQj-0000Dx-9O
	for myserver-commit@gnu.org; Sun, 26 Oct 2008 15:37:41 -0400
Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43)
	id 1KuBQi-0000Dl-6l
	for myserver-commit@gnu.org; Sun, 26 Oct 2008 15:37:40 -0400
Received: from [199.232.76.173] (port=51253 helo=monty-python.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.43) id 1KuBQi-0000Di-0T
	for myserver-commit@gnu.org; Sun, 26 Oct 2008 15:37:40 -0400
Received: from savannah.gnu.org ([199.232.41.3]:34074 helo=sv.gnu.org)
	by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32)
	(Exim 4.60) (envelope-from <INVALID.NOREPLY@gnu.org>)
	id 1KuBQh-0002SF-F6
	for myserver-commit@gnu.org; Sun, 26 Oct 2008 15:37:39 -0400
Received: from cvs.savannah.gnu.org ([199.232.41.69])
	by sv.gnu.org with esmtp (Exim 4.63)
	(envelope-from <INVALID.NOREPLY@gnu.org>) id 1KuBQg-0000XJ-Rl
	for myserver-commit@gnu.org; Sun, 26 Oct 2008 19:37:38 +0000
Received: from dperrone by cvs.savannah.gnu.org with local (Exim 4.63)
	(envelope-from <dperrone@savannah.gnu.org>) id 1KuBQg-0000XE-FA
	for myserver-commit@gnu.org; Sun, 26 Oct 2008 19:37:38 +0000
MIME-Version: 1.0
Errors-To: dperrone
To: myserver-commit@gnu.org
X-Mailer: SVN::Notify 2.64: http://search.cpan.org/dist/SVN-Notify/
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
From: Daniele Perrone <dperrone@it.gnu.org>
Message-Id: <E1KuBQg-0000XE-FA@cvs.savannah.gnu.org>
Date: Sun, 26 Oct 2008 19:37:38 +0000
X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 3)
Subject: [myserver-commit] [2913] Refactored plugin tree
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/pipermail/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, 26 Oct 2008 19:37:41 -0000

Revision: 2913
          http://svn.sv.gnu.org/viewvc/?view=rev&root=myserver&revision=2913
Author:   dperrone
Date:     2008-10-26 19:37:37 +0000 (Sun, 26 Oct 2008)

Log Message:
-----------
Refactored plugin tree

Modified Paths:
--------------
    trunk/plugins/src/http_checker/SConscript
    trunk/plugins/src/http_checker/http_checker.cpp
    trunk/plugins/src/http_checker/plugin.xml
    trunk/plugins/src/php/SConscript
    trunk/plugins/src/php/php.cpp
    trunk/plugins/src/php/php.h
    trunk/plugins/src/php/plugin.xml
    trunk/plugins/src/python_http_handler/SConscript
    trunk/plugins/src/python_http_handler/plugin.xml
    trunk/plugins/src/python_http_handler/python_http_handler.cpp
    trunk/plugins/src/rules_checker/SConscript
    trunk/plugins/src/rules_checker/plugin.xml
    trunk/plugins/src/rules_checker/rules_checker.cpp

Added Paths:
-----------
    trunk/plugins/SConstruct
    trunk/plugins/bin/
    trunk/plugins/pub/
    trunk/plugins/src/
    trunk/plugins/src/http_checker/
    trunk/plugins/src/php/
    trunk/plugins/src/python/
    trunk/plugins/src/python/SConscript
    trunk/plugins/src/python/plugin.xml
    trunk/plugins/src/python/python.cpp
    trunk/plugins/src/python/python.h
    trunk/plugins/src/python_http_handler/
    trunk/plugins/src/python_http_handler/config.h
    trunk/plugins/src/rules_checker/
    trunk/plugins/src/rules_checker/string_alloc.os

Removed Paths:
-------------
    trunk/plugins/executors/
    trunk/plugins/generics/
    trunk/plugins/http_managers/

Added: trunk/plugins/SConstruct
===================================================================
--- trunk/plugins/SConstruct	                        (rev 0)
+++ trunk/plugins/SConstruct	2008-10-26 19:37:37 UTC (rev 2913)
@@ -0,0 +1,127 @@
+#-*- mode: python -*-
+# MySever plugins configuration script for scons.
+#
+# MyServer
+# http://www.gnu.org/software/myserver/
+#
+# Copyright (C) 2002-2008 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
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+import os
+import glob
+
+import xml.dom.minidom
+from xml.dom.minidom import Node
+
+import string
+
+def print_help():
+    print "usage: scons [package|release] plugin=<plugin1>,<plugin2>,...,<pluginN>"
+
+src_dir = "src/"
+bin_dir = "bin/"
+release_dir = "pub/"
+
+plugin = ARGUMENTS.get('plugin', "")
+command = ARGUMENTS.get('command', "build")
+
+
+if plugin=="":
+    print_help()
+    Exit(1)
+
+plugins = plugin.split(",");
+
+
+msheaders = ARGUMENTS.get('msheaders', "")
+
+listinc=[
+      '/usr/local/include',
+      '/usr/include',
+      '/usr/local/include/libxml2',
+      '/usr/include/libxml2',
+      msheaders,
+      '.'
+      ]
+
+def build_plugin(name):
+    dest_dir = bin_dir + name
+    SConscript([src_dir + name + "/SConscript"],['dest_dir','listinc'])
+    Command(dest_dir + "/plugin.xml",src_dir + name + "/plugin.xml", Copy("$TARGET", "$SOURCE"))
+    
+def build_plugins(plugins):
+	for name in plugins:
+		build_plugin(name)
+		
+
+def pack_plugin(name):
+    doc = xml.dom.minidom.parse(bin_dir + name + "/plugin.xml")
+    version = doc.getElementsByTagName("VERSION")
+    filename = name + "-" + version[0].firstChild.data + ".tar.gz"
+    tarenv = Environment(TARFLAGS = '-c -z')
+    tarenv.Tar(release_dir + filename, bin_dir + name)	
+
+
+
+def pack_plugins(plugins):
+	for name in plugins:
+		pack_plugin(name)
+
+
+build = True
+package = False
+release = False
+
+  
+
+if command=='package':
+	build = False
+	package = True
+	
+if command=='release':
+	package = True
+	release = True
+
+
+env = Environment(CPPPATH=listinc,CXXFLAGS="-fPIC -DPIC  -DHAVE_CONFIG_H",
+                      LINKFLAGS="-rdynamic")
+
+conf = Configure(env, config_h="config.h")
+
+
+if not conf.CheckCXXHeader("include/server/server.h"):
+    print "unable to find myserver headers"
+    Exit(1)
+
+
+env = conf.Finish()
+
+if build:
+	build_plugins(plugins)
+
+if package:
+	pack_plugins(plugins)
+
+#TODO: test compile and run.
+#if command == "build":
+#    testsFiles = glob.glob('tests/*.cpp') + files
+#    testsFiles.remove('src/myserver.cpp')
+#    testsFiles.sort()
+#    t = env.Program('tests/tests_suite', testsFiles)
+
+#if command == "tests":
+#    AddPostAction('tests/tests_suite', env.Execute('tests/tests_suite'))
+
+
+

Copied: trunk/plugins/src/http_checker (from rev 2900, trunk/plugins/generics/http_checker)


Property changes on: trunk/plugins/src/http_checker
___________________________________________________________________
Name: svn:mergeinfo
   + 

Modified: trunk/plugins/src/http_checker/SConscript
===================================================================
--- trunk/plugins/generics/http_checker/SConscript	2008-10-23 20:50:14 UTC (rev 2900)
+++ trunk/plugins/src/http_checker/SConscript	2008-10-26 19:37:37 UTC (rev 2913)
@@ -1,6 +1,7 @@
 #-*- mode: python -*-
+Import('dest_dir','listinc')
 
-listinc=[
+local_listinc=[
       GetLaunchDir(),
       '../../../',
       '/usr/local/include',
@@ -12,8 +13,10 @@
       '.'
       ]
 
-env = Environment(CPPPATH=listinc)
+local_listinc.extend(listinc)
 
+env = Environment(CPPPATH=local_listinc)
+
 conf = Configure(env, config_h="config.h")
 
 if conf.CheckHeader("Python.h"):
@@ -21,4 +24,7 @@
 
 env = conf.Finish()
 
-env.SharedLibrary(GetLaunchDir() + "/binaries/plugins/generics/http_checker", ["http_checker.cpp" ], SHLIBPREFIX="")
+env.SharedLibrary(GetLaunchDir() + "/" + dest_dir + "/http_checker", ["http_checker.cpp" ], SHLIBPREFIX="")
+
+Command(GetLaunchDir() + "/" + dest_dir + "/README","README", Copy("$TARGET", "$SOURCE"))
+Command(GetLaunchDir() + "/" + dest_dir + "/http_rules_sample.py","http_rules_sample.py", Copy("$TARGET", "$SOURCE"))

Modified: trunk/plugins/src/http_checker/http_checker.cpp
===================================================================
--- trunk/plugins/generics/http_checker/http_checker.cpp	2008-10-23 20:50:14 UTC (rev 2900)
+++ trunk/plugins/src/http_checker/http_checker.cpp	2008-10-26 19:37:37 UTC (rev 2913)
@@ -17,9 +17,9 @@
 #include <stdafx.h>
 #include <string.h>
 #include <include/server/server.h>
-#include <include/multicast/multicast.h>
+#include <include/base/multicast/multicast.h>
 #include <include/protocol/http/http.h>
-#include <include/plugin/executor/dynamic_executor.h>
+#include <include/plugin/plugin.h>
 #include <Python.h>
 
 #ifdef WIN32
@@ -28,6 +28,10 @@
 #define EXPORTABLE(x) extern "C" x
 #endif
 
+typedef int (*executePROC)(char*, u_long);
+typedef int (*executeFromFilePROC)(char*);
+
+
 struct ThreadData
 {
 	HttpThreadContext* td;
@@ -182,10 +186,18 @@
 
 		for(it = rules.begin(); it != rules.end(); it++)
 		{
-			if((*it).file)
-				python->executeFromFile((char*)(*it).data.c_str());
-			else
-				python->execute((char*)(*it).data.c_str(), (*it).data.length());
+			if((*it).file) 
+			{
+				executeFromFilePROC execute = ((executeFromFilePROC)python->getDirectMethod((char*)"executeFromFile"));
+				if (execute)
+				  execute((char*)(*it).data.c_str());
+			}else
+			{
+				executePROC execute = ((executePROC)python->getDirectMethod((char*)"execute"));
+				
+				if (execute)
+				  execute((char*)(*it).data.c_str(), (*it).data.length());
+			}
 		}
 		return threadData.ret;
 	}
@@ -198,11 +210,11 @@
 		rules.push_back(it);
 	}
 
-	void setPythonExecutor(DynamicExecutor* python){this->python = python;}
+	void setPythonExecutor(Plugin* python){this->python = python;}
 
 private:
 	list<Item> rules;
-	DynamicExecutor* python;
+	Plugin* python;
 };
 
 static HttpObserver observer;
@@ -220,7 +232,6 @@
 	Server* serverInstance = (Server*)server;
 	HttpStaticData* staticData =(HttpStaticData*) serverInstance->getGlobalData("http-static");
 	string msg("new-http-request");
-	string pythonNamespace("executors");
 	string pythonName("python");
 	Plugin* python;
 	XmlParser* configuration;
@@ -234,7 +245,7 @@
 		serverInstance->logUnlockAccess();
 		return -1;
 	}
-	python = serverInstance->getPluginsManager()->getPlugin(pythonNamespace, pythonName);
+	python = serverInstance->getPluginsManager()->getPlugin(pythonName);
 
 	if(!python)
 	{
@@ -245,7 +256,7 @@
 		serverInstance->logUnlockAccess();
 		return -1;
 	}
-	observer.setPythonExecutor((DynamicExecutor*)python);
+	observer.setPythonExecutor(python);
 
 	staticData->addMulticast(msg, &observer);
 

Modified: trunk/plugins/src/http_checker/plugin.xml
===================================================================
--- trunk/plugins/generics/http_checker/plugin.xml	2008-10-23 20:50:14 UTC (rev 2900)
+++ trunk/plugins/src/http_checker/plugin.xml	2008-10-26 19:37:37 UTC (rev 2913)
@@ -2,10 +2,9 @@
 
 <PLUGIN>
 <NAME>http_checker</NAME>
-<TYPE>generics</TYPE>
 <VERSION>0.1</VERSION>
 <AUTHOR>The Free Software Foundation Inc.</AUTHOR>
 <MAINTAINER>The Free Software Foundation Inc.</MAINTAINER>
 <DESCRIPTION>This plugin permits to validate HTTP requests using python</DESCRIPTION>
-<DEPENDS>executors::python</DEPENDS>
+<DEPENDS>python</DEPENDS>
 </PLUGIN>

Copied: trunk/plugins/src/php (from rev 2900, trunk/plugins/http_managers/php)


Property changes on: trunk/plugins/src/php
___________________________________________________________________
Name: svn:mergeinfo
   + 

Modified: trunk/plugins/src/php/SConscript
===================================================================
--- trunk/plugins/http_managers/php/SConscript	2008-10-23 20:50:14 UTC (rev 2900)
+++ trunk/plugins/src/php/SConscript	2008-10-26 19:37:37 UTC (rev 2913)
@@ -1,6 +1,7 @@
 #-*- mode: python -*-
+Import('dest_dir','listinc')
 
-listinc=[
+local_listinc=[
       GetLaunchDir(),
       '../../../',
       '/usr/local/include',
@@ -10,8 +11,10 @@
       '.'
       ]
 
-env = Environment(CPPPATH=listinc)
+local_listinc.extend(listinc)
 
+env = Environment(CPPPATH=local_listinc)
+
 conf = Configure(env, config_h="config.h")
 
 if not conf.CheckFunc("php5"):
@@ -29,5 +32,7 @@
 
 env = conf.Finish()
 
-env.SharedLibrary(GetLaunchDir() + "/binaries/plugins/http_managers/php", ["php.cpp"], SHLIBPREFIX="")
+env.SharedLibrary(GetLaunchDir() + "/" + dest_dir + "/php", ["php.cpp"], SHLIBPREFIX="")
 
+Command(GetLaunchDir() + "/" + dest_dir + "/README","README", Copy("$TARGET", "$SOURCE"))
+

Modified: trunk/plugins/src/php/php.cpp
===================================================================
--- trunk/plugins/http_managers/php/php.cpp	2008-10-23 20:50:14 UTC (rev 2900)
+++ trunk/plugins/src/php/php.cpp	2008-10-26 19:37:37 UTC (rev 2913)
@@ -358,10 +358,26 @@
 }
 
 
+/*!
+ *Default constructor.
+ */
+PhpManager::PhpManager() 
+{
 
-int sendManager(HttpThreadContext* td, ConnectionPtr s, const char *filenamePath,
-								const char* cgi, int onlyHeader)
+}
+
+/*!
+ *Destroy the object.
+ */
+PhpManager::~PhpManager()
 {
+
+}
+
+
+int PhpManager::send(HttpThreadContext*, ConnectionPtr s, const char *filenamePath,
+                   const char* cgi, int selfExecuted, int onlyHeader = 0)
+{
 	PhpData* data;
 	zend_file_handle script;
 	int ret = SUCCESS;

Modified: trunk/plugins/src/php/php.h
===================================================================
--- trunk/plugins/http_managers/php/php.h	2008-10-23 20:50:14 UTC (rev 2900)
+++ trunk/plugins/src/php/php.h	2008-10-26 19:37:37 UTC (rev 2913)
@@ -25,6 +25,7 @@
 #include <include/base/file/file.h>
 #include <include/base/file/files_utility.h>
 #include <include/protocol/http/http.h>
+#include <include/protocol/http/dyn_http_manager.h>
 
 #ifdef WIN32
 #define EXPORTABLE(x) x _declspec(dllexport);
@@ -37,8 +38,20 @@
 
 EXPORTABLE(int) load(void* server, void* parser);
 
+EXPORTABLE(int) postLoad(void* server,void* parser)
+
 EXPORTABLE(int) unload(void* p);
 
+class PhpManager 
+{
+public:
+	PhpManager();
+	virtual ~PhpManager();
+	virtual int send(HttpThreadContext*, ConnectionPtr s, const char *filenamePath,
+                   const char* cgi, int selfExecuted, int onlyHeader = 0);
+
+};
+
 EXPORTABLE(int) sendManager(HttpThreadContext* td, ConnectionPtr s, const char *filenamePath,
 													 const char* cgi, int onlyHeader);
 

Modified: trunk/plugins/src/php/plugin.xml
===================================================================
--- trunk/plugins/http_managers/php/plugin.xml	2008-10-23 20:50:14 UTC (rev 2900)
+++ trunk/plugins/src/php/plugin.xml	2008-10-26 19:37:37 UTC (rev 2913)
@@ -2,7 +2,6 @@
 
 <PLUGIN>
 <NAME>php</NAME>
-<TYPE>http_managers</TYPE>
 <VERSION>0.1</VERSION>
 <AUTHOR>The Free Software Foundation Inc.</AUTHOR>
 <MAINTAINER>The Free Software Foundation Inc.</MAINTAINER>

Added: trunk/plugins/src/python/SConscript
===================================================================
--- trunk/plugins/src/python/SConscript	                        (rev 0)
+++ trunk/plugins/src/python/SConscript	2008-10-26 19:37:37 UTC (rev 2913)
@@ -0,0 +1,29 @@
+#-*- mode: python -*-
+
+Import('dest_dir','listinc')
+
+local_listinc=[
+      '/usr/include/python2.5',
+      '/usr/local/include/python2.5',
+      '/usr/local/include/libxml2',
+      '/usr/include/libxml2',
+      '.'
+      ]
+
+local_listinc.extend(listinc)
+
+env = Environment(CPPPATH=local_listinc)
+
+conf = Configure(env, config_h="config.h")
+
+if conf.CheckHeader("Python.h") and conf.CheckLib("python2.5"):
+    conf.Define('PYTHON', 1)
+
+conf.CheckLib("util")
+conf.CheckLib("pthread")
+conf.CheckLib("dl")
+
+env = conf.Finish()
+
+env.SharedLibrary(GetLaunchDir() + "/" + dest_dir + "/python", ["python.cpp"], SHLIBPREFIX="")
+

Added: trunk/plugins/src/python/plugin.xml
===================================================================
--- trunk/plugins/src/python/plugin.xml	                        (rev 0)
+++ trunk/plugins/src/python/plugin.xml	2008-10-26 19:37:37 UTC (rev 2913)
@@ -0,0 +1,9 @@
+<?xml version="1.0"?>
+
+<PLUGIN>
+<NAME>python</NAME>
+<VERSION>0.1</VERSION>
+<AUTHOR>The MyServer Team</AUTHOR>
+<MAINTAINER>The MyServer Team</MAINTAINER>
+<DESCRIPTION>Python code executor</DESCRIPTION>
+</PLUGIN>

Added: trunk/plugins/src/python/python.cpp
===================================================================
--- trunk/plugins/src/python/python.cpp	                        (rev 0)
+++ trunk/plugins/src/python/python.cpp	2008-10-26 19:37:37 UTC (rev 2913)
@@ -0,0 +1,313 @@
+/*
+MyServer
+Copyright (C) 2007, 2008 The MyServer Team
+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
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program.  If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#include "python.h"
+
+PyInterpreterState* pythonMainInterpreterState = NULL;
+HashMap<ThreadID, PythonData*> pythonThreadData;
+
+static Server *serverInstance;
+
+char* name (char* name, u_long len)
+{
+	char* str = (char*)"python";
+
+	if (name)
+		strncpy (name, str, len);
+
+	return str;
+}
+
+
+PyInterpreterState* PythonData::getInterpreter ()
+	{
+		if(interp == 0)
+			interp = Py_NewInterpreter ();
+		PyThreadState_Swap (NULL);
+		return interp->interp;
+	}
+
+PythonData::PythonData ()
+{
+	clear ();
+}
+
+void PythonData::clear ()
+{
+	interp = 0;
+}
+
+
+
+int load (void* server, void* parser)
+{
+	serverInstance = (Server*)server;
+	const char* pathData = serverInstance->getHashedData("PYTHON_PATH");
+	PyThreadState * mainThreadState;
+	if (pathData)
+	{	
+		string path (pathData);
+		FilesUtility::completePath (path);
+		
+		setenv ("PYTHONPATH", path.c_str(), 1);
+	}
+	else
+	{
+		string path (".");
+		FilesUtility::completePath (path);
+
+		setenv ("PYTHONPATH", path.c_str(), 1);
+	}
+
+  Py_SetProgramName ((char *)("python"));
+	Py_Initialize ();
+	PyEval_InitThreads ();
+
+	mainThreadState = PyThreadState_Get ();
+
+	pythonMainInterpreterState = mainThreadState->interp;
+
+	PyEval_ReleaseLock ();
+
+	return 0;
+}
+
+/*! Unload the plugin.  Called once.  Returns 0 on success.  */
+int unLoad (void* p)
+{
+	PyInterpreterState *interpreter = NULL;
+	PyThreadState *threadState = NULL;
+	PythonData* data = NULL;
+	ThreadID tid = Thread::threadID ();
+
+	PyEval_AcquireLock ();
+
+
+	data = pythonThreadData.get (tid);
+	if(data == 0)
+	{
+		data = new PythonData ();
+		pythonThreadData.put (tid, data);
+	}
+
+	interpreter = data->getInterpreter ();
+	threadState = PyThreadState_New (interpreter);
+
+	PyThreadState_Swap (threadState);
+
+
+	Py_Finalize ();
+
+	
+	PyThreadState_Swap (NULL);
+
+
+	PyEval_ReleaseLock ();
+
+	HashMap<ThreadID, PythonData*>::Iterator it = pythonThreadData.begin ();
+	while (it != pythonThreadData.end ())
+		delete *it++;
+	return 0;
+}
+
+int execute (char* code, u_long length)
+{
+  return executeImpl (code, length, NULL, 1);
+}
+
+int executeImpl (char* code, u_long length, PyThreadState *threadState, int newThreadState)
+{
+	PyInterpreterState *interpreter = NULL;
+	PythonData* data = NULL;
+	ThreadID tid = Thread::threadID ();
+
+	PyEval_AcquireLock ();
+
+	data = pythonThreadData.get (tid);
+	if (data == 0)
+	{
+		data = new PythonData();
+		pythonThreadData.put(tid, data);
+	}
+
+	interpreter = data->getInterpreter ();
+
+  if (newThreadState)
+    threadState = PyThreadState_New (interpreter);
+
+	PyThreadState_Swap (threadState);
+
+
+	PyRun_SimpleString (code);
+	
+	PyThreadState_Swap (NULL);
+
+  if (newThreadState)
+  {
+    PyThreadState_Clear (threadState);
+    PyThreadState_Delete (threadState);
+  }
+
+	PyEval_ReleaseLock ();
+
+  return 0;
+
+
+}
+
+int executeFromFile (char* filename)
+{
+  return executeFromFileImpl (filename, NULL, 1);
+}
+
+int executeFromFileImpl(char* filename, PyThreadState *threadState, int newThreadState)
+{
+	PyInterpreterState *interpreter = NULL;
+	int ret = 0;
+	FILE *file = NULL;
+	PythonData* data = NULL;
+	ThreadID tid = Thread::threadID ();
+
+	PyEval_AcquireLock ();
+
+	data = pythonThreadData.get (tid);
+	if(data == 0)
+	{
+		data = new PythonData ();
+		pythonThreadData.put (tid, data);
+	}
+
+	interpreter = data->getInterpreter ();
+
+  if (newThreadState)
+    threadState = PyThreadState_New (interpreter);
+
+	PyThreadState_Swap (threadState);
+
+	file = fopen (filename, "r");
+
+	if(file == 0)
+	{
+		string msg;
+		msg.assign ("Python: Cannot load file ");
+		msg.append (filename);
+
+		serverInstance->logLockAccess ();
+		serverInstance->logPreparePrintError ();
+		serverInstance->logWriteln (msg.c_str ());
+		serverInstance->logEndPrintError ();
+		serverInstance->logUnlockAccess ();
+
+		ret = -1;
+	}
+	else
+		ret = PyRun_AnyFileEx (file, filename, 1);
+
+	
+	PyThreadState_Swap (NULL);
+
+  if (newThreadState)
+  {
+    PyThreadState_Clear (threadState);
+    PyThreadState_Delete(threadState);
+  }
+
+	PyEval_ReleaseLock ();
+
+  return ret;
+
+}
+
+PyObject* callObject(PyObject *obj, PyObject *args)
+{
+  return callObjectImpl(obj, args, NULL, 1);
+}
+
+ 
+PyObject* callObjectImpl(PyObject *obj, PyObject *args, PyThreadState *threadState, int newThreadState)
+{
+	PyInterpreterState *interpreter = NULL;
+	PythonData* data = NULL;
+	ThreadID tid = Thread::threadID();
+  PyObject *result;
+
+	PyEval_AcquireLock ();
+
+	data = pythonThreadData.get (tid);
+	if(data == 0)
+	{
+		data = new PythonData ();
+		pythonThreadData.put (tid, data);
+	}
+
+	interpreter = data->getInterpreter();
+
+  if (newThreadState)
+    threadState = PyThreadState_New(interpreter);
+
+	PyThreadState_Swap (threadState);
+
+
+  result = PyEval_CallObject (obj, args);
+
+
+	PyThreadState_Swap (NULL);
+
+  if (newThreadState)
+  {
+    PyThreadState_Clear (threadState);
+    PyThreadState_Delete (threadState);
+  }
+
+	PyEval_ReleaseLock ();
+
+  return result;
+}
+
+
+int initModule (char* name, PyMethodDef methods[])
+{
+	PyInterpreterState *interpreter = NULL;
+	PyThreadState *threadState = NULL;
+	PythonData* data = NULL;
+	ThreadID tid = Thread::threadID ();
+
+	PyEval_AcquireLock ();
+
+	data = pythonThreadData.get (tid);
+	if (data == 0)
+	{
+		data = new PythonData ();
+		pythonThreadData.put (tid, data);
+	}
+
+	interpreter = data->getInterpreter ();
+	threadState = PyThreadState_New (interpreter);
+
+	PyThreadState_Swap (threadState);
+
+
+	Py_InitModule (name, methods);
+
+	PyThreadState_Swap (NULL);
+
+
+	PyEval_ReleaseLock ();
+
+	return 0;
+}
+

Added: trunk/plugins/src/python/python.h
===================================================================
--- trunk/plugins/src/python/python.h	                        (rev 0)
+++ trunk/plugins/src/python/python.h	2008-10-26 19:37:37 UTC (rev 2913)
@@ -0,0 +1,65 @@
+/*
+MyServer
+Copyright (C) 2007, 2008 The MyServer Team
+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
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program.  If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#include <Python.h>
+
+#include <stdafx.h>
+#include <include/connection/connection.h>
+#include <include/base/socket/socket.h>
+#include <include/server/server.h>
+#include <include/base/sync/mutex.h>
+#include <include/base/file/file.h>
+#include <include/base/file/files_utility.h>
+
+
+struct PythonData
+{
+	PyThreadState* interp;
+	PyInterpreterState* getInterpreter();
+	PythonData();
+	void clear();
+};
+
+extern HashMap<ThreadID, PythonData*> pythonThreadData;
+
+
+
+#ifdef WIN32
+#define EXPORTABLE(x) x _declspec(dllexport)
+#else
+#define EXPORTABLE(x) extern "C" x
+#endif
+
+
+EXPORTABLE(char*) name(char* name, u_long len);
+
+EXPORTABLE(int) load(void* server,void* parser);
+EXPORTABLE(int) unLoad(void* p);
+
+
+EXPORTABLE(int) execute(char* code, u_long length);
+EXPORTABLE(int) executeFromFile(char* filename);
+
+
+EXPORTABLE(int) executeImpl (char* code, u_long length, PyThreadState *threadState, int newThreadState);
+EXPORTABLE(int) executeFromFileImpl(char* filename, PyThreadState *threadState, int newThreadState);
+
+EXPORTABLE(PyObject*) callObject(PyObject *obj, PyObject *args);
+EXPORTABLE(PyObject*) callObjectImpl(PyObject *obj, PyObject *args, PyThreadState *threadState, int newThreadState);
+
+
+EXPORTABLE(int) initModule(char*, PyMethodDef[]);

Copied: trunk/plugins/src/python_http_handler (from rev 2900, trunk/plugins/generics/python_http_handler)


Property changes on: trunk/plugins/src/python_http_handler
___________________________________________________________________
Name: svn:mergeinfo
   + 

Modified: trunk/plugins/src/python_http_handler/SConscript
===================================================================
--- trunk/plugins/generics/python_http_handler/SConscript	2008-10-23 20:50:14 UTC (rev 2900)
+++ trunk/plugins/src/python_http_handler/SConscript	2008-10-26 19:37:37 UTC (rev 2913)
@@ -1,6 +1,7 @@
 #-*- mode: python -*-
+Import('dest_dir','listinc')
 
-listinc=[
+local_listinc=[
       GetLaunchDir(),
       '../../../',
       '/usr/local/include',
@@ -12,8 +13,10 @@
       '.'
       ]
 
-env = Environment(CPPPATH=listinc)
+local_listinc.extend(listinc)
 
+env = Environment(CPPPATH=local_listinc)
+
 conf = Configure(env, config_h="config.h")
 
 if conf.CheckHeader("Python.h"):
@@ -21,5 +24,7 @@
 
 env = conf.Finish()
 
-env.SharedLibrary(GetLaunchDir() + "/binaries/plugins/generics/python_http_handler", ["python_http_handler.cpp" ], SHLIBPREFIX="")
+env.SharedLibrary(GetLaunchDir() + "/" + dest_dir + "/python_http_handler", ["python_http_handler.cpp" ], SHLIBPREFIX="")
 
+Command(GetLaunchDir() + "/" + dest_dir + "/python","python", Copy("$TARGET", "$SOURCE"))
+Command(GetLaunchDir() + "/" + dest_dir + "/README","README", Copy("$TARGET", "$SOURCE"))

Added: trunk/plugins/src/python_http_handler/config.h
===================================================================
--- trunk/plugins/src/python_http_handler/config.h	                        (rev 0)
+++ trunk/plugins/src/python_http_handler/config.h	2008-10-26 19:37:37 UTC (rev 2913)
@@ -0,0 +1,9 @@
+#ifndef SRC_PYTHON_HTTP_HANDLER_CONFIG_H_SEEN
+#define SRC_PYTHON_HTTP_HANDLER_CONFIG_H_SEEN
+
+
+/* Define to 1 if you have the <Python.h> header file. */
+#define HAVE_PYTHON_H 1
+#define PYTHON 1
+
+#endif /* SRC_PYTHON_HTTP_HANDLER_CONFIG_H_SEEN */

Modified: trunk/plugins/src/python_http_handler/plugin.xml
===================================================================
--- trunk/plugins/generics/python_http_handler/plugin.xml	2008-10-23 20:50:14 UTC (rev 2900)
+++ trunk/plugins/src/python_http_handler/plugin.xml	2008-10-26 19:37:37 UTC (rev 2913)
@@ -2,10 +2,9 @@
 
 <PLUGIN>
 <NAME>python_http_handler</NAME>
-<TYPE>generics</TYPE>
 <VERSION>0.1</VERSION>
 <AUTHOR>The Free Software Foundation Inc.</AUTHOR>
 <MAINTAINER>The Free Software Foundation Inc.</MAINTAINER>
 <DESCRIPTION>This plugin permits to use python as handler</DESCRIPTION>
-<DEPENDS>executors::python</DEPENDS>
+<DEPENDS>python</DEPENDS>
 </PLUGIN>

Modified: trunk/plugins/src/python_http_handler/python_http_handler.cpp
===================================================================
--- trunk/plugins/generics/python_http_handler/python_http_handler.cpp	2008-10-23 20:50:14 UTC (rev 2900)
+++ trunk/plugins/src/python_http_handler/python_http_handler.cpp	2008-10-26 19:37:37 UTC (rev 2913)
@@ -20,19 +20,23 @@
 #include <include/protocol/http/http_data_handler.h>
 #include <include/base/multicast/multicast.h>
 #include <include/protocol/http/http.h>
-#include <include/plugin/executor/dynamic_executor.h>
+#include <include/plugin/plugin.h>
 #include <Python.h>
 
 
 static Server* serverInstance;
 
 
+
+
 #ifdef WIN32
 #define EXPORTABLE(x) x _declspec(dllexport)
 #else
 #define EXPORTABLE(x) extern "C" x
 #endif
 
+typedef int (*executePROC)(char*, u_long);
+typedef int (*executeFromFilePROC)(char*);
 
 class ThreadData : public HttpDataHandler
 {
@@ -360,10 +364,18 @@
 
 		for(it = rules.begin(); it != rules.end(); it++)
 		{
-			if((*it).file)
-				python->executeFromFile((char*)(*it).data.c_str());
-			else
-				python->execute((char*)(*it).data.c_str(), (*it).data.length());
+			if((*it).file) 
+			{
+				executeFromFilePROC execute = ((executeFromFilePROC)python->getDirectMethod((char*)"executeFromFile"));
+				if (execute)
+				  execute((char*)(*it).data.c_str());
+			}else
+			{
+				executePROC execute = ((executePROC)python->getDirectMethod((char*)"execute"));
+				
+				if (execute)
+				  execute((char*)(*it).data.c_str(), (*it).data.length());
+			}
 		}
 		return threadData.getRet();
 	}
@@ -376,11 +388,11 @@
 		rules.push_back(it);
 	}
 
-	void setPythonExecutor(DynamicExecutor* python){this->python = python;}
+	void setPythonExecutor(Plugin* python){this->python = python;}
 
 private:
 	list<Item> rules;
-	DynamicExecutor* python;
+	Plugin* python;
 };
 
 static HttpObserver observer;
@@ -399,7 +411,6 @@
 	serverInstance = (Server*)server;
 	HttpStaticData* staticData =(HttpStaticData*) serverInstance->getGlobalData("http-static");
 	string msg("new-http-request");
-	string pythonNamespace("executors");
 	string pythonName("python");
 	Plugin* python;
 	XmlParser* configuration;
@@ -413,7 +424,7 @@
 		serverInstance->logUnlockAccess();
 		return -1;
 	}
-	python = serverInstance->getPluginsManager()->getPlugin(pythonNamespace, pythonName);
+	python = serverInstance->getPluginsManager()->getPlugin(pythonName);
 
 	if(!python)
 	{
@@ -424,7 +435,7 @@
 		serverInstance->logUnlockAccess();
 		return -1;
 	}
-	observer.setPythonExecutor((DynamicExecutor*)python);
+	observer.setPythonExecutor(python);
 
 	staticData->addMulticast(msg, &observer);
 

Copied: trunk/plugins/src/rules_checker (from rev 2900, trunk/plugins/generics/rules_checker)


Property changes on: trunk/plugins/src/rules_checker
___________________________________________________________________
Name: svn:mergeinfo
   + 

Modified: trunk/plugins/src/rules_checker/SConscript
===================================================================
--- trunk/plugins/generics/rules_checker/SConscript	2008-10-23 20:50:14 UTC (rev 2900)
+++ trunk/plugins/src/rules_checker/SConscript	2008-10-26 19:37:37 UTC (rev 2913)
@@ -1,6 +1,7 @@
 #-*- mode: python -*-
+Import('dest_dir','listinc')
 
-listinc=[
+local_listinc=[
       GetLaunchDir(),
       '../../../',
       '/usr/local/include',
@@ -10,11 +11,15 @@
       '.'
       ]
 
-env = Environment(CPPPATH=listinc)
+local_listinc.extend(listinc)
 
+env = Environment(CPPPATH=local_listinc)
+
 conf = Configure(env, config_h="config.h")
 
 env = conf.Finish()
 
-env.SharedLibrary(GetLaunchDir() + "/binaries/plugins/generics/rules_checker", "functions.cpp  parser.cpp  rules_checker.cpp  string_alloc.cpp".split(), SHLIBPREFIX="")
+env.SharedLibrary(GetLaunchDir() + "/" + dest_dir + "/rules_checker", "functions.cpp  parser.cpp  rules_checker.cpp  string_alloc.cpp".split(), SHLIBPREFIX="")
 
+Command(GetLaunchDir() + "/" + dest_dir + "/README","README", Copy("$TARGET", "$SOURCE"))
+

Modified: trunk/plugins/src/rules_checker/plugin.xml
===================================================================
--- trunk/plugins/generics/rules_checker/plugin.xml	2008-10-23 20:50:14 UTC (rev 2900)
+++ trunk/plugins/src/rules_checker/plugin.xml	2008-10-26 19:37:37 UTC (rev 2913)
@@ -2,7 +2,6 @@
 
 <PLUGIN>
 <NAME>rules_checker</NAME>
-<TYPE>generics</TYPE>
 <VERSION>0.1</VERSION>
 <AUTHOR>The Free Software Foundation Inc.</AUTHOR>
 <MAINTAINER>The Free Software Foundation Inc.</MAINTAINER>

Modified: trunk/plugins/src/rules_checker/rules_checker.cpp
===================================================================
--- trunk/plugins/generics/rules_checker/rules_checker.cpp	2008-10-23 20:50:14 UTC (rev 2900)
+++ trunk/plugins/src/rules_checker/rules_checker.cpp	2008-10-26 19:37:37 UTC (rev 2913)
@@ -18,6 +18,7 @@
 #include <stdafx.h>
 #include <string.h>
 #include <include/server/server.h>
+#include <include/protocol/http/http.h>
 #include "heading.h"
 
 #ifdef WIN32

Added: trunk/plugins/src/rules_checker/string_alloc.os
===================================================================
(Binary files differ)


Property changes on: trunk/plugins/src/rules_checker/string_alloc.os
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream





From MAILER-DAEMON Sun Oct 26 15:54:41 2008
Received: from mailman by lists.gnu.org with archive (Exim 4.43)
	id 1KuBhA-0006lv-Vn
	for mharc-myserver-commit@gnu.org; Sun, 26 Oct 2008 15:54:41 -0400
Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43)
	id 1KuBh8-0006lX-QB
	for myserver-commit@gnu.org; Sun, 26 Oct 2008 15:54:38 -0400
Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43)
	id 1KuBh6-0006jc-QU
	for myserver-commit@gnu.org; Sun, 26 Oct 2008 15:54:37 -0400
Received: from [199.232.76.173] (port=51718 helo=monty-python.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.43) id 1KuBh6-0006jZ-N1
	for myserver-commit@gnu.org; Sun, 26 Oct 2008 15:54:36 -0400
Received: from savannah.gnu.org ([199.232.41.3]:51022 helo=sv.gnu.org)
	by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32)
	(Exim 4.60) (envelope-from <INVALID.NOREPLY@gnu.org>)
	id 1KuBh5-0008Gz-VZ
	for myserver-commit@gnu.org; Sun, 26 Oct 2008 15:54:36 -0400
Received: from cvs.savannah.gnu.org ([199.232.41.69])
	by sv.gnu.org with esmtp (Exim 4.63)
	(envelope-from <INVALID.NOREPLY@gnu.org>) id 1KuBh2-0001JC-Ie
	for myserver-commit@gnu.org; Sun, 26 Oct 2008 19:54:32 +0000
Received: from gscrivano by cvs.savannah.gnu.org with local (Exim 4.63)
	(envelope-from <gscrivano@savannah.gnu.org>) id 1KuBh2-0001J8-DB
	for myserver-commit@gnu.org; Sun, 26 Oct 2008 19:54:32 +0000
MIME-Version: 1.0
Errors-To: gscrivano
To: myserver-commit@gnu.org
X-Mailer: SVN::Notify 2.64: http://search.cpan.org/dist/SVN-Notify/
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
From: Giuseppe Scrivano <gscrivano@gnu.org>
Message-Id: <E1KuBh2-0001J8-DB@cvs.savannah.gnu.org>
Date: Sun, 26 Oct 2008 19:54:32 +0000
X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 3)
Subject: [myserver-commit] [2914] Removed binary file.
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/pipermail/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, 26 Oct 2008 19:54:38 -0000

Revision: 2914
          http://svn.sv.gnu.org/viewvc/?view=rev&root=myserver&revision=2914
Author:   gscrivano
Date:     2008-10-26 19:54:32 +0000 (Sun, 26 Oct 2008)

Log Message:
-----------
Removed binary file.

Removed Paths:
-------------
    trunk/plugins/src/rules_checker/string_alloc.os

Deleted: trunk/plugins/src/rules_checker/string_alloc.os
===================================================================
(Binary files differ)





From MAILER-DAEMON Sun Oct 26 16:01:15 2008
Received: from mailman by lists.gnu.org with archive (Exim 4.43)
	id 1KuBnX-0000nf-Nl
	for mharc-myserver-commit@gnu.org; Sun, 26 Oct 2008 16:01:15 -0400
Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43)
	id 1KuBnW-0000nT-5P
	for myserver-commit@gnu.org; Sun, 26 Oct 2008 16:01:14 -0400
Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43)
	id 1KuBnV-0000nH-Ic
	for myserver-commit@gnu.org; Sun, 26 Oct 2008 16:01:13 -0400
Received: from [199.232.76.173] (port=59008 helo=monty-python.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.43) id 1KuBnV-0000nE-D1
	for myserver-commit@gnu.org; Sun, 26 Oct 2008 16:01:13 -0400
Received: from savannah.gnu.org ([199.232.41.3]:56885 helo=sv.gnu.org)
	by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32)
	(Exim 4.60) (envelope-from <INVALID.NOREPLY@gnu.org>)
	id 1KuBnU-0002JZ-Or
	for myserver-commit@gnu.org; Sun, 26 Oct 2008 16:01:13 -0400
Received: from cvs.savannah.gnu.org ([199.232.41.69])
	by sv.gnu.org with esmtp (Exim 4.63)
	(envelope-from <INVALID.NOREPLY@gnu.org>) id 1KuBnT-00027i-Nf
	for myserver-commit@gnu.org; Sun, 26 Oct 2008 20:01:11 +0000
Received: from gscrivano by cvs.savannah.gnu.org with local (Exim 4.63)
	(envelope-from <gscrivano@savannah.gnu.org>) id 1KuBnT-00027e-DX
	for myserver-commit@gnu.org; Sun, 26 Oct 2008 20:01:11 +0000
MIME-Version: 1.0
Errors-To: gscrivano
To: myserver-commit@gnu.org
X-Mailer: SVN::Notify 2.64: http://search.cpan.org/dist/SVN-Notify/
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
From: Giuseppe Scrivano <gscrivano@gnu.org>
Message-Id: <E1KuBnT-00027e-DX@cvs.savannah.gnu.org>
Date: Sun, 26 Oct 2008 20:01:11 +0000
X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 3)
Subject: [myserver-commit] [2915] Restored basic HTTP error messages.
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/pipermail/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, 26 Oct 2008 20:01:14 -0000

Revision: 2915
          http://svn.sv.gnu.org/viewvc/?view=rev&root=myserver&revision=2915
Author:   gscrivano
Date:     2008-10-26 20:01:10 +0000 (Sun, 26 Oct 2008)

Log Message:
-----------
Restored basic HTTP error messages.

Modified Paths:
--------------
    trunk/myserver/src/http_handler/http_file/http_file.cpp
    trunk/myserver/src/http_handler/wincgi/wincgi.cpp
    trunk/myserver/src/protocol/http/http.cpp

Modified: trunk/myserver/src/http_handler/http_file/http_file.cpp
===================================================================
--- trunk/myserver/src/http_handler/http_file/http_file.cpp	2008-10-26 19:54:32 UTC (rev 2914)
+++ trunk/myserver/src/http_handler/http_file/http_file.cpp	2008-10-26 20:01:10 UTC (rev 2915)
@@ -83,11 +83,30 @@
   FiltersChain chain;
   u_long nbw;
   u_long nbr;
-  
+  time_t lastMT;
+  string tmpTime;
   u_long dataSent = 0;
 
   try
   {
+
+    if (!FilesUtility::fileExists (filenamePath))
+      return td->http->raiseHTTPError(404);
+
+    lastMT = FilesUtility::getLastModTime(td->filenamePath.c_str());
+    if(lastMT == -1)
+      return td->http->raiseHTTPError(500);
+
+    getRFC822GMTTime(lastMT, tmpTime, HTTP_RESPONSE_LAST_MODIFIED_DIM);
+    td->response.lastModified.assign(tmpTime);
+
+    HttpRequestHeader::Entry *ifModifiedSince = 
+      td->request.other.get("Last-Modified");
+
+    if(ifModifiedSince && ifModifiedSince->value->length() && 
+       !ifModifiedSince->value->compare(td->response.lastModified.c_str()))
+          return td->http->sendHTTPNonModified();
+
     file = Server::getInstance()->getCachedFiles()->open(filenamePath);
     if(file == 0)
     {  

Modified: trunk/myserver/src/http_handler/wincgi/wincgi.cpp
===================================================================
--- trunk/myserver/src/http_handler/wincgi/wincgi.cpp	2008-10-26 19:54:32 UTC (rev 2914)
+++ trunk/myserver/src/http_handler/wincgi/wincgi.cpp	2008-10-26 20:01:10 UTC (rev 2915)
@@ -80,8 +80,9 @@
 /*!
  *Send the WinCGI data.
  */
-int WinCgi::send(HttpThreadContext* td,ConnectionPtr s,const char* filename, 
-                 const char* cmdLine, int /*execute*/, int onlyHeader)
+int WinCgi::send(HttpThreadContext* td,ConnectionPtr s,
+                 const char* scriptpath, const char *cgipath,
+                 int /*execute*/, int onlyHeader)
 {
 #ifdef WIN32
   FiltersChain chain;
@@ -105,10 +106,10 @@
   u_long nbw = 0;
   ostringstream stream;
 
-  if(!FilesUtility::fileExists(filename))
+  if(!FilesUtility::fileExists(scriptpath))
     return td->http->raiseHTTPError(404);
 
-  FilesUtility::splitPath(filename,pathname,execname);
+  FilesUtility::splitPath(scriptpath, pathname, execname);
   
   getdefaultwd(dataFilePath,MAX_PATH);
   GetShortPathName(dataFilePath,dataFilePath,MAX_PATH);
@@ -302,7 +303,7 @@
   }
   OutFileHandle.close();
   spi.cmdLine.assign("cmd /c \"");
-  spi.cmdLine.append(filename);
+  spi.cmdLine.append(scriptpath);
   spi.cmdLine.append("\" ");
   spi.cmdLine.append(dataFilePath);
   spi.cwd.assign(pathname);
@@ -310,7 +311,7 @@
   if (proc.execAndWait (&spi, timeout))
   {
     ostringstream msg;
-    msg << "WinCGI: Error executing process " << filename;
+    msg << "WinCGI: Error executing process " << scriptpath;
     td->connection->host->warningsLogRequestAccess(td->id);
     td->connection->host->warningsLogWrite(msg.str().c_str());
     td->connection->host->warningsLogTerminateAccess(td->id);

Modified: trunk/myserver/src/protocol/http/http.cpp
===================================================================
--- trunk/myserver/src/protocol/http/http.cpp	2008-10-26 19:54:32 UTC (rev 2914)
+++ trunk/myserver/src/protocol/http/http.cpp	2008-10-26 20:01:10 UTC (rev 2915)
@@ -771,11 +771,9 @@
    */
   string filename;
   int permissions;
-  string data;
+  const char *cgiManager;
   int mimecmd;
-  time_t lastMT;
   int ret;
-  string tmpTime;
   string directory;
   string file;
   DynamicHttpManager *manager;
@@ -809,20 +807,18 @@
       return processDefaultFile (uri, permissions, onlyHeader);
     }
 
-    data.assign("");
-
     td->response.contentType[0] = '\0';
 
     /* If not specified differently, set the default content type to text/html.  */
     if(td->mime)
     {
-      td->response.contentType.assign(td->mime->mimeType);
-      data.assign(td->mime->cgiManager);
+      td->response.contentType.assign (td->mime->mimeType);
+      cgiManager = td->mime->cgiManager.c_str ();
     }
     else
     {
       td->response.contentType.assign("text/html");
-      data.assign("");
+      cgiManager = "";
     }
 
 
@@ -843,7 +839,7 @@
         return sendAuth();
       }
       ret = cgi->send(td, td->connection, td->filenamePath.c_str(),
-                      data.c_str(), td->mime->selfExecuted,  onlyHeader);
+                      cgiManager, td->mime->selfExecuted,  onlyHeader);
       return ret;
     }
     else if(td->mime && !td->mime->cmdName.compare ("ISAPI"))
@@ -862,7 +858,7 @@
         return sendAuth();
       }
       ret = isapi->send(td, td->connection, td->filenamePath.c_str(),
-                        data.c_str(), td->mime->selfExecuted, onlyHeader);
+                        cgiManager, td->mime->selfExecuted, onlyHeader);
       return ret;
     }
     else if(td->mime && !td->mime->cmdName.compare ("MSGI"))
@@ -893,7 +889,6 @@
     }
     else if(td->mime && !td->mime->cmdName.compare ("WINCGI"))
     {
-      ostringstream cgipath;
       int allowWincgi = 1;
       const char *dataH = td->connection->host->getHashedData("ALLOW_WINCGI");
       if(dataH)
@@ -908,16 +903,11 @@
       {
         return sendAuth();
       }
-      if(data.length())
-      {
-        cgipath <<  data << " \""<< td->filenamePath <<  "\"";
-      }
-      else
-      {
-        cgipath << td->filenamePath;
-      }
-      ret = wincgi->send(td, td->connection, cgipath.str().c_str(),
-                         0, td->mime->selfExecuted, onlyHeader);
+
+      ret = wincgi->send(td, td->connection, 
+                         td->filenamePath.c_str(),
+                         cgiManager,
+                         td->mime->selfExecuted, onlyHeader);
       return ret;
     }
     else if(td->mime && !td->mime->cmdName.compare ("FASTCGI"))
@@ -936,7 +926,7 @@
         return sendAuth();
       }
       ret = fastcgi->send(td, td->connection, td->filenamePath.c_str(),
-                          data.c_str(), td->mime->selfExecuted, onlyHeader);
+                          cgiManager, td->mime->selfExecuted, onlyHeader);
       return ret;
     }
     else if(td->mime && !td->mime->cmdName.compare ("SCGI"))
@@ -955,7 +945,7 @@
         return sendAuth();
       }
       ret = scgi->send(td, td->connection, td->filenamePath.c_str(),
-                       data.c_str(), td->mime->selfExecuted, onlyHeader);
+                       cgiManager, td->mime->selfExecuted, onlyHeader);
       return ret;
     }
     else if (td->mime && (manager = staticHttp.dynManagerList.getHttpManager (td->mime->cmdName)))
@@ -974,87 +964,11 @@
         return sendAuth();
       }
       ret = scgi->send(td, td->connection, td->filenamePath.c_str(),
-                       data.c_str(), 1, onlyHeader);
+                       cgiManager, 1, onlyHeader);
       return ret;
     }
-    else if(!td->mime->cmdName.compare ("SENDLINK"))
+    else if (td->mime && (manager = staticHttp.dynManagerList.getHttpManager(td->mime->cmdName)))
     {
-      u_long nbr;
-      char* linkpath;
-      char* pathInfo;
-      int linkpathSize;
-      File h;
-      int allowSendlink = 1;
-      const char *dataH =
-        td->connection->host->getHashedData("ALLOW_SEND_LINK");
-
-      if(dataH)
-      {
-        if(!strcmpi(dataH, "YES"))
-          allowSendlink = 1;
-        else
-          allowSendlink = 0;
-      }
-
-      if(!allowSendlink || !(permissions & MYSERVER_PERMISSION_READ))
-      {
-        return sendAuth();
-      }
-
-      if(h.openFile(td->filenamePath.c_str(),
-                    File::MYSERVER_OPEN_IFEXISTS|File::MYSERVER_OPEN_READ))
-      {
-        return raiseHTTPError(500);
-      }
-
-      linkpathSize = h.getFileSize() + td->pathInfo.length() + 1;
-
-      if(linkpathSize > MYSERVER_KB(10))
-        linkpathSize = MYSERVER_KB(10);
-
-      linkpath=new char[linkpathSize];
-
-      if(linkpath == 0)
-      {
-        return sendHTTPhardError500();
-      }
-
-      if(h.read(linkpath, linkpathSize, &nbr))
-      {
-        h.close();
-        delete [] linkpath;
-        return raiseHTTPError(500);/*!Internal server error*/
-      }
-
-      h.close();
-      linkpath[nbr]='\0';
-
-      pathInfo = new char[td->pathInfo.length() + 1];
-
-      if(pathInfo == 0)
-      {
-        delete [] linkpath;
-        return raiseHTTPError(500);/*!Internal server error*/
-      }
-      strcpy(pathInfo, td->pathInfo.c_str());
-      translateEscapeString(pathInfo);
-      strncat(linkpath, pathInfo,strlen(linkpath));
-
-      if(nbr)
-      {
-        string uri;
-        uri.assign(linkpath);
-        ret = sendHTTPResource(uri, systemrequest, onlyHeader, 1);
-      }
-      else
-        ret = raiseHTTPError(404);
-
-      delete [] linkpath;
-      delete [] pathInfo;
-      return ret;
-    }
-    else if ((manager = staticHttp.dynManagerList.getHttpManager(td->mime->cmdName)))
-    {
       int allowExternal = 1;
       const char *dataH =
         td->connection->host->getHashedData ("ALLOW_EXTERNAL_COMMANDS");
@@ -1073,7 +987,7 @@
           return manager->send(td,
                                td->connection,
                                td->filenamePath.c_str(),
-                               data.c_str(),
+                               cgiManager,
                                td->mime->selfExecuted,
                                onlyHeader);
         else
@@ -1101,26 +1015,6 @@
       return sendAuth();
     }
 
-    lastMT = FilesUtility::getLastModTime(td->filenamePath.c_str());
-    if(lastMT == -1)
-    {
-      return raiseHTTPError(500);
-    }
-    getRFC822GMTTime(lastMT, tmpTime, HTTP_RESPONSE_LAST_MODIFIED_DIM);
-    td->response.lastModified.assign(tmpTime);
-
-    {
-      HttpRequestHeader::Entry *ifModifiedSince =
-        td->request.other.get("Last-Modified");
-
-      if(ifModifiedSince && ifModifiedSince->value->length())
-      {
-        if(!ifModifiedSince->value->compare(td->response.lastModified.c_str()))
-        {
-          return sendHTTPNonModified();
-        }
-      }
-    }
     ret = httpFile->send(td, td->connection, td->filenamePath.c_str(),
                          0, onlyHeader);
   }





From MAILER-DAEMON Mon Oct 27 06:44:44 2008
Received: from mailman by lists.gnu.org with archive (Exim 4.43)
	id 1KuPaV-0000RB-W0
	for mharc-myserver-commit@gnu.org; Mon, 27 Oct 2008 06:44:44 -0400
Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43)
	id 1KuPaS-0000QX-Jv
	for myserver-commit@gnu.org; Mon, 27 Oct 2008 06:44:40 -0400
Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43)
	id 1KuPaQ-0000Pk-9T
	for myserver-commit@gnu.org; Mon, 27 Oct 2008 06:44:40 -0400
Received: from [199.232.76.173] (port=35557 helo=monty-python.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.43) id 1KuPaP-0000PY-Qj
	for myserver-commit@gnu.org; Mon, 27 Oct 2008 06:44:37 -0400
Received: from savannah.gnu.org ([199.232.41.3]:33798 helo=sv.gnu.org)
	by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32)
	(Exim 4.60) (envelope-from <INVALID.NOREPLY@gnu.org>)
	id 1KuPaP-0006cF-OE
	for myserver-commit@gnu.org; Mon, 27 Oct 2008 06:44:38 -0400
Received: from cvs.savannah.gnu.org ([199.232.41.69])
	by sv.gnu.org with esmtp (Exim 4.63)
	(envelope-from <INVALID.NOREPLY@gnu.org>) id 1KuPaO-0006P6-Dp
	for myserver-commit@gnu.org; Mon, 27 Oct 2008 10:44:36 +0000
Received: from gscrivano by cvs.savannah.gnu.org with local (Exim 4.63)
	(envelope-from <gscrivano@savannah.gnu.org>) id 1KuPaN-0006P1-Jo
	for myserver-commit@gnu.org; Mon, 27 Oct 2008 10:44:36 +0000
MIME-Version: 1.0
Errors-To: gscrivano
To: myserver-commit@gnu.org
X-Mailer: SVN::Notify 2.64: http://search.cpan.org/dist/SVN-Notify/
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
From: Giuseppe Scrivano <gscrivano@gnu.org>
Message-Id: <E1KuPaN-0006P1-Jo@cvs.savannah.gnu.org>
Date: Mon, 27 Oct 2008 10:44:35 +0000
X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 3)
Subject: [myserver-commit] [2916] Reduced
 `HttpHeaders::buildHTTPRequestHeaderStruct'
 complexity extracting new methods.
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/pipermail/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, 27 Oct 2008 10:44:41 -0000

Revision: 2916
          http://svn.sv.gnu.org/viewvc/?view=rev&root=myserver&revision=2916
Author:   gscrivano
Date:     2008-10-27 10:44:34 +0000 (Mon, 27 Oct 2008)

Log Message:
-----------
Reduced `HttpHeaders::buildHTTPRequestHeaderStruct' complexity extracting new methods.

Modified Paths:
--------------
    trunk/myserver/include/protocol/http/http_headers.h
    trunk/myserver/src/protocol/http/http_headers.cpp

Modified: trunk/myserver/include/protocol/http/http_headers.h
===================================================================
--- trunk/myserver/include/protocol/http/http_headers.h	2008-10-26 20:01:10 UTC (rev 2915)
+++ trunk/myserver/include/protocol/http/http_headers.h	2008-10-27 10:44:34 UTC (rev 2916)
@@ -48,26 +48,37 @@
 class HttpHeaders
 {
 public:
-	static int buildHTTPRequestHeaderStruct(const char* input,
-                                          u_long inputSize,
-                                          u_long* nHeaderChars,
-                                          HttpRequestHeader *request, 
-                                          Connection* connection);
-
-	static int buildHTTPResponseHeaderStruct(const char *input, 
+	static int buildHTTPRequestHeaderStruct (const char* input,
+                                           u_long inputSize,
+                                           u_long* nHeaderChars,
+                                           HttpRequestHeader *request, 
+                                           Connection* connection);
+  
+	static int buildHTTPResponseHeaderStruct (const char *input, 
                                            HttpResponseHeader *response, 
                                            u_long* nbtr);
 
-	static int validHTTPRequest(const char*, u_long, u_long*, u_long*);
-	static int validHTTPResponse(const char*, u_long*, u_long*);
+	static int validHTTPRequest (const char*, u_long, u_long*, u_long*);
+	static int validHTTPResponse (const char*, u_long*, u_long*);
 
-	static void resetHTTPRequest(HttpRequestHeader *request);
-	static void resetHTTPResponse(HttpResponseHeader *response);
+	static void resetHTTPRequest (HttpRequestHeader *request);
+	static void resetHTTPResponse (HttpResponseHeader *response);
 
-	static void buildDefaultHTTPResponseHeader(HttpResponseHeader*);
-	static void buildDefaultHTTPRequestHeader(HttpRequestHeader*);
+	static void buildDefaultHTTPResponseHeader (HttpResponseHeader*);
+	static void buildDefaultHTTPRequestHeader (HttpRequestHeader*);
 
-	static void buildHTTPResponseHeader(char *, HttpResponseHeader*);
-	static void buildHTTPRequestHeader(char *, HttpRequestHeader*);
+	static void buildHTTPResponseHeader (char *, HttpResponseHeader*);
+	static void buildHTTPRequestHeader (char *, HttpRequestHeader*);
+
+protected:
+  static int readReqAuthLine (HttpRequestHeader *request, 
+                              Connection *connection, 
+                              const char *token,
+                              int *lenOut);
+
+  static int readReqRangeLine (HttpRequestHeader *request, 
+                               Connection *connection, 
+                               const char *token,
+                               int *lenOut);
 };
 #endif

Modified: trunk/myserver/src/protocol/http/http_headers.cpp
===================================================================
--- trunk/myserver/src/protocol/http/http_headers.cpp	2008-10-26 20:01:10 UTC (rev 2915)
+++ trunk/myserver/src/protocol/http/http_headers.cpp	2008-10-27 10:44:34 UTC (rev 2916)
@@ -654,180 +654,10 @@
     /* Authorization.  */
     if(!strcmpi(command,"Authorization"))
     {
-      while(*token==' ')
-        token++;
-      tokenOff = getCharInString(token," ",HTTP_REQUEST_AUTH_DIM);
-            
-      if(tokenOff==-1)return 400;
-    
+      int ret = readReqAuthLine (request, connection, token, &tokenOff);
+      if (ret)
+        return ret;
       lineControlled = 1;
-  
-      request->auth.assign(token,tokenOff);
-      connection->setLogin("");
-      connection->setPassword("");
-      if(!request->auth.compare("Basic"))
-      {
-        u_long i;
-        const char *base64 = &token[strlen("Basic ")];
-        int len = getEndLine(base64, 64);
-        const char *tmp = base64 + len - 1;
-        const char* lsecondaryBuffer;
-        const char* keep_lsecondaryBuffer;
-        char login[32];
-        char password[32];
-        
-        if(len == -1)
-          return 400;    
-
-        login[0] = password[0] = '\0';
-
-        while (len > 0 && (*tmp == '\r' || *tmp == '\n'))
-        {
-          tmp--;
-          len--;
-        }
-        if (len <= 1)
-          return 400;
-        lsecondaryBuffer = base64Utils.Decode(base64,&len);
-        keep_lsecondaryBuffer = lsecondaryBuffer;
-   
-        for(i = 0; (*lsecondaryBuffer != ':') && (i < 32);i++)
-        {
-          login[i] = *lsecondaryBuffer++;
-          login[i+1] = '\0';
-        }
-        lsecondaryBuffer++;
-        for(i = 0; (*lsecondaryBuffer) && (i < 31); i++)
-        {
-          password[i] = *lsecondaryBuffer++;
-          password[i+1] = '\0';
-        }
-        connection->setLogin(login);
-        connection->setPassword(password);
-        tokenOff = getEndLine(token, 100);
-        delete keep_lsecondaryBuffer;
-      }
-      else if(!request->auth.compare("Digest"))
-      {
-        char *digestBuff;
-        char *digestToken;
-        token += tokenOff;
-        while(*token == ' ')
-          token++;
-        tokenOff = getEndLine(token, 1024);
-        if(tokenOff==-1)
-          return 400;    
-        digestBuff=new char[tokenOff+1];
-        if(!digestBuff)
-          return 400;
-        memcpy(digestBuff,token,tokenOff);
-        digestBuff[tokenOff]='\0';
-        digestToken = strtok( digestBuff, "=" );
-        if(!digestToken)
-          return 400;
-        do
-        {
-          StrTrim(digestToken, (char*)" ");
-          if(!strcmpi(digestToken, (char*)"nonce"))
-          {
-            digestToken = strtok( NULL, (char*)"," );
-            if(digestToken)
-            {
-              StrTrim(digestToken, (char*)"\" ");
-              myserver_strlcpy(request->digestNonce,digestToken,48+1);
-            }
-          }
-          else if(!strcmpi(digestToken, (char*)"opaque"))
-          {
-            digestToken = strtok( NULL, (char*)"," );
-            if(digestToken)
-            {
-              StrTrim(digestToken, (char*)"\" ");
-              myserver_strlcpy(request->digestOpaque,digestToken,48+1);
-            }
-          }
-          else if(!strcmpi(digestToken, (char*)"uri"))
-          {
-            digestToken = strtok( NULL, (char*)"\r\n," );
-            if(digestToken)
-            {
-              StrTrim(digestToken, (char*)"\" ");
-              myserver_strlcpy(request->digestUri,digestToken,1024+1);
-            }
-          }
-          else if(!strcmpi(digestToken, (char*)"method"))
-          {
-            digestToken = strtok( NULL, (char*)"\r\n," );
-            if(digestToken)
-            {
-              StrTrim(digestToken, (char*)"\" ");
-              myserver_strlcpy(request->digestMethod,digestToken,16+1);
-            }
-          }  
-          else if(!strcmpi(digestToken, (char*)"qop"))
-          {
-            digestToken = strtok( NULL, (char*)"\r\n," );
-            if(digestToken)
-            {
-              StrTrim(digestToken,(char*)"\" ");
-              myserver_strlcpy(request->digestQop,digestToken,16+1);
-            }
-          }          
-          else if(!strcmpi(digestToken, (char*)"realm"))
-          {
-            digestToken = strtok( NULL, (char*)"\r\n," );
-            if(digestToken)
-            {
-              StrTrim(digestToken, (char*)"\" ");
-              myserver_strlcpy(request->digestRealm,digestToken,48+1);
-            }
-          }
-          else if(!strcmpi(digestToken, (char*)"cnonce"))
-          {
-            digestToken = strtok( NULL, (char*)"\r\n," );
-            if(digestToken)
-            {
-              StrTrim(digestToken, (char*)" \"");
-              myserver_strlcpy(request->digestCnonce, digestToken, 48+1);
-            }
-          }
-          else if(!strcmpi(digestToken, (char*)"username"))
-          {
-            digestToken = strtok( NULL, (char*)"\r\n," );
-            if(digestToken)
-            {
-              StrTrim(digestToken, (char*)"\" ");
-              myserver_strlcpy(request->digestUsername, digestToken, 48+1);
-              connection->setLogin(digestToken);
-            }
-          }
-          else if(!strcmpi(digestToken, (char*)"response"))
-          {
-            digestToken = strtok( NULL, "\r\n," );
-            if(digestToken)
-             {
-               StrTrim(digestToken, (char*)"\" ");
-               myserver_strlcpy(request->digestResponse,digestToken,48+1);
-             }
-          }
-          else if(!strcmpi(digestToken, (char*)"nc"))
-          {
-            digestToken = strtok( NULL, (char*)"\r\n," );
-            if(digestToken)
-            {
-              StrTrim(digestToken, (char*)"\" ");
-              myserver_strlcpy(request->digestNc,digestToken,10+1);
-            }
-          }
-          else 
-          {
-            digestToken = strtok( NULL, (char*)"\r\n," );
-          }
-          /* Update digestToken.  */
-          digestToken = strtok( NULL, (char*)"=" );
-        }while(digestToken);
-        delete  [] digestBuff;
-      }
     }else
     /* Content-Length.  */
     if(!strcmpi(command, (char*)"Content-Length"))
@@ -841,71 +671,10 @@
     /* Range.  */
     if(!strcmpi(command, (char*)"Range"))
     {
-      char rangeByteBegin[13];
-      char rangeByteEnd[13];
-      const char *localToken = token;
-      int i=0;
-      rangeByteBegin[0] = '\0';
-      rangeByteEnd[0] = '\0';
+      int ret = readReqRangeLine (request, connection, token, &tokenOff);
+      if (ret)
+        return ret;
       lineControlled = 1;
-      tokenOff = getEndLine(token, HTTP_REQUEST_RANGE_TYPE_DIM+30);
-      if(tokenOff ==-1)
-        return 400;
-      do
-      {
-        i++;
-      }
-      while((*(++localToken) != '=')&&(i<HTTP_REQUEST_RANGE_TYPE_DIM));
-
-      request->rangeType.assign(token, i);
-
-      i=0;
-      localToken++;
-      do
-      {
-        rangeByteBegin[i++] = *localToken;
-        rangeByteBegin[i] = '\0';
-      }
-      while((*(++localToken) != '-') && (i<12) && (*localToken != '\r'));
-      i = 0;
-      localToken++;
-      do
-      {
-        rangeByteEnd[i++] = *localToken;
-        rangeByteEnd[i] = '\0';
-      }
-      while((*(++localToken) != '\r' )&&(i<12));
-
-      for(i=0;i < static_cast<int>(request->rangeType.length()); i++)
-        if(request->rangeType[i] == '=')
-          request->rangeType[i] = '\0';
-
-      for(i = 0; i < static_cast<int>(strlen(rangeByteBegin)); i++)
-        if(rangeByteBegin[i] == '=')
-          rangeByteBegin[i] = '\0';
-
-      for(i = 0; i < static_cast<int>(strlen(rangeByteEnd)); i++)
-        if(rangeByteEnd[i]== '=')
-          rangeByteEnd[i]='\0';
-      
-      if(rangeByteBegin[0] == 0)
-      {
-        request->rangeByteBegin=0;
-      }      
-      else
-      {
-        request->rangeByteBegin = (u_long)atol(rangeByteBegin); 
-      }
-      if(rangeByteEnd[0] == '\r')
-      {
-        request->rangeByteEnd = 0;
-      }
-      else
-      {
-        request->rangeByteEnd = (u_long)atol(rangeByteEnd);
-        if(request->rangeByteEnd < request->rangeByteBegin)
-          return 400;
-      }
     }else
     if(!lineControlled)
     {
@@ -938,8 +707,8 @@
       }
     }
     token+= tokenOff + 2;
-    tokenOff = getCharInString(token,":",maxTotchars);
-  }while(((u_long)(token-input)<maxTotchars) && token[0]!='\r');
+    tokenOff = getCharInString(token, ":", maxTotchars);
+  }while (((u_long)(token - input) < maxTotchars) && token[0] != '\r');
 
   /*
    *END REQUEST STRUCTURE BUILD.
@@ -949,6 +718,292 @@
 }
 
 /*!
+ *Parse the range line in a HTTP request.
+ *\param request HttpRequest object to fill.
+ *\param connection Pointer to a connection structure.
+ *\param token Pointer to the beginning of the authorization line.
+ *\param lenOut Pointer to an itneger to keep the line length.
+ *\return 0 on success, any other value is the HTTP error.
+ */
+int HttpHeaders::readReqRangeLine (HttpRequestHeader *request, 
+                                   Connection *connection, 
+                                   const char *token,
+                                   int *lenOut)
+{
+  char rangeByteBegin[13];
+  char rangeByteEnd[13];
+  const char *localToken = token;
+  int i = 0;
+  rangeByteBegin[0] = '\0';
+  rangeByteEnd[0] = '\0';
+
+  int tokenOff = getEndLine(token, HTTP_REQUEST_RANGE_TYPE_DIM + 30);
+  if(tokenOff ==-1)
+    return 400;
+  
+  *lenOut = tokenOff;
+
+  do
+    {
+      i++;
+    }
+  while((*(++localToken) != '=') && (i < HTTP_REQUEST_RANGE_TYPE_DIM));
+
+  request->rangeType.assign(token, i);
+
+  i = 0;
+  localToken++;
+  
+  do
+    {
+      rangeByteBegin[i++] = *localToken;
+      rangeByteBegin[i] = '\0';
+    }
+  while((*(++localToken) != '-') && (i<12) && (*localToken != '\r'));
+  
+  i = 0;
+  localToken++;
+  do
+    {
+      rangeByteEnd[i++] = *localToken;
+      rangeByteEnd[i] = '\0';
+    }
+  while((*(++localToken) != '\r' )&&(i<12));
+
+  for(i=0;i < static_cast<int>(request->rangeType.length()); i++)
+    if(request->rangeType[i] == '=')
+      request->rangeType[i] = '\0';
+  
+  for(i = 0; i < static_cast<int>(strlen(rangeByteBegin)); i++)
+    if(rangeByteBegin[i] == '=')
+      rangeByteBegin[i] = '\0';
+  
+  for(i = 0; i < static_cast<int>(strlen(rangeByteEnd)); i++)
+    if(rangeByteEnd[i]== '=')
+      rangeByteEnd[i]='\0';
+      
+  if(rangeByteBegin[0] == 0)
+    {
+      request->rangeByteBegin=0;
+    }      
+  else
+    {
+      request->rangeByteBegin = (u_long)atol(rangeByteBegin); 
+    }
+  if(rangeByteEnd[0] == '\r')
+    {
+      request->rangeByteEnd = 0;
+    }
+  else
+    {
+      request->rangeByteEnd = (u_long)atol(rangeByteEnd);
+      if(request->rangeByteEnd < request->rangeByteBegin)
+        return 400;
+    }
+
+  return 0;
+}
+
+/*!
+ *Parse the authorization line in a HTTP request.
+ *\param request HttpRequest object to fill.
+ *\param connection Pointer to a connection structure.
+ *\param token Pointer to the beginning of the authorization line.
+ *\param lenOut Pointer to an itneger to keep the line length.
+ *\return 0 on success, any other value is the HTTP error.
+ */
+int HttpHeaders::readReqAuthLine (HttpRequestHeader *request, 
+                                  Connection *connection,
+                                  const char *token,
+                                  int *lenOut)
+{
+  while(*token==' ')
+    token++;
+  int tokenOff = getCharInString(token, " ", HTTP_REQUEST_AUTH_DIM);
+  
+  if(tokenOff==-1)
+    return 400;
+
+  request->auth.assign(token, tokenOff);
+  connection->setLogin("");
+  connection->setPassword("");
+
+  if(!request->auth.compare("Basic"))
+    {
+      u_long i;
+      const char *base64 = &token[6];
+      int len = getEndLine(base64, 64);
+      const char *tmp = base64 + len - 1;
+      const char* lsecondaryBuffer;
+      const char* lsecondaryBufferOr;
+      char login[32];
+      char password[32];
+      
+      if(len == -1)
+        return 400;    
+      
+      login[0] = password[0] = '\0';
+        
+      while (len > 0 && (*tmp == '\r' || *tmp == '\n'))
+        {
+          tmp--;
+          len--;
+        }
+      if (len <= 1)
+        return 400;
+      
+      lsecondaryBuffer = base64Utils.Decode(base64,&len);
+      lsecondaryBufferOr = lsecondaryBuffer;
+   
+      for(i = 0; (*lsecondaryBuffer != ':') && (i < 32);i++)
+        {
+          login[i] = *lsecondaryBuffer++;
+        }
+      login[i] = '\0';
+      
+      lsecondaryBuffer++;
+      for(i = 0; (*lsecondaryBuffer) && (i < 31); i++)
+        {
+          password[i] = *lsecondaryBuffer++;
+        }
+      password[i] = '\0';
+      
+      connection->setLogin(login);
+      connection->setPassword(password);
+      delete lsecondaryBufferOr;
+      *lenOut = tokenOff = getEndLine(token, 100);
+    }
+  else if(!request->auth.compare("Digest"))
+    {
+      char *digestBuff;
+      char *digestToken;
+      token += tokenOff;
+      
+      while(*token == ' ')
+        token++;
+
+      *lenOut = tokenOff = getEndLine(token, 1024);
+
+      if (tokenOff == -1)
+        return 400;    
+
+      digestBuff=new char[tokenOff+1];
+
+      if (!digestBuff)
+        return 400;
+
+      memcpy(digestBuff, token, tokenOff);
+      digestBuff[tokenOff]='\0';
+      digestToken = strtok( digestBuff, "=" );
+      if(!digestToken)
+        return 400;
+      do
+        {
+          StrTrim(digestToken, (char*)" ");
+          if(!strcmpi(digestToken, (char*)"nonce"))
+            {
+              digestToken = strtok( NULL, (char*)"," );
+              if(digestToken)
+                {
+                  StrTrim(digestToken, (char*)"\" ");
+                  myserver_strlcpy(request->digestNonce,digestToken,48+1);
+                }
+            }
+          else if(!strcmpi(digestToken, (char*)"opaque"))
+            {
+              digestToken = strtok( NULL, (char*)"," );
+              if(digestToken)
+                {
+                  StrTrim(digestToken, (char*)"\" ");
+                  myserver_strlcpy(request->digestOpaque,digestToken,48+1);
+                }
+            }
+          else if(!strcmpi(digestToken, (char*)"uri"))
+            {
+              digestToken = strtok( NULL, (char*)"\r\n," );
+              if(digestToken)
+                {
+                  StrTrim(digestToken, (char*)"\" ");
+                  myserver_strlcpy(request->digestUri,digestToken,1024+1);
+                }
+            }
+          else if(!strcmpi(digestToken, (char*)"method"))
+            {
+              digestToken = strtok( NULL, (char*)"\r\n," );
+              if(digestToken)
+                {
+                  StrTrim(digestToken, (char*)"\" ");
+                  myserver_strlcpy(request->digestMethod,digestToken,16+1);
+                }
+            }  
+          else if(!strcmpi(digestToken, (char*)"qop"))
+            {
+              digestToken = strtok( NULL, (char*)"\r\n," );
+              if(digestToken)
+                {
+                  StrTrim(digestToken,(char*)"\" ");
+                  myserver_strlcpy(request->digestQop,digestToken,16+1);
+                }
+            }          
+          else if(!strcmpi(digestToken, (char*)"realm"))
+            {
+              digestToken = strtok( NULL, (char*)"\r\n," );
+              if(digestToken)
+                {
+                  StrTrim(digestToken, (char*)"\" ");
+                  myserver_strlcpy(request->digestRealm,digestToken,48+1);
+                }
+            }
+          else if(!strcmpi(digestToken, (char*)"cnonce"))
+            {
+              digestToken = strtok( NULL, (char*)"\r\n," );
+              if(digestToken)
+                {
+                  StrTrim(digestToken, (char*)" \"");
+                  myserver_strlcpy(request->digestCnonce, digestToken, 48+1);
+                }
+            }
+          else if(!strcmpi(digestToken, (char*)"username"))
+            {
+              digestToken = strtok( NULL, (char*)"\r\n," );
+              if(digestToken)
+                {
+                  StrTrim(digestToken, (char*)"\" ");
+                  myserver_strlcpy(request->digestUsername, digestToken, 48+1);
+                  connection->setLogin(digestToken);
+                }
+            }
+          else if(!strcmpi(digestToken, (char*)"response"))
+            {
+              digestToken = strtok( NULL, "\r\n," );
+              if(digestToken)
+                {
+                  StrTrim(digestToken, (char*)"\" ");
+                  myserver_strlcpy(request->digestResponse,digestToken,48+1);
+                }
+            }
+          else if(!strcmpi(digestToken, (char*)"nc"))
+            {
+              digestToken = strtok( NULL, (char*)"\r\n," );
+              if(digestToken)
+                {
+                  StrTrim(digestToken, (char*)"\" ");
+                  myserver_strlcpy(request->digestNc,digestToken,10+1);
+                }
+            }
+          else 
+            {
+              digestToken = strtok( NULL, (char*)"\r\n," );
+            }
+          /* Update digestToken.  */
+          digestToken = strtok( NULL, (char*)"=" );
+        }while(digestToken);
+      delete  [] digestBuff;
+    }
+  return 0;
+}
+
+/*!
  *Build the HTTP RESPONSE HEADER string.
  *If no input is specified the input is the main buffer of the 
  *HttpThreadContext structure.





From MAILER-DAEMON Mon Oct 27 12:23:27 2008
Received: from mailman by lists.gnu.org with archive (Exim 4.43)
	id 1KuUsJ-0007FR-Et
	for mharc-myserver-commit@gnu.org; Mon, 27 Oct 2008 12:23:27 -0400
Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43)
	id 1KuUsH-0007DK-PS
	for myserver-commit@gnu.org; Mon, 27 Oct 2008 12:23:25 -0400
Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43)
	id 1KuUsH-0007Ci-Ar
	for myserver-commit@gnu.org; Mon, 27 Oct 2008 12:23:25 -0400
Received: from [199.232.76.173] (port=44045 helo=monty-python.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.43) id 1KuUsH-0007CR-30
	for myserver-commit@gnu.org; Mon, 27 Oct 2008 12:23:25 -0400
Received: from savannah.gnu.org ([199.232.41.3]:60498 helo=sv.gnu.org)
	by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32)
	(Exim 4.60) (envelope-from <INVALID.NOREPLY@gnu.org>)
	id 1KuUsH-0002oI-8B
	for myserver-commit@gnu.org; Mon, 27 Oct 2008 12:23:25 -0400
Received: from cvs.savannah.gnu.org ([199.232.41.69])
	by sv.gnu.org with esmtp (Exim 4.63)
	(envelope-from <INVALID.NOREPLY@gnu.org>) id 1KuUsF-0000cq-9f
	for myserver-commit@gnu.org; Mon, 27 Oct 2008 16:23:23 +0000
Received: from francesco_pipita by cvs.savannah.gnu.org with local (Exim 4.63)
	(envelope-from <francesco_pipita@savannah.gnu.org>)
	id 1KuUsE-0000ci-Hu
	for myserver-commit@gnu.org; Mon, 27 Oct 2008 16:23:22 +0000
MIME-Version: 1.0
Errors-To: francesco_pipita
To: myserver-commit@gnu.org
X-Mailer: SVN::Notify 2.64: http://search.cpan.org/dist/SVN-Notify/
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
From: Francesco Pipita <francesco.pipita@gmail.com>
Message-Id: <E1KuUsE-0000ci-Hu@cvs.savannah.gnu.org>
Date: Mon, 27 Oct 2008 16:23:22 +0000
X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 3)
Subject: [myserver-commit] [2917] Added missing `protocols_manager.h' to
 `include/protocol/Makefile.am '.
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/pipermail/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, 27 Oct 2008 16:23:26 -0000

Revision: 2917
          http://svn.sv.gnu.org/viewvc/?view=rev&root=myserver&revision=2917
Author:   francesco_pipita
Date:     2008-10-27 16:23:21 +0000 (Mon, 27 Oct 2008)

Log Message:
-----------
Added missing `protocols_manager.h' to `include/protocol/Makefile.am'.

Modified Paths:
--------------
    trunk/myserver/include/protocol/Makefile.am

Modified: trunk/myserver/include/protocol/Makefile.am
===================================================================
--- trunk/myserver/include/protocol/Makefile.am	2008-10-27 10:44:34 UTC (rev 2916)
+++ trunk/myserver/include/protocol/Makefile.am	2008-10-27 16:23:21 UTC (rev 2917)
@@ -1,4 +1,4 @@
 protocolincludedir=$(includedir)/myserver/include/protocol
-protocolinclude_HEADERS = protocol_buffer.h protocol.h
+protocolinclude_HEADERS = protocol_buffer.h protocol.h protocols_manager.h
 SUBDIRS = control ftp http https
 





From MAILER-DAEMON Mon Oct 27 16:41:30 2008
Received: from mailman by lists.gnu.org with archive (Exim 4.43)
	id 1KuYu2-00089M-Fr
	for mharc-myserver-commit@gnu.org; Mon, 27 Oct 2008 16:41:30 -0400
Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43)
	id 1KuYu1-00089C-36
	for myserver-commit@gnu.org; Mon, 27 Oct 2008 16:41:29 -0400
Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43)
	id 1KuYu0-00088p-2B
	for myserver-commit@gnu.org; Mon, 27 Oct 2008 16:41:28 -0400
Received: from [199.232.76.173] (port=52430 helo=monty-python.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.43) id 1KuYtz-00088l-TX
	for myserver-commit@gnu.org; Mon, 27 Oct 2008 16:41:27 -0400
Received: from savannah.gnu.org ([199.232.41.3]:60653 helo=sv.gnu.org)
	by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32)
	(Exim 4.60) (envelope-from <INVALID.NOREPLY@gnu.org>)
	id 1KuYtz-0008AN-0h
	for myserver-commit@gnu.org; Mon, 27 Oct 2008 16:41:27 -0400
Received: from cvs.savannah.gnu.org ([199.232.41.69])
	by sv.gnu.org with esmtp (Exim 4.63)
	(envelope-from <INVALID.NOREPLY@gnu.org>) id 1KuYtu-00081t-Ji
	for myserver-commit@gnu.org; Mon, 27 Oct 2008 20:41:22 +0000
Received: from ignacy by cvs.savannah.gnu.org with local (Exim 4.63)
	(envelope-from <ignacy@savannah.gnu.org>) id 1KuYtu-00081p-DU
	for myserver-commit@gnu.org; Mon, 27 Oct 2008 20:41:22 +0000
MIME-Version: 1.0
Errors-To: ignacy
To: myserver-commit@gnu.org
X-Mailer: SVN::Notify 2.64: http://search.cpan.org/dist/SVN-Notify/
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
From: Ignacy Moryc <imoryc@gmail.com>
Message-Id: <E1KuYtu-00081p-DU@cvs.savannah.gnu.org>
Date: Mon, 27 Oct 2008 20:41:22 +0000
X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 3)
Subject: [myserver-commit] [2918] Config serialization functionality
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/pipermail/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, 27 Oct 2008 20:41:29 -0000

Revision: 2918
          http://svn.sv.gnu.org/viewvc/?view=rev&root=myserver&revision=2918
Author:   ignacy
Date:     2008-10-27 20:41:22 +0000 (Mon, 27 Oct 2008)

Log Message:
-----------
Config serialization functionality

Modified Paths:
--------------
    trunk/misc/PyGTK_Control/ConfigGUI.py

Modified: trunk/misc/PyGTK_Control/ConfigGUI.py
===================================================================
--- trunk/misc/PyGTK_Control/ConfigGUI.py	2008-10-27 16:23:21 UTC (rev 2917)
+++ trunk/misc/PyGTK_Control/ConfigGUI.py	2008-10-27 20:41:22 UTC (rev 2918)
@@ -15,7 +15,6 @@
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
-
 import sys
 import gobject
 
@@ -299,8 +298,41 @@
         """ This function serializes the configurtion settings
         and returns a dictionary with pairs:
         name_of_setting: vlue """
+        # TODO: Change the combobox to have default prop
         settings = { 'LANGUGE' : self.get("combobox2").get_active_text().partition(".")[0].capitalize(), \
-                     'VERBOSITY' :  self.get("cbVerbosityLevel").get_active_text() }
+                     'VERBOSITY' :  self.get("cbVerbosityLevel").get_active_text(), \
+                     'NTHREADS_STATIC' : self.get("enAlwysActiveThreads").get_text(), \
+                     'NTHREADS_MAX' : self.get("enMaximumNumberOfThreads").get_text(), \
+                     'BUFFER_SIZE' : self.get("enMemoryBuffer").get_text(), \
+                     #TODO Inesrt default filenames from treeview
+                     'CONNECTION_TIMEOUT' : self.get("enConnectionTimeOut").get_text(), \
+                     #'USE_ERROR_FILE' : self.get
+                     'MAX_CONNECTIONS' : self.get("enMaxConnections").get_text(), \
+                     'MAX_LOG_FILE_SIZE' : self.get("enMaxLogFileSize").get_text(), \
+                     'BROWSEFOLDER_CSS' : self.get("enStylesheet").get_text(), \
+                     'SERVER_ADMIN' : self.get("entry10").get_text(), \
+                     'GZIP_THRESHOLD' : self.get("enGzipCompressionThreshold").get_text(), \
+                     #'FOLLOW_LINKS'
+                     #'MAX_FILESCACHE_SIZE' : self.get("").get_text(), \
+                     #'MAX_FILESCACHE_FILESIZE' : self.get("").get_text(), \
+                     #'MIN_FILESCACHE_FILESIZE' : self.get("").get_text(), \
+                     #'USE_HOME_DIRECTORY' : self.get("").get_text(), \
+                     #'HOME_DIRECTORY' : self.get("").get_text(), \
+                     #'CONTROL_ENABLED' : self.get("").get_text(), \
+                     'ALLOW_CGI' : 'YES' if self.get("checkbutton8").get_active() else 'NO', \
+                     'ALLOW_FASTCGI'  : 'YES' if self.get("checkbutton12").get_active() else 'NO', \
+                     'ALLOW_ISAPI' : 'YES' if self.get("checkbutton9").get_active() else 'NO', \
+                     'ALLOW_WINCGI' : 'YES' if self.get("checkbutton11").get_active() else 'NO', \
+                     'ALLOW_MSCGI' : 'YES' if self.get("checkbutton10").get_active() else 'NO', \
+                     'ALLOW_SCGI' : 'YES' if self.get("checkbutton13").get_active() else 'NO', \
+                     'ALLOW_SEND_LINK' : 'YES' if self.get("checkbutton14").get_active() else 'NO', \
+                     'ALLOW_EXTERNAL_COMMANDS' : 'YES' if self.get("checkbutton15").get_active() else 'NO', \
+                     'ALLOW_SEND_FILE' : 'YES' if self.get("checkbutton16").get_active() else 'NO', \
+                     #'MAX_SERVERS_PROCESSES' : self.get("").get_text(), \
+                     #'SERVERS_PROCESSES_INITIAL_PORT' : self.get("").get_text(), \
+                     'CONTROL_ADMIN' : self.get("entry11").get_text(), \
+                     'CONTROL_PASSWORD' : self.get("entry12").get_text(), \
+                      }
         return settings
 
 





From MAILER-DAEMON Mon Oct 27 20:03:12 2008
Received: from mailman by lists.gnu.org with archive (Exim 4.43)
	id 1Kuc3E-0004Xd-Ju
	for mharc-myserver-commit@gnu.org; Mon, 27 Oct 2008 20:03:12 -0400
Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43)
	id 1Kuc3D-0004W0-37
	for myserver-commit@gnu.org; Mon, 27 Oct 2008 20:03:11 -0400
Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43)
	id 1Kuc3C-0004VQ-GP
	for myserver-commit@gnu.org; Mon, 27 Oct 2008 20:03:10 -0400
Received: from [199.232.76.173] (port=59598 helo=monty-python.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.43) id 1Kuc3C-0004VN-98
	for myserver-commit@gnu.org; Mon, 27 Oct 2008 20:03:10 -0400
Received: from savannah.gnu.org ([199.232.41.3]:40646 helo=sv.gnu.org)
	by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32)
	(Exim 4.60) (envelope-from <INVALID.NOREPLY@gnu.org>)
	id 1Kuc3B-0001Ra-N6
	for myserver-commit@gnu.org; Mon, 27 Oct 2008 20:03:09 -0400
Received: from cvs.savannah.gnu.org ([199.232.41.69])
	by sv.gnu.org with esmtp (Exim 4.63)
	(envelope-from <INVALID.NOREPLY@gnu.org>) id 1Kuc3B-0001lA-7I
	for myserver-commit@gnu.org; Tue, 28 Oct 2008 00:03:09 +0000
Received: from francesco_pipita by cvs.savannah.gnu.org with local (Exim 4.63)
	(envelope-from <francesco_pipita@savannah.gnu.org>)
	id 1Kuc3B-0001l6-0H
	for myserver-commit@gnu.org; Tue, 28 Oct 2008 00:03:09 +0000
MIME-Version: 1.0
Errors-To: francesco_pipita
To: myserver-commit@gnu.org
X-Mailer: SVN::Notify 2.64: http://search.cpan.org/dist/SVN-Notify/
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
From: Francesco Pipita <francesco.pipita@gmail.com>
Message-Id: <E1Kuc3B-0001l6-0H@cvs.savannah.gnu.org>
Date: Tue, 28 Oct 2008 00:03:09 +0000
X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 3)
Subject: [myserver-commit] [2919] Fixed a problem with reboots.
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/pipermail/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, 28 Oct 2008 00:03:11 -0000

Revision: 2919
          http://svn.sv.gnu.org/viewvc/?view=rev&root=myserver&revision=2919
Author:   francesco_pipita
Date:     2008-10-28 00:03:08 +0000 (Tue, 28 Oct 2008)

Log Message:
-----------
Fixed a problem with reboots.

Modified Paths:
--------------
    trunk/myserver/src/log/log_manager.cpp
    trunk/myserver/src/server/server.cpp
    trunk/myserver/tests/test_log_manager.cpp

Modified: trunk/myserver/src/log/log_manager.cpp
===================================================================
--- trunk/myserver/src/log/log_manager.cpp	2008-10-27 20:41:22 UTC (rev 2918)
+++ trunk/myserver/src/log/log_manager.cpp	2008-10-28 00:03:08 UTC (rev 2919)
@@ -112,6 +112,11 @@
   return 1;
 }
 
+/*
+ * Remove all the logs owned by `owner' and `owner' as well.
+ * After the call to this method, a call to contains (owner)
+ * must return false.
+ */
 int 
 LogManager::remove (void* owner)
 {
@@ -119,20 +124,21 @@
   int success = 1;
   if (contains (owner))
     {
-      map<string, map<string, LogStream*> > m = owners[owner];
+      map<string, map<string, LogStream*> > *m = &owners[owner];
       map<string, map<string, LogStream*> >::iterator it_1;
-      for (it_1 = m.begin (); it_1 != m.end (); it_1++)
+      for (it_1 = m->begin (); it_1 != m->end (); it_1++)
         {
-          map<string, LogStream*> t = it_1->second;
+          map<string, LogStream*> *t = &it_1->second;
           map<string, LogStream*>::iterator it_2;
-          for (it_2 = t.begin (); it_2 != t.end (); it_2++)
+          for (it_2 = t->begin (); it_2 != t->end (); it_2++)
             {
               delete it_2->second;
               logStreams.erase (it_2->first);
             }
-          t.clear ();
+          t->clear ();
         }
-      m.clear ();
+      m->clear ();
+      owners.erase (owner);
       success = 0;
     }
   mutex->unlock ();

Modified: trunk/myserver/src/server/server.cpp
===================================================================
--- trunk/myserver/src/server/server.cpp	2008-10-27 20:41:22 UTC (rev 2918)
+++ trunk/myserver/src/server/server.cpp	2008-10-28 00:03:08 UTC (rev 2919)
@@ -99,16 +99,22 @@
   vhostList = 0;
   purgeThreadsThreshold = 1;
   freeThreads = 0;
+  logManager = new LogManager (&filtersFactory);
   initLogManager ();
 }
 
 void
 Server::initLogManager ()
 {
-  logLocation.assign ("console://stdout");
-  logManager = new LogManager (&filtersFactory);
-  list<string> filters;
-  logManager->add (this, "MAINLOG", logLocation, filters, 0);
+  if (!logLocation.size ())
+    {
+      logLocation.assign ("console://stdout");
+    }
+  if (!logManager->contains (this))
+    {
+      list<string> filters;
+      logManager->add (this, "MAINLOG", logLocation, filters, 0);
+    }
 }
 
 /*!
@@ -987,6 +993,7 @@
  */
 int Server::initialize()
 {
+  initLogManager ();
   char *data;
 #ifdef WIN32
   envString = GetEnvironmentStrings();

Modified: trunk/myserver/tests/test_log_manager.cpp
===================================================================
--- trunk/myserver/tests/test_log_manager.cpp	2008-10-27 20:41:22 UTC (rev 2918)
+++ trunk/myserver/tests/test_log_manager.cpp	2008-10-28 00:03:08 UTC (rev 2919)
@@ -84,6 +84,7 @@
     CPPUNIT_ASSERT (lm->remove (this));
     lm->add (this, "test", "file://foo", filters, 0);
     CPPUNIT_ASSERT (!lm->remove (this));
+    CPPUNIT_ASSERT (!lm->contains (this));
   }
 
   void testLog ()





From MAILER-DAEMON Tue Oct 28 15:51:33 2008
Received: from mailman by lists.gnu.org with archive (Exim 4.43)
	id 1KuubF-0001qq-8g
	for mharc-myserver-commit@gnu.org; Tue, 28 Oct 2008 15:51:33 -0400
Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43)
	id 1KuubD-0001qO-7P
	for myserver-commit@gnu.org; Tue, 28 Oct 2008 15:51:31 -0400
Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43)
	id 1KuubB-0001pZ-SV
	for myserver-commit@gnu.org; Tue, 28 Oct 2008 15:51:30 -0400
Received: from [199.232.76.173] (port=60470 helo=monty-python.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.43) id 1KuubB-0001pT-Kq
	for myserver-commit@gnu.org; Tue, 28 Oct 2008 15:51:29 -0400
Received: from savannah.gnu.org ([199.232.41.3]:34474 helo=sv.gnu.org)
	by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32)
	(Exim 4.60) (envelope-from <INVALID.NOREPLY@gnu.org>)
	id 1KuubB-0003Rj-Gb
	for myserver-commit@gnu.org; Tue, 28 Oct 2008 15:51:29 -0400
Received: from cvs.savannah.gnu.org ([199.232.41.69])
	by sv.gnu.org with esmtp (Exim 4.63)
	(envelope-from <INVALID.NOREPLY@gnu.org>) id 1KuubA-0003ge-C6
	for myserver-commit@gnu.org; Tue, 28 Oct 2008 19:51:28 +0000
Received: from dperrone by cvs.savannah.gnu.org with local (Exim 4.63)
	(envelope-from <dperrone@savannah.gnu.org>) id 1KuubA-0003ga-2u
	for myserver-commit@gnu.org; Tue, 28 Oct 2008 19:51:28 +0000
MIME-Version: 1.0
Errors-To: dperrone
To: myserver-commit@gnu.org
X-Mailer: SVN::Notify 2.64: http://search.cpan.org/dist/SVN-Notify/
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
From: Daniele Perrone <dperrone@it.gnu.org>
Message-Id: <E1KuubA-0003ga-2u@cvs.savannah.gnu.org>
Date: Tue, 28 Oct 2008 19:51:28 +0000
X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 3)
Subject: [myserver-commit] [2920] Fixed tar tree problem in the creation of
	plugin's packages
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/pipermail/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, 28 Oct 2008 19:51:31 -0000

Revision: 2920
          http://svn.sv.gnu.org/viewvc/?view=rev&root=myserver&revision=2920
Author:   dperrone
Date:     2008-10-28 19:51:27 +0000 (Tue, 28 Oct 2008)

Log Message:
-----------
Fixed tar tree problem in the creation of plugin's packages

Modified Paths:
--------------
    trunk/plugins/SConstruct

Modified: trunk/plugins/SConstruct
===================================================================
--- trunk/plugins/SConstruct	2008-10-28 00:03:08 UTC (rev 2919)
+++ trunk/plugins/SConstruct	2008-10-28 19:51:27 UTC (rev 2920)
@@ -54,7 +54,14 @@
       msheaders,
       '.'
       ]
+    
 
+def tar_package(src_dir, name, filename):
+    import tarfile
+    tarf = tarfile.open(filename.encode("ascii"),"w|gz")
+    tarf.add(src_dir + name,name)
+    tarf.close()
+
 def build_plugin(name):
     dest_dir = bin_dir + name
     SConscript([src_dir + name + "/SConscript"],['dest_dir','listinc'])
@@ -69,8 +76,7 @@
     doc = xml.dom.minidom.parse(bin_dir + name + "/plugin.xml")
     version = doc.getElementsByTagName("VERSION")
     filename = name + "-" + version[0].firstChild.data + ".tar.gz"
-    tarenv = Environment(TARFLAGS = '-c -z')
-    tarenv.Tar(release_dir + filename, bin_dir + name)	
+    tar_package(bin_dir, name, release_dir + filename)	
 
 
 





From MAILER-DAEMON Wed Oct 29 02:16:57 2008
Received: from mailman by lists.gnu.org with archive (Exim 4.43)
	id 1Kv4MT-000870-AU
	for mharc-myserver-commit@gnu.org; Wed, 29 Oct 2008 02:16:57 -0400
Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43)
	id 1Kv4MS-00086o-0W
	for myserver-commit@gnu.org; Wed, 29 Oct 2008 02:16:56 -0400
Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43)
	id 1Kv4MP-00086A-Hf
	for myserver-commit@gnu.org; Wed, 29 Oct 2008 02:16:54 -0400
Received: from [199.232.76.173] (port=58188 helo=monty-python.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.43) id 1Kv4MP-000867-9U
	for myserver-commit@gnu.org; Wed, 29 Oct 2008 02:16:53 -0400
Received: from savannah.gnu.org ([199.232.41.3]:41207 helo=sv.gnu.org)
	by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32)
	(Exim 4.60) (envelope-from <INVALID.NOREPLY@gnu.org>)
	id 1Kv4MO-00013X-FJ
	for myserver-commit@gnu.org; Wed, 29 Oct 2008 02:16:52 -0400
Received: from cvs.savannah.gnu.org ([199.232.41.69])
	by sv.gnu.org with esmtp (Exim 4.63)
	(envelope-from <INVALID.NOREPLY@gnu.org>) id 1Kv4MN-0007Eq-EJ
	for myserver-commit@gnu.org; Wed, 29 Oct 2008 06:16:51 +0000
Received: from andu by cvs.savannah.gnu.org with local (Exim 4.63)
	(envelope-from <andu@savannah.gnu.org>) id 1Kv4MN-0007Em-1E
	for myserver-commit@gnu.org; Wed, 29 Oct 2008 06:16:51 +0000
MIME-Version: 1.0
Errors-To: andu
To: myserver-commit@gnu.org
X-Mailer: SVN::Notify 2.64: http://search.cpan.org/dist/SVN-Notify/
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
From: Alexandru IANCU <alexandru.iancu@gmail.com>
Message-Id: <E1Kv4MN-0007Em-1E@cvs.savannah.gnu.org>
Date: Wed, 29 Oct 2008 06:16:51 +0000
X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 3)
Subject: [myserver-commit] [2921] add IP address range helper class and it's
	tests
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/pipermail/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, 29 Oct 2008 06:16:56 -0000

Revision: 2921
          http://svn.sv.gnu.org/viewvc/?view=rev&root=myserver&revision=2921
Author:   andu
Date:     2008-10-29 06:16:50 +0000 (Wed, 29 Oct 2008)

Log Message:
-----------
add IP address range helper class and it's tests

Modified Paths:
--------------
    trunk/myserver/include/conf/vhost/Makefile.am
    trunk/myserver/src/conf/vhost/Makefile.am
    trunk/myserver/tests/Makefile.am

Added Paths:
-----------
    trunk/myserver/include/conf/vhost/ip.h
    trunk/myserver/src/conf/vhost/ip.cpp
    trunk/myserver/tests/test_ip.cpp

Modified: trunk/myserver/include/conf/vhost/Makefile.am
===================================================================
--- trunk/myserver/include/conf/vhost/Makefile.am	2008-10-28 19:51:27 UTC (rev 2920)
+++ trunk/myserver/include/conf/vhost/Makefile.am	2008-10-29 06:16:50 UTC (rev 2921)
@@ -1,4 +1,4 @@
 vhostincludedir=$(includedir)/myserver/include/conf/vhost
-vhostinclude_HEADERS = vhost.h vhost_manager.h
+vhostinclude_HEADERS = vhost.h vhost_manager.h ip.h
 SUBDIRS =
 

Added: trunk/myserver/include/conf/vhost/ip.h
===================================================================
--- trunk/myserver/include/conf/vhost/ip.h	                        (rev 0)
+++ trunk/myserver/include/conf/vhost/ip.h	2008-10-29 06:16:50 UTC (rev 2921)
@@ -0,0 +1,57 @@
+/* -*- mode: c++ -*- */
+/*
+  MyServer
+  Copyright (C) 2008 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
+  (at your option) any later version.
+
+  This program is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+  GNU General Public License for more details.
+
+  You should have received a copy of the GNU General Public License
+  along with this program.  If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef IP_H
+#define IP_H
+
+#include "stdafx.h"
+#include <string>
+
+class IpRange
+{
+ public:
+  virtual bool InRange(const std::string &ip) = 0;
+  virtual bool InRange(const IpRange *pRange) = 0;
+};
+
+class Ipv4Range : public IpRange
+{
+public:
+  Ipv4Range(const std::string &sRange);
+  Ipv4Range(const std::string &sStartHost, const std::string &sEndHost);
+
+  virtual ~Ipv4Range();
+  virtual bool InRange(const std::string &ip);
+  virtual bool InRange(const IpRange *pRange);
+
+  const unsigned char* GetStart() const { return m_nStart; }
+  const unsigned char* GetEnd() const { return m_nEnd; }
+protected:
+  bool Init();
+  bool InRange(const unsigned char addr[4]);
+  bool SetRange(const std::string &sRange);
+  bool SetRange(const std::string &sStartHost, const std::string &sEndHost);
+  unsigned char m_nStart[4], m_nEnd[4], m_nMask[4];
+};
+
+//TODO: implement
+class Ipv6Range : public IpRange
+{
+};
+
+#endif //IP_H

Modified: trunk/myserver/src/conf/vhost/Makefile.am
===================================================================
--- trunk/myserver/src/conf/vhost/Makefile.am	2008-10-28 19:51:27 UTC (rev 2920)
+++ trunk/myserver/src/conf/vhost/Makefile.am	2008-10-29 06:16:50 UTC (rev 2921)
@@ -1,5 +1,5 @@
 lib_LIBRARIES = libvhost.a
-libvhost_a_SOURCES = vhost.cpp vhost_manager.cpp
+libvhost_a_SOURCES = vhost.cpp vhost_manager.cpp ip.cpp
 SUBDIRS =
 INCLUDES = $(all_includes)
 

Added: trunk/myserver/src/conf/vhost/ip.cpp
===================================================================
--- trunk/myserver/src/conf/vhost/ip.cpp	                        (rev 0)
+++ trunk/myserver/src/conf/vhost/ip.cpp	2008-10-29 06:16:50 UTC (rev 2921)
@@ -0,0 +1,180 @@
+/*
+  MyServer
+  Copyright (C) 2008 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
+  (at your option) any later version.
+
+  This program is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+  GNU General Public License for more details.
+
+  You should have received a copy of the GNU General Public License
+  along with this program.  If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#include <include/conf/vhost/ip.h>
+#include <sstream>
+
+/*!
+ * Ipv4Range c-tor
+ */
+Ipv4Range::Ipv4Range(const std::string &sRange)
+{
+  Init();
+  SetRange(sRange);
+}
+
+/*!
+ * range given as x.x.x.x-y.y.y.y or x.x.x.x/y
+ */
+bool Ipv4Range::SetRange(const std::string &sRange)
+{
+  std::string::size_type nPos = sRange.find('-');
+  if ( nPos != std::string::npos )// x.x.x.x-y.y.y.y form
+    {
+      std::string start(sRange.substr(0, nPos));
+      std::string end(sRange.substr(nPos + 1));
+      SetRange(start, end);
+    }
+  else// x.x.x.x/y form
+    {
+      std::istringstream istream(sRange);
+      char nSep = 0;
+      unsigned char nAddr[4];
+      int nTemp = 0;
+      for ( int i = 0; i < 4 && !istream.eof(); i++ )
+	{
+	  istream >> nTemp;
+	  nAddr[i] = nTemp;
+	  istream >> nSep;
+	}
+      if ( nSep == '/' )
+	istream >> nTemp;
+
+      for ( int i = 0, nByte = 0; i < nTemp && nByte < 4; i++ )
+	{
+	  m_nMask[nByte] += (1 << (i+1)%8);
+	  if ( (i+1)%8 == 0 )
+	    nByte++;
+	}
+      for ( int i = 0; i < 4; i++ )
+	{
+	  if ( m_nMask[i] != 0 )
+	    {
+	      m_nStart[i] = nAddr[i];
+	      m_nEnd[i] = nAddr[i];
+	    }
+	}
+    }
+  return true;
+}
+
+bool Ipv4Range::SetRange(const std::string &sStartHost, const std::string &sEndHost)
+{
+  if ( !Init() )
+    return false;
+
+  std::istringstream start(sStartHost), end(sEndHost);
+  char nSep = 0;
+  int nTemp = 0;
+  for ( int i = 0; i < 4 && !start.eof() && !end.eof(); i++ )
+    {
+      start >> nTemp;
+      m_nStart[i] = nTemp;
+      start >> nSep;
+      end >> nTemp;
+      m_nEnd[i] = nTemp;
+      end >> nSep;
+    }
+
+  // get mask lenght(max common addr part)
+  char bs = 0;
+  for ( bs = 0; bs < 32; bs++ )
+    {
+      if ( (m_nStart[bs/8] & (1 << bs%8)) != (m_nEnd[bs/8] & (1 << bs%8)) )
+	break;
+    }
+  for ( int i = 0, nByte = 0; i < bs && nByte < 4; i++ )
+    {
+      m_nMask[nByte] += (1 << (i+1)%8);
+      if ( (i+1)%8 == 0 )
+	nByte++;
+    }
+  return true;
+}
+
+/*!
+ * Ipv4Range initializer
+ * return false on error
+ */
+bool Ipv4Range::Init()
+{
+  for ( int i = 0; i < 4; i++ )
+    {
+      m_nStart[i] = 0;
+      m_nEnd[i] = 255;
+      m_nMask[i] = 0;
+    }
+  return true;
+}
+
+/*!
+ *d-tor
+ */
+Ipv4Range::~Ipv4Range()
+{
+}
+
+/*!
+ *checks if addr from param belongs the same network address
+ */
+bool Ipv4Range::InRange(const unsigned char addr[4])
+{
+  unsigned char hostMask[4];
+  for ( int i = 0; i < 4; i++ )
+    {
+      hostMask[i] = ~m_nMask[i];
+      if ( (m_nStart[i] & hostMask[i]) < (addr[i] & hostMask[i]) )
+	  break;
+      if ( (m_nStart[i] & hostMask[i]) > (addr[i] & hostMask[i]) )
+	  return false;
+    }
+  for ( int i = 0; i < 4; i++ )
+    {
+      hostMask[i] = ~m_nMask[i];
+      if ( (m_nEnd[i] & hostMask[i]) > (addr[i] & hostMask[i]) )
+	return true;
+      if ( (m_nEnd[i] & hostMask[i]) < (addr[i] & hostMask[i]) )
+	return false;
+    }
+  return true;//equal to start or end
+}
+
+bool Ipv4Range::InRange(const std::string &ip)
+{
+  unsigned char addr[4];
+  std::istringstream stream(ip);
+  char nSep = 0;
+  int nTemp = 0;
+  for ( int i = 0; i < 4 && !stream.eof(); i++ )
+    {
+      stream >> nTemp;
+      addr[i] = nTemp;
+      if ( (addr[i] & m_nMask[i]) != (m_nStart[i] & m_nMask[i]) )
+	return false;//networks differ
+      stream >> nSep;
+    }
+
+  return InRange(addr);
+}
+
+bool Ipv4Range::InRange(const IpRange *pRange)
+{
+  if ( pRange == NULL )
+    return false;
+  const Ipv4Range *pLocal = static_cast<const Ipv4Range *>(pRange);
+  return InRange(pLocal->GetStart()) && InRange(pLocal->GetEnd());
+}

Modified: trunk/myserver/tests/Makefile.am
===================================================================
--- trunk/myserver/tests/Makefile.am	2008-10-28 19:51:27 UTC (rev 2920)
+++ trunk/myserver/tests/Makefile.am	2008-10-29 06:16:50 UTC (rev 2921)
@@ -2,5 +2,5 @@
 #
 
 bin_PROGRAMS = tests_suite
-tests_suite_SOURCES = main.cpp test_connection.cpp test_ftp.cpp test_log_manager.cpp test_mime_manager.cpp test_mutex.cpp test_security_domain.cpp test_validator.cpp test_auth_domain.cpp test_connections_scheduler.cpp test_gzip.cpp test_log_stream_factory.cpp test_pipe.cpp test_security_manager.cpp test_validator_factory.cpp test_base64.cpp test_file_stream.cpp test_hashmap.cpp test_md5.cpp test_recursive_mutex.cpp test_semaphore.cpp test_xml.cpp test_cached_file_buffer.cpp test_file_stream_creator.cpp test_homedir.cpp test_mem_buff.cpp test_regex.cpp test_socket_stream_creator.cpp test_cached_file.cpp test_files_utility.cpp test_http_request.cpp test_http_req_security_domain.cpp test_mem_stream.cpp test_safetime.cpp test_thread.cpp test_cached_file_factory.cpp test_filter_chain.cpp test_http_response.cpp test_multicast.cpp test_security_cache.cpp test_security_token.cpp test_utility.cpp  test_xml_validator.cpp
+tests_suite_SOURCES = main.cpp test_connection.cpp test_ftp.cpp test_log_manager.cpp test_mime_manager.cpp test_mutex.cpp test_security_domain.cpp test_validator.cpp test_auth_domain.cpp test_connections_scheduler.cpp test_gzip.cpp test_log_stream_factory.cpp test_pipe.cpp test_security_manager.cpp test_validator_factory.cpp test_base64.cpp test_file_stream.cpp test_hashmap.cpp test_md5.cpp test_recursive_mutex.cpp test_semaphore.cpp test_xml.cpp test_cached_file_buffer.cpp test_file_stream_creator.cpp test_homedir.cpp test_mem_buff.cpp test_regex.cpp test_socket_stream_creator.cpp test_cached_file.cpp test_files_utility.cpp test_http_request.cpp test_http_req_security_domain.cpp test_mem_stream.cpp test_safetime.cpp test_thread.cpp test_cached_file_factory.cpp test_filter_chain.cpp test_http_response.cpp test_multicast.cpp test_security_cache.cpp test_security_token.cpp test_utility.cpp  test_xml_validator.cpp test_ip.cpp
 tests_suite_LDADD = ../src/libmyserver.a $(CPPUNIT_LDFLAGS) $(PTHREAD_LIB) $(IDN_LIB) $(XNET_LIB) $(EVENT_LIB) $(DL_LIB) $(OPENSSL_LIB) $(ZLIB_LIB) $(XML_LIBS) $(LDFLAGS)

Added: trunk/myserver/tests/test_ip.cpp
===================================================================
--- trunk/myserver/tests/test_ip.cpp	                        (rev 0)
+++ trunk/myserver/tests/test_ip.cpp	2008-10-29 06:16:50 UTC (rev 2921)
@@ -0,0 +1,44 @@
+/*
+ MyServer
+ Copyright (C) 2008 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
+ (at your option) any later version.
+ 
+ This program is distributed in the hope that it will be useful, 
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ GNU General Public License for more details.
+ 
+ You should have received a copy of the GNU General Public License
+ along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include <include/conf/vhost/ip.h>
+#include <cppunit/CompilerOutputter.h>
+#include <cppunit/extensions/TestFactoryRegistry.h>
+#include <cppunit/ui/text/TestRunner.h>
+#include <cppunit/extensions/HelperMacros.h>
+
+class TestIpRange : public CppUnit::TestFixture
+{
+  CPPUNIT_TEST_SUITE( TestIpRange );
+  CPPUNIT_TEST( testRangeInclusion );
+  CPPUNIT_TEST( testIpInRange );
+  CPPUNIT_TEST_SUITE_END();
+
+public:
+  void setUp() {}
+  void tearDown() {}
+  void testRangeInclusion()
+  {
+    Ipv4Range LargeRange("192.168.0.0/24"), InsideRange("192.168.0.100-192.168.0.200");
+    CPPUNIT_ASSERT( LargeRange.InRange(&InsideRange) );
+  }
+  void testIpInRange()
+  {
+    Ipv4Range testRange("192.168.0.0/24");
+    CPPUNIT_ASSERT( testRange.InRange("192.168.0.127") );
+  }
+};





From MAILER-DAEMON Wed Oct 29 12:21:30 2008
Received: from mailman by lists.gnu.org with archive (Exim 4.43)
	id 1KvDnW-00050E-Ou
	for mharc-myserver-commit@gnu.org; Wed, 29 Oct 2008 12:21:30 -0400
Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43)
	id 1KvDnV-0004zV-1l
	for myserver-commit@gnu.org; Wed, 29 Oct 2008 12:21:29 -0400
Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43)
	id 1KvDnU-0004z9-CU
	for myserver-commit@gnu.org; Wed, 29 Oct 2008 12:21:28 -0400
Received: from [199.232.76.173] (port=49493 helo=monty-python.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.43) id 1KvDnU-0004z1-1k
	for myserver-commit@gnu.org; Wed, 29 Oct 2008 12:21:28 -0400
Received: from savannah.gnu.org ([199.232.41.3]:47199 helo=sv.gnu.org)
	by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32)
	(Exim 4.60) (envelope-from <INVALID.NOREPLY@gnu.org>)
	id 1KvDnT-0007sH-AF
	for myserver-commit@gnu.org; Wed, 29 Oct 2008 12:21:27 -0400
Received: from cvs.savannah.gnu.org ([199.232.41.69])
	by sv.gnu.org with esmtp (Exim 4.63)
	(envelope-from <INVALID.NOREPLY@gnu.org>) id 1KvDnP-0001z9-Is
	for myserver-commit@gnu.org; Wed, 29 Oct 2008 16:21:23 +0000
Received: from andu by cvs.savannah.gnu.org with local (Exim 4.63)
	(envelope-from <andu@savannah.gnu.org>) id 1KvDnO-0001z1-2G
	for myserver-commit@gnu.org; Wed, 29 Oct 2008 16:21:22 +0000
MIME-Version: 1.0
Errors-To: andu
To: myserver-commit@gnu.org
X-Mailer: SVN::Notify 2.64: http://search.cpan.org/dist/SVN-Notify/
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
From: Alexandru IANCU <alexandru.iancu@gmail.com>
Message-Id: <E1KvDnO-0001z1-2G@cvs.savannah.gnu.org>
Date: Wed, 29 Oct 2008 16:21:22 +0000
X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 3)
Subject: [myserver-commit] [2922] (forgot to) register Ip address range test
	:)
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/pipermail/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, 29 Oct 2008 16:21:29 -0000

Revision: 2922
          http://svn.sv.gnu.org/viewvc/?view=rev&root=myserver&revision=2922
Author:   andu
Date:     2008-10-29 16:21:20 +0000 (Wed, 29 Oct 2008)

Log Message:
-----------
(forgot to) register Ip address range test :)

Modified Paths:
--------------
    trunk/myserver/tests/test_ip.cpp

Modified: trunk/myserver/tests/test_ip.cpp
===================================================================
--- trunk/myserver/tests/test_ip.cpp	2008-10-29 06:16:50 UTC (rev 2921)
+++ trunk/myserver/tests/test_ip.cpp	2008-10-29 16:21:20 UTC (rev 2922)
@@ -42,3 +42,5 @@
     CPPUNIT_ASSERT( testRange.InRange("192.168.0.127") );
   }
 };
+
+CPPUNIT_TEST_SUITE_REGISTRATION( TestIpRange );





From MAILER-DAEMON Wed Oct 29 17:27:46 2008
Received: from mailman by lists.gnu.org with archive (Exim 4.43)
	id 1KvIZu-0005Tg-1l
	for mharc-myserver-commit@gnu.org; Wed, 29 Oct 2008 17:27:46 -0400
Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43)
	id 1KvIZs-0005Tb-FN
	for myserver-commit@gnu.org; Wed, 29 Oct 2008 17:27:44 -0400
Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43)
	id 1KvIZq-0005TP-UW
	for myserver-commit@gnu.org; Wed, 29 Oct 2008 17:27:44 -0400
Received: from [199.232.76.173] (port=43586 helo=monty-python.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.43) id 1KvIZq-0005TM-Nd
	for myserver-commit@gnu.org; Wed, 29 Oct 2008 17:27:42 -0400
Received: from savannah.gnu.org ([199.232.41.3]:41080 helo=sv.gnu.org)
	by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32)
	(Exim 4.60) (envelope-from <INVALID.NOREPLY@gnu.org>)
	id 1KvIZq-00039C-DV
	for myserver-commit@gnu.org; Wed, 29 Oct 2008 17:27:42 -0400
Received: from cvs.savannah.gnu.org ([199.232.41.69])
	by sv.gnu.org with esmtp (Exim 4.63)
	(envelope-from <INVALID.NOREPLY@gnu.org>) id 1KvIZp-0005VV-Li
	for myserver-commit@gnu.org; Wed, 29 Oct 2008 21:27:41 +0000
Received: from andu by cvs.savannah.gnu.org with local (Exim 4.63)
	(envelope-from <andu@savannah.gnu.org>) id 1KvIZp-0005VQ-Do
	for myserver-commit@gnu.org; Wed, 29 Oct 2008 21:27:41 +0000
MIME-Version: 1.0
Errors-To: andu
To: myserver-commit@gnu.org
X-Mailer: SVN::Notify 2.64: http://search.cpan.org/dist/SVN-Notify/
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
From: Alexandru IANCU <alexandru.iancu@gmail.com>
Message-Id: <E1KvIZp-0005VQ-Do@cvs.savannah.gnu.org>
Date: Wed, 29 Oct 2008 21:27:41 +0000
X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 3)
Subject: [myserver-commit] [2923] add more features to IP address range +
	tests
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/pipermail/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, 29 Oct 2008 21:27:45 -0000

Revision: 2923
          http://svn.sv.gnu.org/viewvc/?view=rev&root=myserver&revision=2923
Author:   andu
Date:     2008-10-29 21:27:40 +0000 (Wed, 29 Oct 2008)

Log Message:
-----------
add more features to IP address range + tests

Modified Paths:
--------------
    trunk/myserver/include/conf/vhost/ip.h
    trunk/myserver/src/conf/vhost/ip.cpp
    trunk/myserver/tests/test_ip.cpp

Modified: trunk/myserver/include/conf/vhost/ip.h
===================================================================
--- trunk/myserver/include/conf/vhost/ip.h	2008-10-29 16:21:20 UTC (rev 2922)
+++ trunk/myserver/include/conf/vhost/ip.h	2008-10-29 21:27:40 UTC (rev 2923)
@@ -27,14 +27,20 @@
  public:
   virtual bool InRange(const std::string &ip) = 0;
   virtual bool InRange(const IpRange *pRange) = 0;
+
+  static IpRange *RangeFactory(const std::string &ipRange);
 };
 
 class Ipv4Range : public IpRange
 {
 public:
+  Ipv4Range();
   Ipv4Range(const std::string &sRange);
   Ipv4Range(const std::string &sStartHost, const std::string &sEndHost);
 
+  bool SetRange(const std::string &sRange);
+  bool SetRange(const std::string &sStartHost, const std::string &sEndHost);
+
   virtual ~Ipv4Range();
   virtual bool InRange(const std::string &ip);
   virtual bool InRange(const IpRange *pRange);
@@ -44,8 +50,6 @@
 protected:
   bool Init();
   bool InRange(const unsigned char addr[4]);
-  bool SetRange(const std::string &sRange);
-  bool SetRange(const std::string &sStartHost, const std::string &sEndHost);
   unsigned char m_nStart[4], m_nEnd[4], m_nMask[4];
 };
 

Modified: trunk/myserver/src/conf/vhost/ip.cpp
===================================================================
--- trunk/myserver/src/conf/vhost/ip.cpp	2008-10-29 16:21:20 UTC (rev 2922)
+++ trunk/myserver/src/conf/vhost/ip.cpp	2008-10-29 21:27:40 UTC (rev 2923)
@@ -19,11 +19,36 @@
 #include <sstream>
 
 /*!
+ * comment here
+ */
+IpRange *IpRange::RangeFactory(const std::string &ipRange)
+{
+  Ipv4Range *pV4 = new Ipv4Range();
+  if ( pV4->SetRange(ipRange) )
+    return pV4;
+
+  /* when will be implemented
+  Ipv6Range *pV6 = new Ipv6Range();
+  if ( pV6->SetRange(ipRange) )
+    return pV6;
+  */
+
+  return NULL;
+}
+
+/*!
  * Ipv4Range c-tor
  */
+Ipv4Range::Ipv4Range()
+{
+  Init();
+}
+
+/*!
+ * Ipv4Range c-tor
+ */
 Ipv4Range::Ipv4Range(const std::string &sRange)
 {
-  Init();
   SetRange(sRange);
 }
 
@@ -32,12 +57,16 @@
  */
 bool Ipv4Range::SetRange(const std::string &sRange)
 {
+  if ( !Init() )
+    return false;
+  if ( sRange.empty() )
+    return true;//just init
   std::string::size_type nPos = sRange.find('-');
   if ( nPos != std::string::npos )// x.x.x.x-y.y.y.y form
     {
       std::string start(sRange.substr(0, nPos));
       std::string end(sRange.substr(nPos + 1));
-      SetRange(start, end);
+      return SetRange(start, end);
     }
   else// x.x.x.x/y form
     {
@@ -51,9 +80,14 @@
 	  nAddr[i] = nTemp;
 	  istream >> nSep;
 	}
+
+      nTemp = 32;
       if ( nSep == '/' )
-	istream >> nTemp;
+	  istream >> nTemp;
 
+      if ( !istream.eof() )
+	return false;
+
       for ( int i = 0, nByte = 0; i < nTemp && nByte < 4; i++ )
 	{
 	  m_nMask[nByte] += (1 << (i+1)%8);
@@ -89,6 +123,8 @@
       m_nEnd[i] = nTemp;
       end >> nSep;
     }
+  if ( !start.eof() || !end.eof() )
+    return false;
 
   // get mask lenght(max common addr part)
   char bs = 0;

Modified: trunk/myserver/tests/test_ip.cpp
===================================================================
--- trunk/myserver/tests/test_ip.cpp	2008-10-29 16:21:20 UTC (rev 2922)
+++ trunk/myserver/tests/test_ip.cpp	2008-10-29 21:27:40 UTC (rev 2923)
@@ -26,6 +26,9 @@
   CPPUNIT_TEST_SUITE( TestIpRange );
   CPPUNIT_TEST( testRangeInclusion );
   CPPUNIT_TEST( testIpInRange );
+  CPPUNIT_TEST( testSingleIpRange );
+  CPPUNIT_TEST( testEmptyRange );
+  CPPUNIT_TEST( testRangeFactory );
   CPPUNIT_TEST_SUITE_END();
 
 public:
@@ -41,6 +44,24 @@
     Ipv4Range testRange("192.168.0.0/24");
     CPPUNIT_ASSERT( testRange.InRange("192.168.0.127") );
   }
+  void testSingleIpRange()
+  {
+    Ipv4Range singleIpRange("192.168.0.100");
+    CPPUNIT_ASSERT( singleIpRange.InRange(&singleIpRange) );
+  }
+  void testEmptyRange()
+  {
+    Ipv4Range emptyRange("");
+    CPPUNIT_ASSERT( emptyRange.InRange("10.0.0.0") );//anyy IP addr
+  }
+  void testRangeFactory()
+  {
+    IpRange *pRange = IpRange::RangeFactory("192.168.51.0/23");
+    CPPUNIT_ASSERT( pRange->InRange("192.168.51.100") );
+
+    delete pRange;
+    pRange = NULL;
+  }
 };
 
 CPPUNIT_TEST_SUITE_REGISTRATION( TestIpRange );





From MAILER-DAEMON Wed Oct 29 18:28:31 2008
Received: from mailman by lists.gnu.org with archive (Exim 4.43)
	id 1KvJWg-0004im-TW
	for mharc-myserver-commit@gnu.org; Wed, 29 Oct 2008 18:28:31 -0400
Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43)
	id 1KvJWe-0004gt-LG
	for myserver-commit@gnu.org; Wed, 29 Oct 2008 18:28:28 -0400
Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43)
	id 1KvJWc-0004eP-Lt
	for myserver-commit@gnu.org; Wed, 29 Oct 2008 18:28:27 -0400
Received: from [199.232.76.173] (port=55933 helo=monty-python.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.43) id 1KvJWc-0004dk-9W
	for myserver-commit@gnu.org; Wed, 29 Oct 2008 18:28:26 -0400
Received: from savannah.gnu.org ([199.232.41.3]:36729 helo=sv.gnu.org)
	by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32)
	(Exim 4.60) (envelope-from <INVALID.NOREPLY@gnu.org>)
	id 1KvJWb-0006lE-Sm
	for myserver-commit@gnu.org; Wed, 29 Oct 2008 18:28:26 -0400
Received: from cvs.savannah.gnu.org ([199.232.41.69])
	by sv.gnu.org with esmtp (Exim 4.63)
	(envelope-from <INVALID.NOREPLY@gnu.org>) id 1KvJWb-0000Df-3r
	for myserver-commit@gnu.org; Wed, 29 Oct 2008 22:28:25 +0000
Received: from gscrivano by cvs.savannah.gnu.org with local (Exim 4.63)
	(envelope-from <gscrivano@savannah.gnu.org>) id 1KvJWa-0000DT-E7
	for myserver-commit@gnu.org; Wed, 29 Oct 2008 22:28:24 +0000
MIME-Version: 1.0
Errors-To: gscrivano
To: myserver-commit@gnu.org
X-Mailer: SVN::Notify 2.64: http://search.cpan.org/dist/SVN-Notify/
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
From: Giuseppe Scrivano <gscrivano@gnu.org>
Message-Id: <E1KvJWa-0000DT-E7@cvs.savannah.gnu.org>
Date: Wed, 29 Oct 2008 22:28:24 +0000
X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 3)
Subject: [myserver-commit] [2924] Reduced `Http::sendHTTPResource' function
	complexity.
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/pipermail/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, 29 Oct 2008 22:28:28 -0000

Revision: 2924
          http://svn.sv.gnu.org/viewvc/?view=rev&root=myserver&revision=2924
Author:   gscrivano
Date:     2008-10-29 22:28:23 +0000 (Wed, 29 Oct 2008)

Log Message:
-----------
Reduced `Http::sendHTTPResource' function complexity.

Modified Paths:
--------------
    trunk/myserver/include/protocol/http/dyn_http_manager_list.h
    trunk/myserver/include/protocol/http/http.h
    trunk/myserver/src/protocol/http/dyn_http_manager_list.cpp
    trunk/myserver/src/protocol/http/http.cpp

Modified: trunk/myserver/include/protocol/http/dyn_http_manager_list.h
===================================================================
--- trunk/myserver/include/protocol/http/dyn_http_manager_list.h	2008-10-29 21:27:40 UTC (rev 2923)
+++ trunk/myserver/include/protocol/http/dyn_http_manager_list.h	2008-10-29 22:28:23 UTC (rev 2924)
@@ -1,7 +1,7 @@
 /* -*- mode: c++ -*- */
 /*
 MyServer
-Copyright (C) 2005, 2007 Free Software Foundation, Inc.
+Copyright (C) 2005, 2007, 2008 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
@@ -29,28 +29,34 @@
 #include <string>
 using namespace std;
 
-class DynamicHttpManager;
+class HttpDataHandler;
 
 class DynHttpManagerList
 {
 public:
-  DynamicHttpManager* getHttpManager(string& name);
+  HttpDataHandler *getHttpManager (string& name);
 
-  HashMap<string, DynamicHttpManager*>::Iterator begin(){return dynamicHttpManagers.begin();}
-  HashMap<string, DynamicHttpManager*>::Iterator end(){return dynamicHttpManagers.end();}
+  HttpDataHandler *getHttpManager (const char *name)
+  {
+   	string strName (name);
+   	return getHttpManager (strName);
+  }
 
-  void addHttpManager(string& name, DynamicHttpManager* httpManager);
+  HashMap<string, HttpDataHandler*>::Iterator begin (){return dynamicHttpManagers.begin ();}
+  HashMap<string, HttpDataHandler*>::Iterator end (){return dynamicHttpManagers.end ();}
 
-  void addHttpManager(char* name, DynamicHttpManager* httpManager)
+  void addHttpManager (string& name, HttpDataHandler* httpManager);
+
+  void addHttpManager (const char* name, HttpDataHandler* httpManager)
   {
-   	string strName(name);
-   	addHttpManager(strName, httpManager);
+   	string strName (name);
+   	addHttpManager (strName, httpManager);
   }
 
-  DynHttpManagerList();
-  ~DynHttpManagerList();
+  DynHttpManagerList ();
+  ~DynHttpManagerList ();
 private:
-	HashMap<string, DynamicHttpManager*> dynamicHttpManagers;
+	HashMap<string, HttpDataHandler*> dynamicHttpManagers;
 };
 
 #endif

Modified: trunk/myserver/include/protocol/http/http.h
===================================================================
--- trunk/myserver/include/protocol/http/http.h	2008-10-29 21:27:40 UTC (rev 2923)
+++ trunk/myserver/include/protocol/http/http.h	2008-10-29 22:28:23 UTC (rev 2924)
@@ -49,19 +49,32 @@
     return MulticastRegistry<string, void*, int>::getHandlers(msg);
   }
 
+  HttpStaticData ();
+  virtual ~HttpStaticData ();
+
   void clear()
   {
     clearMulticastRegistry();
   }
 
-  DynHttpCommandManager dynCmdManager;
-  DynHttpManagerList dynManagerList;
-
   string browseDirCSSpath;
   u_long gzipThreshold;
   vector<string> defaultFilename;
   int cgiTimeout;
   int allowVhostMime;
+
+  HttpDataHandler *mscgi;
+  HttpDataHandler *wincgi;
+  HttpDataHandler *isapi;
+  HttpDataHandler *cgi;
+  HttpDataHandler *scgi;
+  HttpDataHandler *fastcgi;
+  HttpDataHandler *httpFile;
+  HttpDataHandler *httpDir;
+
+
+  DynHttpCommandManager dynCmdManager;
+  DynHttpManagerList dynManagerList;
 };
 
 /*!
@@ -193,14 +206,6 @@
 
   int processDefaultFile (string& uri, int permissions, int onlyHeader);
 
-  HttpDataHandler* mscgi;
-  HttpDataHandler* wincgi;
-  HttpDataHandler* isapi;
-  HttpDataHandler* cgi;
-  HttpDataHandler* scgi;
-  HttpDataHandler* fastcgi;
-  HttpDataHandler* httpFile;
-  HttpDataHandler* httpDir;
   struct HttpThreadContext *td;
   void clean();
   void computeDigest(char*, char*);

Modified: trunk/myserver/src/protocol/http/dyn_http_manager_list.cpp
===================================================================
--- trunk/myserver/src/protocol/http/dyn_http_manager_list.cpp	2008-10-29 21:27:40 UTC (rev 2923)
+++ trunk/myserver/src/protocol/http/dyn_http_manager_list.cpp	2008-10-29 22:28:23 UTC (rev 2924)
@@ -26,7 +26,7 @@
 /*!
  *Initialize the object.
  */
-DynHttpManagerList::DynHttpManagerList() 
+DynHttpManagerList::DynHttpManagerList () 
 {
 
 }
@@ -34,27 +34,26 @@
 /*!
  *Destroy the object.
  */
-DynHttpManagerList::~DynHttpManagerList()
+DynHttpManagerList::~DynHttpManagerList ()
 {
 
 }
 
 /*!
- *Get the DynamicHttpManagers.
+ *Get the HttpDataHandlers.
  *\param name http manager name.
  */
-DynamicHttpManager* DynHttpManagerList::getHttpManager(string& name)
+HttpDataHandler* DynHttpManagerList::getHttpManager (string& name)
 {
-  return dynamicHttpManagers.get(name);
+  return dynamicHttpManagers.get (name);
 }
 
 /*!
- *Add the DynamicHttpManagers.
+ *Add the HttpDataHandlers.
  *\param name http manager name.
  *\param httpManager http manager to add.
  */
-void DynHttpManagerList::addHttpManager(string& name, DynamicHttpManager* httpManager)
+void DynHttpManagerList::addHttpManager (string& name, HttpDataHandler* httpManager)
 {
-  dynamicHttpManagers.put(name,httpManager);
+  dynamicHttpManagers.put (name, httpManager);
 }
-

Modified: trunk/myserver/src/protocol/http/http.cpp
===================================================================
--- trunk/myserver/src/protocol/http/http.cpp	2008-10-29 21:27:40 UTC (rev 2923)
+++ trunk/myserver/src/protocol/http/http.cpp	2008-10-29 22:28:23 UTC (rev 2924)
@@ -66,12 +66,37 @@
 /*!
  *Get a pointer to a structure shared among all the instances.
  */
-HttpStaticData* Http::getStaticData()
+HttpStaticData* Http::getStaticData ()
 {
   return &staticHttp;
 }
 
 
+HttpStaticData::HttpStaticData ()
+{
+  mscgi = new MsCgi();
+  wincgi = new WinCgi();
+  isapi = new Isapi();
+  cgi = new Cgi();
+  scgi = new Scgi();
+  fastcgi = new FastCgi();
+  httpFile = new HttpFile();
+  httpDir = new HttpDir();
+}
+
+HttpStaticData::~HttpStaticData ()
+{
+  delete mscgi;
+  delete wincgi;
+  delete isapi;
+  delete cgi;
+  delete scgi;
+  delete fastcgi;
+  delete httpFile;
+  delete httpDir;
+}
+
+
 /*!
  *Build a response for an OPTIONS request.
  */
@@ -776,7 +801,7 @@
   int ret;
   string directory;
   string file;
-  DynamicHttpManager *manager;
+  HttpDataHandler *manager;
 
   /*! By default allows only few actions. */
   permissions = MYSERVER_PERMISSION_READ | MYSERVER_PERMISSION_BROWSE ;
@@ -822,205 +847,37 @@
     }
 
 
-    if(td->mime && !td->mime->cmdName.compare ("CGI"))
+    if (td->mime && (manager = staticHttp.dynManagerList.getHttpManager (td->mime->cmdName)))
     {
-      int allowCgi = 1;
-      const char *dataH = td->connection->host->getHashedData("ALLOW_CGI");
-      if(dataH)
+      if (manager)
       {
-        if(!strcmpi(dataH, "YES"))
-          allowCgi = 1;
-        else
-          allowCgi = 0;
-      }
+        if (!(permissions & MYSERVER_PERMISSION_EXECUTE))
+            return sendAuth();
 
-      if(!allowCgi || !(permissions & MYSERVER_PERMISSION_EXECUTE))
-      {
-        return sendAuth();
+        return manager->send (td,
+                              td->connection,
+                              td->filenamePath.c_str(),
+                              cgiManager,
+                              td->mime->selfExecuted,
+                              onlyHeader);
       }
-      ret = cgi->send(td, td->connection, td->filenamePath.c_str(),
-                      cgiManager, td->mime->selfExecuted,  onlyHeader);
-      return ret;
     }
-    else if(td->mime && !td->mime->cmdName.compare ("ISAPI"))
-    {
-      int allowIsapi = 1;
-      const char *dataH = td->connection->host->getHashedData("ALLOW_ISAPI");
-      if(dataH)
-      {
-        if(!strcmpi(dataH, "YES"))
-          allowIsapi = 1;
-        else
-          allowIsapi = 0;
-      }
-      if(!allowIsapi || !(permissions & MYSERVER_PERMISSION_EXECUTE))
-      {
-        return sendAuth();
-      }
-      ret = isapi->send(td, td->connection, td->filenamePath.c_str(),
-                        cgiManager, td->mime->selfExecuted, onlyHeader);
-      return ret;
-    }
-    else if(td->mime && !td->mime->cmdName.compare ("MSGI"))
-    {
-      char* target;
-      int allowMscgi = 1;
-      const char *dataH = td->connection->host->getHashedData("ALLOW_MSCGI");
-      if(dataH)
-      {
-        if(!strcmpi(dataH, "YES"))
-          allowMscgi = 1;
-        else
-          allowMscgi = 0;
-      }
 
-      if(!allowMscgi || !(permissions & MYSERVER_PERMISSION_EXECUTE))
-      {
-        return sendAuth();
-      }
-      if(td->request.uriOptsPtr)
-        target = td->request.uriOptsPtr;
-      else
-        target = (char*)td->request.uriOpts.c_str();
 
-      ret = mscgi->send(td, td->connection, td->filenamePath.c_str(),
-                        target, td->mime->selfExecuted, onlyHeader);
-      return ret;
-    }
-    else if(td->mime && !td->mime->cmdName.compare ("WINCGI"))
-    {
-      int allowWincgi = 1;
-      const char *dataH = td->connection->host->getHashedData("ALLOW_WINCGI");
-      if(dataH)
-      {
-        if(!strcmpi(dataH, "YES"))
-          allowWincgi = 1;
-        else
-          allowWincgi = 0;
-      }
+    if (!(permissions & MYSERVER_PERMISSION_READ))
+      return sendAuth ();
 
-      if(!allowWincgi || !(permissions & MYSERVER_PERMISSION_EXECUTE))
-      {
-        return sendAuth();
-      }
+    manager = staticHttp.dynManagerList.getHttpManager ("FILE");
 
-      ret = wincgi->send(td, td->connection, 
-                         td->filenamePath.c_str(),
-                         cgiManager,
-                         td->mime->selfExecuted, onlyHeader);
-      return ret;
-    }
-    else if(td->mime && !td->mime->cmdName.compare ("FASTCGI"))
-    {
-      int allowFastcgi = 1;
-      const char *dataH = td->connection->host->getHashedData("ALLOW_FASTCGI");
-      if(dataH)
-      {
-        if(!strcmpi(dataH, "YES"))
-          allowFastcgi=1;
-        else
-          allowFastcgi=0;
-      }
-      if(!allowFastcgi || !(permissions & MYSERVER_PERMISSION_EXECUTE))
-      {
-        return sendAuth();
-      }
-      ret = fastcgi->send(td, td->connection, td->filenamePath.c_str(),
-                          cgiManager, td->mime->selfExecuted, onlyHeader);
-      return ret;
-    }
-    else if(td->mime && !td->mime->cmdName.compare ("SCGI"))
-    {
-      int allowScgi = 1;
-      const char *dataH = td->connection->host->getHashedData("ALLOW_SCGI");
-      if(dataH)
-      {
-        if(!strcmpi(dataH, "YES"))
-          allowScgi = 1;
-        else
-          allowScgi = 0;
-      }
-      if(!allowScgi || !(permissions & MYSERVER_PERMISSION_EXECUTE))
-      {
-        return sendAuth();
-      }
-      ret = scgi->send(td, td->connection, td->filenamePath.c_str(),
-                       cgiManager, td->mime->selfExecuted, onlyHeader);
-      return ret;
-    }
-    else if (td->mime && (manager = staticHttp.dynManagerList.getHttpManager (td->mime->cmdName)))
-    {
-      int allowScgi = 1;
-      const char *dataH = td->connection->host->getHashedData("ALLOW_SCGI");
-      if(dataH)
-      {
-        if(!strcmpi(dataH, "YES"))
-          allowScgi = 1;
-        else
-          allowScgi = 0;
-      }
-      if(!allowScgi || !(permissions & MYSERVER_PERMISSION_EXECUTE))
-      {
-        return sendAuth();
-      }
-      ret = scgi->send(td, td->connection, td->filenamePath.c_str(),
-                       cgiManager, 1, onlyHeader);
-      return ret;
-    }
-    else if (td->mime && (manager = staticHttp.dynManagerList.getHttpManager(td->mime->cmdName)))
-    {
-      int allowExternal = 1;
-      const char *dataH =
-        td->connection->host->getHashedData ("ALLOW_EXTERNAL_COMMANDS");
+    if (!manager)
+      return raiseHTTPError (500);
 
-      if(dataH)
-      {
-        if(!strcmpi(dataH, "YES"))
-          allowExternal = 1;
-        else
-          allowExternal = 0;
-      }
-
-      if(allowExternal && td->mime)
-      {
-        if(manager)
-          return manager->send(td,
-                               td->connection,
-                               td->filenamePath.c_str(),
-                               cgiManager,
-                               td->mime->selfExecuted,
-                               onlyHeader);
-        else
-          return raiseHTTPError(501);
-      }
-    }
-
-    int allowSend = 1;
-    const char *data = td->connection->host->getHashedData("ALLOW_SEND_FILE");
-    if(data)
-    {
-      if(!strcmpi(data, "YES"))
-        allowSend = 1;
-      else
-        allowSend = 0;
-    }
-
-    if(!allowSend)
-    {
-      return sendAuth();
-    }
-
-    if(!(permissions & MYSERVER_PERMISSION_READ))
-    {
-      return sendAuth();
-    }
-
-    ret = httpFile->send(td, td->connection, td->filenamePath.c_str(),
-                         0, onlyHeader);
+    return manager->send (td, td->connection, td->filenamePath.c_str(),
+                          0, onlyHeader);
   }
-  catch(...)
+  catch (...)
   {
-    return raiseHTTPError(500);
+    return raiseHTTPError (500);
   };
 
   return ret;
@@ -2007,11 +1864,6 @@
   int i;
   int ret;
 
-  if( !(permissions & MYSERVER_PERMISSION_BROWSE) )
-    {
-      return sendAuth();
-    }
-
   for(i = 0;; i++)
     {
       const char *defaultFileNamePath = getDefaultFilenamePath(i);
@@ -2055,8 +1907,17 @@
           return ret;
         }
     }
-  return httpDir->send(td, td->connection, td->filenamePath.c_str(), 0,
-                       onlyHeader);
+
+  if( !(permissions & MYSERVER_PERMISSION_BROWSE) )
+      return sendAuth();
+
+  HttpDataHandler *handler = staticHttp.dynManagerList.getHttpManager ("DIR");
+
+  if (!handler)
+    return raiseHTTPError (500);
+
+  return handler->send (td, td->connection, td->filenamePath.c_str(),
+                        0, onlyHeader);
 }
 
 /*!
@@ -2173,24 +2034,33 @@
   Server::getInstance()->setGlobalData("http-static", getStaticData());
 
   /* Load the HTTP errors.  */
-  HttpErrors::load();
+  HttpErrors::load ();
 
   /* Initialize ISAPI.  */
-  Isapi::load(configurationFileManager);
+  Isapi::load (configurationFileManager);
 
   /* Initialize FastCGI.  */
-  FastCgi::load(configurationFileManager);
+  FastCgi::load (configurationFileManager);
 
   /* Initialize SCGI.  */
-  Scgi::load(configurationFileManager);
+  Scgi::load (configurationFileManager);
 
   /* Load the MSCGI library.  */
-  MsCgi::load(configurationFileManager);
+  MsCgi::load (configurationFileManager);
 
-  HttpFile::load(configurationFileManager);
-  HttpDir::load(configurationFileManager);
+  HttpFile::load (configurationFileManager);
+  HttpDir::load (configurationFileManager);
 
-  /*! Determine the min file size that will use GZIP compression.  */
+  staticHttp.dynManagerList.addHttpManager ("FILE", staticHttp.httpFile);
+  staticHttp.dynManagerList.addHttpManager ("DIR", staticHttp.httpDir);
+  staticHttp.dynManagerList.addHttpManager ("CGI", staticHttp.cgi);
+  staticHttp.dynManagerList.addHttpManager ("MSCGI", staticHttp.mscgi);
+  staticHttp.dynManagerList.addHttpManager ("SCGI", staticHttp.scgi);
+  staticHttp.dynManagerList.addHttpManager ("WINCGI", staticHttp.wincgi);
+  staticHttp.dynManagerList.addHttpManager ("FASTCGI", staticHttp.fastcgi);
+  staticHttp.dynManagerList.addHttpManager ("ISAPI", staticHttp.isapi);
+
+  /* Determine the min file size that will use GZIP compression.  */
   data = configurationFileManager->getValue("GZIP_THRESHOLD");
   if(data)
   {
@@ -2329,15 +2199,6 @@
   td->scriptFile.assign("");
   td->inputDataPath.assign("");
   td->outputDataPath.assign("");
-
-  mscgi = new MsCgi();
-  wincgi = new WinCgi();
-  isapi = new Isapi();
-  cgi = new Cgi();
-  scgi = new Scgi();
-  fastcgi = new FastCgi();
-  httpFile = new HttpFile();
-  httpDir = new HttpDir();
 }
 
 /*!
@@ -2363,15 +2224,5 @@
   td->scriptFile.assign("");
   td->inputDataPath.assign("");
   td->outputDataPath.assign("");
-
-  delete mscgi;
-  delete wincgi;
-  delete isapi;
-  delete cgi;
-  delete scgi;
-  delete fastcgi;
-  delete httpFile;
-  delete httpDir;
-  
   delete td;
 }





From MAILER-DAEMON Thu Oct 30 16:39:54 2008
Received: from mailman by lists.gnu.org with archive (Exim 4.43)
	id 1KveJ8-0003b9-Iz
	for mharc-myserver-commit@gnu.org; Thu, 30 Oct 2008 16:39:54 -0400
Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43)
	id 1KveJ7-0003b4-9g
	for myserver-commit@gnu.org; Thu, 30 Oct 2008 16:39:53 -0400
Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43)
	id 1KveJ5-0003ar-Or
	for myserver-commit@gnu.org; Thu, 30 Oct 2008 16:39:51 -0400
Received: from [199.232.76.173] (port=43104 helo=monty-python.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.43) id 1KveJ5-0003ao-IP
	for myserver-commit@gnu.org; Thu, 30 Oct 2008 16:39:51 -0400
Received: from savannah.gnu.org ([199.232.41.3]:44311 helo=sv.gnu.org)
	by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32)
	(Exim 4.60) (envelope-from <INVALID.NOREPLY@gnu.org>)
	id 1KveJ6-0001vz-1n
	for myserver-commit@gnu.org; Thu, 30 Oct 2008 16:39:52 -0400
Received: from cvs.savannah.gnu.org ([199.232.41.69])
	by sv.gnu.org with esmtp (Exim 4.63)
	(envelope-from <INVALID.NOREPLY@gnu.org>) id 1KveJ4-0006fj-FV
	for myserver-commit@gnu.org; Thu, 30 Oct 2008 20:39:50 +0000
Received: from gscrivano by cvs.savannah.gnu.org with local (Exim 4.63)
	(envelope-from <gscrivano@savannah.gnu.org>) id 1KveJ4-0006fe-5t
	for myserver-commit@gnu.org; Thu, 30 Oct 2008 20:39:50 +0000
MIME-Version: 1.0
Errors-To: gscrivano
To: myserver-commit@gnu.org
X-Mailer: SVN::Notify 2.64: http://search.cpan.org/dist/SVN-Notify/
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
From: Giuseppe Scrivano <gscrivano@gnu.org>
Message-Id: <E1KveJ4-0006fe-5t@cvs.savannah.gnu.org>
Date: Thu, 30 Oct 2008 20:39:50 +0000
X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 3)
Subject: [myserver-commit] [2925] Added support for regex in the security
	file CONDITION.
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/pipermail/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, 30 Oct 2008 20:39:53 -0000

Revision: 2925
          http://svn.sv.gnu.org/viewvc/?view=rev&root=myserver&revision=2925
Author:   gscrivano
Date:     2008-10-30 20:39:49 +0000 (Thu, 30 Oct 2008)

Log Message:
-----------
Added support for regex in the security file CONDITION.

Modified Paths:
--------------
    trunk/myserver/documentation/security.texi
    trunk/myserver/src/conf/security/xml_validator.cpp

Modified: trunk/myserver/documentation/security.texi
===================================================================
--- trunk/myserver/documentation/security.texi	2008-10-29 22:28:23 UTC (rev 2924)
+++ trunk/myserver/documentation/security.texi	2008-10-30 20:39:49 UTC (rev 2925)
@@ -128,6 +128,16 @@
 In this case, the inner block is evaluated every time the
 @code{auth.user} is different than "Guest".
 
+It is possible to match a value against a regular expression, in this
+case you will need to declare it explicitly.
+
+@example
+<CONDITION name="auth.user" value="admin.*" regex="yes" not="yes">
+...
+</CONDITION>
+@end example
+
+
 @subsubsection DEFINE element
 The @code{DEFINE} block is used to specify a value for a variable that
 later can be accessed by the server.

Modified: trunk/myserver/src/conf/security/xml_validator.cpp
===================================================================
--- trunk/myserver/src/conf/security/xml_validator.cpp	2008-10-29 22:28:23 UTC (rev 2924)
+++ trunk/myserver/src/conf/security/xml_validator.cpp	2008-10-30 20:39:49 UTC (rev 2925)
@@ -19,6 +19,7 @@
 #include <include/conf/security/xml_validator.h>
 #include <include/conf/security/auth_domain.h>
 #include <include/conf/security/security_cache.h>
+#include <include/base/regex/myserver_regex.h>
 
 XmlValidator::XmlValidator ()
 {
@@ -281,21 +282,26 @@
   string name;
   const xmlChar *isNot = (const xmlChar*)"";
   const xmlChar *value = (const xmlChar*)"";
+  const xmlChar *regex = (const xmlChar*)"";
   xmlAttr *attrs = node->properties;
   
   while (attrs)
   {
-    if(!xmlStrcmp (attrs->name, (const xmlChar *)"name") &&
+    if (!xmlStrcmp (attrs->name, (const xmlChar *)"name") &&
        attrs->children && attrs->children->content)
       name.assign ((const char*)attrs->children->content);
     
-    if(!xmlStrcmp (attrs->name, (const xmlChar *)"value") &&
+    if (!xmlStrcmp (attrs->name, (const xmlChar *)"value") &&
        attrs->children && attrs->children->content)
       value = attrs->children->content;
 
-    if(!xmlStrcmp (attrs->name, (const xmlChar *)"not") &&
+    if (!xmlStrcmp (attrs->name, (const xmlChar *)"not") &&
        attrs->children && attrs->children->content)
       isNot = attrs->children->content;
+
+    if (!xmlStrcmp (attrs->name, (const xmlChar *)"regex") &&
+       attrs->children && attrs->children->content)
+      regex = attrs->children->content;
     
     attrs = attrs->next;
   }
@@ -305,7 +311,21 @@
   if (!storedValue)
     return false;
 
-  bool eq = storedValue->compare ((const char*)value) == 0;
+  bool eq;
+
+  if (!xmlStrcmp (regex, (const xmlChar *) "yes"))
+  {
+    Regex regex;
+
+    if (regex.compile ((const char*)value, REG_EXTENDED))
+      return false;
+
+    regmatch_t pm;
+
+    eq = regex.exec (storedValue->c_str (), 1, &pm, 0) == 0;
+  }
+  else
+    eq = storedValue->compare ((const char*)value) == 0;
   
   if (!xmlStrcmp (isNot, (const xmlChar *) "yes"))
     return !eq;





