myserver-commit
[Top][All Lists]
Advanced

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

[myserver-commit] [SCM] GNU MyServer branch, master, updated. v0.9.2-355


From: Giuseppe Scrivano
Subject: [myserver-commit] [SCM] GNU MyServer branch, master, updated. v0.9.2-355-g3a43751
Date: Sun, 22 Aug 2010 15:20: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  3a43751716065260b0a009c7f9d890a603f5e862 (commit)
       via  4b2b0d771b43f30c9ebfed4beae8fdb670ec7c20 (commit)
       via  0d949766f4eb4002bb90bcf9fa59b4e5e5084798 (commit)
      from  7b9b7738613c23430876f180bd75efca342dc14a (commit)

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

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


commit 3a43751716065260b0a009c7f9d890a603f5e862
Author: Giuseppe Scrivano <address@hidden>
Date:   Sun Aug 22 17:22:10 2010 +0200

    Allow arbitrary depth for MIME locations path.

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



commit 4b2b0d771b43f30c9ebfed4beae8fdb670ec7c20
Author: Giuseppe Scrivano <address@hidden>
Date:   Sun Aug 22 17:16:11 2010 +0200

    Append query information to the requested URL.

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



commit 0d949766f4eb4002bb90bcf9fa59b4e5e5084798
Author: Giuseppe Scrivano <address@hidden>
Date:   Sun Aug 22 17:15:08 2010 +0200

    Do not use stat cache for temporary files.

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

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

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


hooks/post-receive
-- 
GNU MyServer



reply via email to

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