From MAILER-DAEMON Wed Jun 02 07:05:36 2010
Received: from mailman by lists.gnu.org with archive (Exim 4.43)
	id 1OJllQ-0005k6-Bf
	for mharc-myserver-commit@gnu.org; Wed, 02 Jun 2010 07:05:36 -0400
Received: from [140.186.70.92] (port=39623 helo=eggs.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.43) id 1OJllK-0005jg-4S
	for myserver-commit@gnu.org; Wed, 02 Jun 2010 07:05:34 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69)
	(envelope-from <gscrivano@gnu.org>) id 1OJllF-0004BI-2h
	for myserver-commit@gnu.org; Wed, 02 Jun 2010 07:05:29 -0400
Received: from colonialone.fsf.org ([140.186.70.51]:47311
	helo=internal.in.savannah.gnu.org)
	by eggs.gnu.org with esmtp (Exim 4.69)
	(envelope-from <gscrivano@gnu.org>) id 1OJllE-0004BE-Vp
	for myserver-commit@gnu.org; Wed, 02 Jun 2010 07:05:25 -0400
Received: from [10.1.0.108] (helo=vcs-noshell.in.savannah.gnu.org)
	by internal.in.savannah.gnu.org with esmtp (Exim 4.69)
	(envelope-from <gscrivano@gnu.org>) id 1OJllE-00085C-T2
	for myserver-commit@gnu.org; Wed, 02 Jun 2010 11:05:24 +0000
Received: from gscrivano by vcs-noshell.in.savannah.gnu.org with local (Exim
	4.69) (envelope-from <gscrivano@savannah.gnu.org>)
	id 1OJllA-0004OQ-G7
	for myserver-commit@gnu.org; Wed, 02 Jun 2010 11:05:24 +0000
To: myserver-commit@gnu.org
X-Git-Refname: refs/heads/master
X-Git-Reftype: branch
X-Git-Oldrev: 6820a5ec13af7472af93c345f1a36d690c9f3121
X-Git-Newrev: c113da3f88c4f45c9e297c3150fc400c36e5560e
Message-Id: <E1OJllA-0004OQ-G7@vcs-noshell.in.savannah.gnu.org>
From: Giuseppe Scrivano <gscrivano@gnu.org>
Date: Wed, 02 Jun 2010 11:05:23 +0000
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2)
Subject: [myserver-commit] [SCM] GNU MyServer branch, master,
	updated. v0.9.2-255-gc113da3
X-BeenThere: myserver-commit@gnu.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: myserver-commit.gnu.org
List-Unsubscribe: <http://lists.gnu.org/mailman/listinfo/myserver-commit>,
	<mailto:myserver-commit-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/myserver-commit>
List-Post: <mailto:myserver-commit@gnu.org>
List-Help: <mailto:myserver-commit-request@gnu.org?subject=help>
List-Subscribe: <http://lists.gnu.org/mailman/listinfo/myserver-commit>,
	<mailto:myserver-commit-request@gnu.org?subject=subscribe>
X-List-Received-Date: Wed, 02 Jun 2010 11:05:35 -0000

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU MyServer".

The branch, master has been updated
       via  c113da3f88c4f45c9e297c3150fc400c36e5560e (commit)
      from  6820a5ec13af7472af93c345f1a36d690c9f3121 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------


commit c113da3f88c4f45c9e297c3150fc400c36e5560e
Author: Giuseppe Scrivano <gscrivano@gnu.org>
Date:   Wed Jun 2 13:04:56 2010 +0200

    Maintain a real NEWS file.

diff --git a/myserver/NEWS b/myserver/NEWS
index ab7df0d..eed9f5b 100644
--- a/myserver/NEWS
+++ b/myserver/NEWS
@@ -1,3 +1,58 @@
-Official news are aggregated at:
+GNU myserver NEWS                                    -*- outline -*-
 
-http://savannah.gnu.org/news/atom.php?group=myserver
+* Noteworthy changes in release ?.?
+
+** Bug fixes
+
+  Fix a segfault when the same log is shared by different virtual hosts.
+
+  Improved logging system, now more detailed error messages are provided.
+
+  Fix some tests when the test suite is executed under a chroot.
+
+  Fix some portability problems under FreeBSD systems.
+
+  Handle properly HTTP/1.0 requests without a "Host" header.
+
+  Use the chunked transfer encoding only with HTTP/1.1 clients.
+
+  The build doesn't fail if zlib is not found.
+
+
+* Noteworthy changes in release 0.9.2
+
+** Bug fixes
+
+  Vulnerability fix for CVE-2009-4029[1].
+
+  Sockets operations under Windows are now done using gnulib.
+
+  Fix the X-Sendfile directive when using keep-alive connections.
+
+
+* Noteworthy changes in release 0.9.1
+
+** New features
+
+  A GUI written in python to easily manage the server.
+
+  Gnulib usage.
+
+  Support for the Gopher protocol.
+
+  gettext i18n.
+
+  X-Sendfile directive for FastCGI.
+
+  Support for crypted passwords in the security files.
+
+========================================================================
+
+Copyright (C) 2008-2010 Free Software Foundation, Inc.
+
+Permission is granted to copy, distribute and/or modify this document
+under the terms of the GNU Free Documentation License, Version 1.3 or
+any later version published by the Free Software Foundation; with no
+Invariant Sections, with no Front-Cover Texts, and with no Back-Cover
+Texts.  A copy of the license is included in the ``GNU Free
+Documentation License'' file as part of this distribution.

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

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


hooks/post-receive
-- 
GNU MyServer


From MAILER-DAEMON Sun Jun 20 16:22:55 2010
Received: from mailman by lists.gnu.org with archive (Exim 4.43)
	id 1OQR2d-0001P0-E6
	for mharc-myserver-commit@gnu.org; Sun, 20 Jun 2010 16:22:55 -0400
Received: from [140.186.70.92] (port=41636 helo=eggs.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.43) id 1OQR2b-0001NV-EG
	for myserver-commit@gnu.org; Sun, 20 Jun 2010 16:22:54 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69)
	(envelope-from <gscrivano@gnu.org>) id 1OQR2Z-0003Rc-37
	for myserver-commit@gnu.org; Sun, 20 Jun 2010 16:22:53 -0400
Received: from colonialone.fsf.org ([140.186.70.51]:36960
	helo=internal.in.savannah.gnu.org)
	by eggs.gnu.org with esmtp (Exim 4.69)
	(envelope-from <gscrivano@gnu.org>) id 1OQR2Z-0003RY-1g
	for myserver-commit@gnu.org; Sun, 20 Jun 2010 16:22:51 -0400
Received: from [10.1.0.108] (helo=vcs-noshell.in.savannah.gnu.org)
	by internal.in.savannah.gnu.org with esmtp (Exim 4.69)
	(envelope-from <gscrivano@gnu.org>) id 1OQR2Y-0008MU-Oi
	for myserver-commit@gnu.org; Sun, 20 Jun 2010 20:22:50 +0000
Received: from gscrivano by vcs-noshell.in.savannah.gnu.org with local (Exim
	4.69) (envelope-from <gscrivano@savannah.gnu.org>)
	id 1OQR2O-0001du-SD
	for myserver-commit@gnu.org; Sun, 20 Jun 2010 20:22:50 +0000
To: myserver-commit@gnu.org
X-Git-Refname: refs/heads/master
X-Git-Reftype: branch
X-Git-Oldrev: c113da3f88c4f45c9e297c3150fc400c36e5560e
X-Git-Newrev: 3bc226cb84df485ebc5d14db26a5f2c1f75ceb92
Message-Id: <E1OQR2O-0001du-SD@vcs-noshell.in.savannah.gnu.org>
From: Giuseppe Scrivano <gscrivano@gnu.org>
Date: Sun, 20 Jun 2010 20:22:49 +0000
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2)
Subject: [myserver-commit] [SCM] GNU MyServer branch, master,
	updated. v0.9.2-258-g3bc226c
X-BeenThere: myserver-commit@gnu.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: myserver-commit.gnu.org
List-Unsubscribe: <http://lists.gnu.org/mailman/listinfo/myserver-commit>,
	<mailto:myserver-commit-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/myserver-commit>
List-Post: <mailto:myserver-commit@gnu.org>
List-Help: <mailto:myserver-commit-request@gnu.org?subject=help>
List-Subscribe: <http://lists.gnu.org/mailman/listinfo/myserver-commit>,
	<mailto:myserver-commit-request@gnu.org?subject=subscribe>
X-List-Received-Date: Sun, 20 Jun 2010 20:22:54 -0000

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU MyServer".

