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-228


From: Giuseppe Scrivano
Subject: [myserver-commit] [SCM] GNU MyServer branch, master, updated. v0.9.2-228-gaaa3953
Date: Tue, 11 May 2010 10:30:30 +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  aaa3953a513a54cf43d28e4ec8b718703c868570 (commit)
       via  747e5350c01142b80c1f3b5665f0f2ed93c1854a (commit)
       via  d25111eedceb92b4f037fd9e11c5ccdf2391934a (commit)
       via  b8bef11fab3a916f0eaee8602ac88e3c2f9537a2 (commit)
      from  c7fe97145fa20fddb1e0a87557b405b66a49d75f (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 aaa3953a513a54cf43d28e4ec8b718703c868570
Author: Giuseppe Scrivano <address@hidden>
Date:   Tue May 11 12:00:00 2010 +0200

    Workaround a bug in git-version-gen.

diff --git a/myserver/bootstrap.conf b/myserver/bootstrap.conf
index 7d6802d..3cf34ee 100644
--- a/myserver/bootstrap.conf
+++ b/myserver/bootstrap.conf
@@ -80,3 +80,11 @@ gnulib_extra_files="
        $build_aux/config.rpath
        doc/INSTALL
 "
+
+# Workaround a bug in git-version-gen, that doesn't allow to be used
+# in a sibling directory of the git repository.  Remove this as soon
+# as the bug is fixed.
+bootstrap_epilogue()
+{
+        sed -i -e"s|test -d .git|true|" build-aux/git-version-gen
+}



commit 747e5350c01142b80c1f3b5665f0f2ed93c1854a
Author: Giuseppe Scrivano <address@hidden>
Date:   Tue May 11 10:59:18 2010 +0200

    Load the XML file in memory before parse it.

diff --git a/myserver/src/base/xml/xml_parser.cpp 
b/myserver/src/base/xml/xml_parser.cpp
index 22cdc04..6b8a483 100644
--- a/myserver/src/base/xml/xml_parser.cpp
+++ b/myserver/src/base/xml/xml_parser.cpp
@@ -81,41 +81,69 @@ bool XmlParser::cleanXML ()
  */
 int XmlParser::open (const char* filename, bool useXpath)
 {
+  File xmlFile;
+
   cur = NULL;
   this->useXpath = useXpath;
 
-  if (!FilesUtility::nodeExists (filename))
-    return -1;
-
   if (doc!= NULL)
     close ();
 
-  doc = xmlParseFile (filename);
-  if (doc == NULL)
+  if (xmlFile.openFile (filename, File::READ | File::OPEN_IF_EXISTS))
     return -1;
 
-  cur = xmlDocGetRootElement (doc);
-  if (!cur)
+  u_long size = xmlFile.getFileSize ();
+  char *buffer = new char [size];
+  try
     {
-      close ();
-      return -1;
-    }
+      u_long nbr;
+      xmlFile.read (buffer, size, &nbr);
 
-  mtime = FilesUtility::getLastModTime (filename);
-  if (mtime == static_cast<time_t>(-1))
-    {
-      close ();
-      return -1;
-    }
+      doc = xmlParseMemory (buffer, nbr);
 
-  if (useXpath)
-    {
-      xpathCtx = xmlXPathNewContext (doc);
-      if (xpathCtx == NULL)
+      delete [] buffer;
+      buffer = NULL;
+
+      if (doc == NULL)
+        return -1;
+
+      if (nbr != size)
         {
           close ();
           return -1;
         }
+
+      cur = xmlDocGetRootElement (doc);
+      if (!cur)
+        {
+          close ();
+          return -1;
+        }
+
+      mtime = xmlFile.getLastModTime ();
+      if (mtime == static_cast<time_t> (-1))
+        {
+          close ();
+          return -1;
+        }
+
+      if (useXpath)
+        {
+          xpathCtx = xmlXPathNewContext (doc);
+          if (xpathCtx == NULL)
+            {
+              close ();
+              return -1;
+            }
+        }
+      xmlFile.close ();
+    }
+  catch (exception & e)
+    {
+      if (buffer)
+        delete [] buffer;
+
+      throw e;
     }
   return 0;
 }
@@ -350,7 +378,7 @@ int XmlParser::close ()
  */
 int XmlParser::save (const char *filename, int *nbytes)
 {
-  int err = xmlSaveFile (filename,doc);
+  int err = xmlSaveFile (filename, doc);
   if (nbytes)
     *nbytes = err;
 
diff --git a/myserver/src/conf/security/security_cache.cpp 
b/myserver/src/conf/security/security_cache.cpp
index e8d7e89..934f0ba 100644
--- a/myserver/src/conf/security/security_cache.cpp
+++ b/myserver/src/conf/security/security_cache.cpp
@@ -30,7 +30,7 @@ using namespace std;
 
 /*
   Constructor for the SecurityCache object.
- */
+*/
 SecurityCache::SecurityCache ()
 {
   /*
@@ -72,11 +72,11 @@ void SecurityCache::setMaxNodes (int newLimit)
 
   /*! Remove all the additional nodes from the dictionary. */
   while (newLimit < dictionary.size ())
-  {
-    XmlParser* toremove = dictionary.remove (dictionary.begin ());
-    if (toremove)
-      delete toremove;
-  }
+    {
+      XmlParser* toremove = dictionary.remove (dictionary.begin ());
+      if (toremove)
+        delete toremove;
+    }
   limit = newLimit;
 }
 
@@ -108,43 +108,43 @@ int SecurityCache::getSecurityFile (const string& dir,
 
   /* The security file exists in the directory.  */
   if (FilesUtility::nodeExists (secFile))
-  {
-    out.assign (secFile);
-    return 0;
-  }
+    {
+      out.assign (secFile);
+      return 0;
+    }
 
 
   /* Go upper in the tree till we find a security file.  */
   for (;;)
-  {
-    if (found || !file.length ())
-      break;
-
-    for (i = file.length () - 1; i; i--)
-      if (file[i] == '/')
-      {
-        file.erase (i, file.length () - i);
+    {
+      if (found || !file.length ())
         break;
-      }
 
-    /*
-      Top of the tree, check if the security file is present in the
-      system directory.  Return an error if it is not.
-    */
-    if (i == 0)
-    {
-      out.assign (sys);
-      out.append ("/");
-      out.append (secFileName);
-      return !FilesUtility::nodeExists (out);
-    }
+      for (i = file.length () - 1; i; i--)
+        if (file[i] == '/')
+          {
+            file.erase (i, file.length () - i);
+            break;
+          }
+
+      /*
+        Top of the tree, check if the security file is present in the
+        system directory.  Return an error if it is not.
+      */
+      if (i == 0)
+        {
+          out.assign (sys);
+          out.append ("/");
+          out.append (secFileName);
+          return !FilesUtility::nodeExists (out);
+        }
 
-    secFile.assign (file);
-    secFile.append ("/");
-    secFile.append (secFileName);
+      secFile.assign (file);
+      secFile.append ("/");
+      secFile.append (secFileName);
 
-    found = FilesUtility::nodeExists (secFile);
-  }
+      found = FilesUtility::nodeExists (secFile);
+    }
 
   out.assign (secFile);
   return 0;
@@ -183,60 +183,60 @@ XmlParser* SecurityCache::getParser (const string &dir,
 
   /* If the parser is already present and satisfy XPath then use it.  */
   if (parser && (!useXpath || parser->isXpathEnabled ()))
-  {
-    time_t fileModTime;
-    fileModTime = FilesUtility::getLastModTime (file.c_str ());
-
-    if ((fileModTime != static_cast<time_t>(-1))  &&
-       (parser->getLastModTime () != fileModTime))
     {
-      parser->close ();
+      time_t fileModTime;
+      fileModTime = FilesUtility::getLastModTime (file.c_str ());
 
-      /* FIXME:  Don't open the file twice, once to check
-       * and the second time to parse.  */
-      if (maxSize)
+      if ((fileModTime != static_cast<time_t>(-1))  &&
+          (parser->getLastModTime () != fileModTime))
         {
-          File parserFile;
-          if (parserFile.openFile (file.c_str (), File::READ))
-            return NULL;
+          parser->close ();
 
-          if (parserFile.getFileSize () > maxSize)
-            return NULL;
+          /* FIXME:  Don't open the file twice, once to check
+           * and the second time to parse.  */
+          if (maxSize)
+            {
+              File parserFile;
+              if (parserFile.openFile (file.c_str (), File::READ))
+                return NULL;
 
-          parserFile.close ();
-        }
+              if (parserFile.getFileSize () > maxSize)
+                return NULL;
 
-      if (parser->open (file.c_str (), useXpath) == -1)
-      {
-        dictionary.remove (file.c_str ());
-        return NULL;
-      }
+              parserFile.close ();
+            }
 
+          if (parser->open (file.c_str (), useXpath) == -1)
+            {
+              dictionary.remove (file.c_str ());
+              return NULL;
+            }
+
+        }
     }
-  }
   else
-  {
-    /* Create the parser and add it to the dictionary.  */
-    XmlParser* old;
-    parser = new XmlParser ();
+    {
+      /* Create the parser and add it to the dictionary.  */
+      XmlParser* old;
+      parser = new XmlParser ();
 
-    if (parser == NULL)
-      return NULL;
+      if (parser == NULL)
+        return NULL;
 
-    if (dictionary.size () >= limit)
-    {
-      XmlParser* toremove = dictionary.remove (dictionary.begin ());
-      if (toremove)
-        delete toremove;
-    }
+      if (dictionary.size () >= limit)
+        {
+          XmlParser* toremove = dictionary.remove (dictionary.begin ());
+          if (toremove)
+            delete toremove;
+        }
 
-    if (parser->open (file.c_str (), useXpath) == -1)
-      return NULL;
+      if (parser->open (file.c_str (), useXpath) == -1)
+        return NULL;
 
-    old = dictionary.put (file, parser);
-    if (old)
-      delete old;
-  }
+      old = dictionary.put (file, parser);
+      if (old)
+        delete old;
+    }
 
   return parser;
 }



commit d25111eedceb92b4f037fd9e11c5ccdf2391934a
Author: Giuseppe Scrivano <address@hidden>
Date:   Tue May 11 10:32:53 2010 +0200

    HttpHeader doesn't allocate name and value dinamically.

diff --git a/myserver/include/protocol/http/http_header.h 
b/myserver/include/protocol/http/http_header.h
index fe03c69..3a61ce7 100644
--- a/myserver/include/protocol/http/http_header.h
+++ b/myserver/include/protocol/http/http_header.h
@@ -30,27 +30,20 @@ struct HttpHeader
 {
   struct Entry
   {
-    string *name;
-    string *value;
-    Entry () : name (NULL), value (NULL)
+    string name;
+    string value;
+    Entry ()
     {
-      name = new string ();
-      value = new string ();
     }
 
     Entry (string& n, string& v) : name (NULL), value (NULL)
     {
-      name = new string ();
-      value = new string ();
-
-      name->assign (n);
-      value->assign (v);
+      name.assign (n);
+      value.assign (v);
     }
 
     ~Entry ()
     {
-      delete name;
-      delete value;
     }
 
   };
diff --git a/myserver/src/http_handler/http_dir/http_dir.cpp 
b/myserver/src/http_handler/http_dir/http_dir.cpp
index 3fa9fdc..61872de 100644
--- a/myserver/src/http_handler/http_dir/http_dir.cpp
+++ b/myserver/src/http_handler/http_dir/http_dir.cpp
@@ -557,15 +557,15 @@ int HttpDir::send (HttpThreadContext* td,
       *td->auxiliaryBuffer << "</table>\r\n<hr />\r\n<address>"
                            << MYSERVER_VERSION;
 
-      if (host && host->value->length ())
+      if (host && host->value.length ())
         {
           ostringstream portBuff;
-          size_t portSeparator = host->value->find (':');
+          size_t portSeparator = host->value.find (':');
           *td->auxiliaryBuffer << " on ";
           if (portSeparator != string::npos)
-            *td->auxiliaryBuffer << host->value->substr (0, 
portSeparator).c_str () ;
+            *td->auxiliaryBuffer << host->value.substr (0, 
portSeparator).c_str () ;
           else
-            *td->auxiliaryBuffer << host->value->c_str () ;
+            *td->auxiliaryBuffer << host->value.c_str () ;
 
           *td->auxiliaryBuffer << " Port ";
           portBuff << td->connection->getLocalPort ();
diff --git a/myserver/src/http_handler/http_file/http_file.cpp 
b/myserver/src/http_handler/http_file/http_file.cpp
index ceea526..910827c 100644
--- a/myserver/src/http_handler/http_file/http_file.cpp
+++ b/myserver/src/http_handler/http_file/http_file.cpp
@@ -242,8 +242,8 @@ int HttpFile::send (HttpThreadContext* td, const char 
*filenamePath,
       HttpRequestHeader::Entry *ifModifiedSince =
         td->request.other.get ("last-modified");
 
-      if (ifModifiedSince && ifModifiedSince->value->length () &&
-          !ifModifiedSince->value->compare (tmpTime))
+      if (ifModifiedSince && ifModifiedSince->value.length () &&
+          !ifModifiedSince->value.compare (tmpTime))
         return td->http->sendHTTPNonModified ();
 
       try
@@ -272,19 +272,19 @@ int HttpFile::send (HttpThreadContext* td, const char 
*filenamePath,
     generateEtag (etag, lastMT, filesize);
 
     HttpRequestHeader::Entry *etagHeader = td->request.other.get ("etag");
-    if (etagHeader && !etagHeader->value->compare (etag))
+    if (etagHeader && !etagHeader->value.compare (etag))
       return td->http->sendHTTPNonModified ();
     else
       {
         HttpResponseHeader::Entry *e = td->response.other.get ("etag");
         if (e)
-          e->value->assign (etag);
+          e->value.assign (etag);
         else
           {
             e = new HttpResponseHeader::Entry ();
-            e->name->assign ("etag");
-            e->value->assign (etag);
-            td->response.other.put (*(e->name), e);
+            e->name.assign ("etag");
+            e->value.assign (etag);
+            td->response.other.put (e->name, e);
           }
       }
 
@@ -310,13 +310,13 @@ int HttpFile::send (HttpThreadContext* td, const char 
*filenamePath,
 
         e = td->response.other.get ("content-range");
         if (e)
-          e->value->assign (buffer.str ());
+          e->value.assign (buffer.str ());
         else
           {
             e = new HttpResponseHeader::Entry ();
-            e->name->assign ("content-range");
-            e->value->assign (buffer.str ());
-            td->response.other.put (*(e->name), e);
+            e->name.assign ("content-range");
+            e->value.assign (buffer.str ());
+            td->response.other.put (e->name, e);
           }
       }
     chain.setStream (&memStream);
@@ -328,7 +328,7 @@ int HttpFile::send (HttpThreadContext* td, const char 
*filenamePath,
                                                                
td->mime->filters,
                                                                &memStream,
                                                                &nbw, 0,
-                                                               e ? e->value : 
NULL);
+                                                               e ? &e->value : 
NULL);
         memStream.refresh ();
         dataSent += nbw;
       }
@@ -354,13 +354,13 @@ int HttpFile::send (HttpThreadContext* td, const char 
*filenamePath,
         e = td->response.other.get ("content-encoding");
 
         if (e)
-          e->value->assign (s);
+          e->value.assign (s);
         else
           {
             e = new HttpResponseHeader::Entry ();
-            e->name->assign ("content-encoding");
-            e->value->assign (s);
-            td->response.other.put (*(e->name), e);
+            e->name.assign ("content-encoding");
+            e->value.assign (s);
+            td->response.other.put (e->name, e);
           }
         /* Do not use chunked transfer with old HTTP/1.0 clients.  */
         if (keepalive)
@@ -372,13 +372,13 @@ int HttpFile::send (HttpThreadContext* td, const char 
*filenamePath,
         HttpResponseHeader::Entry *e;
         e = td->response.other.get ("transfer-encoding");
         if (e)
-          e->value->assign ("chunked");
+          e->value.assign ("chunked");
         else
           {
             e = new HttpResponseHeader::Entry ();
-            e->name->assign ("transfer-encoding");
-            e->value->assign ("chunked");
-            td->response.other.put (*(e->name), e);
+            e->name.assign ("transfer-encoding");
+            e->value.assign ("chunked");
+            td->response.other.put (e->name, e);
           }
       }
     else
diff --git a/myserver/src/http_handler/isapi/isapi.cpp 
b/myserver/src/http_handler/isapi/isapi.cpp
index 0d4be8e..fd552db 100644
--- a/myserver/src/http_handler/isapi/isapi.cpp
+++ b/myserver/src/http_handler/isapi/isapi.cpp
@@ -228,7 +228,7 @@ BOOL WINAPI ISAPI_WriteClientExport (HCONN hConn, LPVOID 
Buffer, LPDWORD lpdwByt
     ((Vhost*)(ConnInfo->td->connection->host))->warningsLogWrite (_("ISAPI: 
internal error"));
     return HttpDataHandler::RET_FAILURE;
   }
-  keepalive = connection && (!stringcmpi (connection->value->c_str (), 
"keep-alive")) ;
+  keepalive = connection && (!stringcmpi (connection->value.c_str (), 
"keep-alive")) ;
 
   /*If the HTTP header was sent do not send it again. */
   if (!ConnInfo->headerSent)
@@ -286,12 +286,12 @@ BOOL WINAPI ISAPI_WriteClientExport (HCONN hConn, LPVOID 
Buffer, LPDWORD lpdwByt
                   HttpResponseHeader::Entry *e;
                   e = ConnInfo->td->response.other.get ("transfer-encoding");
                   if (e)
-                    e->value->assign ("chunked");
+                    e->value.assign ("chunked");
                   else
                     {
                       e = new HttpResponseHeader::Entry ();
-                      e->name->assign ("transfer-encoding");
-                      e->value->assign ("chunked");
+                      e->name.assign ("transfer-encoding");
+                      e->value.assign ("chunked");
                       ConnInfo->td->response.other.put (*(e->name), e);
                     }
                 }
@@ -501,15 +501,15 @@ BOOL Isapi::buildAllHttpHeaders (HttpThreadContext* td, 
ConnectionPtr /*!a*/,
   HttpRequestHeader::Entry *accept = td->request.other.get ("accept");
   HttpRequestHeader::Entry *cache = td->request.other.get ("cache-control");
 
-  if (accept && accept->value->length () && (valLen+30<maxLen))
+  if (accept && accept->value.length () && (valLen+30<maxLen))
     valLen += sprintf (&ValStr[valLen],"HTTP_ACCEPT:%s\n",
-                       accept->value->c_str ());
+                       accept->value.c_str ());
   else if (valLen + 30 < maxLen)
     return 1;
 
-  if (cache && cache->value->length () && (valLen+30<maxLen))
+  if (cache && cache->value.length () && (valLen+30<maxLen))
     valLen += sprintf (&ValStr[valLen], "HTTP_CACHE_CONTROL:%s\n",
-                       cache->value->c_str ());
+                       cache->value.c_str ());
   else if (valLen + 30 < maxLen)
     return 1;
 
@@ -529,84 +529,84 @@ BOOL Isapi::buildAllHttpHeaders (HttpThreadContext* td, 
ConnectionPtr /*!a*/,
   HttpRequestHeader::Entry* e = td->request.other.get ("accept-encoding");
   if (e && (valLen + 30 < maxLen))
     valLen += sprintf (&ValStr[valLen], "HTTP_ACCEPT_ENCODING:%s\n",
-                       e->value->c_str ());
+                       e->value.c_str ());
   else if (valLen + 30 < maxLen)
     return 1;
 
   e = td->request.other.get ("accept-language");
   if (e && (valLen + 30 < maxLen))
     valLen += sprintf (&ValStr[valLen],"HTTP_ACCEPT_LANGUAGE:%s\n",
-                       e->value->c_str ());
+                       e->value.c_str ());
   else if (valLen + 30 < maxLen)
     return 1;
 
   e = td->request.other.get ("accept-charset");
   if (e && (valLen + 30 < maxLen))
     valLen += sprintf (&ValStr[valLen],"HTTP_ACCEPT_CHARSET:%s\n",
-                       e->value->c_str ());
+                       e->value.c_str ());
   else if (valLen + 30 < maxLen)
     return 1;
 
   e = td->request.other.get ("pragma");
   if (e && (valLen + 30 < maxLen))
     valLen += sprintf (&ValStr[valLen],"HTTP_PRAGMA:%s\n",
-                       e->value->c_str ());
+                       e->value.c_str ());
   else if (valLen + 30 < maxLen)
     return 1;
 
   e = td->request.other.get ("connection");
   if (e && (valLen + 30< maxLen))
     valLen += sprintf (&ValStr[valLen],"HTTP_CONNECTION:%s\n",
-                       e->value->c_str ());
+                       e->value.c_str ());
   else if (valLen + 30 < maxLen)
     return 1;
 
   e = td->request.other.get ("cookie");
   if (e && (valLen + 30 < maxLen))
     valLen += sprintf (&ValStr[valLen],"HTTP_COOKIE:%s\n",
-                       e->value->c_str ());
+                       e->value.c_str ());
   else if (valLen + 30 < maxLen)
     return 1;
 
   e = td->request.other.get ("host");
   if (e && (valLen + 30 < maxLen))
     valLen += sprintf (&ValStr[valLen],"HTTP_HOST:%s\n",
-                       e->value->c_str ());
+                       e->value.c_str ());
   else if (valLen + 30 < maxLen)
     return 1;
 
   e = td->request.other.get ("date");
   if (e && (valLen + 30 < maxLen))
     valLen += sprintf (&ValStr[valLen],"HTTP_DATE:%s\n",
-                       e->value->c_str ());
+                       e->value.c_str ());
   else if (valLen + 30 < maxLen)
     return 1;
 
   e = td->request.other.get ("if-modified-since");
   if (e && (valLen + 30 < maxLen))
     valLen += sprintf (&ValStr[valLen],"HTTP_IF_MODIFIED_SINCE:%s\n",
-                       e->value->c_str ());
+                       e->value.c_str ());
   else if (valLen + 30 < maxLen)
     return 1;
 
   e = td->request.other.get ("referer");
   if (e && (valLen + 30 < maxLen))
     valLen += sprintf (&ValStr[valLen],"HTTP_REFERER:%s\n",
-                       e->value->c_str ());
+                       e->value.c_str ());
   else if (valLen + 30 < maxLen)
     return 1;
 
   e = td->request.other.get ("user-agent");
   if (e && (valLen + 30 < maxLen))
     valLen += sprintf (&ValStr[valLen],"HTTP_USER_AGENT:%s\n",
-                       e->value->c_str ());
+                       e->value.c_str ());
   else if (valLen + 30 < maxLen)
     return 1;
 
   e = td->request.other.get ("from");
   if (e && (valLen + 30 < maxLen))
     valLen += sprintf (&ValStr[valLen],"HTTP_FROM:%s\n",
-                       e->value->c_str ());
+                       e->value.c_str ());
   else if (valLen + 30 < maxLen)
     return 1;
 
