myserver-commit
[Top][All Lists]
Advanced

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

[myserver-commit] [2896] Changed code to find `PATH_INFO'.


From: Giuseppe Scrivano
Subject: [myserver-commit] [2896] Changed code to find `PATH_INFO'.
Date: Tue, 21 Oct 2008 20:53:57 +0000

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

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

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

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

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

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

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






reply via email to

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