The branch, master has been updated
       via  3bc226cb84df485ebc5d14db26a5f2c1f75ceb92 (commit)
       via  bce46e8e06ca3db5c36f9e2cb3a0ca56f9eff1e3 (commit)
       via  24ac2a8932d6cb1bcd874bc5c5e2cc5bdfa35e7b (commit)
      from  c113da3f88c4f45c9e297c3150fc400c36e5560e (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------


commit 3bc226cb84df485ebc5d14db26a5f2c1f75ceb92
Author: Giuseppe Scrivano <gscrivano@gnu.org>
Date:   Sun Jun 20 21:53:40 2010 +0200

    Use gnulib macro's to detect IPv6.

diff --git a/myserver/configure.ac b/myserver/configure.ac
index af0fc26..11b8468 100644
--- a/myserver/configure.ac
+++ b/myserver/configure.ac
@@ -80,9 +80,6 @@ else
    MAKE_DOC=yes
 fi
 
-AC_ARG_ENABLE([ipv6], [--enable-ipv6 Build with IPv6 support],
-		      enable_ipv6="yes", enable_ipv6="")
-
 AC_ARG_ENABLE([tests], [--disable-tests Disable the tests suite],
                        enable_tests="$enableval", enable_tests="yes")
 
@@ -244,37 +241,6 @@ fi
 AC_SUBST(ZLIB_LIB)
 AC_SUBST(SSL_LIB)
 
-if test x$enable_ipv6 = xyes; then
-    dnl Check for IPv6
-    AC_MSG_CHECKING([for IPv6])
-    AC_RUN_IFELSE([AC_LANG_SOURCE([[ /* AF_INET6 available check */
-    #include <sys/types.h>
-    #include <sys/socket.h>
-    main()
-    {
-     if (socket(AF_INET6, SOCK_STREAM, 0) < 0)
-       exit(1);
-     else
-       exit(0);
-    }
-    ]])],[ AC_MSG_RESULT(yes)
-      AC_DEFINE(HAVE_IPV6, 1, [Enable IPv6 support])
-    ],[ AC_MSG_RESULT(no)
-      AC_DEFINE(HAVE_IPV6, 0, [Disable IPv6 support])
-      AC_MSG_ERROR([
-*** Cannot enable IPv6 support
-])
-    ],[ AC_MSG_RESULT(no)
-      AC_DEFINE(HAVE_IPV6, 0, [Disable IPv6 support])
-      AC_MSG_ERROR([
-*** Cannot enable IPv6 support
-])
-    
-    ])
-else
-    AC_DEFINE(HAVE_IPV6, 0, [Disable IPv6 support])
-fi
-
 if test "x$enable_tests" = xyes; then
   dnl Looking for cppunit
   AM_PATH_CPPUNIT(1.12.0, have_cppunit=yes)



commit bce46e8e06ca3db5c36f9e2cb3a0ca56f9eff1e3
Author: Giuseppe Scrivano <gscrivano@gnu.org>
Date:   Sun Jun 20 21:52:52 2010 +0200

    Fix some build errors when using IPv6

diff --git a/myserver/src/base/socket/socket.cpp b/myserver/src/base/socket/socket.cpp
index 57eb5c9..80c67b4 100644
--- a/myserver/src/base/socket/socket.cpp
+++ b/myserver/src/base/socket/socket.cpp
@@ -255,32 +255,30 @@ int Socket::getLocalIPsList (string &out)
 
   Socket::gethostname (serverName, HOST_NAME_MAX);
 #if HAVE_IPV6
-  addrinfo aiHints = { 0 }, *pHostInfo = NULL, *pCrtHostInfo = NULL;
+  addrinfo aiHints = {0}, *pHostInfo = NULL, *pCrtHostInfo = NULL;
   aiHints.ai_socktype = SOCK_STREAM;
-  if ( getaddrinfo (serverName, NULL, &aiHints, &pHostInfo) == 0 &&
-       pHostInfo != NULL )
+  if (getaddrinfo (serverName, NULL, &aiHints, &pHostInfo) == 0
+      && pHostInfo != NULL)
     {
       sockaddr_storage *pCurrentSockAddr = NULL;
       char straddr[NI_MAXHOST] = "";
       memset (straddr, 0, NI_MAXHOST);
       ostringstream stream;
-      for ( pCrtHostInfo = pHostInfo; pCrtHostInfo != NULL;
-            pCrtHostInfo = pCrtHostInfo->ai_next )
+      for (pCrtHostInfo = pHostInfo; pCrtHostInfo != NULL;
+           pCrtHostInfo = pCrtHostInfo->ai_next)
         {
-          pCurrentSockAddr =
-            reinterpret_cast<sockaddr_storage *>(pCrtHostInfo->ai_addr);
+          pCurrentSockAddr = (sockaddr_storage *)(pCrtHostInfo->ai_addr);
           if ( pCurrentSockAddr == NULL )
             continue;
 
-          if ( !getnameinfo (reinterpret_cast<sockaddr *>(pCurrentSockAddr),
-                             sizeof (sockaddr_storage), straddr, NI_MAXHOST,
-                             NULL, 0, NI_NUMERICHOST) )
-            {
-              stream << ( !stream.str ().empty () ? ", " : "" ) << straddr;
-            }
-          else
+          if (getnameinfo (pCrtHostInfo->ai_addr,
+                           sizeof (sockaddr_storage), straddr, NI_MAXHOST,
+                           NULL, 0, NI_NUMERICHOST))
             return -1;
+
+          stream << ( !stream.str ().empty () ? ", " : "" ) << straddr;
         }
+
       out.assign (stream.str ());
       freeaddrinfo (pHostInfo);
     }
@@ -289,12 +287,10 @@ int Socket::getLocalIPsList (string &out)
   MYSERVER_HOSTENT *localhe;
   in_addr ia;
   localhe = Socket::gethostbyname (serverName);
-
   if (localhe)
     {
       ostringstream stream;
       int i;
-      /*! Print all the interfaces IPs. */
       for (i = 0; (localhe->h_addr_list[i]); i++)
         {
 # ifdef WIN32
@@ -417,7 +413,7 @@ int Socket::connect (const char* host, u_short port)
     }
 
   memset (szPort, 0, sizeof (char)*10);
-  checked::snprintf (szPort, 10, "%d", port);
+  gnulib::snprintf (szPort, 10, "%d", port);
 
   if (aiHints.ai_family != 0)
     nGetaddrinfoRet = getaddrinfo (host, NULL, &aiHints, &pHostInfo);
diff --git a/myserver/src/server/server.cpp b/myserver/src/server/server.cpp
index 79a4e07..710d5c3 100644
--- a/myserver/src/server/server.cpp
+++ b/myserver/src/server/server.cpp
@@ -1037,6 +1037,7 @@ int Server::addConnection (Socket *s, MYSERVER_SOCKADDRIN *asockIn)
     return -1;
 
 #if ( HAVE_IPV6 )
+  int ret;
   if ( asockIn->ss_family == AF_INET )
     ret = getnameinfo (reinterpret_cast<const sockaddr *>(asockIn),
                        sizeof (sockaddr_in),



commit 24ac2a8932d6cb1bcd874bc5c5e2cc5bdfa35e7b
Author: Giuseppe Scrivano <gscrivano@gnu.org>
Date:   Sun Jun 20 21:29:09 2010 +0200

    Add new module `getaddrinfo'.

diff --git a/myserver/bootstrap.conf b/myserver/bootstrap.conf
index 630df4d..3bb098f 100644
--- a/myserver/bootstrap.conf
+++ b/myserver/bootstrap.conf
@@ -34,6 +34,7 @@ crypto/sha1
 connect
 c++defs
 fsync
+getaddrinfo
 getcwd
 getopt-gnu
 getpeername

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

Summary of changes:
 myserver/bootstrap.conf             |    1 +
 myserver/configure.ac               |   34 ----------------------------------
 myserver/src/base/socket/socket.cpp |   30 +++++++++++++-----------------
 myserver/src/server/server.cpp      |    1 +
 4 files changed, 15 insertions(+), 51 deletions(-)


hooks/post-receive
-- 
GNU MyServer


From MAILER-DAEMON Sun Jun 20 16:46:54 2010
Received: from mailman by lists.gnu.org with archive (Exim 4.43)
	id 1OQRPq-0000cV-9o
	for mharc-myserver-commit@gnu.org; Sun, 20 Jun 2010 16:46:54 -0400
Received: from [140.186.70.92] (port=58391 helo=eggs.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.43) id 1OQRPo-0000bD-14
	for myserver-commit@gnu.org; Sun, 20 Jun 2010 16:46:53 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69)
	(envelope-from <gscrivano@gnu.org>) id 1OQRPn-0006KS-2a
	for myserver-commit@gnu.org; Sun, 20 Jun 2010 16:46:51 -0400
Received: from colonialone.fsf.org ([140.186.70.51]:59643
	helo=internal.in.savannah.gnu.org)
	by eggs.gnu.org with esmtp (Exim 4.69)
	(envelope-from <gscrivano@gnu.org>) id 1OQRPn-0006KJ-1K
	for myserver-commit@gnu.org; Sun, 20 Jun 2010 16:46:51 -0400
Received: from [10.1.0.108] (helo=vcs-noshell.in.savannah.gnu.org)
	by internal.in.savannah.gnu.org with esmtp (Exim 4.69)
	(envelope-from <gscrivano@gnu.org>) id 1OQRPm-0000Dl-LM
	for myserver-commit@gnu.org; Sun, 20 Jun 2010 20:46:50 +0000
Received: from gscrivano by vcs-noshell.in.savannah.gnu.org with local (Exim
	4.69) (envelope-from <gscrivano@savannah.gnu.org>)
	id 1OQRPm-0003TA-CM
	for myserver-commit@gnu.org; Sun, 20 Jun 2010 20:46:50 +0000
To: myserver-commit@gnu.org
X-Git-Refname: refs/heads/master
X-Git-Reftype: branch
X-Git-Oldrev: 3bc226cb84df485ebc5d14db26a5f2c1f75ceb92
X-Git-Newrev: dcc848a5b06a388ec97bc77bcd4b8cfe70289080
Message-Id: <E1OQRPm-0003TA-CM@vcs-noshell.in.savannah.gnu.org>
From: Giuseppe Scrivano <gscrivano@gnu.org>
Date: Sun, 20 Jun 2010 20:46:50 +0000
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2)
Subject: [myserver-commit] [SCM] GNU MyServer branch, master,
	updated. v0.9.2-259-gdcc848a
X-BeenThere: myserver-commit@gnu.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: myserver-commit.gnu.org
List-Unsubscribe: <http://lists.gnu.org/mailman/listinfo/myserver-commit>,
	<mailto:myserver-commit-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/myserver-commit>
List-Post: <mailto:myserver-commit@gnu.org>
List-Help: <mailto:myserver-commit-request@gnu.org?subject=help>
List-Subscribe: <http://lists.gnu.org/mailman/listinfo/myserver-commit>,
	<mailto:myserver-commit-request@gnu.org?subject=subscribe>
X-List-Received-Date: Sun, 20 Jun 2010 20:46:53 -0000

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU MyServer".

The branch, master has been updated
       via  dcc848a5b06a388ec97bc77bcd4b8cfe70289080 (commit)
      from  3bc226cb84df485ebc5d14db26a5f2c1f75ceb92 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------


commit dcc848a5b06a388ec97bc77bcd4b8cfe70289080
Author: Giuseppe Scrivano <gscrivano@gnu.org>
Date:   Sun Jun 20 22:45:37 2010 +0200

    Use 127.0.0.1 for localhost address even if IPv6 is detected at build time.

diff --git a/myserver/include/base/socket/socket.h b/myserver/include/base/socket/socket.h
index 5ad6be0..b0481c1 100644
--- a/myserver/include/base/socket/socket.h
+++ b/myserver/include/base/socket/socket.h
@@ -51,7 +51,7 @@ typedef int SocketHandle;
 #  define MAX_IP_STRING_LEN  32
 # endif
 
-# if HAVE_IPV6
+# if 0 && HAVE_IPV6
 #  define LOCALHOST_ADDRESS "::1"
 # else
 #  define LOCALHOST_ADDRESS "127.0.0.1"

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

Summary of changes:
 myserver/include/base/socket/socket.h |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)


hooks/post-receive
-- 
GNU MyServer


From MAILER-DAEMON Mon Jun 21 05:08:16 2010
Received: from mailman by lists.gnu.org with archive (Exim 4.43)
	id 1OQczI-0006Cj-4l
	for mharc-myserver-commit@gnu.org; Mon, 21 Jun 2010 05:08:16 -0400
Received: from [140.186.70.92] (port=35231 helo=eggs.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.43) id 1OQczF-0006BL-Ci
	for myserver-commit@gnu.org; Mon, 21 Jun 2010 05:08:14 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69)
	(envelope-from <gscrivano@gnu.org>) id 1OQczD-0006J9-Px
	for myserver-commit@gnu.org; Mon, 21 Jun 2010 05:08:12 -0400
Received: from colonialone.fsf.org ([140.186.70.51]:42076
	helo=internal.in.savannah.gnu.org)
	by eggs.gnu.org with esmtp (Exim 4.69)
	(envelope-from <gscrivano@gnu.org>) id 1OQczD-0006J5-NK
	for myserver-commit@gnu.org; Mon, 21 Jun 2010 05:08:11 -0400
Received: from [10.1.0.108] (helo=vcs-noshell.in.savannah.gnu.org)
	by internal.in.savannah.gnu.org with esmtp (Exim 4.69)
	(envelope-from <gscrivano@gnu.org>) id 1OQczD-0000er-MY
	for myserver-commit@gnu.org; Mon, 21 Jun 2010 09:08:11 +0000
Received: from gscrivano by vcs-noshell.in.savannah.gnu.org with local (Exim
	4.69) (envelope-from <gscrivano@savannah.gnu.org>)
	id 1OQcz8-0003u9-DR
	for myserver-commit@gnu.org; Mon, 21 Jun 2010 09:08:11 +0000
To: myserver-commit@gnu.org
X-Git-Refname: refs/heads/master
X-Git-Reftype: branch
X-Git-Oldrev: dcc848a5b06a388ec97bc77bcd4b8cfe70289080
X-Git-Newrev: 44aaca8c923a74bce455d9864510b904a2753a3b
Message-Id: <E1OQcz8-0003u9-DR@vcs-noshell.in.savannah.gnu.org>
From: Giuseppe Scrivano <gscrivano@gnu.org>
Date: Mon, 21 Jun 2010 09:08:10 +0000
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2)
Subject: [myserver-commit] [SCM] GNU MyServer branch, master,
	updated. v0.9.2-260-g44aaca8
X-BeenThere: myserver-commit@gnu.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: myserver-commit.gnu.org
List-Unsubscribe: <http://lists.gnu.org/mailman/listinfo/myserver-commit>,
	<mailto:myserver-commit-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/myserver-commit>
List-Post: <mailto:myserver-commit@gnu.org>
List-Help: <mailto:myserver-commit-request@gnu.org?subject=help>
List-Subscribe: <http://lists.gnu.org/mailman/listinfo/myserver-commit>,
	<mailto:myserver-commit-request@gnu.org?subject=subscribe>
X-List-Received-Date: Mon, 21 Jun 2010 09:08:15 -0000

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU MyServer".

The branch, master has been updated
       via  44aaca8c923a74bce455d9864510b904a2753a3b (commit)
      from  dcc848a5b06a388ec97bc77bcd4b8cfe70289080 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------


commit 44aaca8c923a74bce455d9864510b904a2753a3b
Author: Giuseppe Scrivano <gscrivano@gnu.org>
Date:   Mon Jun 21 11:07:31 2010 +0200

    Now `Socket::getLocalIPsList' uses exceptions to raise errors.

diff --git a/myserver/include/base/socket/socket.h b/myserver/include/base/socket/socket.h
index b0481c1..f538968 100644
--- a/myserver/include/base/socket/socket.h
+++ b/myserver/include/base/socket/socket.h
@@ -104,7 +104,7 @@ public:
 
   u_long getThrottling ();
   void setThrottling (u_long);
-  static int getLocalIPsList (string&);
+  static void getLocalIPsList (string&);
   /*! 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);
diff --git a/myserver/src/base/socket/socket.cpp b/myserver/src/base/socket/socket.cpp
index 80c67b4..27ba6f8 100644
--- a/myserver/src/base/socket/socket.cpp
+++ b/myserver/src/base/socket/socket.cpp
@@ -248,7 +248,7 @@ int  Socket::setsockopt (int level, int optname,
 /*!
   Fill the out string with a list of the local IPs. Returns 0 on success.
  */
-int Socket::getLocalIPsList (string &out)
+void Socket::getLocalIPsList (string &out)
 {
   char serverName[HOST_NAME_MAX + 1];
   memset (serverName, 0, HOST_NAME_MAX + 1);
@@ -257,8 +257,9 @@ int Socket::getLocalIPsList (string &out)
 #if HAVE_IPV6
   addrinfo aiHints = {0}, *pHostInfo = NULL, *pCrtHostInfo = NULL;
   aiHints.ai_socktype = SOCK_STREAM;
-  if (getaddrinfo (serverName, NULL, &aiHints, &pHostInfo) == 0
-      && pHostInfo != NULL)
+
+  checked::checkError (getaddrinfo (serverName, NULL, &aiHints, &pHostInfo));
+  if (pHostInfo != NULL)
     {
       sockaddr_storage *pCurrentSockAddr = NULL;
       char straddr[NI_MAXHOST] = "";
@@ -271,10 +272,10 @@ int Socket::getLocalIPsList (string &out)
           if ( pCurrentSockAddr == NULL )
             continue;
 
-          if (getnameinfo (pCrtHostInfo->ai_addr,
-                           sizeof (sockaddr_storage), straddr, NI_MAXHOST,
-                           NULL, 0, NI_NUMERICHOST))
-            return -1;
+          checked::checkError (getnameinfo (pCrtHostInfo->ai_addr,
+                                            sizeof (sockaddr_storage), straddr,
+                                            NI_MAXHOST, NULL, 0,
+                                            NI_NUMERICHOST));
 
           stream << ( !stream.str ().empty () ? ", " : "" ) << straddr;
         }
@@ -282,7 +283,6 @@ int Socket::getLocalIPsList (string &out)
       out.assign (stream.str ());
       freeaddrinfo (pHostInfo);
     }
-  return 0;
 #else
   MYSERVER_HOSTENT *localhe;
   in_addr ia;
@@ -302,15 +302,12 @@ int Socket::getLocalIPsList (string &out)
         }
 
       out.assign (stream.str ());
-      return 0;
     }
   else
     {
       out.assign (LOCALHOST_ADDRESS);
-      return 0;
     }
 #endif
-  return -1;
 }
 
 /*!
diff --git a/myserver/src/server/server.cpp b/myserver/src/server/server.cpp
index 710d5c3..0896eb0 100644
--- a/myserver/src/server/server.cpp
+++ b/myserver/src/server/server.cpp
@@ -269,7 +269,11 @@ int Server::postLoad ()
     delete ipAddresses;
   ipAddresses = new string ();
 
-  if (Socket::getLocalIPsList (*ipAddresses))
+  try
+    {
+      Socket::getLocalIPsList (*ipAddresses);
+    }
+  catch (exception & e)
     {
       log (MYSERVER_LOG_MSG_ERROR, _("Error reading IP list"));
       return -1;
diff --git a/myserver/tests/test_socket.cpp b/myserver/tests/test_socket.cpp
index 209e004..3c53739 100644
--- a/myserver/tests/test_socket.cpp
+++ b/myserver/tests/test_socket.cpp
@@ -150,19 +150,20 @@ public:
 
   void testGetLocalIPsList ()
   {
-    int status = obj->socket (AF_INET, SOCK_STREAM, 0);
-
-    CPPUNIT_ASSERT (status != -1);
-
+    int err = 0;
     string out;
 
-    status = obj->getLocalIPsList (out);
-
-    CPPUNIT_ASSERT (status != -1);
-
-    status = obj->close ();
-
-    CPPUNIT_ASSERT (status != -1);
+    try
+      {
+        obj->socket (AF_INET, SOCK_STREAM, 0);
+        obj->getLocalIPsList (out);
+        obj->close ();
+      }
+    catch (exception & e)
+      {
+        CPPUNIT_FAIL (e.what ());
+        obj->close ();
+      }
   }
 };
 

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

Summary of changes:
 myserver/include/base/socket/socket.h |    2 +-
 myserver/src/base/socket/socket.cpp   |   19 ++++++++-----------
 myserver/src/server/server.cpp        |    6 +++++-
 myserver/tests/test_socket.cpp        |   23 ++++++++++++-----------
 4 files changed, 26 insertions(+), 24 deletions(-)


hooks/post-receive
-- 
GNU MyServer


From MAILER-DAEMON Mon Jun 21 07:48:32 2010
Received: from mailman by lists.gnu.org with archive (Exim 4.43)
	id 1OQfUO-0006P1-Nu
	for mharc-myserver-commit@gnu.org; Mon, 21 Jun 2010 07:48:32 -0400
Received: from [140.186.70.92] (port=50410 helo=eggs.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.43) id 1OQfUI-0006Os-Jq
	for myserver-commit@gnu.org; Mon, 21 Jun 2010 07:48:31 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69)
	(envelope-from <gscrivano@gnu.org>) id 1OQfUG-0006Ph-5S
	for myserver-commit@gnu.org; Mon, 21 Jun 2010 07:48:26 -0400
Received: from colonialone.fsf.org ([140.186.70.51]:44579
	helo=internal.in.savannah.gnu.org)
	by eggs.gnu.org with esmtp (Exim 4.69)
	(envelope-from <gscrivano@gnu.org>) id 1OQfUG-0006Pc-2J
	for myserver-commit@gnu.org; Mon, 21 Jun 2010 07:48:24 -0400
Received: from [10.1.0.108] (helo=vcs-noshell.in.savannah.gnu.org)
	by internal.in.savannah.gnu.org with esmtp (Exim 4.69)
	(envelope-from <gscrivano@gnu.org>) id 1OQfUF-0002ZH-MF
	for myserver-commit@gnu.org; Mon, 21 Jun 2010 11:48:23 +0000
Received: from gscrivano by vcs-noshell.in.savannah.gnu.org with local (Exim
	4.69) (envelope-from <gscrivano@savannah.gnu.org>)
	id 1OQfUF-0007st-Io
	for myserver-commit@gnu.org; Mon, 21 Jun 2010 11:48:23 +0000
To: myserver-commit@gnu.org
X-Git-Refname: refs/heads/master
X-Git-Reftype: branch
X-Git-Oldrev: 44aaca8c923a74bce455d9864510b904a2753a3b
X-Git-Newrev: fc763153ffea70459d61ce10fa093c78efdb05fe
Message-Id: <E1OQfUF-0007st-Io@vcs-noshell.in.savannah.gnu.org>
From: Giuseppe Scrivano <gscrivano@gnu.org>
Date: Mon, 21 Jun 2010 11:48:23 +0000
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2)
Subject: [myserver-commit] [SCM] GNU MyServer branch, master,
	updated. v0.9.2-261-gfc76315
X-BeenThere: myserver-commit@gnu.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: myserver-commit.gnu.org
List-Unsubscribe: <http://lists.gnu.org/mailman/listinfo/myserver-commit>,
	<mailto:myserver-commit-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/myserver-commit>
List-Post: <mailto:myserver-commit@gnu.org>
List-Help: <mailto:myserver-commit-request@gnu.org?subject=help>
List-Subscribe: <http://lists.gnu.org/mailman/listinfo/myserver-commit>,
	<mailto:myserver-commit-request@gnu.org?subject=subscribe>
X-List-Received-Date: Mon, 21 Jun 2010 11:48:32 -0000

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU MyServer".

The branch, master has been updated
       via  fc763153ffea70459d61ce10fa093c78efdb05fe (commit)
      from  44aaca8c923a74bce455d9864510b904a2753a3b (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------


commit fc763153ffea70459d61ce10fa093c78efdb05fe
Author: Giuseppe Scrivano <gscrivano@gnu.org>
Date:   Mon Jun 21 13:48:18 2010 +0200

    Fix a build error with GCC 4.5.

diff --git a/myserver/src/base/files_cache/cached_file.cpp b/myserver/src/base/files_cache/cached_file.cpp
index 9b98780..d03b56b 100644
--- a/myserver/src/base/files_cache/cached_file.cpp
+++ b/myserver/src/base/files_cache/cached_file.cpp
@@ -47,7 +47,7 @@ using namespace std;
  */
 CachedFile::CachedFile (CachedFileBuffer* cfb)
 {
-  File::File ();
+  handle = -1;
   buffer = cfb;
   fseek = 0;
   cfb->addRef ();

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

Summary of changes:
 myserver/src/base/files_cache/cached_file.cpp |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)