@@ -862,7 +862,7 @@ int Isapi::send (HttpThreadContext* td,
 
 
       HttpRequestHeader::Entry *content = td->request.other.get 
("content-type");
-      ExtCtrlBlk.lpszContentType = content ? (char*)content->value->c_str () : 
NULL;
+      ExtCtrlBlk.lpszContentType = content ? (char*)content->value.c_str () : 
NULL;
 
       connTable[connIndex].td->buffer->setLength (0);
       connTable[connIndex].td->buffer->getAt (0)='\0';
@@ -883,7 +883,7 @@ int Isapi::send (HttpThreadContext* td,
       HttpRequestHeader::Entry *connection
         = connTable[connIndex].td->request.other.get ("connection");
 
-      if (connection && !stringcmpi (connection->value->c_str (), 
"keep-alive"))
+      if (connection && !stringcmpi (connection->value.c_str (), "keep-alive"))
         connTable[connIndex].chain.getStream ()->write ("0\r\n\r\n", 5, &nbw);
 
       switch (ret)
diff --git a/myserver/src/http_handler/proxy/proxy.cpp 
b/myserver/src/http_handler/proxy/proxy.cpp
index 3f96454..7e7eef2 100644
--- a/myserver/src/http_handler/proxy/proxy.cpp
+++ b/myserver/src/http_handler/proxy/proxy.cpp
@@ -40,11 +40,8 @@
   \param execute Not used.
   \param onlyHeader Specify if send only the HTTP header.
  */
-int Proxy::send (HttpThreadContext *td,
-                 const char* scriptpath,
-                 const char* exec,
-                 bool execute,
-                 bool onlyHeader)
+int Proxy::send (HttpThreadContext *td, const char* scriptpath,
+                 const char* exec, bool execute, bool onlyHeader)
 {
   Url destUrl (exec, 80);
   Socket sock;
@@ -56,7 +53,7 @@ int Proxy::send (HttpThreadContext *td,
          td->request.begin (); it != td->request.end (); it++)
     {
       HttpRequestHeader::Entry *e = *it;
-      req.setValue (e->name->c_str (), e->value->c_str ());
+      req.setValue (e->name.c_str (), e->value.c_str ());
     }
 
   if (destUrl.getProtocol ().compare ("http")
diff --git a/myserver/src/http_handler/wincgi/wincgi.cpp 
b/myserver/src/http_handler/wincgi/wincgi.cpp
index 9cdc554..8c1345c 100644
--- a/myserver/src/http_handler/wincgi/wincgi.cpp
+++ b/myserver/src/http_handler/wincgi/wincgi.cpp
@@ -159,23 +159,23 @@ int WinCgi::send (HttpThreadContext* td, const char* 
scriptpath,
         }
 
       HttpRequestHeader::Entry *referer = td->request.other.get ("referer");
-      if (referer && referer->value->length ())
+      if (referer && referer->value.length ())
         {
-          sprintf (buffer,"Referer=%s\r\n", referer->value->c_str ());
+          sprintf (buffer,"Referer=%s\r\n", referer->value.c_str ());
           DataFileHandle.writeToFile (buffer,(u_long) strlen (buffer),&nbr);
         }
 
       HttpRequestHeader::Entry *contentType = td->request.other.get 
("content-type");
-      if (contentType && contentType->value->length ())
+      if (contentType && contentType->value.length ())
         {
-          sprintf (buffer, "Content Type=%s\r\n", contentType->value->c_str 
());
+          sprintf (buffer, "Content Type=%s\r\n", contentType->value.c_str ());
           DataFileHandle.writeToFile (buffer, (u_long) strlen (buffer), &nbr);
         }
 
       HttpRequestHeader::Entry *userAgent = td->request.other.get 
("user-agent");
-      if (userAgent && userAgent->value->length ())
+      if (userAgent && userAgent->value.length ())
         {
-          sprintf (buffer,"User Agent=%s\r\n", userAgent->value->c_str ());
+          sprintf (buffer,"User Agent=%s\r\n", userAgent->value.c_str ());
           DataFileHandle.writeToFile (buffer, (u_long) strlen (buffer), &nbr);
         }
 
@@ -205,7 +205,7 @@ int WinCgi::send (HttpThreadContext* td, const char* 
scriptpath,
 
       HttpRequestHeader::Entry *host = td->request.other.get ("host");
       if (host)
-        sprintf (buffer, "Server Name=%s\r\n", host->value->c_str ());
+        sprintf (buffer, "Server Name=%s\r\n", host->value.c_str ());
       DataFileHandle.writeToFile (buffer, (u_long) strlen (buffer), &nbr);
 
       strcpy (buffer, "[System]\r\n");
diff --git a/myserver/src/protocol/http/env/env.cpp 
b/myserver/src/protocol/http/env/env.cpp
index 4ba281f..13af4f4 100644
--- a/myserver/src/protocol/http/env/env.cpp
+++ b/myserver/src/protocol/http/env/env.cpp
@@ -207,7 +207,7 @@ void Env::buildEnvironmentString (HttpThreadContext* td, 
char *cgiEnv,
   if (reqEntry)
   {
     memCgi << end_str << "CONTENT_TYPE=";
-    memCgi << reqEntry->value->c_str ();
+    memCgi << reqEntry->value.c_str ();
   }
 
   buildHttpHeaderEnvString (memCgi, td->request);
@@ -232,13 +232,13 @@ void Env::buildHttpHeaderEnvString (MemBuf& memCgi, 
HttpRequestHeader & req)
     string name;
 
     name.assign ("HTTP_");
-    name.append (en->name->c_str ());
+    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 ();
+    memCgi  << end_str << name.c_str () << "=" << en->value.c_str ();
   }
 }
 
diff --git a/myserver/src/protocol/http/http.cpp 
b/myserver/src/protocol/http/http.cpp
index 423ca64..61257a2 100644
--- a/myserver/src/protocol/http/http.cpp
+++ b/myserver/src/protocol/http/http.cpp
@@ -136,8 +136,8 @@ int Http::optionsHTTPRESOURCE (string& filename, int 
yetmapped)
       *td->auxiliaryBuffer << "HTTP/1.1 200 OK\r\n";
       *td->auxiliaryBuffer << "Date: " << time;
       *td->auxiliaryBuffer << "\r\nServer: GNU MyServer " << MYSERVER_VERSION;
-      if (connection && connection->value->length ())
-        *td->auxiliaryBuffer << "\r\nConnection:" << connection->value->c_str 
() << "\r\n";
+      if (connection && connection->value.length ())
+        *td->auxiliaryBuffer << "\r\nConnection:" << connection->value.c_str 
() << "\r\n";
       *td->auxiliaryBuffer << "Content-length: 0\r\nAccept-Ranges: bytes\r\n";
       *td->auxiliaryBuffer << "Allow: " << methods << "\r\n\r\n";
       td->connection->socket->send (td->auxiliaryBuffer->getBuffer (),
@@ -178,8 +178,8 @@ int Http::traceHTTPRESOURCE (string& filename, int 
yetmapped)
       *td->auxiliaryBuffer << "Date: " << time << "\r\n";
       *td->auxiliaryBuffer << "Server: GNU MyServer " << MYSERVER_VERSION << 
"\r\n";
       connection = td->request.other.get ("connection");
-      if (connection && connection->value->length ())
-        *td->auxiliaryBuffer << "Connection:" << connection->value->c_str () 
<< "\r\n";
+      if (connection && connection->value.length ())
+        *td->auxiliaryBuffer << "Connection:" << connection->value.c_str () << 
"\r\n";
 
       *td->auxiliaryBuffer << "Content-length:" << tmp << "\r\n"
               << "Content-type: message/http\r\n"
@@ -795,8 +795,8 @@ int Http::logHTTPaccess ()
           HttpRequestHeader::Entry *referer = td->request.other.get ("refer");
 
           if (strstr ((td->connection->host)->getAccessLogOpt (), 
"type=combined"))
-            *td->auxiliaryBuffer << " " << (referer ? referer->value->c_str () 
: "")
-            << " " << (userAgent ? userAgent->value->c_str () : "");
+            *td->auxiliaryBuffer << " " << (referer ? referer->value.c_str () 
: "")
+            << " " << (userAgent ? userAgent->value.c_str () : "");
         }
 
       *td->auxiliaryBuffer << end_str;
@@ -974,11 +974,11 @@ int Http::controlConnection (ConnectionPtr a, char*, 
char*, u_long, u_long,
           HttpRequestHeader::Entry *connection
             = td->request.other.get ("connection");
           if (connection)
-            keepalive = !stringcmpi (connection->value->c_str (), "keep-alive")
+            keepalive = !stringcmpi (connection->value.c_str (), "keep-alive")
               && !td->request.ver.compare ("HTTP/1.1");
 
           if (! td->request.ver.compare ("HTTP/1.1")
-              && (host == NULL || host->value->length () == 0))
+              && (host == NULL || host->value.length () == 0))
             {
               int ret = raiseHTTPError (400);
               logHTTPaccess ();
@@ -990,7 +990,7 @@ int Http::controlConnection (ConnectionPtr a, char*, char*, 
u_long, u_long,
 
           /* Find the virtual host to check both host name and IP value.  */
           Vhost* newHost = Server::getInstance ()->getVhosts ()->getVHost 
(host ?
-                                                       host->value->c_str () : 
"",
+                                                       host->value.c_str () : 
"",
                                          a->getLocalIpAddr (), a->getLocalPort 
());
           if (a->host)
             a->host->removeRef ();
@@ -1218,13 +1218,13 @@ int Http::requestAuthorization ()
   *td->auxiliaryBuffer << "Server: GNU MyServer " << MYSERVER_VERSION << 
"\r\n";
   *td->auxiliaryBuffer << "Content-type: text/html\r\n"
           << "Connection: ";
-  *td->auxiliaryBuffer << (connection ? connection->value->c_str () : "");
+  *td->auxiliaryBuffer << (connection ? connection->value.c_str () : "");
   *td->auxiliaryBuffer << "\r\nContent-length: 0\r\n";
 
   if (td->authScheme == HTTP_AUTH_SCHEME_BASIC)
     {
       *td->auxiliaryBuffer << "WWW-Authenticate: Basic realm=\""
-                           << (host ? host->value->c_str () : "")
+                           << (host ? host->value.c_str () : "")
                            << "\"\r\n";
     }
   else if (td->authScheme == HTTP_AUTH_SCHEME_DIGEST)
@@ -1242,7 +1242,7 @@ int Http::requestAuthorization ()
           hud->reset ();
         }
 
-      myserver_strlcpy (hud->realm, host ? host->value->c_str () : "", 48);
+      myserver_strlcpy (hud->realm, host ? host->value.c_str () : "", 48);
 
       /* Just a random string.  */
       md5Str[0] = (char) td->id;
@@ -1331,7 +1331,7 @@ int Http::raiseHTTPError (int ID)
 
       HttpHeaders::buildDefaultHTTPResponseHeader (&(td->response));
 
-      if (connection && !stringcmpi (connection->value->c_str (), 
"keep-alive"))
+      if (connection && !stringcmpi (connection->value.c_str (), "keep-alive"))
         td->response.setValue ("connection", "keep-alive");
 
       td->response.httpStatus = ID;
@@ -1346,7 +1346,7 @@ int Http::raiseHTTPError (int ID)
         {
           ostringstream nURL;
           int isPortSpecified = 0;
-          const char* hostStr = host ? host->value->c_str () : "";
+          const char* hostStr = host ? host->value.c_str () : "";
           /* Change the URI to reflect the default file name.  */
           nURL << protocolPrefix << hostStr;
           for (int i = 0; hostStr[i]; i++)
@@ -1647,7 +1647,7 @@ int Http::sendHTTPRedirect (const char *newURL)
           << "Location: " << newURL << "\r\n"
           << "Content-length: 0\r\n";
 
-  if (connection && !stringcmpi (connection->value->c_str (), "keep-alive"))
+  if (connection && !stringcmpi (connection->value.c_str (), "keep-alive"))
     *td->auxiliaryBuffer << "Connection: keep-alive\r\n";
   else
     *td->auxiliaryBuffer << "Connection: close\r\n";
@@ -1674,7 +1674,7 @@ int Http::sendHTTPNonModified ()
   *td->auxiliaryBuffer << "HTTP/1.1 304 Not Modified\r\nAccept-Ranges: 
bytes\r\n"
           << "Server: GNU MyServer " << MYSERVER_VERSION << "\r\n";
 
-  if (connection && !stringcmpi (connection->value->c_str (), "keep-alive"))
+  if (connection && !stringcmpi (connection->value.c_str (), "keep-alive"))
     *td->auxiliaryBuffer << "Connection: keep-alive\r\n";
   else
     *td->auxiliaryBuffer << "Connection: close\r\n";
diff --git a/myserver/src/protocol/http/http_data_handler.cpp 
b/myserver/src/protocol/http/http_data_handler.cpp
index b4f8bd5..dca42f8 100644
--- a/myserver/src/protocol/http/http_data_handler.cpp
+++ b/myserver/src/protocol/http/http_data_handler.cpp
@@ -207,13 +207,13 @@ HttpDataHandler::checkDataChunks (HttpThreadContext* td, 
bool* keepalive,
       HttpResponseHeader::Entry *e;
       e = td->response.other.get ("transfer-encoding");
       if (e)
-        e->value->assign ("chunked");
+        e->value.assign ("chunked");
       else
         {
           e = new HttpResponseHeader::Entry ();
-          e->name->assign ("transfer-encoding");
-          e->value->assign ("chunked");
-          td->response.other.put (*(e->name), e);
+          e->name.assign ("transfer-encoding");
+          e->value.assign ("chunked");
+          td->response.other.put (e->name, e);
         }
       *useChunks = true;
     }
diff --git a/myserver/src/protocol/http/http_data_read.cpp 
b/myserver/src/protocol/http/http_data_read.cpp
index aeb5852..85fd7d3 100644
--- a/myserver/src/protocol/http/http_data_read.cpp
+++ b/myserver/src/protocol/http/http_data_read.cpp
@@ -252,12 +252,12 @@ int HttpDataRead::readPostData (HttpThreadContext* td, 
int* httpRetCode)
   if (contentType == 0)
   {
     contentType = new HttpRequestHeader::Entry ();
-    contentType->name->assign ("content-type");
-    contentType->value->assign ("application/x-www-form-urlencoded");
+    contentType->name.assign ("content-type");
+    contentType->value.assign ("application/x-www-form-urlencoded");
   }
-  else if (contentType->value->length () == 0)
+  else if (contentType->value.length () == 0)
   {
-    contentType->value->assign ("application/x-www-form-urlencoded");
+    contentType->value.assign ("application/x-www-form-urlencoded");
   }
 
   td->request.uriOptsPtr = &(td->buffer->getBuffer ())[td->nHeaderChars];
@@ -286,7 +286,7 @@ int HttpDataRead::readPostData (HttpThreadContext* td, int* 
httpRetCode)
     HttpRequestHeader::Entry *content =
       td->request.other.get ("content-encoding");
 
-    if (content && (content->value->length () == '\0')
+    if (content && (content->value.length () == '\0')
            && (td->request.contentLength.length () == 0))
     {
       *httpRetCode = 400;
@@ -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"))
     {
       int ret = readChunkedPostData (td->request.uriOptsPtr,
                                      &inPos,
diff --git a/myserver/src/protocol/http/http_header.cpp 
b/myserver/src/protocol/http/http_header.cpp
index c231478..32c8eaa 100644
--- a/myserver/src/protocol/http/http_header.cpp
+++ b/myserver/src/protocol/http/http_header.cpp
@@ -37,8 +37,8 @@ string* HttpHeader::getValue (const char *name, string *out)
   if (e)
     {
       if (out)
-        out->assign (*(e->value));
-      return e->value;
+        out->assign (e->value);
+      return &(e->value);
     }
 
   return NULL;
@@ -55,14 +55,14 @@ string* HttpHeader::setValue (const char *name, const char 
*in)
   Entry *e = other.get (key);
   if (e)
     {
-      e->value->assign (in);
-      return (e->value);
+      e->value.assign (in);
+      return &(e->value);
     }
   else
     {
       e = new Entry;
-      e->name->assign (name);
-      e->value->assign (in);
+      e->name.assign (name);
+      e->value.assign (in);
       other.put (key, e);
     }
 
diff --git a/myserver/src/protocol/http/http_headers.cpp 
b/myserver/src/protocol/http/http_headers.cpp
index 4145db7..7899815 100644
--- a/myserver/src/protocol/http/http_headers.cpp
+++ b/myserver/src/protocol/http/http_headers.cpp
@@ -75,7 +75,7 @@ u_long HttpHeaders::buildHTTPResponseHeader (char *str,
        */
       HttpResponseHeader::Entry *e = response->other.get ("transfer-encoding");
 
-      if (!e || (e && e->value->find ("chunked", 0) == string::npos ))
+      if (!e || (e && e->value.find ("chunked", 0) == string::npos ))
         {
           pos += myserver_strlcpy (pos, "Content-length: ", MAX - (long)(pos - 
str));
           pos += myserver_strlcpy (pos, response->contentLength.c_str (),
@@ -89,9 +89,9 @@ u_long HttpHeaders::buildHTTPResponseHeader (char *str,
   for (; it != response->other.end (); it++)
     {
       HttpResponseHeader::Entry *e = *it;
-      pos += myserver_strlcpy (pos, e->name->c_str (), MAX - (long)(pos - 
str));
+      pos += myserver_strlcpy (pos, e->name.c_str (), MAX - (long)(pos - str));
       pos += myserver_strlcpy (pos, ": ", MAX - (long)(pos - str));
-      pos += myserver_strlcpy (pos, e->value->c_str (), MAX - (long)(pos - 
str));
+      pos += myserver_strlcpy (pos, e->value.c_str (), MAX - (long)(pos - 
str));
       pos += myserver_strlcpy (pos, "\r\n", MAX - (long)(pos - str));
     }
 
@@ -181,10 +181,10 @@ u_long HttpHeaders::buildHTTPRequestHeader (char * str,
         HttpRequestHeader::Entry *e = *it;
         if (e)
           {
-            pos += myserver_strlcpy (pos, e->name->c_str (),
+            pos += myserver_strlcpy (pos, e->name.c_str (),
                                      MAX - (long)(pos - str));
             pos += myserver_strlcpy (pos, ": ", MAX - (long)(pos - str));
-            pos += myserver_strlcpy (pos, e->value->c_str (),
+            pos += myserver_strlcpy (pos, e->value.c_str (),
                                      MAX - (long)(pos - str));
             pos += myserver_strlcpy (pos, "\r\n", MAX - (long)(pos - str));
           }
@@ -580,18 +580,18 @@ int HttpHeaders::buildHTTPRequestHeaderStruct (const char 
*input,
           HttpRequestHeader::Entry *old = request->other.get (cmdStr);
           if (old)
             {
-              old->value->append (", ");
-              old->value->append (token,
+              old->value.append (", ");
+              old->value.append (token,
                              std::min (static_cast<int>(HTTP_RESPONSE_OTHER_DIM
-                                                        - old->value->length 
()),
+                                                        - old->value.length 
()),
                                        static_cast<int>(tokenOff)));
             }
           else
             {
               HttpRequestHeader::Entry *e = new HttpRequestHeader::Entry ();
-              e->name->assign (cmdStr.c_str (),
+              e->name.assign (cmdStr.c_str (),
                                std::min (HTTP_RESPONSE_OTHER_DIM, tokenOff));
-              e->value->assign (token, std::min (HTTP_RESPONSE_OTHER_DIM,
+              e->value.assign (token, std::min (HTTP_RESPONSE_OTHER_DIM,
                                                  tokenOff));
               request->other.put (cmdStr, e);
             }
@@ -1064,23 +1064,23 @@ int HttpHeaders::buildHTTPResponseHeaderStruct (const 
char *input,
 
             HttpResponseHeader::Entry *old = NULL;
             HttpResponseHeader::Entry *e = new HttpResponseHeader::Entry ();
-            e->name->assign (command);
-            transform (e->name->begin (), e->name->end (), e->name->begin (),
+            e->name.assign (command);
+            transform (e->name.begin (), e->name.end (), e->name.begin (),
                        ::tolower);
-            old = response->other.put (*e->name, e);
+            old = response->other.put (e->name, e);
             if (old)
               {
                 if (append)
                   {
-                    e->value->assign (*old->value);
-                    e->value->append (", ");
+                    e->value.assign (old->value);
+                    e->value.append (", ");
                   }
 
-                e->value->append (token);
+                e->value.append (token);
                 delete old;
               }
             else
-              e->value->assign (token);
+              e->value.assign (token);
           }
       }
     token = strtok (NULL, cmdSeps);
diff --git a/myserver/src/protocol/http/http_request.cpp 
b/myserver/src/protocol/http/http_request.cpp
index 9249d8b..572aa34 100644
--- a/myserver/src/protocol/http/http_request.cpp
+++ b/myserver/src/protocol/http/http_request.cpp
@@ -85,7 +85,7 @@ bool HttpRequestHeader::isKeepAlive ()
 {
   Entry *connection = other.get ("connection");
   if (connection)
-    return (! stringcmpi (*connection->value,
+    return (! stringcmpi (connection->value,
                           "keep-alive"));
 
   return false;



commit b8bef11fab3a916f0eaee8602ac88e3c2f9537a2
Author: Giuseppe Scrivano <address@hidden>
Date:   Mon May 10 11:03:59 2010 +0200

    Use the gnulib `git-version-gen' module.

diff --git a/myserver/Makefile.am b/myserver/Makefile.am
index 6d7794f..b69052d 100644
--- a/myserver/Makefile.am
+++ b/myserver/Makefile.am
@@ -26,10 +26,19 @@ SUBDIRS = lib po include src $(CONTROL) binaries $(DOCS) 
$(TESTS_DIR)
 
 include_HEADERS = myserver.h
 
-EXTRA_DIST = doxygen SConstruct
+EXTRA_DIST = doxygen SConstruct .version
 
 ACLOCAL_AMFLAGS = -I m4
 
+BUILT_SOURCES = .version
+.version:
+       $(AM_V_GEN)echo $(VERSION) > address@hidden && mv address@hidden $@
+
+# Arrange so that .tarball-version appears only in the distribution
+# tarball, and never in a checked-out repository.
+dist-hook:
+       $(AM_V_GEN)echo $(VERSION) > $(distdir)/.tarball-version
+
 localedir.h: Makefile
        echo '/* This file is auto-generated by Makefile!  */' >$@
        echo '#define LOCALEDIR "$(localedir)"' >> $@
diff --git a/myserver/bootstrap.conf b/myserver/bootstrap.conf
index c376756..7d6802d 100644
--- a/myserver/bootstrap.conf
+++ b/myserver/bootstrap.conf
@@ -41,6 +41,7 @@ getsockname
 getsockopt
 gettext
 gettimeofday
+git-version-gen
 ioctl
 listen
 malloc
diff --git a/myserver/configure.ac b/myserver/configure.ac
index ac0f690..af0fc26 100644
--- a/myserver/configure.ac
+++ b/myserver/configure.ac
@@ -17,7 +17,9 @@ dnl
 dnl You should have received a copy of the GNU General Public License
 dnl along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
-AC_INIT([GNU MyServer],[m4_esyscmd(cat version)],address@hidden)
+AC_INIT([GNU MyServer],
+m4_esyscmd([build-aux/git-version-gen .tarball-version]),
address@hidden)
 AC_PREREQ(2.65)
 AC_CONFIG_AUX_DIR([build-aux])
 AC_CONFIG_HEADERS([config.h])

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

Summary of changes:
 myserver/Makefile.am                              |   11 ++-
 myserver/bootstrap.conf                           |    9 ++
 myserver/configure.ac                             |    4 +-
 myserver/include/protocol/http/http_header.h      |   17 +--
 myserver/src/base/xml/xml_parser.cpp              |   70 +++++++---
 myserver/src/conf/security/security_cache.cpp     |  152 ++++++++++----------
 myserver/src/http_handler/http_dir/http_dir.cpp   |    8 +-
 myserver/src/http_handler/http_file/http_file.cpp |   40 +++---
 myserver/src/http_handler/isapi/isapi.cpp         |   44 +++---
 myserver/src/http_handler/proxy/proxy.cpp         |    9 +-
 myserver/src/http_handler/wincgi/wincgi.cpp       |   14 +-
 myserver/src/protocol/http/env/env.cpp            |    6 +-
 myserver/src/protocol/http/http.cpp               |   32 ++--
 myserver/src/protocol/http/http_data_handler.cpp  |    8 +-
 myserver/src/protocol/http/http_data_read.cpp     |   12 +-
 myserver/src/protocol/http/http_header.cpp        |   12 +-
 myserver/src/protocol/http/http_headers.cpp       |   34 +++---
 myserver/src/protocol/http/http_request.cpp       |    2 +-
 18 files changed, 261 insertions(+), 223 deletions(-)


hooks/post-receive
-- 
GNU MyServer



reply via email to

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