myserver-commit
[Top][All Lists]
Advanced

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

[myserver-commit] [SCM] GNU MyServer branch, master, updated. dde8b6efbc


From: Giuseppe Scrivano
Subject: [myserver-commit] [SCM] GNU MyServer branch, master, updated. dde8b6efbc2a7ccc51ed0915ad1b431707120bc8
Date: Fri, 31 Jul 2009 22:30:28 +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  dde8b6efbc2a7ccc51ed0915ad1b431707120bc8 (commit)
       via  a6dcee46d29a5fc880a4c93a4bffd00740661641 (commit)
       via  47e6e2dfd5cb0289723dc9c172dfa7207ace77cf (commit)
       via  7df4e5c863dcc61b64ef801f26e3c03d76fc5a7c (commit)
       via  7da09db135a59df021963791d5707e7280e7ad63 (commit)
       via  9b63ee90aac24e5bd19fdd31ec114f732b1b5a72 (commit)
       via  ba7b9bedfd28e7c6cd898d61f2694b4802646d42 (commit)
      from  20fc8ae23b82d5d05b1bf79cea7511e9e04c57c6 (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 dde8b6efbc2a7ccc51ed0915ad1b431707120bc8
Author: Giuseppe Scrivano <address@hidden>
Date:   Sat Aug 1 00:29:59 2009 +0200

    Avoid to read from the socket when the POST data specified by 
Content-Length is already consumed.

diff --git a/myserver/src/protocol/http/http_data_read.cpp 
b/myserver/src/protocol/http/http_data_read.cpp
index 274f68b..3e15e68 100644
--- a/myserver/src/protocol/http/http_data_read.cpp
+++ b/myserver/src/protocol/http/http_data_read.cpp
@@ -230,7 +230,7 @@ int HttpDataRead::readChunkedPostData(const char* inBuffer,
 int HttpDataRead::readPostData(HttpThreadContext* td, int* httpRetCode)
 {
   int contentLength = 0;
-
+  bool contentLengthSpecified = false;
   u_long nbw = 0;
   u_long bufferDataSize = 0;
 
@@ -265,7 +265,7 @@ int HttpDataRead::readPostData(HttpThreadContext* td, int* 
httpRetCode)
   if(td->request.contentLength.length())
   {
     contentLength = atoi(td->request.contentLength.c_str());
-
+    contentLengthSpecified = true;
     if(contentLength < 0)
     {
       *httpRetCode = 400;
@@ -279,7 +279,7 @@ int HttpDataRead::readPostData(HttpThreadContext* td, int* 
httpRetCode)
    *If a CONTENT-ENCODING is specified the CONTENT-LENGTH is not
    *always needed.
    */
-  if(!contentLength && td->request.isKeepAlive())
+  if(!contentLengthSpecified && td->request.isKeepAlive ())
   {
     HttpRequestHeader::Entry *content =
       td->request.other.get("Content-Encoding");
@@ -315,16 +315,16 @@ int HttpDataRead::readPostData(HttpThreadContext* td, 
int* httpRetCode)
   {
     if(!encoding->value->compare("chunked"))
     {
-      int ret = readChunkedPostData(td->request.uriOptsPtr,
-                                    &inPos,
-                                    bufferDataSize,
-                                    td->connection->socket,
-                                    td->secondaryBuffer->getBuffer(),
-                                    td->secondaryBuffer->getRealLength() - 1,
-                                    &nbr,
-                                    timeout,
-                                    &(td->inputData),
-                                    0);
+      int ret = readChunkedPostData (td->request.uriOptsPtr,
+                                     &inPos,
+                                     bufferDataSize,
+                                     td->connection->socket,
+                                     td->secondaryBuffer->getBuffer(),
+                                     td->secondaryBuffer->getRealLength() - 1,
+                                     &nbr,
+                                     timeout,
+                                     &(td->inputData),
+                                     0);
 
       if(ret == -1)
       {
@@ -346,49 +346,63 @@ int HttpDataRead::readPostData(HttpThreadContext* td, 
int* httpRetCode)
       return 1;
     }
   }
-  /* If it is not specified an encoding, read the data as it is.  */
-  else for(;;)
-  {
-
-    if(readContiguousPrimitivePostData(td->request.uriOptsPtr,
-                                       &inPos,
-                                       bufferDataSize,
-                                       td->connection->socket,
-                                       td->secondaryBuffer->getBuffer(),
-                                       td->secondaryBuffer->getRealLength() - 
1,
-                                       &nbr,
-                                       timeout))
+  else
     {
-      td->inputData.close();
-      FilesUtility::deleteFile(td->inputDataPath);
-      *httpRetCode = 400;
-      return 1;
+      /* If it is not specified an encoding, read the data as it is.  */
+      if (!contentLengthSpecified)
+        {
+          *httpRetCode = 400;
+          return 1;
+        }
+
+      for (;;)
+        {
+
+          /* Do not try to read more than what we expect.  */
+          u_long dimBuffer = std::min (td->secondaryBuffer->getRealLength() - 
1l,
+                                       length);
+
+          if (readContiguousPrimitivePostData (td->request.uriOptsPtr,
+                                               &inPos,
+                                               bufferDataSize,
+                                               td->connection->socket,
+                                               td->secondaryBuffer->getBuffer 
(),
+                                               dimBuffer,
+                                               &nbr,
+                                               timeout))
+            {
+              td->inputData.close ();
+              FilesUtility::deleteFile (td->inputDataPath);
+              *httpRetCode = 400;
+              return 1;
+            }
+
+          if (nbr <= length)
+            length -= nbr;
+          else
+            {
+              td->inputData.close ();
+              FilesUtility::deleteFile (td->inputDataPath);
+              *httpRetCode = 400;
+              return 1;
+            }
+
+          td->secondaryBuffer->getBuffer ()[nbr] = '\0';
+
+          if (nbr && td->inputData.writeToFile (td->secondaryBuffer->getBuffer 
(),
+                                                nbr, &nbw))
+            {
+              td->inputDataPath.assign ("");
+              td->outputDataPath.assign ("");
+              td->inputData.close ();
+              return -1;
+            }
+
+          if (!length)
+            break;
+        }
     }
 
-    if(nbr <= length)
-      length -= nbr;
-    else
-    {
-      td->inputData.close();
-      FilesUtility::deleteFile(td->inputDataPath);
-      *httpRetCode = 400;
-      return 1;
-    }
-
-    td->secondaryBuffer->getBuffer()[nbr] = '\0';
-
-    if(nbr && td->inputData.writeToFile(td->secondaryBuffer->getBuffer(), nbr, 
&nbw))
-    {
-      td->inputDataPath.assign("");
-      td->outputDataPath.assign("");
-      td->inputData.close();
-      return -1;
-    }
-
-    if(!length)
-      break;
-  }
-
   td->inputData.seek (0);
   return 0;
 }



commit a6dcee46d29a5fc880a4c93a4bffd00740661641
Author: Giuseppe Scrivano <address@hidden>
Date:   Fri Jul 31 22:53:58 2009 +0200

    By default allow anonymous access to the FTP server.

diff --git a/myserver/binaries/myserver.default.windows.xml 
b/myserver/binaries/myserver.default.windows.xml
index 77f11ad..5bb5d83 100755
--- a/myserver/binaries/myserver.default.windows.xml
+++ b/myserver/binaries/myserver.default.windows.xml
@@ -106,7 +106,7 @@
 
   <!--FTP GLOBAL CONFIGURATION-->
   <!--ALLOW ANONYMOUS LOGIN-->
-  <DEFINE name="ftp.allow_anonymous" value="NO" />
+  <DEFINE name="ftp.allow_anonymous" value="YES" />
 
   <!--IF ANONYMOUS ALLOWED, TELLS IF NEEDS PASS-->
   <DEFINE name="ftp.anonymous_need_pass" value="NO" />
diff --git a/myserver/binaries/myserver.default.xml 
b/myserver/binaries/myserver.default.xml
index 77f11ad..5bb5d83 100755
--- a/myserver/binaries/myserver.default.xml
+++ b/myserver/binaries/myserver.default.xml
@@ -106,7 +106,7 @@
 
   <!--FTP GLOBAL CONFIGURATION-->
   <!--ALLOW ANONYMOUS LOGIN-->
-  <DEFINE name="ftp.allow_anonymous" value="NO" />
+  <DEFINE name="ftp.allow_anonymous" value="YES" />
 
   <!--IF ANONYMOUS ALLOWED, TELLS IF NEEDS PASS-->
   <DEFINE name="ftp.anonymous_need_pass" value="NO" />



commit 47e6e2dfd5cb0289723dc9c172dfa7207ace77cf
Author: Giuseppe Scrivano <address@hidden>
Date:   Fri Jul 31 22:51:53 2009 +0200

    Report when the MSCGI library can't be opened correctly.

diff --git a/myserver/src/http_handler/mscgi/mscgi.cpp 
b/myserver/src/http_handler/mscgi/mscgi.cpp
index f8d9b95..1177d54 100644
--- a/myserver/src/http_handler/mscgi/mscgi.cpp
+++ b/myserver/src/http_handler/mscgi/mscgi.cpp
@@ -118,17 +118,24 @@ int MsCgi::send(HttpThreadContext* td, const char* exec, 
const char* cmdLine,
 
   ret = hinstLib.loadLibrary(exec, 0);
 
-  if (!ret) 
-  { 
-    td->secondaryBuffer->getAt(0) = '\0';
+  if (ret)
+  {
+    string msg;
+    msg.assign ("MSCGI: cannot load ");
+    msg.append (exec);
+    td->connection->host->warningsLogWrite (msg.c_str ());
+    chain.clearAllFilters ();
+
+    /* Internal server error.  */
+    return td->http->raiseHTTPError(500);
+  }
 
-    ProcMain = (CGIMAIN) hinstLib.getProc( "myserver_main"); 
+  td->secondaryBuffer->getAt(0) = '\0';
 
-    if(ProcMain)
-    {
-      (ProcMain)(td->request.uriOpts.c_str (), &data);
-    }
-    else
+  ProcMain = (CGIMAIN) hinstLib.getProc( "myserver_main");
+  if(ProcMain)
+    (ProcMain)(td->request.uriOpts.c_str (), &data);
+  else
     {
       string msg;
       msg.assign("MSCGI: error accessing entrypoint for ");
@@ -136,15 +143,9 @@ int MsCgi::send(HttpThreadContext* td, const char* exec, 
const char* cmdLine,
       td->connection->host->warningsLogWrite(msg.c_str());
       return td->http->raiseHTTPError(500);
     }
-    hinstLib.close();
-  } 
-  else
-  {
-    chain.clearAllFilters(); 
+  hinstLib.close();
+
 
-    /* Internal server error.  */
-    return td->http->raiseHTTPError(500);
-  }
   if(data.errorPage)
   {
     chain.clearAllFilters(); 



commit 7df4e5c863dcc61b64ef801f26e3c03d76fc5a7c
Author: Giuseppe Scrivano <address@hidden>
Date:   Fri Jul 31 22:34:02 2009 +0200

    Socket::read returns immediately when the socket is non blocking.

diff --git a/myserver/src/base/socket/socket.cpp 
b/myserver/src/base/socket/socket.cpp
index da7d08c..7664dff 100644
--- a/myserver/src/base/socket/socket.cpp
+++ b/myserver/src/base/socket/socket.cpp
@@ -627,10 +627,7 @@ int Socket::recv(char* buffer,int len,int flags)
   int err = 0;
 
 #ifdef WIN32
-  do
-  {
-    err = ::recv(socketHandle, buffer, len, flags);
-  }while((err == SOCKET_ERROR) && (GetLastError() == WSAEWOULDBLOCK));
+  err = ::recv(socketHandle, buffer, len, flags);
 
   if ( err == SOCKET_ERROR && GetLastError() == WSAEWOULDBLOCK && 
isNonBlocking)
     return 0;
diff --git a/myserver/src/protocol/ftp/ftp.cpp 
b/myserver/src/protocol/ftp/ftp.cpp
index 34f7d25..46ad2f6 100755
--- a/myserver/src/protocol/ftp/ftp.cpp
+++ b/myserver/src/protocol/ftp/ftp.cpp
@@ -213,7 +213,7 @@ struct reply
     std::string sText;
 };
 
-struct reply reply_table[] = {
+static struct reply reply_table[] = {
   {120, "Service ready in %s minutes."},
   {125, "Data connection already open; transfer starting."},
   {150, "File status okay; about to open data connection."},



commit 7da09db135a59df021963791d5707e7280e7ad63
Merge: 9b63ee9 20fc8ae
Author: Giuseppe Scrivano <address@hidden>
Date:   Thu Jul 30 20:00:52 2009 +0200

    Merge branch 'master' of file:///home/gscrivano/myserver/myserver




commit 9b63ee90aac24e5bd19fdd31ec114f732b1b5a72
Merge: ba7b9be 814f9d5
Author: Giuseppe Scrivano <address@hidden>
Date:   Thu Jul 30 18:44:28 2009 +0200

    Merge branch 'master' of file:///home/gscrivano/myserver/myserver




commit ba7b9bedfd28e7c6cd898d61f2694b4802646d42
Author: Giuseppe Scrivano <address@hidden>
Date:   Sun Jul 19 21:22:38 2009 +0200

    Compile MSCGI examples under Windows.

diff --git a/myserver/binaries/web/Makefile.am 
b/myserver/binaries/web/Makefile.am
index b2e9ad6..cf26f49 100644
--- a/myserver/binaries/web/Makefile.am
+++ b/myserver/binaries/web/Makefile.am
@@ -1,5 +1,6 @@
+
 if BUILD_MSCGI
-       CGI_SRC = cgi-src
+CGI_SRC = cgi-src
 endif
 
 SUBDIRS = cgi-bin $(CGI_SRC) downloads
diff --git a/myserver/configure.in b/myserver/configure.in
index 001a09a..92ac4e5 100644
--- a/myserver/configure.in
+++ b/myserver/configure.in
@@ -100,7 +100,8 @@ AC_CHECK_LIB(gcrypt, gcry_control, AC_DEFINE(GCRY_CONTROL, 
1, [Define if the gcr
 
 case "${host}" in
     *-*-mingw32*)
-     LDFLAGS="$LDFLAGS -lwsock32 -lgdi32 -lole32  -luuid -luserenv"
+     LDFLAGS="-lwsock32 -lgdi32 -lole32  -luuid -luserenv $LDFLAGS"
+     MAKE_MSCGI=yes
      ;;
   *)
      dnl Looking for pthreads
@@ -124,7 +125,6 @@ case "${host}" in
                 *** MSCGI support will not function
                     ])
          DL_LIB=""
-         MAKE_MSCGI=no
    fi
 
 
@@ -310,6 +310,10 @@ AM_CONDITIONAL(BUILD_TESTS, test "$MAKE_TESTS" = "yes")
 AM_CONDITIONAL(BUILD_MSCGI, test "$MAKE_MSCGI" = "yes")
 AM_CONDITIONAL(BUILD_DOC, test "$MAKE_DOC" = "yes")
 
+AC_SUBST(BUILD_TESTS)
+AC_SUBST(BUILD_DOC)
+AC_SUBST(BUILD_MSCGI)
+
 dnl AC_CONFIG_SUBDIRS()
 AC_CONFIG_FILES([
     Makefile
diff --git a/myserver/src/base/ssl/ssl.cpp b/myserver/src/base/ssl/ssl.cpp
index 730671c..2e93e63 100644
--- a/myserver/src/base/ssl/ssl.cpp
+++ b/myserver/src/base/ssl/ssl.cpp
@@ -23,13 +23,23 @@ along with this program.  If not, see 
<http://www.gnu.org/licenses/>.
 extern "C"
 {
 #if GCRY_CONTROL
-#include <errno.h>
-#include <gcrypt.h>
+
+# include <errno.h>
+
+# ifdef WIN32
+#  undef socklen_t
+# endif
+
+# include <gcrypt.h>
+
+# ifdef HAVE_PTHREAD
 GCRY_THREAD_OPTION_PTHREAD_IMPL;
+# endif
+
 #endif
 
 #ifdef HAVE_PTHREAD
-#include <pthread.h>
+# include <pthread.h>
 #endif
 }
 
@@ -99,7 +109,7 @@ void initializeSSL ()
 
   if (!initialized)
   {
-#if GCRY_CONTROL
+#if GCRY_CONTROL && HAVE_PTHREAD
     gcry_control (GCRYCTL_SET_THREAD_CBS, &gcry_threads_pthread);
 #endif
     gnutls_global_init ();

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

Summary of changes:
 myserver/binaries/myserver.default.windows.xml |    2 +-
 myserver/binaries/myserver.default.xml         |    2 +-
 myserver/src/base/socket/socket.cpp            |    5 +-
 myserver/src/http_handler/mscgi/mscgi.cpp      |   35 ++++----
 myserver/src/protocol/ftp/ftp.cpp              |    2 +-
 myserver/src/protocol/http/http_data_read.cpp  |  120 +++++++++++++-----------
 6 files changed, 89 insertions(+), 77 deletions(-)


hooks/post-receive
-- 
GNU MyServer




reply via email to

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