hooks/post-receive
-- 
GNU MyServer


From MAILER-DAEMON Mon Jun 21 09:41:45 2010
Received: from mailman by lists.gnu.org with archive (Exim 4.43)
	id 1OQhFx-0006mq-01
	for mharc-myserver-commit@gnu.org; Mon, 21 Jun 2010 09:41:45 -0400
Received: from [140.186.70.92] (port=47214 helo=eggs.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.43) id 1OQhFt-0006lu-VD
	for myserver-commit@gnu.org; Mon, 21 Jun 2010 09:41:43 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69)
	(envelope-from <gscrivano@gnu.org>) id 1OQhFp-0006kL-V3
	for myserver-commit@gnu.org; Mon, 21 Jun 2010 09:41:41 -0400
Received: from colonialone.fsf.org ([140.186.70.51]:48569
	helo=internal.in.savannah.gnu.org)
	by eggs.gnu.org with esmtp (Exim 4.69)
	(envelope-from <gscrivano@gnu.org>) id 1OQhFp-0006kC-TQ
	for myserver-commit@gnu.org; Mon, 21 Jun 2010 09:41:37 -0400
Received: from [10.1.0.108] (helo=vcs-noshell.in.savannah.gnu.org)
	by internal.in.savannah.gnu.org with esmtp (Exim 4.69)
	(envelope-from <gscrivano@gnu.org>) id 1OQhFp-0003xD-8U
	for myserver-commit@gnu.org; Mon, 21 Jun 2010 13:41:37 +0000
Received: from gscrivano by vcs-noshell.in.savannah.gnu.org with local (Exim
	4.69) (envelope-from <gscrivano@savannah.gnu.org>)
	id 1OQhFo-0000Fy-PZ
	for myserver-commit@gnu.org; Mon, 21 Jun 2010 13:41:37 +0000
To: myserver-commit@gnu.org
X-Git-Refname: refs/heads/master
X-Git-Reftype: branch
X-Git-Oldrev: fc763153ffea70459d61ce10fa093c78efdb05fe
X-Git-Newrev: 810e6145fe5888c11e76853f833badbc42c8042e
Message-Id: <E1OQhFo-0000Fy-PZ@vcs-noshell.in.savannah.gnu.org>
From: Giuseppe Scrivano <gscrivano@gnu.org>
Date: Mon, 21 Jun 2010 13:41:37 +0000
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2)
Subject: [myserver-commit] [SCM] GNU MyServer branch, master,
	updated. v0.9.2-263-g810e614
X-BeenThere: myserver-commit@gnu.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: myserver-commit.gnu.org
List-Unsubscribe: <http://lists.gnu.org/mailman/listinfo/myserver-commit>,
	<mailto:myserver-commit-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/myserver-commit>
List-Post: <mailto:myserver-commit@gnu.org>
List-Help: <mailto:myserver-commit-request@gnu.org?subject=help>
List-Subscribe: <http://lists.gnu.org/mailman/listinfo/myserver-commit>,
	<mailto:myserver-commit-request@gnu.org?subject=subscribe>
X-List-Received-Date: Mon, 21 Jun 2010 13:41:43 -0000

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU MyServer".

