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


From: Giuseppe Scrivano
Subject: [myserver-commit] [SCM] GNU MyServer branch, master, updated. v0.9.2-368-gcbfdd2c
Date: Thu, 26 Aug 2010 20:06:57 +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  cbfdd2c73fadd5b06565244d70260b18316601dc (commit)
       via  4b445c980923deca0c6b9441ef8dca8281070ea1 (commit)
       via  a42782f48497ded7e19c5a02dbe4dbf406643870 (commit)
       via  ea0de3c421e4bb1134183be584c95a198d4738b2 (commit)
       via  3082ab4e97e68bdac383bffbbf085e3c6270009e (commit)
       via  879da1b3cc6757c4a8d9bd20a0041d250f6e45ca (commit)
      from  97b336221bbda87f4cf56ac31d39a6b8bdb0d157 (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 cbfdd2c73fadd5b06565244d70260b18316601dc
Author: Giuseppe Scrivano <address@hidden>
Date:   Thu Aug 26 20:35:55 2010 +0200

    File: use checked::ftruncate and change its argument type to off_t.

diff --git a/myserver/include/base/file/file.h 
b/myserver/include/base/file/file.h
index faa5128..dfb1cee 100644
--- a/myserver/include/base/file/file.h
+++ b/myserver/include/base/file/file.h
@@ -83,7 +83,7 @@ public:
   virtual int fastCopyToSocket (Socket *dest, off_t offset,
                                 MemBuf *buf, size_t *nbw);
 
-  int truncate (u_long size = 0);
+  int truncate (off_t size = 0);
 
   void fstat (struct stat *fstat);
 
diff --git a/myserver/src/base/file/file.cpp b/myserver/src/base/file/file.cpp
index d36cde8..1239b4f 100644
--- a/myserver/src/base/file/file.cpp
+++ b/myserver/src/base/file/file.cpp
@@ -109,13 +109,10 @@ File::File (char *nfilename, int opt)
   Truncate the file.
   \param size Specify the new file size.
  */
-int File::truncate (u_long size)
+int File::truncate (off_t size)
 {
-  int err = ftruncate (handle, size);
-  if (err)
-    return err;
-
-  return seek (size);
+  checked::ftruncate (handle, size);
+  return 0;
 }
 
 /*!



commit 4b445c980923deca0c6b9441ef8dca8281070ea1
Author: Giuseppe Scrivano <address@hidden>
Date:   Thu Aug 26 20:33:08 2010 +0200

    checked: add truncate and ftruncate.

diff --git a/myserver/include/base/exceptions/checked.h 
b/myserver/include/base/exceptions/checked.h
index 3001970..6685dc2 100644
--- a/myserver/include/base/exceptions/checked.h
+++ b/myserver/include/base/exceptions/checked.h
@@ -90,6 +90,7 @@ namespace checked
   int stat(const char *path, struct stat *buf);
   int fstat (int fd, struct stat *buf);
   int fstatat (int fd, char const *name, struct stat *st, int flags);
+  int ftruncate (int fd, off_t length);
   char *getcwd (char *buf, size_t size);
   int gethostname (char *name, size_t len);
   int getsockname (int fd, struct sockaddr *addr, socklen_t *addrlen);
@@ -122,6 +123,7 @@ namespace checked
   char *strdup (char const *__s);
   int unlink (char const *file);
   ssize_t write (int fd, const void *buf, size_t count);
+  int truncate (const char *path, off_t length);
 }
 
 #endif
diff --git a/myserver/src/base/exceptions/checked.cpp 
b/myserver/src/base/exceptions/checked.cpp
index a575282..670ad1c 100644
--- a/myserver/src/base/exceptions/checked.cpp
+++ b/myserver/src/base/exceptions/checked.cpp
@@ -78,6 +78,11 @@ namespace checked
     return checkError (gnulib::fstatat (fd, name, st, flags));
   }
 
+  int ftruncate (int fd, off_t length)
+  {
+    return checkError (ftruncate (fd, length));
+  }
+
   char *getcwd (char *buf, size_t size)
   {
     return (char *) checkErrorNull (gnulib::getcwd (buf, size));
@@ -245,6 +250,11 @@ namespace checked
     return checkError (gnulib::write (fd, buf, count));
   }
 
+  int truncate (const char *path, off_t length)
+  {
+    return checkError (truncate (path, length));
+  }
+
   /*
     Maps POSIX errors to exceptions
    */



commit a42782f48497ded7e19c5a02dbe4dbf406643870
Author: Giuseppe Scrivano <address@hidden>
Date:   Thu Aug 26 20:17:05 2010 +0200

    Control: truncate the file to zero instead of open it after it was deleted.

diff --git a/myserver/src/protocol/control/control_protocol.cpp 
b/myserver/src/protocol/control/control_protocol.cpp
index 8b22074..3558f58 100644
--- a/myserver/src/protocol/control/control_protocol.cpp
+++ b/myserver/src/protocol/control/control_protocol.cpp
@@ -638,8 +638,8 @@ int ControlProtocol::getFile (ConnectionPtr a, char *fn, 
File *in, File *out,
 }
 
 /*!
-  Save the file on the local FS.
- */
+  Save the file locally.
+*/
 int ControlProtocol::putFile (ConnectionPtr a, char *fn, File *in,
                               File *out, char *buffer, int bufferSize,
                               ControlHeader &header)
@@ -647,38 +647,14 @@ int ControlProtocol::putFile (ConnectionPtr a, char *fn, 
File *in,
   const char *filename = 0;
   File localfile;
   int ret = 0;
-  /*! # of bytes read.  */
   size_t nbr = 0;
-  /*! # of bytes written.  */
   size_t nbw = 0;
   Server::getInstance ()->disableAutoReboot ();
 
   filename = fn;
 
-  /* Remove the file before create it.  */
-  ret = FilesUtility::deleteFile (filename);
-
-  /* An internal server error happens.  */
-  if (ret)
-    {
-      a->host->warningsLogWrite (_("Control: internal error"));
-      return CONTROL_INTERNAL;
-    }
-
-  ret = localfile.openFile (filename, File::WRITE | File::FILE_OPEN_ALWAYS);
-
-  /* An internal server error happens.  */
-  if (ret)
-    {
-      a->host->warningsLogWrite (_("Control: internal error"));
-      return CONTROL_INTERNAL;
-    }
-
-  if (in == NULL)
-    {
-      a->host->warningsLogWrite (_("Control: internal error"));
-      return CONTROL_INTERNAL;
-    }
+  localfile.openFile (filename, File::WRITE | File::FILE_OPEN_ALWAYS);
+  localfile.truncate (0);
 
   for (;;)
     {
@@ -691,7 +667,7 @@ int ControlProtocol::putFile (ConnectionPtr a, char *fn, 
File *in,
         }
 
       /* Break the loop when we can't read no more data.  */
-      if (!nbr)
+      if (! nbr)
         break;
 
       ret = localfile.writeToFile (buffer, nbr, &nbw);
@@ -703,7 +679,6 @@ int ControlProtocol::putFile (ConnectionPtr a, char *fn, 
File *in,
         }
     }
   localfile.close ();
-
   return 0;
 }
 



commit ea0de3c421e4bb1134183be584c95a198d4738b2
Author: Giuseppe Scrivano <address@hidden>
Date:   Thu Aug 26 15:26:11 2010 +0200

    Http::computeDigest accepts only one parameter.

diff --git a/myserver/include/protocol/http/http.h 
b/myserver/include/protocol/http/http.h
index 0507178..68433aa 100644
--- a/myserver/include/protocol/http/http.h
+++ b/myserver/include/protocol/http/http.h
@@ -172,7 +172,7 @@ protected:
 
   struct HttpThreadContext *td;
   void clean ();
-  void computeDigest (char*, char*);
+  void computeDigest (char *out);
   u_long checkDigest ();
 
   HttpProtocol *staticData;
diff --git a/myserver/src/protocol/http/http.cpp 
b/myserver/src/protocol/http/http.cpp
index bba7b1b..43902ad 100644
--- a/myserver/src/protocol/http/http.cpp
+++ b/myserver/src/protocol/http/http.cpp
@@ -1183,14 +1183,12 @@ int Http::controlConnection (ConnectionPtr a, char*, 
char*, u_long, u_long,
 }
 
 /*!
-  Compute the Digest outputting it to a buffer.
+  Compute the Digest and write it to out.
  */
-void Http::computeDigest (char* out, char* buffer)
+void Http::computeDigest (char* out)
 {
   Md5 md5;
-  if (!out)
-    return;
-
+  char buffer[64];
   sprintf (buffer, "%i-%u-%s", (int) clock (), (u_int) td->id,
            td->connection->getIpAddr ());
 
@@ -1255,7 +1253,7 @@ int Http::requestAuthorization ()
       if (td->connection->protocolBuffer &&
           ((!(hud->digest)) || (hud->nonce[0] == '\0')))
         {
-          computeDigest (hud->nonce, md5Str);
+          computeDigest (hud->nonce);
           hud->nc = 0;
         }
 



commit 3082ab4e97e68bdac383bffbbf085e3c6270009e
Author: Giuseppe Scrivano <address@hidden>
Date:   Thu Aug 26 15:13:43 2010 +0200

    Http: use true/false instead of 1/0.

diff --git a/myserver/src/protocol/http/http.cpp 
b/myserver/src/protocol/http/http.cpp
index a0c6352..bba7b1b 100644
--- a/myserver/src/protocol/http/http.cpp
+++ b/myserver/src/protocol/http/http.cpp
@@ -1105,16 +1105,16 @@ int Http::controlConnection (ConnectionPtr a, char*, 
char*, u_long, u_long,
               else if (!td->request.cmd.compare ("HEAD"))
                 {
                   td->onlyHeader = true;
-                  ret = sendHTTPResource (td->request.uri, 0, 1);
+                  ret = sendHTTPResource (td->request.uri, false, true);
                 }
               else if (!td->request.cmd.compare ("DELETE"))
                 ret = dav.davdelete (td);
               else if (!td->request.cmd.compare ("PUT"))
-                ret = putHTTPRESOURCE (td->request.uri, 0, 1);
+                ret = putHTTPRESOURCE (td->request.uri, false, true);
               else if (!td->request.cmd.compare ("OPTIONS"))
-                ret = optionsHTTPRESOURCE (td->request.uri, 0);
+                ret = optionsHTTPRESOURCE (td->request.uri, false);
               else if (!td->request.cmd.compare ("TRACE"))
-                ret = traceHTTPRESOURCE (td->request.uri, 0);
+                ret = traceHTTPRESOURCE (td->request.uri, false);
               else if (!td->request.cmd.compare ("MKCOL"))
                 ret = dav.mkcol (td);
               else if (!td->request.cmd.compare ("PROPFIND"))



commit 879da1b3cc6757c4a8d9bd20a0041d250f6e45ca
Author: Giuseppe Scrivano <address@hidden>
Date:   Thu Aug 26 15:09:51 2010 +0200

    Remove method Http::deleteHTTPRESOURCE.

diff --git a/myserver/include/protocol/http/http.h 
b/myserver/include/protocol/http/http.h
index 706c75c..0507178 100644
--- a/myserver/include/protocol/http/http.h
+++ b/myserver/include/protocol/http/http.h
@@ -98,11 +98,6 @@ public:
   int traceHTTPRESOURCE (string& filename,
                          bool yetMapped = false);
 
-  int deleteHTTPRESOURCE (string &filename,
-                          bool systemrequest = false,
-                          bool onlyHeader = false,
-                          bool yetMapped = false);
-
   bool allowMethod (const char *name);
 
   int raiseHTTPError (int ID);
diff --git a/myserver/src/protocol/http/http.cpp 
b/myserver/src/protocol/http/http.cpp
index 8054f79..a0c6352 100644
--- a/myserver/src/protocol/http/http.cpp
+++ b/myserver/src/protocol/http/http.cpp
@@ -542,15 +542,6 @@ int Http::preprocessHttpRequest (string &resource, bool 
yetmapped,
 }
 
 /*!
-  Delete the resource identified by filename.
- */
-int Http::deleteHTTPRESOURCE (string& filename, bool sysReq, bool onlyHeader,
-                              bool yetmapped)
-{
-  return sendHTTPResource (filename, sysReq, onlyHeader, yetmapped);
-}
-
-/*!
   Check the Digest authorization
 
   \return 1 if the client credentials are OK.

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

Summary of changes:
 myserver/include/base/exceptions/checked.h         |    2 +
 myserver/include/base/file/file.h                  |    2 +-
 myserver/include/protocol/http/http.h              |    7 +---
 myserver/src/base/exceptions/checked.cpp           |   10 ++++++
 myserver/src/base/file/file.cpp                    |    9 ++---
 myserver/src/protocol/control/control_protocol.cpp |   35 +++-----------------
 myserver/src/protocol/http/http.cpp                |   27 ++++-----------
 7 files changed, 30 insertions(+), 62 deletions(-)


hooks/post-receive
-- 
GNU MyServer



reply via email to

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