The branch, master has been updated
       via  810e6145fe5888c11e76853f833badbc42c8042e (commit)
       via  efa4a8d51afd9e841c141f7c0892d8f2508b7434 (commit)
      from  fc763153ffea70459d61ce10fa093c78efdb05fe (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------


commit 810e6145fe5888c11e76853f833badbc42c8042e
Author: Giuseppe Scrivano <gscrivano@gnu.org>
Date:   Mon Jun 21 15:41:31 2010 +0200

    Fix warnings reported by GCC 4.5.

diff --git a/myserver/include/conf/vhost/xml_vhost_handler.h b/myserver/include/conf/vhost/xml_vhost_handler.h
index 9fcd225..f2c6344 100644
--- a/myserver/include/conf/vhost/xml_vhost_handler.h
+++ b/myserver/include/conf/vhost/xml_vhost_handler.h
@@ -32,17 +32,16 @@ public:
   XmlVhostHandler (ListenThreads* lt, LogManager* lm);
   ~XmlVhostHandler ();
   int getHostsNumber ();
-  Vhost* getVHost (int n);
+  Vhost* getVHost (u_long n);
   void clean ();
-  int removeVHost (int n);
-  int switchVhosts (int n1, int n2);
+  int removeVHost (u_long n);
   vector<Vhost*>* getVHostList ();
 
   /*! Get a pointer to a vhost.  */
-  virtual Vhost* getVHost (const char*, const char*, u_short);
+  virtual Vhost* getVHost (const char *, const char *, u_short);
 
   /*! Add an element to the vhost list.  */
-  int addVHost (Vhost*);
+  int addVHost (Vhost *);
 
   /*! Load the virtual hosts list from a xml configuration file.  */
   virtual int load (const char *);
diff --git a/myserver/src/base/files_cache/cached_file_factory.cpp b/myserver/src/base/files_cache/cached_file_factory.cpp
index c473ac7..3695bcb 100644
--- a/myserver/src/base/files_cache/cached_file_factory.cpp
+++ b/myserver/src/base/files_cache/cached_file_factory.cpp
@@ -140,10 +140,9 @@ File* CachedFileFactory::open (const char* filename, int flags)
   CachedFileFactoryRecord *record;
   CachedFileBuffer *buffer;
   CachedFile* cachedFile;
-  u_long ticks;
+  u_long ticks = getTicks ();
 
   mutex.lock ();
-
   try
     {
       record = buffers.get (filename);
@@ -243,14 +242,13 @@ void CachedFileFactory::nullReferences (CachedFileBuffer* cfb)
   float averageUsage;
   float bufferAverageUsage;
   float spaceUsage;
-  u_long ticks;
+  u_long ticks = getTicks ();
   mutex.lock ();
 
   try
     {
-      ticks = getTicks ();
       record = buffers.get (cfb->getFilename ());
-      if (!record)
+      if (! record)
         {
           mutex.unlock ();
           return;
@@ -259,7 +257,7 @@ void CachedFileFactory::nullReferences (CachedFileBuffer* cfb)
       spaceUsage = (float)usedSize / size;
       averageUsage = (float)used * 1000.0f / (ticks - created);
       bufferAverageUsage = (float)record->used * 1000.0f /
-        (getTicks () - record->created);
+        (ticks - record->created);
 
       if (((spaceUsage > 0.65f) && (bufferAverageUsage < averageUsage)
            && ((ticks - record->created) > 10000))
diff --git a/myserver/src/base/process/fork_server.cpp b/myserver/src/base/process/fork_server.cpp
index 37a439a..88a9b78 100644
--- a/myserver/src/base/process/fork_server.cpp
+++ b/myserver/src/base/process/fork_server.cpp
@@ -108,7 +108,7 @@ int ForkServer::readString (Socket *sock, char **out)
   *out = new char[len + 1];
   (*out)[len] = '\0';
 
-  if (len && (sock->read (*out, len, &nbr) || nbr < len))
+  if (len && (sock->read (*out, len, &nbr) || (int) nbr < len))
     {
       delete [] *out;
       return -1;
diff --git a/myserver/src/conf/main/xml_main_configuration.cpp b/myserver/src/conf/main/xml_main_configuration.cpp
index 771e34d..98f21bb 100644
--- a/myserver/src/conf/main/xml_main_configuration.cpp
+++ b/myserver/src/conf/main/xml_main_configuration.cpp
@@ -49,7 +49,6 @@ const char *XmlMainConfiguration::getValue (const char* field)
   for (; lcur; lcur = lcur->next)
     if (lcur->name && !xmlStrcmp (lcur->name, (const xmlChar *) "DEFINE"))
       {
-        NodeTree<string> *node = new NodeTree<string> ();
         const char *name = NULL;
         const char *value = NULL;
 
diff --git a/myserver/src/conf/vhost/xml_vhost_handler.cpp b/myserver/src/conf/vhost/xml_vhost_handler.cpp
index 0092389..949571f 100644
--- a/myserver/src/conf/vhost/xml_vhost_handler.cpp
+++ b/myserver/src/conf/vhost/xml_vhost_handler.cpp
@@ -27,7 +27,7 @@
 #include <include/conf/xml_conf.h>
 
 
-static VhostManagerHandler *builder (ListenThreads* lt, LogManager* lm)
+static VhostManagerHandler *builder (ListenThreads *lt, LogManager *lm)
 {
   return new XmlVhostHandler (lt, lm);
 }
@@ -37,7 +37,7 @@ static VhostManagerHandler *builder (ListenThreads* lt, LogManager* lm)
 
   \param manager Where register the builder.
  */
-void XmlVhostHandler::registerBuilder (VhostManager& manager)
+void XmlVhostHandler::registerBuilder (VhostManager &manager)
 {
   string xml ("xml");
   manager.registerBuilder (xml, builder);
@@ -47,7 +47,7 @@ void XmlVhostHandler::registerBuilder (VhostManager& manager)
   XmlVhostHandler add function.
   \param vh The virtual host to add.
  */
-int XmlVhostHandler::addVHost (Vhost* vh)
+int XmlVhostHandler::addVHost (Vhost *vh)
 {
   vector<Vhost*>::iterator it;
 
@@ -84,7 +84,7 @@ int XmlVhostHandler::addVHost (Vhost* vh)
 /*!
   \see VhostManager#getVHost
  */
-Vhost* XmlVhostHandler::getVHost (const char* host, const char* ip, u_short port)
+Vhost* XmlVhostHandler::getVHost (const char *host, const char *ip, u_short port)
 {
   vector<Vhost*>::iterator it;
   /*
@@ -121,7 +121,7 @@ Vhost* XmlVhostHandler::getVHost (const char* host, const char* ip, u_short port
   \param lt A ListenThreads object to use to create new threads.
   \param lm The log manager to use.
  */
-XmlVhostHandler::XmlVhostHandler (ListenThreads* lt, LogManager* lm)
+XmlVhostHandler::XmlVhostHandler (ListenThreads *lt, LogManager *lm)
 {
   listenThreads = lt;
   logManager = lm;
@@ -533,7 +533,7 @@ int XmlVhostHandler::load (const char *filename)
 /*!
   \see VhostManager#getVHost
  */
-Vhost* XmlVhostHandler::getVHost (int n)
+Vhost* XmlVhostHandler::getVHost (u_long n)
 {
   if (n > hosts.size ())
     return NULL;
@@ -546,7 +546,7 @@ Vhost* XmlVhostHandler::getVHost (int n)
   First position is zero.
   \param n The virtual host identifier in the list.
  */
-int XmlVhostHandler::removeVHost (int n)
+int XmlVhostHandler::removeVHost (u_long n)
 {
   vector<Vhost*>::iterator it = hosts.erase (hosts.begin () + n - 1);
   delete *it;
diff --git a/myserver/src/filter/gzip/gzip_decompress.cpp b/myserver/src/filter/gzip/gzip_decompress.cpp
index d83a8d5..f5d3ac6 100644
--- a/myserver/src/filter/gzip/gzip_decompress.cpp
+++ b/myserver/src/filter/gzip/gzip_decompress.cpp
@@ -216,12 +216,11 @@ u_long GzipDecompress::getHeader (char *buffer, u_long buffersize)
 int GzipDecompress::read (char* buffer, u_long len, u_long *nbr)
 {
   char *tmp_buff;
-  int ret;
   u_long nbr_parent;
-  if (!parent)
+  if (! parent)
     return -1;
 
-  if (!active)
+  if (! active)
     return parent->read (buffer, len, nbr);
 
   tmp_buff = new char[len/2];
@@ -236,7 +235,6 @@ int GzipDecompress::read (char* buffer, u_long len, u_long *nbr)
       throw;
     }
 
-
   delete [] tmp_buff;
   return 0;
 }
diff --git a/myserver/src/http_handler/cgi/cgi.cpp b/myserver/src/http_handler/cgi/cgi.cpp
index bb19bc9..d94a15e 100644
--- a/myserver/src/http_handler/cgi/cgi.cpp
+++ b/myserver/src/http_handler/cgi/cgi.cpp
@@ -442,7 +442,7 @@ int Cgi::sendHeader (HttpThreadContext *td, Pipe &stdOutFile, FiltersChain &chai
           return 1;
         }
 
-      for (int i = std::max (0, (int) (headerOffset - nBytesRead - 10));
+      for (u_long i = std::max (0UL, (headerOffset - nBytesRead - 10));
            i < headerOffset; i++)
         {
           char *buff = td->auxiliaryBuffer->getBuffer ();
diff --git a/myserver/src/http_handler/http_file/http_file.cpp b/myserver/src/http_handler/http_file/http_file.cpp
index 18ddd9e..202ffaf 100644
--- a/myserver/src/http_handler/http_file/http_file.cpp
+++ b/myserver/src/http_handler/http_file/http_file.cpp
@@ -199,7 +199,6 @@ int HttpFile::send (HttpThreadContext* td, const char *filenamePath,
     With this routine we send a file through the HTTP protocol.
     Open the file and save its handle.
    */
-  int ret;
   u_long filesize = 0;
   File *file = NULL;
   u_long bytesToSend;
@@ -219,16 +218,16 @@ int HttpFile::send (HttpThreadContext* td, const char *filenamePath,
   try
     {
 
-      if (!td->request.cmd.compare ("PUT"))
+      if (! td->request.cmd.compare ("PUT"))
         return putFile (td, td->filenamePath);
 
-      if (!td->request.cmd.compare ("DELETE"))
+      if (! td->request.cmd.compare ("DELETE"))
         return deleteFile (td, td->filenamePath);
 
-      if (!(td->permissions & MYSERVER_PERMISSION_READ))
+      if (! (td->permissions & MYSERVER_PERMISSION_READ))
         return td->http->sendAuth ();
 
-      if (!FilesUtility::nodeExists (filenamePath))
+      if (! FilesUtility::nodeExists (filenamePath))
         return td->http->raiseHTTPError (404);
 
       lastMT = FilesUtility::getLastModTime (td->filenamePath.c_str ());
diff --git a/myserver/src/http_handler/mscgi/mscgi.cpp b/myserver/src/http_handler/mscgi/mscgi.cpp
index e65ea0c..c1831f4 100644
--- a/myserver/src/http_handler/mscgi/mscgi.cpp
+++ b/myserver/src/http_handler/mscgi/mscgi.cpp
@@ -57,7 +57,6 @@ int MsCgi::send (HttpThreadContext* td, const char* exec, const char* cmdLine,
   u_long nbw;
   DynamicLibrary hinstLib;
   CGIMAIN ProcMain = 0;
-  int ret = 0;
 
 #if !(WIN32 | HAVE_DL)
   return td->http->raiseHTTPError (501);
diff --git a/myserver/src/protocol/control/control_protocol.cpp b/myserver/src/protocol/control/control_protocol.cpp
index ede75b3..9f2e1b3 100644
--- a/myserver/src/protocol/control/control_protocol.cpp
+++ b/myserver/src/protocol/control/control_protocol.cpp
@@ -235,7 +235,8 @@ int ControlProtocol::controlConnection (ConnectionPtr a, char *request,
         Returning 0 from the controlConnection we will remove the connection
         from the active connections list.
        */
-      if (header.parse_header (request, nbtr, &realHeaderLength) != CONTROL_OK)
+      ret = header.parse_header (request, nbtr, &realHeaderLength);
+      if (ret != CONTROL_OK)
         {
           /* parse_header returns -1 on an incomplete header.  */
           if (ret == -1)
diff --git a/myserver/tests/test_exceptions.cpp b/myserver/tests/test_exceptions.cpp
index 1a983d4..bd7cdff 100644
--- a/myserver/tests/test_exceptions.cpp
+++ b/myserver/tests/test_exceptions.cpp
@@ -87,7 +87,7 @@ public:
     bool success = false;
     try
       {
-        char *p = checked::getcwd (buf, 1);
+        checked::getcwd (buf, 1);
         CPPUNIT_FAIL ("The exception in testWrongCwd wasn't thrown or caught");
       }
     catch (...)
diff --git a/myserver/tests/test_plugins_manager.cpp b/myserver/tests/test_plugins_manager.cpp
index 62eb8ee..16f5591 100644
--- a/myserver/tests/test_plugins_manager.cpp
+++ b/myserver/tests/test_plugins_manager.cpp
@@ -102,7 +102,7 @@ protected:
 
   virtual Plugin* preLoadPlugin (string &file, Server* server, bool global)
   {
-
+    return NULL;
   }
 };
 
@@ -116,6 +116,7 @@ private:
                         string &file, PluginInfo* pinfo)
   {
 
+    return 0;
   }
 
 public:
diff --git a/myserver/tests/test_socket.cpp b/myserver/tests/test_socket.cpp
index 3c53739..cd5040b 100644
--- a/myserver/tests/test_socket.cpp
+++ b/myserver/tests/test_socket.cpp
@@ -150,9 +150,7 @@ public:
 
   void testGetLocalIPsList ()
   {
-    int err = 0;
     string out;
-
     try
       {
         obj->socket (AF_INET, SOCK_STREAM, 0);
@@ -215,4 +213,5 @@ static DEFINE_THREAD (testRecvClient, pParam)
   catch (...)
     {
     }
+  return 0;
 }
diff --git a/myserver/tests/test_socket_stream_creator.cpp b/myserver/tests/test_socket_stream_creator.cpp
index 6a92453..e618209 100644
--- a/myserver/tests/test_socket_stream_creator.cpp
+++ b/myserver/tests/test_socket_stream_creator.cpp
@@ -51,6 +51,7 @@ public:
     try
       {
         LogStream* ls = ssc->create (ff, LOCALHOST_ADDRESS ":0", filters, 0);
+        CPPUNIT_ASSERT (ls);
       }
     catch (...)
       {
diff --git a/myserver/tests/test_unix_socket.cpp b/myserver/tests/test_unix_socket.cpp
index 769fd05..c73195b 100644
--- a/myserver/tests/test_unix_socket.cpp
+++ b/myserver/tests/test_unix_socket.cpp
@@ -144,7 +144,6 @@ public:
   {
 # ifndef WIN32
     const char *msg = "hello world";
-    ThreadID tid;
     Pipe pipe;
     u_long nbw;
     char buffer[64];



commit efa4a8d51afd9e841c141f7c0892d8f2508b7434
Author: Giuseppe Scrivano <gscrivano@gnu.org>
Date:   Mon Jun 21 15:06:26 2010 +0200

    Remove unused static function.

diff --git a/myserver/src/base/base64/mime_utils.cpp b/myserver/src/base/base64/mime_utils.cpp
index dca7b8f..4717434 100644
--- a/myserver/src/base/base64/mime_utils.cpp
+++ b/myserver/src/base/base64/mime_utils.cpp
@@ -40,35 +40,6 @@ static char* myserver_strupr (char * s)
   return s;
 }
 
-#define strupos(x, y) (strustr (x, y) != NULL ? strustr (x, y) - x : -1)
-
-static char* strustr (char *source, char *s)
-{
-  char *csource = new char[strlen (source) + 1];
-  if (csource == 0)
-    return 0;
-  char *cs = new char[strlen (s) + 1];
-  if (cs == 0)
-  {
-    delete [] csource;
-    return 0;
-  }
-  strncpy (csource, source, (strlen (source) + 2));
-  strncpy (cs, s, (strlen (s) + 2));
-  myserver_strupr (csource);
-  myserver_strupr (cs);
-  char *result = strstr (csource, cs);
-  if (result != NULL)
-  {
-    int pos =static_cast<int>(result - csource);
-    result = source;
-    result += pos;
-  }
-  delete [] csource;
-  delete [] cs;
-  return result;
-}
-
 const char base64chars[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
 #define SKIP '\202'
 #define NOSKIP 'A'

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

Summary of changes:
 myserver/include/conf/vhost/xml_vhost_handler.h    |    9 +++---
 myserver/src/base/base64/mime_utils.cpp            |   29 --------------------
 .../src/base/files_cache/cached_file_factory.cpp   |   10 +++----
 myserver/src/base/process/fork_server.cpp          |    2 +-
 myserver/src/conf/main/xml_main_configuration.cpp  |    1 -
 myserver/src/conf/vhost/xml_vhost_handler.cpp      |   14 +++++-----
 myserver/src/filter/gzip/gzip_decompress.cpp       |    6 +---
 myserver/src/http_handler/cgi/cgi.cpp              |    2 +-
 myserver/src/http_handler/http_file/http_file.cpp  |    9 +++---
 myserver/src/http_handler/mscgi/mscgi.cpp          |    1 -
 myserver/src/protocol/control/control_protocol.cpp |    3 +-
 myserver/tests/test_exceptions.cpp                 |    2 +-
 myserver/tests/test_plugins_manager.cpp            |    3 +-
 myserver/tests/test_socket.cpp                     |    3 +-
 myserver/tests/test_socket_stream_creator.cpp      |    1 +
 myserver/tests/test_unix_socket.cpp                |    1 -
 16 files changed, 30 insertions(+), 66 deletions(-)


hooks/post-receive
-- 
GNU MyServer


From MAILER-DAEMON Tue Jun 22 09:43:04 2010
Received: from mailman by lists.gnu.org with archive (Exim 4.43)
	id 1OR3km-0005ye-5a
	for mharc-myserver-commit@gnu.org; Tue, 22 Jun 2010 09:43:04 -0400
Received: from [140.186.70.92] (port=53775 helo=eggs.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.43) id 1OR3kH-00050D-5Z
	for myserver-commit@gnu.org; Tue, 22 Jun 2010 09:43:01 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69)
	(envelope-from <gscrivano@gnu.org>) id 1OR3jC-0002OU-Lj
	for myserver-commit@gnu.org; Tue, 22 Jun 2010 09:41:31 -0400
Received: from colonialone.fsf.org ([140.186.70.51]:41861
	helo=internal.in.savannah.gnu.org)
	by eggs.gnu.org with esmtp (Exim 4.69)
	(envelope-from <gscrivano@gnu.org>) id 1OR3jC-0002OP-Hu
	for myserver-commit@gnu.org; Tue, 22 Jun 2010 09:41:26 -0400
Received: from [10.1.0.108] (helo=vcs-noshell.in.savannah.gnu.org)
	by internal.in.savannah.gnu.org with esmtp (Exim 4.69)
	(envelope-from <gscrivano@gnu.org>) id 1OR3jC-0004RY-6o
	for myserver-commit@gnu.org; Tue, 22 Jun 2010 13:41:26 +0000
Received: from gscrivano by vcs-noshell.in.savannah.gnu.org with local (Exim
	4.69) (envelope-from <gscrivano@savannah.gnu.org>)
	id 1OR3j8-0001bx-KN
	for myserver-commit@gnu.org; Tue, 22 Jun 2010 13:41:26 +0000
To: myserver-commit@gnu.org
X-Git-Refname: refs/heads/master
X-Git-Reftype: branch
X-Git-Oldrev: 810e6145fe5888c11e76853f833badbc42c8042e
X-Git-Newrev: 0ca49e426dec971726ae03d2ac09557dad828e39
Message-Id: <E1OR3j8-0001bx-KN@vcs-noshell.in.savannah.gnu.org>
From: Giuseppe Scrivano <gscrivano@gnu.org>
Date: Tue, 22 Jun 2010 13:41:25 +0000
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2)
Subject: [myserver-commit] [SCM] GNU MyServer branch, master,
	updated. v0.9.2-264-g0ca49e4
X-BeenThere: myserver-commit@gnu.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: myserver-commit.gnu.org
List-Unsubscribe: <http://lists.gnu.org/mailman/listinfo/myserver-commit>,
	<mailto:myserver-commit-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/myserver-commit>
List-Post: <mailto:myserver-commit@gnu.org>
List-Help: <mailto:myserver-commit-request@gnu.org?subject=help>
List-Subscribe: <http://lists.gnu.org/mailman/listinfo/myserver-commit>,
	<mailto:myserver-commit-request@gnu.org?subject=subscribe>
X-List-Received-Date: Tue, 22 Jun 2010 13:43:02 -0000

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU MyServer".

The branch, master has been updated
       via  0ca49e426dec971726ae03d2ac09557dad828e39 (commit)
      from  810e6145fe5888c11e76853f833badbc42c8042e (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------


commit 0ca49e426dec971726ae03d2ac09557dad828e39
Author: Giuseppe Scrivano <gscrivano@gnu.org>
Date:   Tue Jun 22 15:39:39 2010 +0200

    If an encoding is not specified do not check for the content length

diff --git a/myserver/src/protocol/http/http_data_read.cpp b/myserver/src/protocol/http/http_data_read.cpp
index aaaf7bb..dadf324 100644
--- a/myserver/src/protocol/http/http_data_read.cpp
+++ b/myserver/src/protocol/http/http_data_read.cpp
@@ -350,13 +350,6 @@ int HttpDataRead::readPostData (HttpThreadContext* td, int* httpRetCode)
   }
   else
     {
-      /* If it is not specified an encoding, read the data as it is.  */
-      if (!contentLengthSpecified)
-        {
-          *httpRetCode = 400;
-          return 1;
-        }
-
       for (;;)
         {
 

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

Summary of changes:
 myserver/src/protocol/http/http_data_read.cpp |    7 -------
 1 files changed, 0 insertions(+), 7 deletions(-)


hooks/post-receive
-- 
GNU MyServer


From MAILER-DAEMON Tue Jun 22 18:21:05 2010
Received: from mailman by lists.gnu.org with archive (Exim 4.43)
	id 1ORBq5-00052t-4r
	for mharc-myserver-commit@gnu.org; Tue, 22 Jun 2010 18:21:05 -0400
Received: from [140.186.70.92] (port=46564 helo=eggs.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.43) id 1ORBq1-00051b-W4
	for myserver-commit@gnu.org; Tue, 22 Jun 2010 18:21:03 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69)
	(envelope-from <gscrivano@gnu.org>) id 1ORBq0-0006u7-F8
	for myserver-commit@gnu.org; Tue, 22 Jun 2010 18:21:01 -0400
Received: from colonialone.fsf.org ([140.186.70.51]:43749
	helo=internal.in.savannah.gnu.org)
	by eggs.gnu.org with esmtp (Exim 4.69)
	(envelope-from <gscrivano@gnu.org>) id 1ORBq0-0006u1-CE
	for myserver-commit@gnu.org; Tue, 22 Jun 2010 18:21:00 -0400
Received: from [10.1.0.108] (helo=vcs-noshell.in.savannah.gnu.org)
	by internal.in.savannah.gnu.org with esmtp (Exim 4.69)
	(envelope-from <gscrivano@gnu.org>) id 1ORBq0-0002Lh-44
	for myserver-commit@gnu.org; Tue, 22 Jun 2010 22:21:00 +0000
Received: from gscrivano by vcs-noshell.in.savannah.gnu.org with local (Exim
	4.69) (envelope-from <gscrivano@savannah.gnu.org>)
	id 1ORBpy-0001Tk-4z
	for myserver-commit@gnu.org; Tue, 22 Jun 2010 22:21:00 +0000
To: myserver-commit@gnu.org
X-Git-Refname: refs/heads/master
X-Git-Reftype: branch
X-Git-Oldrev: 0ca49e426dec971726ae03d2ac09557dad828e39
X-Git-Newrev: a125bce0bbb9a4c98a729ae53386e46be1e56423
Message-Id: <E1ORBpy-0001Tk-4z@vcs-noshell.in.savannah.gnu.org>
From: Giuseppe Scrivano <gscrivano@gnu.org>
Date: Tue, 22 Jun 2010 22:21:00 +0000
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2)
Subject: [myserver-commit] [SCM] GNU MyServer branch, master,
	updated. v0.9.2-265-ga125bce
X-BeenThere: myserver-commit@gnu.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: myserver-commit.gnu.org
List-Unsubscribe: <http://lists.gnu.org/mailman/listinfo/myserver-commit>,
	<mailto:myserver-commit-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/myserver-commit>
List-Post: <mailto:myserver-commit@gnu.org>
List-Help: <mailto:myserver-commit-request@gnu.org?subject=help>
List-Subscribe: <http://lists.gnu.org/mailman/listinfo/myserver-commit>,
	<mailto:myserver-commit-request@gnu.org?subject=subscribe>
X-List-Received-Date: Tue, 22 Jun 2010 22:21:03 -0000

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU MyServer".

The branch, master has been updated
       via  a125bce0bbb9a4c98a729ae53386e46be1e56423 (commit)
      from  0ca49e426dec971726ae03d2ac09557dad828e39 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------


commit a125bce0bbb9a4c98a729ae53386e46be1e56423
Author: Giuseppe Scrivano <gscrivano@gnu.org>
Date:   Wed Jun 23 00:18:14 2010 +0200

    Always create the temporary file used to store POST data.

diff --git a/myserver/src/protocol/http/http_data_read.cpp b/myserver/src/protocol/http/http_data_read.cpp
index dadf324..6aedc5c 100644
--- a/myserver/src/protocol/http/http_data_read.cpp
+++ b/myserver/src/protocol/http/http_data_read.cpp
@@ -48,28 +48,28 @@ using namespace std;
   \param nbr Number of bytes read.
   \param timeout Timeout value to use on the socket.
   \return Return 0 on success.
- */
+*/
 int HttpDataRead::readContiguousPrimitivePostData (const char* inBuffer,
-                                                  u_long *inBufferPos,
-                                                  u_long inBufferSize,
-                                                  Socket *inSocket,
-                                                  char* outBuffer,
-                                                  u_long outBufferSize,
-                                                  u_long* nbr,
-                                                  u_long timeout)
+                                                   u_long *inBufferPos,
+                                                   u_long inBufferSize,
+                                                   Socket *inSocket,
+                                                   char* outBuffer,
+                                                   u_long outBufferSize,
+                                                   u_long* nbr,
+                                                   u_long timeout)
 {
   int ret;
   *nbr = 0;
   if (inBufferSize - *inBufferPos)
-  {
-    *nbr = min (outBufferSize, inBufferSize - *inBufferPos);
-    memcpy (outBuffer, inBuffer + *inBufferPos, *nbr);
-    *inBufferPos += *nbr;
-  }
+    {
+      *nbr = min (outBufferSize, inBufferSize - *inBufferPos);
+      memcpy (outBuffer, inBuffer + *inBufferPos, *nbr);
+      *inBufferPos += *nbr;
+    }
 
   /*
     No other space in the out buffer, return from the function with success.
-   */
+  */
   if (outBufferSize == *nbr)
     return 0;
 
@@ -101,122 +101,122 @@ int HttpDataRead::readContiguousPrimitivePostData (const char* inBuffer,
   \return Return 0 on success.
   \return -1 on internal error.
   \return Any other value is the HTTP error code.
- */
+*/
 int HttpDataRead::readChunkedPostData (const char* inBuffer,
-                                      u_long *inBufferPos,
-                                      u_long inBufferSize,
-                                      Socket *inSocket,
-                                      char* outBuffer,
-                                      u_long outBufferSize,
-                                      u_long* outNbr,
-                                      u_long timeout,
-                                      Stream* out,
-                                      long maxChunks)
+                                       u_long *inBufferPos,
+                                       u_long inBufferSize,
+                                       Socket *inSocket,
+                                       char* outBuffer,
+                                       u_long outBufferSize,
+                                       u_long* outNbr,
+                                       u_long timeout,
+                                       Stream* out,
+                                       long maxChunks)
 {
   u_long nbr;
   *outNbr = 0;
 
   for (int n = 0; maxChunks == 0 || n < maxChunks; n++)
-  {
-    u_long chunkNbr;
-    u_long dataToRead;
-    u_long nbw;
-    u_long bufferlen;
-    char buffer[20];
-    char c;
-    bufferlen = 0;
-    buffer[0] = '\0';
-    for (;;)
     {
-      if (readContiguousPrimitivePostData (inBuffer,
-                                         inBufferPos,
-                                         inBufferSize,
-                                         inSocket,
-                                         &c,
-                                         1,
-                                         &nbr,
-                                         timeout))
-        return -1;
-
-      if (nbr != 1)
-        return -1;
+      u_long chunkNbr;
+      u_long dataToRead;
+      u_long nbw;
+      u_long bufferlen;
+      char buffer[20];
+      char c;
+      bufferlen = 0;
+      buffer[0] = '\0';
+      for (;;)
+        {
+          if (readContiguousPrimitivePostData (inBuffer,
+                                               inBufferPos,
+                                               inBufferSize,
+                                               inSocket,
+                                               &c,
+                                               1,
+                                               &nbr,
+                                               timeout))
+            return -1;
 
-      if ((c != '\r') && (bufferlen < 19))
-      {
-        buffer[bufferlen++] = c;
-        buffer[bufferlen] = '\0';
-      }
-      else
-        break;
-    }
+          if (nbr != 1)
+            return -1;
 
-    /* Read the \n character too. */
-    if (readContiguousPrimitivePostData (inBuffer,
-                                       inBufferPos,
-                                       inBufferSize,
-                                       inSocket,
-                                       &c,
-                                       1,
-                                       &nbr,
-                                       timeout))
-       return -1;
+          if ((c != '\r') && (bufferlen < 19))
+            {
+              buffer[bufferlen++] = c;
+              buffer[bufferlen] = '\0';
+            }
+          else
+            break;
+        }
 
-    dataToRead = (u_long) hexToInt (buffer);
+      /* Read the \n character too. */
+      if (readContiguousPrimitivePostData (inBuffer,
+                                           inBufferPos,
+                                           inBufferSize,
+                                           inSocket,
+                                           &c,
+                                           1,
+                                           &nbr,
+                                           timeout))
+        return -1;
 
-    /* The last chunk length is 0.  */
-    if (dataToRead == 0)
-      break;
+      dataToRead = (u_long) hexToInt (buffer);
 
-    chunkNbr = 0;
+      /* The last chunk length is 0.  */
+      if (dataToRead == 0)
+        break;
 
-    while (chunkNbr < dataToRead)
-    {
-      u_long rs = min (outBufferSize , dataToRead - chunkNbr);
+      chunkNbr = 0;
 
-      if (readContiguousPrimitivePostData (inBuffer,
-                                         inBufferPos,
-                                         inBufferSize,
-                                         inSocket,
-                                         outBuffer,
-                                         rs,
-                                         &nbr,
-                                         timeout))
-      {
-        return -1;
-      }
+      while (chunkNbr < dataToRead)
+        {
+          u_long rs = min (outBufferSize , dataToRead - chunkNbr);
+
+          if (readContiguousPrimitivePostData (inBuffer,
+                                               inBufferPos,
+                                               inBufferSize,
+                                               inSocket,
+                                               outBuffer,
+                                               rs,
+                                               &nbr,
+                                               timeout))
+            {
+              return -1;
+            }
 
-      if (nbr == 0)
-        return -1;
+          if (nbr == 0)
+            return -1;
 
-      chunkNbr += nbr;
+          chunkNbr += nbr;
 
-      if (out && out->write (outBuffer, nbr, &nbw))
-        return -1;
+          if (out && out->write (outBuffer, nbr, &nbw))
+            return -1;
 
-      if (nbw != nbr)
-        return -1;
+          if (nbw != nbr)
+            return -1;
 
-      if (out)
-        *outNbr += nbw;
-      else
-        *outNbr += nbr;
+          if (out)
+            *outNbr += nbw;
+          else
+            *outNbr += nbr;
+
+          /* Read final chunk \r\n.  */
+          if (readContiguousPrimitivePostData (inBuffer,
+                                               inBufferPos,
+                                               inBufferSize,
+                                               inSocket,
+                                               outBuffer,
+                                               2,
+                                               &nbr,
+                                               timeout))
+            {
+              return -1;
+            }
 
-      /* Read final chunk \r\n.  */
-      if (readContiguousPrimitivePostData (inBuffer,
-                                         inBufferPos,
-                                         inBufferSize,
-                                         inSocket,
-                                         outBuffer,
-                                         2,
-                                         &nbr,
-                                         timeout))
-      {
-        return -1;
-      }
+        }
 
     }
-
-  }
   return 0;
 }
 
@@ -226,9 +226,9 @@ int HttpDataRead::readChunkedPostData (const char* inBuffer,
   \param httpRetCode The HTTP error to report to the client.
   \return Return 0 on success.
   \return Return -1 on irreversible error and
-         the connection should be removed immediately.
+  the connection should be removed immediately.
   \return Any other value is a protocol error specified in HTTPRETCODE.
- */
+*/
 int HttpDataRead::readPostData (HttpThreadContext* td, int* httpRetCode)
 {
   int contentLength = 0;
@@ -250,61 +250,58 @@ int HttpDataRead::readPostData (HttpThreadContext* td, int* httpRetCode)
 
   /* Specify a type if it not specified by the client.  */
   if (contentType == 0)
-  {
-    contentType = new HttpRequestHeader::Entry ();
-    contentType->name.assign ("content-type");
-    contentType->value.assign ("application/x-www-form-urlencoded");
-  }
+    {
+      contentType = new HttpRequestHeader::Entry ();
+      contentType->name.assign ("content-type");
+      contentType->value.assign ("application/x-www-form-urlencoded");
+    }
   else if (contentType->value.length () == 0)
-  {
     contentType->value.assign ("application/x-www-form-urlencoded");
-  }
 
   td->request.uriOptsPtr = &(td->buffer->getBuffer ())[td->nHeaderChars];
   td->buffer->getBuffer ()[td->nBytesToRead < td->buffer->getRealLength () - 1
-                   ? td->nBytesToRead : td->buffer->getRealLength ()-1] = '\0';
+                           ? td->nBytesToRead : td->buffer->getRealLength ()-1] = '\0';
 
   if (td->request.contentLength.length ())
-  {
-    contentLength = atoi (td->request.contentLength.c_str ());
-    contentLengthSpecified = true;
-    if (contentLength < 0)
     {
-      *httpRetCode = 400;
-      return 1;
+      contentLength = atoi (td->request.contentLength.c_str ());
+      contentLengthSpecified = true;
+      if (contentLength < 0)
+        {
+          *httpRetCode = 400;
+          return 1;
+        }
     }
-  }
 
-  /*!
+  /*
     If the connection is Keep-Alive be sure that the client specify the
     HTTP CONTENT-LENGTH field.
     If a CONTENT-ENCODING is specified the CONTENT-LENGTH is not
     always needed.
-   */
+  */
   if (!contentLengthSpecified && td->request.isKeepAlive ())
-  {
-    HttpRequestHeader::Entry *content =
-      td->request.other.get ("content-encoding");
-
-    if (content && (content->value.length () == '\0')
-           && (td->request.contentLength.length () == 0))
     {
-      *httpRetCode = 400;
-      return 1;
+      HttpRequestHeader::Entry *content =
+        td->request.other.get ("content-encoding");
+
+      if (content && (content->value.length () == '\0')
+          && (td->request.contentLength.length () == 0))
+        {
+          *httpRetCode = 400;
+          return 1;
+        }
     }
-  }
 
   /*
     Create the file that contains the posted data.
     This data is the stdin file in the CGI.
-   */
-  if (td->inputData.openFile (td->inputDataPath, File::FILE_OPEN_ALWAYS |
-                            File::READ |
-                            File::WRITE))
-  {
-    *httpRetCode = 500;
-    return 1;
-  }
+  */
+  if (td->inputData.openFile (td->inputDataPath, File::READ
+                              | File::WRITE))
+    {
+      *httpRetCode = 500;
+      return 1;
+    }
 
   length = contentLength;
 
@@ -314,40 +311,40 @@ int HttpDataRead::readPostData (HttpThreadContext* td, int* httpRetCode)
 
   /* If it is specified a transfer encoding read data using it.  */
   if (encoding)
-  {
-    if (!encoding->value.compare ("chunked"))
     {
-      int ret = readChunkedPostData (td->request.uriOptsPtr,
-                                     &inPos,
-                                     bufferDataSize,
-                                     td->connection->socket,
-                                     td->auxiliaryBuffer->getBuffer (),
-                                     td->auxiliaryBuffer->getRealLength () - 1,
-                                     &nbr,
-                                     timeout,
-                                     &(td->inputData),
-                                     0);
-
-      if (ret == -1)
-      {
-        td->inputDataPath.assign ("");
-        td->outputDataPath.assign ("");
-        td->inputData.close ();
-        return -1;
-      }
-      else if (ret)
-      {
-        *httpRetCode = ret;
-        return 1;
-      }
+      if (!encoding->value.compare ("chunked"))
+        {
+          int ret = readChunkedPostData (td->request.uriOptsPtr,
+                                         &inPos,
+                                         bufferDataSize,
+                                         td->connection->socket,
+                                         td->auxiliaryBuffer->getBuffer (),
+                                         td->auxiliaryBuffer->getRealLength () - 1,
+                                         &nbr,
+                                         timeout,
+                                         &(td->inputData),
+                                         0);
 
+          if (ret == -1)
+            {
+              td->inputDataPath.assign ("");
+              td->outputDataPath.assign ("");
+              td->inputData.close ();
+              return -1;
+            }
+          else if (ret)
+            {
+              *httpRetCode = ret;
+              return 1;
+            }
+
+        }
+      else
+        {
+          *httpRetCode = 501;
+          return 1;
+        }
     }
-    else
-    {
-      *httpRetCode = 501;
-      return 1;
-    }
-  }
   else
     {
       for (;;)

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

Summary of changes:
 myserver/src/protocol/http/http_data_read.cpp |  359 ++++++++++++-------------
 1 files changed, 178 insertions(+), 181 deletions(-)


hooks/post-receive
-- 
GNU MyServer


From MAILER-DAEMON Wed Jun 23 06:41:07 2010
Received: from mailman by lists.gnu.org with archive (Exim 4.43)
	id 1ORNOE-0002qA-Vm
	for mharc-myserver-commit@gnu.org; Wed, 23 Jun 2010 06:41:07 -0400
Received: from [140.186.70.92] (port=37639 helo=eggs.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.43) id 1ORNO8-0001jY-CL
	for myserver-commit@gnu.org; Wed, 23 Jun 2010 06:41:02 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69)
	(envelope-from <gscrivano@gnu.org>) id 1ORNKt-0004wr-Ge
	for myserver-commit@gnu.org; Wed, 23 Jun 2010 06:37:41 -0400
Received: from colonialone.fsf.org ([140.186.70.51]:51831
	helo=internal.in.savannah.gnu.org)
	by eggs.gnu.org with esmtp (Exim 4.69)
	(envelope-from <gscrivano@gnu.org>) id 1ORNKt-0004wm-Dg
	for myserver-commit@gnu.org; Wed, 23 Jun 2010 06:37:39 -0400
Received: from [10.1.0.108] (helo=vcs-noshell.in.savannah.gnu.org)
	by internal.in.savannah.gnu.org with esmtp (Exim 4.69)
	(envelope-from <gscrivano@gnu.org>) id 1ORNKs-0002lI-II
	for myserver-commit@gnu.org; Wed, 23 Jun 2010 10:37:38 +0000
Received: from gscrivano by vcs-noshell.in.savannah.gnu.org with local (Exim
	4.69) (envelope-from <gscrivano@savannah.gnu.org>)
	id 1ORNKp-0003aP-Lv
	for myserver-commit@gnu.org; Wed, 23 Jun 2010 10:37:38 +0000
To: myserver-commit@gnu.org
X-Git-Refname: refs/heads/master
X-Git-Reftype: branch
X-Git-Oldrev: a125bce0bbb9a4c98a729ae53386e46be1e56423
X-Git-Newrev: 019962be8f4376abffeb724b242b4f6e31f0b8a1
Message-Id: <E1ORNKp-0003aP-Lv@vcs-noshell.in.savannah.gnu.org>
From: Giuseppe Scrivano <gscrivano@gnu.org>
Date: Wed, 23 Jun 2010 10:37:38 +0000
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2)
Subject: [myserver-commit] [SCM] GNU MyServer branch, master,
	updated. v0.9.2-266-g019962b
X-BeenThere: myserver-commit@gnu.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: myserver-commit.gnu.org
List-Unsubscribe: <http://lists.gnu.org/mailman/listinfo/myserver-commit>,
	<mailto:myserver-commit-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/myserver-commit>
List-Post: <mailto:myserver-commit@gnu.org>
List-Help: <mailto:myserver-commit-request@gnu.org?subject=help>
List-Subscribe: <http://lists.gnu.org/mailman/listinfo/myserver-commit>,
	<mailto:myserver-commit-request@gnu.org?subject=subscribe>
X-List-Received-Date: Wed, 23 Jun 2010 10:41:02 -0000

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU MyServer".

The branch, master has been updated
       via  019962be8f4376abffeb724b242b4f6e31f0b8a1 (commit)
      from  a125bce0bbb9a4c98a729ae53386e46be1e56423 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------


commit 019962be8f4376abffeb724b242b4f6e31f0b8a1
Author: Giuseppe Scrivano <gscrivano@gnu.org>
Date:   Wed Jun 23 12:31:25 2010 +0200

    Use `mkostemp' to open temporary files.
    
    Now FilesUtility::temporaryFileName generates a mask for `mkstemp' hence remove
    the members `inputDataPath' and 'outputDataPath' from struct HttpThreadContext,
    they are path masks not real file names.

diff --git a/myserver/bootstrap.conf b/myserver/bootstrap.conf
index 3bb098f..5b2f306 100644
--- a/myserver/bootstrap.conf
+++ b/myserver/bootstrap.conf
@@ -47,6 +47,7 @@ git-version-gen
 ioctl
 listen
 malloc
+mkostemp
 mktime
 nproc
 open
diff --git a/myserver/include/base/file/file.h b/myserver/include/base/file/file.h
index fe38dfd..5a8b3a9 100644
--- a/myserver/include/base/file/file.h
+++ b/myserver/include/base/file/file.h
@@ -52,7 +52,7 @@ public:
 
   virtual Handle getHandle ();
   virtual int setHandle (Handle);
-  virtual int writeToFile (const char *, u_long , u_long *);
+  virtual int writeToFile (const char *, u_long, u_long *);
   virtual int createTemporaryFile (const char *, bool unlink = true);
 
   virtual int openFile (const char *, u_long, mode_t mask = 00700);
diff --git a/myserver/include/base/files_cache/cached_file.h b/myserver/include/base/files_cache/cached_file.h
index bf5a189..bf6b1af 100644
--- a/myserver/include/base/files_cache/cached_file.h
+++ b/myserver/include/base/files_cache/cached_file.h
@@ -35,7 +35,7 @@ public:
   virtual int setHandle (Handle);
   virtual int read (char* ,u_long ,u_long* );
   virtual int writeToFile (const char* ,u_long ,u_long* );
-  virtual int createTemporaryFile (const char* );
+  virtual int createTemporaryFile (const char *, bool unlink = true);
 
   virtual int openFile (const char*, u_long );
   virtual int openFile (string const &file, u_long opt)
diff --git a/myserver/include/protocol/http/http_thread_context.h b/myserver/include/protocol/http/http_thread_context.h
index 25bf3b2..1f4788f 100644
--- a/myserver/include/protocol/http/http_thread_context.h
+++ b/myserver/include/protocol/http/http_thread_context.h
@@ -78,8 +78,6 @@ struct HttpThreadContext
   string scriptPath;
   string scriptDir;
   string scriptFile;
-  string inputDataPath;
-  string outputDataPath;
   string vhostDir;
   string vhostSys;
   HashMap<string,string*> other;
diff --git a/myserver/src/base/file/file.cpp b/myserver/src/base/file/file.cpp
index 789e01d..6244655 100644
--- a/myserver/src/base/file/file.cpp
+++ b/myserver/src/base/file/file.cpp
@@ -47,6 +47,7 @@
 
 #include <string>
 #include <sstream>
+#include <memory>
 
 using namespace std;
 
@@ -129,7 +130,8 @@ void File::fstat (struct stat *fstat)
 /*!
   Open (or create if not exists) a file, but must explicitly use read and/or
   write flags and open flag.
-  \param nfilename Filename to open.
+  \param nfilename Filename to open.    If TEMPORARY or TEMPORARY_DELAYED is
+  used, then this parameter specifies the mask to use for mkostemp(3).
   \param opt Specify how open the file.
   \param mask Creation mode when a new file is created.
   openFile returns 0 if the call was successful, any other value on errors.
@@ -138,8 +140,6 @@ int File::openFile (const char* nfilename, u_long opt, mode_t mask)
 {
   int flags;
 
-  filename.assign (nfilename);
-
   if ((opt & File::READ) && (opt & File::WRITE))
     flags = O_RDWR;
   else if (opt & File::READ)
@@ -153,18 +153,32 @@ int File::openFile (const char* nfilename, u_long opt, mode_t mask)
   if (opt & File::APPEND)
     flags |= O_APPEND;
 
-  handle = gnulib::open (filename.c_str (), flags);
-  if (handle < 0)
+
+  if (opt & (File::TEMPORARY_DELAYED | File::TEMPORARY))
     {
-      if (! ((errno == ENOENT) && (opt & File::FILE_OPEN_ALWAYS)))
+      auto_ptr <char> templatefn (checked::strdup (nfilename));
+      handle = mkostemp (templatefn.get (), flags);
+      if (handle < 0)
         checked::raiseException ();
 
-      flags |= O_CREAT;
-      handle = checked::open (filename.c_str (), flags, S_IRUSR | S_IWUSR);
+      setFilename (templatefn.get ());
+
+      if (opt & File::TEMPORARY)
+        checked::unlink (getFilename ());
     }
+  else
+    {
+      setFilename (nfilename);
+      handle = gnulib::open (filename.c_str (), flags);
+      if (handle < 0)
+        {
+          if (! ((errno == ENOENT) && (opt & File::FILE_OPEN_ALWAYS)))
+            checked::raiseException ();
 
-  if (opt & File::TEMPORARY)
-    checked::unlink (filename.c_str ());
+          flags |= O_CREAT;
+          handle = checked::open (filename.c_str (), flags, S_IRUSR | S_IWUSR);
+        }
+    }
 
   this->opt = opt;
   return handle < 0;
@@ -244,8 +258,8 @@ int File::close ()
   if (handle != -1)
     {
       if (opt & File::TEMPORARY_DELAYED)
-        checked::unlink (filename.c_str ());
-      ret = checked::fsync (handle);
+        gnulib::unlink (filename.c_str ());
+
       ret |= checked::close (handle);
     }
 
diff --git a/myserver/src/base/file/files_utility.cpp b/myserver/src/base/file/files_utility.cpp
index fac0ddf..802a50d 100644
--- a/myserver/src/base/file/files_utility.cpp
+++ b/myserver/src/base/file/files_utility.cpp
@@ -673,20 +673,15 @@ void FilesUtility::resetTmpPath ()
 
 
 /*!
-  Create an unique temporary file name.  This function doesn't create
-  or open the file but generates only its name.
+  Create an unique temporary file name mask that can be used by mkstemp.
   \param tid Caller thread id.
   \param out Output string.
  */
 void FilesUtility::temporaryFileName (u_long tid, string &out)
 {
-  ostringstream stream;
-  static u_long counter = 1;
-  counter++;
-
   if (tmpPath.length () == 0)
     tmpPath.assign (getdefaultwd (0, 0));
 
-  stream << tmpPath << "/myserver_" << counter  << "_" << tid << ".tmp";
-  out.assign (stream.str ());
+  out.assign (tmpPath);
+  out.append ("/myserver_XXXXXX");
 }
diff --git a/myserver/src/base/files_cache/cached_file.cpp b/myserver/src/base/files_cache/cached_file.cpp
index d03b56b..1291e4f 100644
--- a/myserver/src/base/files_cache/cached_file.cpp
+++ b/myserver/src/base/files_cache/cached_file.cpp
@@ -136,9 +136,9 @@ int CachedFile::read (char* buffer, u_long buffersize, u_long* nbr)
 /*!
   A CachedFile can't be temporary.
   Create a temporary file.
-  \param filename The new temporary file name.
+  \see File#createTemporaryFile.
  */
-int CachedFile::createTemporaryFile (const char* filename)
+int CachedFile::createTemporaryFile (const char *, bool)
 {
   return -1;
 }
diff --git a/myserver/src/http_handler/cgi/cgi.cpp b/myserver/src/http_handler/cgi/cgi.cpp
index d94a15e..d355a21 100644
--- a/myserver/src/http_handler/cgi/cgi.cpp
+++ b/myserver/src/http_handler/cgi/cgi.cpp
@@ -76,7 +76,6 @@ int Cgi::send (HttpThreadContext* td, const char* scriptpath,
     to get other params like in a POST request.
   */
   Pipe stdOutFile;
-  File stdInFile;
   int len = strlen (cgipath);
   int i;
 
@@ -213,10 +212,6 @@ int Cgi::send (HttpThreadContext* td, const char* scriptpath,
       */
       stdOutFile.create ();
 
-      /* Open the stdin file for the new CGI process.  */
-      stdInFile.openFile (td->inputDataPath,
-                          File::READ | File::FILE_OPEN_ALWAYS);
-
       /*
         Build the environment string used by the CGI process.
         Use the td->auxiliaryBuffer to build the environment string.
@@ -241,12 +236,11 @@ int Cgi::send (HttpThreadContext* td, const char* scriptpath,
                                                     MYSERVER_SERVER_CONF, ""));
 
       spi.stdError = (FileHandle) stdOutFile.getWriteHandle ();
-      spi.stdIn = (FileHandle) stdInFile.getHandle ();
+      spi.stdIn = (FileHandle) td->inputData.getHandle ();
       spi.stdOut = (FileHandle) stdOutFile.getWriteHandle ();
       spi.envString = td->auxiliaryBuffer->getBuffer ();
 
       if (spi.stdError == (FileHandle) -1 ||
-          spi.stdIn == (FileHandle) -1 ||
           spi.stdOut == (FileHandle) -1)
         {
           td->connection->host->warningsLogWrite (_("Cgi: internal error"));
@@ -274,15 +268,10 @@ int Cgi::send (HttpThreadContext* td, const char* scriptpath,
       sendData (td, stdOutFile, chain, cgiProc, onlyHeader, nph);
 
       stdOutFile.close ();
-      stdInFile.close ();
       cgiProc.terminateProcess ();
       chain.clearAllFilters ();
 
       cgiProc.terminateProcess ();
-
-      /* Delete the file only if it was created by the CGI module.  */
-      if (td->inputData.getHandle () >= 0)
-        FilesUtility::deleteFile (td->inputDataPath.c_str ());
     }
   catch (exception & e)
     {
diff --git a/myserver/src/http_handler/fastcgi/fastcgi.cpp b/myserver/src/http_handler/fastcgi/fastcgi.cpp
index 37b41a8..3dbbdb0 100644
--- a/myserver/src/http_handler/fastcgi/fastcgi.cpp
+++ b/myserver/src/http_handler/fastcgi/fastcgi.cpp
@@ -181,11 +181,6 @@ int FastCgi::send (HttpThreadContext* td, const char* scriptpath,
 #endif
         }
 
-      td->inputData.close ();
-      td->inputData.openFile (td->inputDataPath, File::READ
-                              | File::FILE_OPEN_ALWAYS
-                              | File::NO_INHERIT);
-
       server = connect (&con, cmdLine.str ().c_str ());
       if (server == NULL)
         {
diff --git a/myserver/src/http_handler/scgi/scgi.cpp b/myserver/src/http_handler/scgi/scgi.cpp
index d3033ad..224b6cc 100644
--- a/myserver/src/http_handler/scgi/scgi.cpp
+++ b/myserver/src/http_handler/scgi/scgi.cpp
@@ -169,9 +169,6 @@ int Scgi::send (HttpThreadContext* td, const char* scriptpath,
           chain.clearAllFilters ();
           return td->http->raiseHTTPError (500);
         }
-      td->inputData.close ();
-      td->inputData.openFile (td->inputDataPath, File::READ
-                              | File::FILE_OPEN_ALWAYS | File::NO_INHERIT);
 
       try
         {
diff --git a/myserver/src/protocol/http/http.cpp b/myserver/src/protocol/http/http.cpp
index 29603c2..7d980dc 100644
--- a/myserver/src/protocol/http/http.cpp
+++ b/myserver/src/protocol/http/http.cpp
@@ -847,8 +847,6 @@ int Http::controlConnection (ConnectionPtr a, char*, char*, u_long, u_long,
       td->appendOutputs = false;
       td->onlyHeader = false;
       td->filenamePath.assign ("");
-      td->outputDataPath.assign ("");
-      td->inputDataPath.assign ("");
       td->mime = NULL;
       td->headerSent = false;
       td->sentData = 0;
@@ -918,13 +916,6 @@ int Http::controlConnection (ConnectionPtr a, char*, char*, u_long, u_long,
 
       td->response.ver.assign (td->request.ver.c_str ());
 
-      /*
-        For methods that accept data after the HTTP header set the correct
-        pointer and create a file containing the informations after the header.
-       */
-      FilesUtility::temporaryFileName (td->id, td->inputDataPath);
-      FilesUtility::temporaryFileName (td->id, td->outputDataPath);
-
       dynamicCommand =
         staticData->getDynCmdManager ()->getHttpCommand (td->request.cmd);
 
@@ -1141,19 +1132,8 @@ int Http::controlConnection (ConnectionPtr a, char*, char*, u_long, u_long,
 
       try
         {
-          /* If the inputData file was not closed close it.  */
-          if (td->inputData.getHandle () >= 0)
-            {
-              td->inputData.close ();
-              FilesUtility::deleteFile (td->inputDataPath);
-            }
-
-          /* If the outputData file was not closed close it.  */
-          if (td->outputData.getHandle () >= 0)
-            {
-              td->outputData.close ();
-              FilesUtility::deleteFile (td->outputDataPath);
-            }
+          td->inputData.close ();
+          td->outputData.close ();
         }
       catch (GenericFileException & e)
         {
@@ -1737,8 +1717,6 @@ Http::Http (HttpProtocol *staticData)
   td->scriptPath.assign ("");
   td->scriptDir.assign ("");
   td->scriptFile.assign ("");
-  td->inputDataPath.assign ("");
-  td->outputDataPath.assign ("");
 }
 
 /*!
@@ -1762,7 +1740,5 @@ void Http::clean ()
   td->scriptPath.assign ("");
   td->scriptDir.assign ("");
   td->scriptFile.assign ("");
-  td->inputDataPath.assign ("");
-  td->outputDataPath.assign ("");
   delete td;
 }
diff --git a/myserver/src/protocol/http/http_data_read.cpp b/myserver/src/protocol/http/http_data_read.cpp
index 6aedc5c..242baf2 100644
--- a/myserver/src/protocol/http/http_data_read.cpp
+++ b/myserver/src/protocol/http/http_data_read.cpp
@@ -241,6 +241,10 @@ int HttpDataRead::readPostData (HttpThreadContext* td, int* httpRetCode)
   u_long inPos = 0;
   u_long nbr;
   u_long length;
+  string inputDataPath;
+
+  FilesUtility::temporaryFileName (td->id, inputDataPath);
+
 
   HttpRequestHeader::Entry *contentType =
     td->request.other.get ("content-type");
@@ -296,8 +300,8 @@ int HttpDataRead::readPostData (HttpThreadContext* td, int* httpRetCode)
     Create the file that contains the posted data.
     This data is the stdin file in the CGI.
   */
-  if (td->inputData.openFile (td->inputDataPath, File::READ
-                              | File::WRITE))
+  if (td->inputData.createTemporaryFile (inputDataPath.c_str (), File::READ
+                                         | File::WRITE))
     {
       *httpRetCode = 500;
       return 1;
@@ -327,8 +331,6 @@ int HttpDataRead::readPostData (HttpThreadContext* td, int* httpRetCode)
 
           if (ret == -1)
             {
-              td->inputDataPath.assign ("");
-              td->outputDataPath.assign ("");
               td->inputData.close ();
               return -1;
             }
@@ -364,7 +366,6 @@ int HttpDataRead::readPostData (HttpThreadContext* td, int* httpRetCode)
                                                timeout))
             {
               td->inputData.close ();
-              FilesUtility::deleteFile (td->inputDataPath);
               *httpRetCode = 400;
               return 1;
             }
@@ -374,7 +375,6 @@ int HttpDataRead::readPostData (HttpThreadContext* td, int* httpRetCode)
           else
             {
               td->inputData.close ();
-              FilesUtility::deleteFile (td->inputDataPath);
               *httpRetCode = 400;
               return 1;
             }
@@ -384,8 +384,6 @@ int HttpDataRead::readPostData (HttpThreadContext* td, int* httpRetCode)
           if (nbr && td->inputData.writeToFile (td->auxiliaryBuffer->getBuffer (),
                                                 nbr, &nbw))
             {
-              td->inputDataPath.assign ("");
-              td->outputDataPath.assign ("");
               td->inputData.close ();
               return -1;
             }
diff --git a/myserver/tests/test_file.cpp b/myserver/tests/test_file.cpp
index c650cdb..0e50697 100644
--- a/myserver/tests/test_file.cpp
+++ b/myserver/tests/test_file.cpp
@@ -64,14 +64,14 @@ public:
 
   void tearDown ()
   {
-    delete tfile;
     try
       {
-        FilesUtility::deleteFile (fname);
+        FilesUtility::deleteFile (tfile->getFilename ());
       }
     catch (...)
       {
       }
+    delete tfile;
   }
 
   void testCreateTemporaryDelayedFile ()
@@ -80,13 +80,13 @@ public:
     CPPUNIT_ASSERT_EQUAL (ret, 0);
 
     /* The unlink is done just before the close, the file can be stat'ed. */
-    ret = FilesUtility::nodeExists (fname.c_str ());
+    ret = FilesUtility::nodeExists (tfile->getFilename ());
     CPPUNIT_ASSERT (ret);
 
     ret = tfile->close ();
     CPPUNIT_ASSERT_EQUAL (ret, 0);
 
-    ret = FilesUtility::nodeExists (fname.c_str ());
+    ret = FilesUtility::nodeExists (tfile->getFilename ());
     CPPUNIT_ASSERT_EQUAL (ret, 0);
   }
 
@@ -96,13 +96,13 @@ public:
     CPPUNIT_ASSERT_EQUAL (ret, 0);
 
     /* Using unlink the file can't be stat'ed at this point.  */
-    ret = FilesUtility::nodeExists (fname.c_str ());
+    ret = FilesUtility::nodeExists (tfile->getFilename ());
     CPPUNIT_ASSERT_EQUAL (ret, 0);
 
     ret = tfile->close ();
     CPPUNIT_ASSERT_EQUAL (ret, 0);
 
-    ret = FilesUtility::nodeExists (fname.c_str ());
+    ret = FilesUtility::nodeExists (tfile->getFilename ());
     CPPUNIT_ASSERT_EQUAL (ret, 0);
   }
 

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

Summary of changes:
 myserver/bootstrap.conf                            |    1 +
 myserver/include/base/file/file.h                  |    2 +-
 myserver/include/base/files_cache/cached_file.h    |    2 +-
 .../include/protocol/http/http_thread_context.h    |    2 -
 myserver/src/base/file/file.cpp                    |   40 +++++++++++++------
 myserver/src/base/file/files_utility.cpp           |   11 +----
 myserver/src/base/files_cache/cached_file.cpp      |    4 +-
 myserver/src/http_handler/cgi/cgi.cpp              |   13 +------
 myserver/src/http_handler/fastcgi/fastcgi.cpp      |    5 --
 myserver/src/http_handler/scgi/scgi.cpp            |    3 -
 myserver/src/protocol/http/http.cpp                |   28 +-------------
 myserver/src/protocol/http/http_data_read.cpp      |   14 +++----
 myserver/tests/test_file.cpp                       |   12 +++---
 13 files changed, 50 insertions(+), 87 deletions(-)


hooks/post-receive
-- 
GNU MyServer


From MAILER-DAEMON Wed Jun 23 09:04:47 2010
Received: from mailman by lists.gnu.org with archive (Exim 4.43)
	id 1ORPdH-0000rF-5W
	for mharc-myserver-commit@gnu.org; Wed, 23 Jun 2010 09:04:47 -0400
Received: from [140.186.70.92] (port=56179 helo=eggs.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.43) id 1ORPdE-0000py-Ma
	for myserver-commit@gnu.org; Wed, 23 Jun 2010 09:04:45 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69)
	(envelope-from <gscrivano@gnu.org>) id 1ORPdD-0002yk-Ej
	for myserver-commit@gnu.org; Wed, 23 Jun 2010 09:04:44 -0400
Received: from colonialone.fsf.org ([140.186.70.51]:50554
	helo=internal.in.savannah.gnu.org)
	by eggs.gnu.org with esmtp (Exim 4.69)
	(envelope-from <gscrivano@gnu.org>) id 1ORPdD-0002ye-DM
	for myserver-commit@gnu.org; Wed, 23 Jun 2010 09:04:43 -0400
Received: from [10.1.0.108] (helo=vcs-noshell.in.savannah.gnu.org)
	by internal.in.savannah.gnu.org with esmtp (Exim 4.69)
	(envelope-from <gscrivano@gnu.org>) id 1ORPdD-0004W3-AE
	for myserver-commit@gnu.org; Wed, 23 Jun 2010 13:04:43 +0000
Received: from gscrivano by vcs-noshell.in.savannah.gnu.org with local (Exim
	4.69) (envelope-from <gscrivano@savannah.gnu.org>)
	id 1ORPdC-0005iH-3Q
	for myserver-commit@gnu.org; Wed, 23 Jun 2010 13:04:43 +0000
To: myserver-commit@gnu.org
X-Git-Refname: refs/heads/master
X-Git-Reftype: branch
X-Git-Oldrev: 019962be8f4376abffeb724b242b4f6e31f0b8a1
X-Git-Newrev: fa279d5ec14c26dabb0b80e79bbb03d337c2eeda
Message-Id: <E1ORPdC-0005iH-3Q@vcs-noshell.in.savannah.gnu.org>
From: Giuseppe Scrivano <gscrivano@gnu.org>
Date: Wed, 23 Jun 2010 13:04:42 +0000
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2)
Subject: [myserver-commit] [SCM] GNU MyServer branch, master,
	updated. v0.9.2-267-gfa279d5
X-BeenThere: myserver-commit@gnu.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: myserver-commit.gnu.org
List-Unsubscribe: <http://lists.gnu.org/mailman/listinfo/myserver-commit>,
	<mailto:myserver-commit-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/myserver-commit>
List-Post: <mailto:myserver-commit@gnu.org>
List-Help: <mailto:myserver-commit-request@gnu.org?subject=help>
List-Subscribe: <http://lists.gnu.org/mailman/listinfo/myserver-commit>,
	<mailto:myserver-commit-request@gnu.org?subject=subscribe>
X-List-Received-Date: Wed, 23 Jun 2010 13:04:46 -0000

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU MyServer".

The branch, master has been updated
       via  fa279d5ec14c26dabb0b80e79bbb03d337c2eeda (commit)
      from  019962be8f4376abffeb724b242b4f6e31f0b8a1 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------


commit fa279d5ec14c26dabb0b80e79bbb03d337c2eeda
Author: Giuseppe Scrivano <gscrivano@gnu.org>
Date:   Wed Jun 23 15:04:31 2010 +0200

    Do not remove immediately the temporary file containing the request payload.

diff --git a/myserver/src/protocol/http/http_data_read.cpp b/myserver/src/protocol/http/http_data_read.cpp
index 242baf2..ecbf056 100644
--- a/myserver/src/protocol/http/http_data_read.cpp
+++ b/myserver/src/protocol/http/http_data_read.cpp
@@ -300,8 +300,7 @@ int HttpDataRead::readPostData (HttpThreadContext* td, int* httpRetCode)
     Create the file that contains the posted data.
     This data is the stdin file in the CGI.
   */
-  if (td->inputData.createTemporaryFile (inputDataPath.c_str (), File::READ
-                                         | File::WRITE))
+  if (td->inputData.createTemporaryFile (inputDataPath.c_str (), false))
     {
       *httpRetCode = 500;
       return 1;

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

Summary of changes:
 myserver/src/protocol/http/http_data_read.cpp |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)


hooks/post-receive
-- 
GNU MyServer


From MAILER-DAEMON Wed Jun 23 11:02:46 2010
Received: from mailman by lists.gnu.org with archive (Exim 4.43)
	id 1ORRTS-0007Hc-AW
	for mharc-myserver-commit@gnu.org; Wed, 23 Jun 2010 11:02:46 -0400
Received: from [140.186.70.92] (port=33724 helo=eggs.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.43) id 1ORRTL-0007EP-Kf
	for myserver-commit@gnu.org; Wed, 23 Jun 2010 11:02:43 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69)
	(envelope-from <gscrivano@gnu.org>) id 1ORRTA-00050N-Or
	for myserver-commit@gnu.org; Wed, 23 Jun 2010 11:02:31 -0400
Received: from colonialone.fsf.org ([140.186.70.51]:57447
	helo=internal.in.savannah.gnu.org)
	by eggs.gnu.org with esmtp (Exim 4.69)
	(envelope-from <gscrivano@gnu.org>) id 1ORRTA-00050H-Lq
	for myserver-commit@gnu.org; Wed, 23 Jun 2010 11:02:28 -0400
Received: from [10.1.0.108] (helo=vcs-noshell.in.savannah.gnu.org)
	by internal.in.savannah.gnu.org with esmtp (Exim 4.69)
	(envelope-from <gscrivano@gnu.org>) id 1ORRTA-0005zY-GD
	for myserver-commit@gnu.org; Wed, 23 Jun 2010 15:02:28 +0000
Received: from gscrivano by vcs-noshell.in.savannah.gnu.org with local (Exim
	4.69) (envelope-from <gscrivano@savannah.gnu.org>)
	id 1ORRT7-0005Ct-4V
	for myserver-commit@gnu.org; Wed, 23 Jun 2010 15:02:28 +0000
To: myserver-commit@gnu.org
X-Git-Refname: refs/heads/master
X-Git-Reftype: branch
X-Git-Oldrev: fa279d5ec14c26dabb0b80e79bbb03d337c2eeda
X-Git-Newrev: 1c01f9f9491cb6f61df071666a784de603b0acc6
Message-Id: <E1ORRT7-0005Ct-4V@vcs-noshell.in.savannah.gnu.org>
From: Giuseppe Scrivano <gscrivano@gnu.org>
Date: Wed, 23 Jun 2010 15:02:27 +0000
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2)
Subject: [myserver-commit] [SCM] GNU MyServer branch, master,
	updated. v0.9.2-271-g1c01f9f
X-BeenThere: myserver-commit@gnu.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: myserver-commit.gnu.org
List-Unsubscribe: <http://lists.gnu.org/mailman/listinfo/myserver-commit>,
	<mailto:myserver-commit-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/myserver-commit>
List-Post: <mailto:myserver-commit@gnu.org>
List-Help: <mailto:myserver-commit-request@gnu.org?subject=help>
List-Subscribe: <http://lists.gnu.org/mailman/listinfo/myserver-commit>,
	<mailto:myserver-commit-request@gnu.org?subject=subscribe>
X-List-Received-Date: Wed, 23 Jun 2010 15:02:44 -0000

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU MyServer".

The branch, master has been updated
       via  1c01f9f9491cb6f61df071666a784de603b0acc6 (commit)
       via  0fafdf621cd32cd452074721d8dc3860c4aa7007 (commit)
       via  2eab3e3fed1ddd84bb877c7eb737e4702d60ee06 (commit)
       via  d05067a9f29fa83925d215eaf7d9b44957dbeaa3 (commit)
      from  fa279d5ec14c26dabb0b80e79bbb03d337c2eeda (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------


commit 1c01f9f9491cb6f61df071666a784de603b0acc6
Author: Giuseppe Scrivano <gscrivano@gnu.org>
Date:   Wed Jun 23 17:00:39 2010 +0200

    Read correctly the request payload when the Content-Length is not specified.

diff --git a/myserver/src/protocol/http/env/env.cpp b/myserver/src/protocol/http/env/env.cpp
index 3a413d0..f7ad3cf 100644
--- a/myserver/src/protocol/http/env/env.cpp
+++ b/myserver/src/protocol/http/env/env.cpp
@@ -42,9 +42,9 @@ using namespace std;
   \param cgiEnv The zero terminated list of environment string.
   \param processEnv Specify if add current process environment
   variables too.
- */
+*/
 void Env::buildEnvironmentString (HttpThreadContext* td, char *cgiEnv,
-                                 int processEnv)
+                                  int processEnv)
 {
   MemBuf memCgi;
   MemBuf portBuffer;
@@ -81,8 +81,8 @@ void Env::buildEnvironmentString (HttpThreadContext* td, char *cgiEnv,
 
   memCgi << end_str << "SERVER_ADMIN=";
   memCgi << td->securityToken.getData ("server.admin",
-                                             MYSERVER_VHOST_CONF |
-                                             MYSERVER_SERVER_CONF, "");
+                                       MYSERVER_VHOST_CONF |
+                                       MYSERVER_SERVER_CONF, "");
 
   memCgi << end_str << "REQUEST_METHOD=";
   memCgi << td->request.cmd.c_str ();
@@ -97,41 +97,39 @@ void Env::buildEnvironmentString (HttpThreadContext* td, char *cgiEnv,
   memCgi << end_str << "GATEWAY_INTERFACE=CGI/1.1";
 
   if (td->request.contentLength.length ())
-  {
-    memCgi << end_str << "CONTENT_LENGTH=";
-    memCgi << td->request.contentLength.c_str ();
-  }
+    {
+      memCgi << end_str << "CONTENT_LENGTH=";
+      memCgi << td->request.contentLength.c_str ();
+    }
   else
-  {
-    u_long fs = 0;
-    ostringstream stream;
-
-    if (td->inputData.getHandle () >= 0)
-      fs = td->inputData.getFileSize ();
-
-    stream << fs;
+    {
+      u_long fs = 0;
+      ostringstream stream;
 
-    memCgi << end_str << "CONTENT_LENGTH=" << stream.str ().c_str ();
-  }
+      if (td->inputData.getHandle () >= 0)
+        fs = td->inputData.getFileSize ();
 
+      stream << fs;
+      memCgi << end_str << "CONTENT_LENGTH=" << stream.str ().c_str ();
+    }
 
   if (td->request.rangeByteBegin || td->request.rangeByteEnd)
-  {
-    ostringstream rangeBuffer;
-    memCgi << end_str << "HTTP_RANGE=" << td->request.rangeType << "=" ;
-    if (td->request.rangeByteBegin)
     {
-      rangeBuffer << static_cast<int>(td->request.rangeByteBegin);
-      memCgi << rangeBuffer.str ();
-    }
-    memCgi << "-";
-    if (td->request.rangeByteEnd)
-    {
-      rangeBuffer << td->request.rangeByteEnd;
-      memCgi << rangeBuffer.str ();
-    }
+      ostringstream rangeBuffer;
+      memCgi << end_str << "HTTP_RANGE=" << td->request.rangeType << "=" ;
+      if (td->request.rangeByteBegin)
+        {
+          rangeBuffer << static_cast<int>(td->request.rangeByteBegin);
+          memCgi << rangeBuffer.str ();
+        }
+      memCgi << "-";
+      if (td->request.rangeByteEnd)
+        {
+          rangeBuffer << td->request.rangeByteEnd;
+          memCgi << rangeBuffer.str ();
+        }
 
-  }
+    }
 
   memCgi << end_str << "CGI_ROOT=";
   memCgi << td->cgiRoot;
@@ -152,18 +150,18 @@ void Env::buildEnvironmentString (HttpThreadContext* td, char *cgiEnv,
 
 
   if (td->pathInfo.length ())
-  {
-    memCgi << end_str << "PATH_INFO=";
-    memCgi << td->pathInfo;
+    {
+      memCgi << end_str << "PATH_INFO=";
+      memCgi << td->pathInfo;
 
-    memCgi << end_str << "PATH_TRANSLATED=";
-    memCgi << td->pathTranslated;
-  }
+      memCgi << end_str << "PATH_TRANSLATED=";
+      memCgi << td->pathTranslated;
+    }
   else
-  {
-    memCgi << end_str << "PATH_TRANSLATED=";
-    memCgi << td->filenamePath;
-  }
+    {
+      memCgi << end_str << "PATH_TRANSLATED=";
+      memCgi << td->filenamePath;
+    }
 
   memCgi << end_str << "SCRIPT_FILENAME=";
   memCgi << td->filenamePath;
@@ -171,7 +169,7 @@ void Env::buildEnvironmentString (HttpThreadContext* td, char *cgiEnv,
   /*
     For the DOCUMENT_URI and SCRIPT_NAME copy the
     requested uri without the pathInfo.
-   */
+  */
   memCgi << end_str << "SCRIPT_NAME=";
   memCgi << td->request.uri.c_str ();
 
@@ -205,10 +203,10 @@ void Env::buildEnvironmentString (HttpThreadContext* td, char *cgiEnv,
   reqEntry = td->request.other.get ("content-type");
 
   if (reqEntry)
-  {
-    memCgi << end_str << "CONTENT_TYPE=";
-    memCgi << reqEntry->value.c_str ();
-  }
+    {
+      memCgi << end_str << "CONTENT_TYPE=";
+      memCgi << reqEntry->value.c_str ();
+    }
 
   buildHttpHeaderEnvString (memCgi, td->request);
 
@@ -221,30 +219,30 @@ void Env::buildEnvironmentString (HttpThreadContext* td, char *cgiEnv,
 
 /*!
   Append to the environment string variables from the HTTP request header.
- */
+*/
 void Env::buildHttpHeaderEnvString (MemBuf& memCgi, HttpRequestHeader & req)
 {
 
   HashMap<string, HttpRequestHeader::Entry*>::Iterator it = req.begin ();
   for (; it != req.end (); it++)
-  {
-    HttpRequestHeader::Entry* en = *it;
-    string name;
-
-    name.assign ("HTTP_");
-    name.append (en->name.c_str ());
-    transform (name.begin ()+5, name.end (), name.begin ()+5, ::toupper);
-    for (int i = name.length (); i > 5; i--)
-      if (name[i] == '-')
-        name[i] = '_';
-
-    memCgi  << end_str << name.c_str () << "=" << en->value.c_str ();
-  }
+    {
+      HttpRequestHeader::Entry* en = *it;
+      string name;
+
+      name.assign ("HTTP_");
+      name.append (en->name.c_str ());
+      transform (name.begin ()+5, name.end (), name.begin ()+5, ::toupper);
+      for (int i = name.length (); i > 5; i--)
+        if (name[i] == '-')
+          name[i] = '_';
+
+      memCgi  << end_str << name.c_str () << "=" << en->value.c_str ();
+    }
 }
 
 /*!
   Append to the environment string process env variables.
- */
+*/
 void Env::buildProcessEnvString (MemBuf& memCgi)
 {
 #ifdef WIN32
@@ -254,13 +252,13 @@ void Env::buildProcessEnvString (MemBuf& memCgi)
   memCgi << end_str;
   if (lpvEnv)
     for (lpszVariable = (LPTSTR) lpvEnv; *lpszVariable; lpszVariable++)
-    {
-      if (((char*)lpszVariable)[0]  != '=' )
       {
-        memCgi << (char*)lpszVariable << end_str;
+        if (((char*)lpszVariable)[0]  != '=' )
+          {
+            memCgi << (char*)lpszVariable << end_str;
+          }
+        while (*lpszVariable)
+          *lpszVariable++;
       }
-      while (*lpszVariable)
-        *lpszVariable++;
-    }
 #endif
 }
diff --git a/myserver/src/protocol/http/http_data_read.cpp b/myserver/src/protocol/http/http_data_read.cpp
index ecbf056..49eeaa5 100644
--- a/myserver/src/protocol/http/http_data_read.cpp
+++ b/myserver/src/protocol/http/http_data_read.cpp
@@ -74,7 +74,6 @@ int HttpDataRead::readContiguousPrimitivePostData (const char* inBuffer,
     return 0;
 
   ret = inSocket->recv (outBuffer + *nbr,  outBufferSize - *nbr, 0, timeout);
-
   if (ret == -1)
     return -1;
 
@@ -306,6 +305,7 @@ int HttpDataRead::readPostData (HttpThreadContext* td, int* httpRetCode)
       return 1;
     }
 
+  /* It is used only when content-length is specified.  */
   length = contentLength;
 
   bufferDataSize = (td->nBytesToRead < td->buffer->getRealLength () - 1
@@ -315,7 +315,7 @@ int HttpDataRead::readPostData (HttpThreadContext* td, int* httpRetCode)
   /* If it is specified a transfer encoding read data using it.  */
   if (encoding)
     {
-      if (!encoding->value.compare ("chunked"))
+      if (encoding->value.compare ("chunked") == 0)
         {
           int ret = readChunkedPostData (td->request.uriOptsPtr,
                                          &inPos,
@@ -328,7 +328,7 @@ int HttpDataRead::readPostData (HttpThreadContext* td, int* httpRetCode)
                                          &(td->inputData),
                                          0);
 
-          if (ret == -1)
+          if (ret < 0)
             {
               td->inputData.close ();
               return -1;
@@ -350,10 +350,11 @@ int HttpDataRead::readPostData (HttpThreadContext* td, int* httpRetCode)
     {
       for (;;)
         {
-
           /* Do not try to read more than what we expect.  */
-          u_long dimBuffer = std::min (td->auxiliaryBuffer->getRealLength () - 1ul,
-                                       length);
+          u_long dimBuffer = td->auxiliaryBuffer->getRealLength () - 1ul;
+
+          if (contentLengthSpecified && length < dimBuffer)
+            dimBuffer = length;
 
           if (readContiguousPrimitivePostData (td->request.uriOptsPtr,
                                                &inPos,
@@ -369,13 +370,16 @@ int HttpDataRead::readPostData (HttpThreadContext* td, int* httpRetCode)
               return 1;
             }
 
-          if (nbr <= length)
-            length -= nbr;
-          else
+          if (contentLengthSpecified)
             {
-              td->inputData.close ();
-              *httpRetCode = 400;
-              return 1;
+              if (nbr <= length)
+                length -= nbr;
+              else
+                {
+                  td->inputData.close ();
+                  *httpRetCode = 400;
+                  return 1;
+                }
             }
 
           td->auxiliaryBuffer->getBuffer ()[nbr] = '\0';
@@ -387,7 +391,8 @@ int HttpDataRead::readPostData (HttpThreadContext* td, int* httpRetCode)
               return -1;
             }
 
-          if (!length)
+          if ((contentLengthSpecified && length == 0)
+              || (!contentLengthSpecified && nbr == 0))
             break;
         }
     }



commit 0fafdf621cd32cd452074721d8dc3860c4aa7007
Author: Giuseppe Scrivano <gscrivano@gnu.org>
Date:   Wed Jun 23 16:45:57 2010 +0200

    Open the STDIN file for CGI in read only mode.

diff --git a/myserver/src/http_handler/cgi/cgi.cpp b/myserver/src/http_handler/cgi/cgi.cpp
index d355a21..2ca9359 100644
--- a/myserver/src/http_handler/cgi/cgi.cpp
+++ b/myserver/src/http_handler/cgi/cgi.cpp
@@ -76,6 +76,7 @@ int Cgi::send (HttpThreadContext* td, const char* scriptpath,
     to get other params like in a POST request.
   */
   Pipe stdOutFile;
+  File stdInFile;
   int len = strlen (cgipath);
   int i;
 
@@ -222,34 +223,27 @@ int Cgi::send (HttpThreadContext* td, const char* scriptpath,
       spi.cmdLine = cmdLine.str ();
       spi.cwd.assign (td->scriptDir);
 
-      spi.gid = atoi (td->securityToken.getData ("cgi.gid", MYSERVER_VHOST_CONF |
-                                                 MYSERVER_MIME_CONF |
-                                                 MYSERVER_SECURITY_CONF |
-                                                 MYSERVER_SERVER_CONF, "0"));
-      spi.uid = atoi (td->securityToken.getData ("cgi.uid", MYSERVER_VHOST_CONF |
-                                                 MYSERVER_MIME_CONF |
-                                                 MYSERVER_SECURITY_CONF |
-                                                 MYSERVER_SERVER_CONF, "0"));
-      spi.chroot.assign (td->securityToken.getData ("cgi.chroot", MYSERVER_VHOST_CONF |
-                                                    MYSERVER_MIME_CONF |
-                                                    MYSERVER_SECURITY_CONF |
-                                                    MYSERVER_SERVER_CONF, ""));
-
+      spi.gid = atoi (td->securityToken.getData ("cgi.gid", MYSERVER_VHOST_CONF
+                                                 | MYSERVER_MIME_CONF
+                                                 | MYSERVER_SECURITY_CONF
+                                                 | MYSERVER_SERVER_CONF, "0"));
+      spi.uid = atoi (td->securityToken.getData ("cgi.uid", MYSERVER_VHOST_CONF
+                                                 | MYSERVER_MIME_CONF
+                                                 | MYSERVER_SECURITY_CONF
+                                                 | MYSERVER_SERVER_CONF, "0"));
+      spi.chroot.assign (td->securityToken.getData ("cgi.chroot", MYSERVER_VHOST_CONF
+                                                    | MYSERVER_MIME_CONF
+                                                    | MYSERVER_SECURITY_CONF
+                                                    | MYSERVER_SERVER_CONF, ""));
+
+      stdInFile.openFile (td->inputData.getFilename (), File::READ);
+
+      spi.stdIn = (FileHandle) stdInFile.getHandle ();
       spi.stdError = (FileHandle) stdOutFile.getWriteHandle ();
-      spi.stdIn = (FileHandle) td->inputData.getHandle ();
       spi.stdOut = (FileHandle) stdOutFile.getWriteHandle ();
       spi.envString = td->auxiliaryBuffer->getBuffer ();
 
-      if (spi.stdError == (FileHandle) -1 ||
-          spi.stdOut == (FileHandle) -1)
-        {
-          td->connection->host->warningsLogWrite (_("Cgi: internal error"));
-          stdOutFile.close ();
-          chain.clearAllFilters ();
-          return td->http->raiseHTTPError (500);
-        }
-
-      /* Execute the CGI process. */
+      /* Execute the CGI process.  */
       if (Process::getForkServer ()->isInitialized ())
         {
           int pid;
@@ -262,7 +256,7 @@ int Cgi::send (HttpThreadContext* td, const char* scriptpath,
       else
         cgiProc.exec (&spi);
 
-      /* Close the write stream of the pipe on the server.  */
+      stdInFile.close ();
       stdOutFile.closeWrite ();
 
       sendData (td, stdOutFile, chain, cgiProc, onlyHeader, nph);
@@ -270,13 +264,12 @@ int Cgi::send (HttpThreadContext* td, const char* scriptpath,
       stdOutFile.close ();
       cgiProc.terminateProcess ();
       chain.clearAllFilters ();
-
-      cgiProc.terminateProcess ();
     }
   catch (exception & e)
     {
       td->connection->host->warningsLogWrite (_E ("Cgi: internal error"), &e);
       stdOutFile.close ();
+      stdInFile.close ();
       chain.clearAllFilters ();
       return td->http->raiseHTTPError (500);
     }



commit 2eab3e3fed1ddd84bb877c7eb737e4702d60ee06
Author: Giuseppe Scrivano <gscrivano@gnu.org>
Date:   Wed Jun 23 16:45:18 2010 +0200

    When creating a temporary file, don't attempt to delete it before.

diff --git a/myserver/src/base/file/file.cpp b/myserver/src/base/file/file.cpp
index 6244655..106422b 100644
--- a/myserver/src/base/file/file.cpp
+++ b/myserver/src/base/file/file.cpp
@@ -148,7 +148,7 @@ int File::openFile (const char* nfilename, u_long opt, mode_t mask)
     flags = O_WRONLY;
 
   if (opt & File::NO_FOLLOW_SYMLINK)
-    flags = O_NOFOLLOW;
+    flags |= O_NOFOLLOW;
 
   if (opt & File::APPEND)
     flags |= O_APPEND;
@@ -240,12 +240,9 @@ const char *File::getFilename ()
  */
 int File::createTemporaryFile (const char* filename, bool unlink)
 {
-  if (FilesUtility::nodeExists (filename))
-    FilesUtility::deleteFile (filename);
-
   u_long temporaryOpt = unlink ? File::TEMPORARY : File::TEMPORARY_DELAYED;
 
-  return openFile (filename, File::READ | File::WRITE | File::NO_INHERIT
+  return openFile (filename, File::READ | File::WRITE
                    | File::FILE_OPEN_ALWAYS | temporaryOpt);
 }
 



commit d05067a9f29fa83925d215eaf7d9b44957dbeaa3
Author: Giuseppe Scrivano <gscrivano@gnu.org>
Date:   Wed Jun 23 16:44:06 2010 +0200

    Do not close standard descriptors.

diff --git a/myserver/src/base/process/process.cpp b/myserver/src/base/process/process.cpp
index c4bacb8..9c1b97a 100644
--- a/myserver/src/base/process/process.cpp
+++ b/myserver/src/base/process/process.cpp
@@ -262,34 +262,31 @@ int Process::exec (StartProcInfo* spi, bool waitEnd)
       if (generateEnvString (envp, size, (char*) spi->envString))
         exit (1);
 
-      if (spi->cwd.length ()
-          && chdir (spi->cwd.c_str ()) == -1)
+      if (spi->cwd.length () && chdir (spi->cwd.c_str ()) == -1)
         exit (1);
 
-      if ((long)spi->stdOut == -1)
-        spi->stdOut = checked::open ("/dev/null", O_WRONLY);
+      if (spi->stdIn < 0)
+        gnulib::close (0);
+      else
+        checked::dup2 (spi->stdIn, 0);
 
-      if ((long)spi->stdError == -1)
-        spi->stdError = checked::open ("/dev/null", O_WRONLY);
+      if (spi->stdOut < 0)
+        gnulib::close (1);
+      else
+        checked::dup2 (spi->stdOut, 1);
 
-      checked::close (0);
+      if (spi->stdError < 0)
+        gnulib::close (2);
+      else
+        checked::dup2 (spi->stdError, 2);
 
-      if (spi->stdIn != -1)
-        {
-          if (checked::dup2 (spi->stdIn, 0) == -1)
-            exit (1);
-          checked::close (spi->stdIn);
-        }
-
-      checked::close (1);
 
-      if (checked::dup2 (spi->stdOut, 1) == -1)
-        exit (1);
-
-      checked::close (2);
-
-      if (checked::dup2 (spi->stdError, 2) == -1)
-        exit (1);
+      if (spi->stdIn < 0)
+        gnulib::close (spi->stdIn);
+      if (spi->stdOut < 0)
+        gnulib::close (spi->stdOut);
+      if (spi->stdError < 0)
+        gnulib::close (spi->stdError);
 
       if (spi->handlesToClose)
         {
@@ -304,7 +301,7 @@ int Process::exec (StartProcInfo* spi, bool waitEnd)
       execve ((const char*) args[0],
               (char* const*) args, (char* const*) envp);
 
-    exit (1);
+      exit (1);
   }
 
   if (waitEnd)

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

Summary of changes:
 myserver/src/base/file/file.cpp               |    7 +-
 myserver/src/base/process/process.cpp         |   43 ++++----
 myserver/src/http_handler/cgi/cgi.cpp         |   47 ++++-----
 myserver/src/protocol/http/env/env.cpp        |  134 ++++++++++++-------------
 myserver/src/protocol/http/http_data_read.cpp |   31 ++++---
 5 files changed, 126 insertions(+), 136 deletions(-)


hooks/post-receive
-- 
GNU MyServer


