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. 40159f18d6


From: Giuseppe Scrivano
Subject: [myserver-commit] [SCM] GNU MyServer branch, master, updated. 40159f18d6d81acded8f0e875075105aa0a68b63
Date: Sun, 09 Aug 2009 10:04:50 +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  40159f18d6d81acded8f0e875075105aa0a68b63 (commit)
       via  142ea49d9a8945ec00c312bc680929bb755960a5 (commit)
      from  fbc5966d528e40ddf3fc25ee7450363fa8168848 (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 40159f18d6d81acded8f0e875075105aa0a68b63
Author: Giuseppe Scrivano <address@hidden>
Date:   Sun Aug 9 12:00:35 2009 +0200

    Rename the `StrTrim' function to `trim'.

diff --git a/myserver/include/base/string/securestr.h 
b/myserver/include/base/string/securestr.h
index 8dab641..110ad30 100755
--- a/myserver/include/base/string/securestr.h
+++ b/myserver/include/base/string/securestr.h
@@ -2,7 +2,7 @@
 /*
 MyServer
 * strlcpy and strlcat by codingmaster
-Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc.
+Copyright (C) 2002, 2003, 2004, 2009 Free Software Foundation, Inc.
 Copyright (C) 2004 by codingmaster
 This program is free software; you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
@@ -19,10 +19,13 @@ along with this program.  If not, see 
<http://www.gnu.org/licenses/>.
 */
 #include "stdafx.h"
 #ifndef SECURESTR_H
-#define SECURESTR_H
+# define SECURESTR_H
 
-unsigned int myserver_strlcat(char *destination, const char *source, unsigned 
int size);
-unsigned int myserver_strlcpy(char *destination, const char *source, unsigned 
int size);
+unsigned int myserver_strlcat (char *destination, const char *source,
+                               unsigned int size);
+
+unsigned int myserver_strlcpy (char *destination, const char *source,
+                               unsigned int size);
 #endif
 
 
diff --git a/myserver/include/base/string/stringutils.h 
b/myserver/include/base/string/stringutils.h
index 2f534f7..f5ece8a 100644
--- a/myserver/include/base/string/stringutils.h
+++ b/myserver/include/base/string/stringutils.h
@@ -1,19 +1,19 @@
 /* -*- mode: c++ -*- */
 /*
-MyServer
-Copyright (C) 2002, 2003, 2004, 2008, 2009 Free Software Foundation, Inc.
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 3 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program.  If not, see <http://www.gnu.org/licenses/>.
+  MyServer
+  Copyright (C) 2002, 2003, 2004, 2008, 2009 Free Software Foundation, Inc.
+  This program is free software; you can redistribute it and/or modify
+  it under the terms of the GNU General Public License as published by
+  the Free Software Foundation; either version 3 of the License, or
+  (at your option) any later version.
+
+  This program is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+  GNU General Public License for more details.
+
+  You should have received a copy of the GNU General Public License
+  along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
 
 #ifndef STRINGUTILS_H
@@ -24,68 +24,67 @@ along with this program.  If not, see 
<http://www.gnu.org/licenses/>.
 
 using namespace std;
 
-const char *getRFC822GMTTime(char* out,int len);
-const char *getRFC822GMTTime(const time_t,char* out,int len);
-const char *getRFC822LocalTime(char* out,int len);
-const char *getRFC822LocalTime(const time_t,char* out,int len);
+const char *getRFC822GMTTime (char* out,int len);
+const char *getRFC822GMTTime (const time_t,char* out,int len);
+const char *getRFC822LocalTime (char* out,int len);
+const char *getRFC822LocalTime (const time_t,char* out,int len);
 
-const char *getRFC822GMTTime(string& out,int len);
-const char *getRFC822GMTTime(const time_t, string& out, int len);
-const char *getRFC822LocalTime(string& out,int len);
-const char *getRFC822LocalTime(const time_t, string &out,int len);
+const char *getRFC822GMTTime (string& out,int len);
+const char *getRFC822GMTTime (const time_t, string& out, int len);
+const char *getRFC822LocalTime (string& out,int len);
+const char *getRFC822LocalTime (const time_t, string &out,int len);
 
-int getCharInString(const char*,const char*,int max);
+int getCharInString (const char*,const char*,int max);
 
-const char* getLocalLogFormatDate(const time_t t, char* out, int len);
-const char* getGMTLogFormatDate(const time_t t, char* out, int len);
-const char* getLocalLogFormatDate(char* out, int len);
-const char* getGMTLogFormatDate(char* out, int len);
+const char* getLocalLogFormatDate (const time_t t, char* out, int len);
+const char* getGMTLogFormatDate (const time_t t, char* out, int len);
+const char* getLocalLogFormatDate (char* out, int len);
+const char* getGMTLogFormatDate (char* out, int len);
 
-const char* getLocalLogFormatDate(const time_t t, string& out, int len);
-const char* getGMTLogFormatDate(const time_t t, string& out, int len);
-const char* getLocalLogFormatDate(string& out, int len);
-const char* getGMTLogFormatDate(string& out, int len);
+const char* getLocalLogFormatDate (const time_t t, string& out, int len);
+const char* getGMTLogFormatDate (const time_t t, string& out, int len);
+const char* getLocalLogFormatDate (string& out, int len);
+const char* getGMTLogFormatDate (string& out, int len);
 
-time_t getTime(const char* str);
-inline time_t getTime(string const& str){ return getTime(str.c_str()); }
+time_t getTime (const char* str);
+inline time_t getTime (string const& str){ return getTime (str.c_str ()); }
 
-void StrTrim(char* str, char* trimChars);
+void trim (char* str, char* trimChars);
 
-void gotoNextLine(char** cmd);
+void gotoNextLine (char** cmd);
 
-int hexVal(char c);
+int hexVal (char c);
 
-void translateEscapeString(char *TargetStr);
-void translateEscapeString(string& TargetStr);
+void translateEscapeString (char *TargetStr);
+void translateEscapeString (string& TargetStr);
 
 int hexToInt(const char *str);
-inline time_t hexToInt(string const& str){ return hexToInt(str.c_str()); }
+inline time_t hexToInt(string const& str){ return hexToInt(str.c_str ()); }
 
-int getEndLine(const char* str, int max);
-inline int getEndLine(string const& str, int max)
-                {return getEndLine(str.c_str(), max); }
+int getEndLine (const char* str, int max);
+inline int getEndLine (string const& str, int max)
+{return getEndLine (str.c_str (), max); }
 
-string trim(string const& s, string const&t = " ");
+string trim (string const& s, string const&t = " ");
 string trimLeft ( string const &s , string const &t = " " );
 string trimRight ( string const &s , string const &t = " " );
 
-int stringcmpi(string const &a, string const &b);
-int stringcmp(string const &a, string const &b);
+int stringcmpi (string const &a, string const &b);
+int stringcmp (string const &a, string const &b);
 
-int stringcmpi(string const &a, const char* b);
-int stringcmp(string const &a, const char* b);
+int stringcmpi (string const &a, const char* b);
+int stringcmp (string const &a, const char* b);
 
 #ifndef WIN32
-extern "C" {
+extern "C"
+{
 char* strupr(char * string);
-
-#include <string.h>
+# include <string.h>
 }
 #endif
 
 #ifndef strcmpi
-#define strcmpi strcasecmp
+# define strcmpi strcasecmp
 #endif
 
 #endif
-
diff --git a/myserver/src/base/string/securestr.cpp 
b/myserver/src/base/string/securestr.cpp
index 860b345..28531a6 100644
--- a/myserver/src/base/string/securestr.cpp
+++ b/myserver/src/base/string/securestr.cpp
@@ -1,20 +1,20 @@
 /*
-MyServer
-* strlcpy and strlcat by codingmaster
-Copyright (C) 2002, 2003, 2004, 2007, 2008 Free Software Foundation, Inc.
-Copyright (C) 2004 by codingmaster
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 3 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program.  If not, see <http://www.gnu.org/licenses/>.
+  MyServer
+  * strlcpy and strlcat by codingmaster
+  Copyright (C) 2002, 2003, 2004, 2007, 2008, 2009 Free Software Foundation, 
Inc.
+  Copyright (C) 2004 by codingmaster
+  This program is free software; you can redistribute it and/or modify
+  it under the terms of the GNU General Public License as published by
+  the Free Software Foundation; either version 3 of the License, or
+  (at your option) any later version.
+
+  This program is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+  GNU General Public License for more details.
+
+  You should have received a copy of the GNU General Public License
+  along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
 #include <include/base/string/securestr.h>
 #include <string.h>
@@ -22,100 +22,101 @@ along with this program.  If not, see 
<http://www.gnu.org/licenses/>.
 #define FAST_SECURE_STR
 
 /*!
- *Secure string concatenate routine.
+ * Secure string concatenate routine.
  */
-unsigned int myserver_strlcat(char *dst, const char *src, unsigned int size)
+unsigned int myserver_strlcat (char *dst, const char *src, unsigned int size)
 {
 #ifdef FAST_SECURE_STR
-  u_long dstLen = strlen(dst);
-  u_long srcLen = strlen(src);
+  u_long dstLen = strlen (dst);
+  u_long srcLen = strlen (src);
   u_long tc;
 
   size -= dstLen;
 
   tc = (srcLen < size ? srcLen : size);
 
-  if(tc)
-  {
-    if(size <= srcLen)
-      tc--;
-    memcpy(dst + dstLen, src, tc);
-    dst[tc] = '\0';
-  }
+  if (tc)
+    {
+      if (size <= srcLen)
+        tc--;
+      memcpy (dst + dstLen, src, tc);
+      dst[tc] = '\0';
+    }
 
   return dstLen + srcLen;
 #else
   char *dstptr = dst;
   size_t dstlen,tocopy = size;
   const char *srcptr = src;
-  
-  while(tocopy-- && *dstptr)
-  dstptr++;
-    
+
+  while (tocopy-- && *dstptr)
+    dstptr++;
+
   dstlen = dstptr - dst;
-  
+
   tocopy = size - dstlen;
-  if(!tocopy)
-    return((int)(dstlen + strlen(src)));
-    
-  while(*srcptr)
-  {
-    if(tocopy!=1)
+  if (!tocopy)
+    return ((int)(dstlen + strlen (src)));
+
+  while (*srcptr)
     {
-      *dstptr++ = *srcptr;
-      tocopy--;
+      if (tocopy!=1)
+        {
+          *dstptr++ = *srcptr;
+          tocopy--;
+        }
+      srcptr++;
     }
-    srcptr++;
-  }
-  
+
   *dstptr = 0;
-  
-  return((int)(dstlen + (srcptr - src)));
+
+  return ((int)(dstlen + (srcptr - src)));
 #endif
 }
 
 /*!
- *Secure string copy routine.
- */   
-unsigned int myserver_strlcpy(register char *dst, register const char *src, 
unsigned int size)
+ * Secure string copy routine.
+ */
+unsigned int myserver_strlcpy (register char *dst, register const char *src,
+                               unsigned int size)
 {
 #ifdef FAST_SECURE_STR
-  u_long ret = strlen(src);
+  u_long ret = strlen (src);
   u_long tc = (ret < size ? ret : size);
-  
-  if(tc)
-  {
-    if(size <= ret)
-      tc--;
-
-    memcpy(dst, src, tc);
-    dst[tc] = '\0';
-  }
+
+  if (tc)
+    {
+      if (size <= ret)
+        tc--;
+
+      memcpy (dst, src, tc);
+      dst[tc] = '\0';
+    }
   return ret;
 #else
   char *dstptr = dst;
   size_t tocopy = size;
   const char *srcptr = src;
-  
-  if(tocopy && --tocopy)
-  {
-    do
+
+  if (tocopy && --tocopy)
     {
-      if(!(*dstptr++ = *srcptr++))
-        break;
+      do
+        {
+          if (!(*dstptr++ = *srcptr++))
+            break;
+        }
+
+      while (--tocopy);
     }
-  
-    while(--tocopy);
-  }
-  
-  if(!tocopy)
-  {
-    if(size)
-      *dstptr = 0;
-    
-    while(*srcptr++);
-  }
-  
-  return((int)(srcptr - src - 1));
+
+  if (!tocopy)
+    {
+      if (size)
+        *dstptr = 0;
+
+      while (*srcptr++);
+    }
+
+  return ((int)(srcptr - src - 1));
 #endif
 }
diff --git a/myserver/src/base/string/stringutils.cpp 
b/myserver/src/base/string/stringutils.cpp
index a3bb5a6..71aed2c 100644
--- a/myserver/src/base/string/stringutils.cpp
+++ b/myserver/src/base/string/stringutils.cpp
@@ -1,48 +1,48 @@
 /*
-MyServer
-Copyright (C) 2002, 2003, 2004, 2006, 2007, 2008, 2009 Free Software 
Foundation, Inc.
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 3 of the License,  or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful, 
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program.  If not, see <http://www.gnu.org/licenses/>.
+  MyServer
+  Copyright (C) 2002, 2003, 2004, 2006, 2007, 2008, 2009 Free Software 
Foundation, Inc.
+  This program is free software; you can redistribute it and/or modify
+  it under the terms of the GNU General Public License as published by
+  the Free Software Foundation; either version 3 of the License,  or
+  (at your option) any later version.
+
+  This program is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+  GNU General Public License for more details.
+
+  You should have received a copy of the GNU General Public License
+  along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
 
-
 #include "stdafx.h"
 #include <include/base/string/stringutils.h>
 #include <include/base/safetime/safetime.h>
 
-extern "C" {
+extern "C"
+{
 #include <stdlib.h>
 #include <string.h>
 #include <ctype.h>
 #ifndef WIN32
-#include <stdio.h>
+# include <stdio.h>
 #endif
 }
 
 #ifdef GETTIMEOFDAY
-#include <sys/time.h>
+# include <sys/time.h>
 #endif
 
 #ifdef WIN32
-#include <direct.h>
-#include <time.h>
+# include <direct.h>
+# include <time.h>
 #endif
 
 /*!
- *This function format current time to the RFC 822 format and output 
- *it to a string.
+ * This function format current time to the RFC 822 format and output
+ * it to a string.
  */
-const char *getRFC822GMTTime(string& out,int len)
+const char *getRFC822GMTTime (string& out,int len)
 {
   time_t ltime;
   time( &ltime );
@@ -50,127 +50,121 @@ const char *getRFC822GMTTime(string& out,int len)
 }
 
 /*!
- *This function format current time to the RFC 822 format and output 
- *it to a string.
+ * This function format current time to the RFC 822 format and output
+ * it to a string.
  */
-const char *getRFC822GMTTime(const time_t t, string& out, int len)
+const char *getRFC822GMTTime (const time_t t, string& out, int len)
 {
-  /*! 
-   *FIXME: Do not use a temporary buffer but access directly the string
-   *class data. 
-   */
   char buff[32];
-  getRFC822GMTTime(t, buff, 32);
-  out.assign(buff);
-  return out.c_str();
+  getRFC822GMTTime (t, buff, 32);
+  out.assign (buff);
+  return out.c_str ();
 }
 
 /*!
- *This function format current time to the RFC 822 format and output 
- *it to a string.
+ * This function format current time to the RFC 822 format and output
+ * it to a string.
  */
-const char *getRFC822LocalTime(string& out,int len)
+const char *getRFC822LocalTime (string& out,int len)
 {
   time_t ltime;
-  time( &ltime );
-  return getRFC822LocalTime(ltime, out, len);
+  time (&ltime);
+  return getRFC822LocalTime (ltime, out, len);
 }
 
 /*!
- *This function format current time to the RFC 822 format and output 
- *it to a string.
+ * This function format current time to the RFC 822 format and output
+ * it to a string.
  */
-const char *getRFC822LocalTime(const time_t t, string &out,int len)
+const char *getRFC822LocalTime (const time_t t, string &out,int len)
 {
-  /*! 
-   *FIXME: Do not use a temporary buffer but access directly the string
-   *class data. 
-   */
   char buff[32];
-  getRFC822LocalTime(t, buff, 32);
-  out.assign(buff);
-  return out.c_str();
+  getRFC822LocalTime (t, buff, 32);
+  out.assign (buff);
+  return out.c_str ();
 }
 
 /*!
- *This function format current time to the RFC 822 format.
+ * This function format current time to the RFC 822 format.
  */
-const char *getRFC822GMTTime(char* out, int len)
+const char *getRFC822GMTTime (char* out, int len)
 {
   time_t ltime;
-  time( &ltime );
-  return getRFC822GMTTime(ltime, out, len);
+  time (&ltime);
+  return getRFC822GMTTime (ltime, out, len);
 }
+
 /*!
- *This function formats a time to the RFC 822 format.
+ * This function formats a time to the RFC 822 format.
  */
-const char *getRFC822GMTTime(const time_t ltime, char* out, int /*!len*/)
+const char *getRFC822GMTTime (const time_t ltime, char* out, int /*!len*/)
 {
   char *asct;
   u_long ind = 0;
-  tm* GMtime = gmtime( &ltime );
-  GMtime->tm_year += 1900;
-  asct=asctime(GMtime);
-  out[ind++]=asct[0];
-  out[ind++]=asct[1];
-  out[ind++]=asct[2];
-  out[ind++]=',';
-
-  if(asct[8] != ' ')
-    out[ind++]=' ';
-
-  out[ind++]=asct[8];
-  out[ind++]=asct[9];
-  out[ind++]=' ';
-  out[ind++]=asct[4];
-  out[ind++]=asct[5];
-  out[ind++]=asct[6];
-  out[ind++]=' ';
-
-  sprintf(&out[ind], "%i", GMtime->tm_year);
+  tm* gmTime = gmtime (&ltime);
+  gmTime->tm_year += 1900;
+  asct= asctime (gmTime);
+  out[ind++]= asct[0];
+  out[ind++]= asct[1];
+  out[ind++]= asct[2];
+  out[ind++] = ',';
+
+  if (asct[8] != ' ')
+    out[ind++] = ' ';
+
+  out[ind++] = asct[8];
+  out[ind++] = asct[9];
+  out[ind++] = ' ';
+  out[ind++]= asct[4];
+  out[ind++]= asct[5];
+  out[ind++]= asct[6];
+  out[ind++] = ' ';
+
+  sprintf(&out[ind], "%i", gmTime->tm_year);
   ind += 4;
 
-  out[ind++]=' ';
-  out[ind++]=asct[11];
-  out[ind++]=asct[12];
-  out[ind++]=':';
-  out[ind++]=asct[14];
-  out[ind++]=asct[15];
-  out[ind++]=':';
-  out[ind++]=asct[17];
-  out[ind++]=asct[18];
-  out[ind++]=' ';
-  out[ind++]='G';
-  out[ind++]='M';
-  out[ind++]='T';
-  out[ind++]='\0';
-  out[ind++]='\0';
-  out[ind++]='\0';
+  out[ind++] = ' ';
+  out[ind++]= asct[11];
+  out[ind++]= asct[12];
+  out[ind++] = ':';
+  out[ind++]= asct[14];
+  out[ind++]= asct[15];
+  out[ind++] = ':';
+  out[ind++]= asct[17];
+  out[ind++]= asct[18];
+  out[ind++] = ' ';
+  out[ind++] = 'G';
+  out[ind++] = 'M';
+  out[ind++] = 'T';
+  out[ind++] = '\0';
+  out[ind++] = '\0';
+  out[ind++] = '\0';
   return out;
 }
+
 /*!
- *This function convert from a RFC 822 format to a time_t.
+ * This function convert from a RFC 822 format to a time_t.
  */
-time_t getTime(const char* str)
+time_t getTime (const char* str)
 {
   char lb[30];
   int c = 0;
   int i;
   tm t;
-  for(i = 0; i < 30; i++)
-  {
-    if(str[c] == ',')
+  for (i = 0; i < 30; i++)
     {
-      c++;
-      lb[i] = '\0';
-      break;
+      if (str[c] == ',')
+        {
+          c++;
+          lb[i] = '\0';
+          break;
+        }
+      else
+        lb[i] = str[c++];
     }
-    else
-      lb[i] = str[c++];
-  }
   i = lb[0] + lb[1] + lb[3];
   switch(i)
-  {
+    {
     case 310:
       t.tm_wday = 0;  //Sun
       break;
@@ -192,36 +186,36 @@ time_t getTime(const char* str)
     case 296:
       t.tm_wday = 6;  //Sat
       break;
-  }
+    }
 
   c++;
-  for(i = 0; i < 30; i++)
-  {
-    if(i && str[c]==' ')
+  for (i = 0; i < 30; i++)
     {
-      c++;
-      lb[i] = '\0';
-      break;
+      if (i && str[c] == ' ')
+        {
+          c++;
+          lb[i] = '\0';
+          break;
+        }
+      else
+        lb[i] = str[c++];
     }
-    else
-      lb[i] = str[c++];
-  }
   t.tm_mday = atoi(lb);
-  
-  for(i = 0; i < 30; i++)
-  {
-    if(i && str[c] == ' ')
+
+  for (i = 0; i < 30; i++)
     {
-      c++;
-      lb[i] = '\0';
-      break;
+      if (i && str[c] == ' ')
+        {
+          c++;
+          lb[i] = '\0';
+          break;
+        }
+      else
+        lb[i] = str[c++];
     }
-    else
-      lb[i] = str[c++];
-  }
   i = lb[0] + lb[1] + lb[3];
   switch(i)
-  {
+    {
     case 281:
       t.tm_wday = 0;  //Jan
       break;
@@ -258,61 +252,61 @@ time_t getTime(const char* str)
     case 268:
       t.tm_wday = 11;  //Dec
       break;
-  }
+    }
 
-  for(i = 0; i < 30; i++)
-  {
-    if(i && str[c]==' ')
+  for (i = 0; i < 30; i++)
     {
-      c++;
-      lb[i] = '\0';
-      break;
+      if (i && str[c] == ' ')
+        {
+          c++;
+          lb[i] = '\0';
+          break;
+        }
+      else
+        lb[i] = str[c++];
     }
-    else
-      lb[i] = str[c++];
-  }
   t.tm_year = atoi(lb) - 1900;
-  
-  for(i = 0; i < 30; i++)
-  {
-    if(i && str[c] == ':')
+
+  for (i = 0; i < 30; i++)
     {
-      c++;
-      lb[i] = '\0';
-      break;
+      if (i && str[c] == ':')
+        {
+          c++;
+          lb[i] = '\0';
+          break;
+        }
+      else
+        lb[i] = str[c++];
     }
-    else
-      lb[i] = str[c++];
-  }
   t.tm_hour = atoi(lb);
 
-  for(i = 0; i < 30; i++)
-  {
-    if(i && str[c] == ':')
+  for (i = 0; i < 30; i++)
     {
-      c++;
-      lb[i] = '\0';
-      break;
+      if (i && str[c] == ':')
+        {
+          c++;
+          lb[i] = '\0';
+          break;
+        }
+      else
+        lb[i] = str[c++];
     }
-    else
-      lb[i] = str[c++];
-  }
   t.tm_min = atoi(lb);
 
-  for(i = 0; i < 30; i++)
-  {
-    if(i && str[c]==':')
+  for (i = 0; i < 30; i++)
     {
-      c++;
-      lb[i] = '\0';
-      break;
+      if (i && str[c] == ':')
+        {
+          c++;
+          lb[i] = '\0';
+          break;
+        }
+      else
+        lb[i] = str[c++];
     }
-    else
-      lb[i] = str[c++];
-  }
   t.tm_sec = atoi(lb);
   t.tm_yday = 0;
-  t.tm_wday = 0;  
+  t.tm_wday = 0;
 
   t.tm_isdst = -1;
 
@@ -320,33 +314,33 @@ time_t getTime(const char* str)
 }
 
 /*!
- *This function format current time to the RFC 822 format.
+ * This function format current time to the RFC 822 format.
  */
-const char *getRFC822LocalTime(char* out, int len)
+const char *getRFC822LocalTime (char* out, int len)
 {
   time_t ltime;
-  time( &ltime );
-  return getRFC822LocalTime(ltime, out, len);
+  time (&ltime);
+  return getRFC822LocalTime (ltime, out, len);
 }
 /*!
- *This function formats a time to the RFC 822 format.
+ * This function formats a time to the RFC 822 format.
  */
-const char *getRFC822LocalTime(const time_t ltime, char* out, int /*!len*/)
+const char *getRFC822LocalTime (const time_t ltime, char* out, int /*!len*/)
 {
   char *asct;
   tm result;
   u_long ind = 0;
-  
-  myserver_localtime( &ltime, &result );
+
+  myserver_localtime (&ltime, &result);
 
   result.tm_year += 1900;
-  asct = asctime(&result);
+  asct = asctime (&result);
   out[ind++] = asct[0];
   out[ind++] = asct[1];
   out[ind++] = asct[2];
   out[ind++] = ',';
 
-  if(asct[8] != ' ')
+  if (asct[8] != ' ')
     out[ind++] = ' ';
 
   out[ind++] = asct[8];
@@ -357,7 +351,7 @@ const char *getRFC822LocalTime(const time_t ltime, char* 
out, int /*!len*/)
   out[ind++] = asct[6];
   out[ind++] = ' ';
 
-  sprintf(&out[ind], "%i", result.tm_year);
+  sprintf (&out[ind], "%i", result.tm_year);
   ind += 4;
 
   out[ind++] = ' ';
@@ -380,93 +374,94 @@ const char *getRFC822LocalTime(const time_t ltime, char* 
out, int /*!len*/)
 }
 
 /*!
- *Get the local time string.
+ * Get the local time string.
  */
-const char* getLocalLogFormatDate(char* out, int len)
+const char* getLocalLogFormatDate (char* out, int len)
 {
   time_t ltime;
-  time( &ltime );
-  return getLocalLogFormatDate(ltime, out, len);
+  time (&ltime);
+  return getLocalLogFormatDate (ltime, out, len);
 }
 
 /*!
- *Get the GMT time string.
+ * Get the GMT time string.
  */
-const char* getGMTLogFormatDate(char* out, int len)
-{  
+const char* getGMTLogFormatDate (char* out, int len)
+{
   time_t ltime;
-  time( &ltime );
-  return getGMTLogFormatDate(ltime, out, len);
+  time(&ltime);
+  return getGMTLogFormatDate (ltime, out, len);
 }
 
 
 /*!
- *Get the local time string.
+ * Get the local time string.
  */
-const char* getLocalLogFormatDate(const time_t t, string& out, int len)
+const char* getLocalLogFormatDate (const time_t t, string& out, int len)
 {
   char buff[32];
-  getLocalLogFormatDate(t, buff, len);
-  out.assign(buff);
-  return out.c_str();
+  getLocalLogFormatDate (t, buff, len);
+  out.assign (buff);
+  return out.c_str ();
 }
 
 /*!
- *Get the GMT time string.
+ * Get the GMT time string.
  */
-const char* getGMTLogFormatDate(const time_t t, string& out, int len)
+const char* getGMTLogFormatDate (const time_t t, string& out, int len)
 {
   char buff[32];
-  getGMTLogFormatDate(t, buff, len);
-  out.assign(buff);
-  return out.c_str();
+  getGMTLogFormatDate (t, buff, len);
+  out.assign (buff);
+  return out.c_str ();
 }
 /*!
- *Get the local time string.
+ * Get the local time string.
  */
-const char* getLocalLogFormatDate(string& out, int len)
+const char* getLocalLogFormatDate (string& out, int len)
 {
   char buff[32];
-  getLocalLogFormatDate(buff, len);
-  out.assign(buff);
-  return out.c_str();
+  getLocalLogFormatDate (buff, len);
+  out.assign (buff);
+  return out.c_str ();
 }
 
 /*!
- *Get the GMT time string.
+ * Get the GMT time string.
  */
 const char* getGMTLogFormatDate(string& out, int len)
 {
   char buff[32];
-  getGMTLogFormatDate(buff, len);
-  out.assign(buff);
-  return out.c_str();
+  getGMTLogFormatDate (buff, len);
+  out.assign (buff);
+  return out.c_str ();
 }
 
 /*!
- *Get a string in the format "day/month/year:hour:minute:second offset" 
- *for the local zone.
+ * Get a string in the format "day/month/year:hour:minute:second offset"
+ * for the local zone.
  */
-const char* getLocalLogFormatDate(const time_t t, char* out, int len)
+const char* getLocalLogFormatDate (const time_t t, char* out, int len)
 {
   int offset = 0;
   time_t ltime;
-  time( &ltime );
+  time (&ltime);
   char *asct;
-  tm GMtime;
-  myserver_localtime( &ltime, &GMtime );
-  if(len < 25)
+  tm gmTime;
+  myserver_localtime (&ltime, &gmTime );
+  if (len < 25)
     return 0;
-  GMtime.tm_year += 1900;
-  asct = asctime(&GMtime);
-   out[0] = asct[8] != ' ' ? asct[8] : '0';
+
+  gmTime.tm_year += 1900;
+  asct = asctime (&gmTime);
+  out[0] = asct[8] != ' ' ? asct[8] : '0';
   out[1] = asct[9];
   out[2] = '/';
   out[3] = asct[4];
   out[4]= asct[5];
   out[5] = asct[6];
   out[6] = '/';
-  sprintf(&out[7], "%i", GMtime.tm_year);
+  sprintf (&out[7], "%i", gmTime.tm_year);
   out[11] = ':';
   out[12] = asct[11];
   out[13] = asct[12];
@@ -479,7 +474,7 @@ const char* getLocalLogFormatDate(const time_t t, char* 
out, int len)
   out[20] = ' ';
 
 #ifndef WIN32
-  extern long timezone; 
+  extern long timezone;
   offset = -timezone;
 #else
 
@@ -487,56 +482,56 @@ const char* getLocalLogFormatDate(const time_t t, char* 
out, int len)
   struct timeval tv;
   struct timezone tz;
 
-  gettimeofday(&tv, &tz);
+  gettimeofday (&tv, &tz);
   offset = -tz.tz_minuteswest * 60;
 
 #else
   TIME_ZONE_INFORMATION tzi;
-  GetTimeZoneInformation(&tzi);
+  GetTimeZoneInformation (&tzi);
   offset = -tzi.Bias * 60;
 #endif
 
 #endif
 
-  if(offset < 0)
-  {
-    offset = -offset;
-    out[21] = '-';
-  }
+  if (offset < 0)
+    {
+      offset = -offset;
+      out[21] = '-';
+    }
   else
     out[21] = '+';
-  sprintf(&out[22], "%.2i%.2i", offset / (60 * 60), offset % (60 * 60) / 60);
+  sprintf (&out[22], "%.2i%.2i", offset / (60 * 60), offset % (60 * 60) / 60);
   out[26] = '\0';
   return out;
 }
 
 
 /*!
- *Get a string in the format "day/month/year:hour:minute:second offset" 
+ *Get a string in the format "day/month/year:hour:minute:second offset"
  *for the GMT zone.
  */
-const char* getGMTLogFormatDate(const time_t t, char* out, int len)
+const char* getGMTLogFormatDate (const time_t t, char* out, int len)
 {
   time_t ltime;
-  time( &ltime );
+  time (&ltime);
   char *asct;
   tm result;
 
-  myserver_localtime( &ltime, &result );
+  myserver_localtime ( &ltime, &result );
 
-  if(len < 25)
+  if (len < 25)
     return 0;
 
   result.tm_year += 1900;
-  asct = asctime(&result);
-   out[0] = asct[8] != ' ' ? asct[8] : '0';
+  asct = asctime (&result);
+  out[0] = asct[8] != ' ' ? asct[8] : '0';
   out[1] = asct[9];
   out[2] = '/';
   out[3] = asct[4];
   out[4] = asct[5];
   out[5] = asct[6];
   out[6] = '/';
-  sprintf(&out[7], "%i", result.tm_year);
+  sprintf (&out[7], "%i", result.tm_year);
   out[11] = ':';
   out[12] = asct[11];
   out[13] = asct[12];
@@ -559,131 +554,102 @@ const char* getGMTLogFormatDate(const time_t t, char* 
out, int len)
 /*!
  *Trim a string from the right side.
  */
-string trimRight(string const &s, string const &t )
+string trimRight (string const &s, string const &t)
 {
   string str = s;
-  return str.erase(str.find_last_not_of(t) + 1 ) ;
+  return str.erase (str.find_last_not_of (t) + 1 );
 }
 
 
 /*!
  *Trim a string from the left side.
  */
-string trimLeft(string const &s, string const &t )
+string trimLeft (string const &s, string const &t )
 {
   std::string str = s;
-  return str.erase( 0, s.find_first_not_of (t)) ;
+  return str.erase (0, s.find_first_not_of (t));
 }
 
 /*!
  *Trim a string.
  */
-string trim(string const &s,  string const &t)
+string trim (string const &s,  string const &t)
 {
-  return trimLeft(trimRight(s, t));
+  return trimLeft (trimRight (s, t));
 }
 
 /*!
  *This funtions takes two strings, first the str we're going to work on,
- *and second a list of characters that the funtion is going to remove 
+ *and second a list of characters that the funtion is going to remove
  *from the head and tail of the first string.
  *Ex:       char str[16]="Hellow World!!!";
  *          char trim[7]="e!HlwW";
  *          StrTrim(str,trim);
  *result:    str="ow World"
- *'w', 'W' and the last 'l' aren't removed because they aren't 
+ *'w', 'W' and the last 'l' aren't removed because they aren't
  *attached to the head or tail of the string
  */
 
-void StrTrim(char* str, char* trimchars)
+void trim (char* str, char* trimchars)
 {
   char *strptr = str;
   char *trimptr = trimchars;
-  
-  /*!
-  *Here we trim the characters of the head of the string.
-  *Just cycle through the trimchars and compare,
-  *if we find a char in str, increment the str to check the next char,
-  *and set the trimchars to the beggining.
-  *The first time it fails to find a char in str, it just leaves.
-  */
-  while(*trimptr && *strptr)
-  {
-    if(*strptr == *trimptr)
+
+  while (*trimptr && *strptr)
     {
-      strptr++;
-      trimptr = trimchars;
-      continue;
+      if (*strptr == *trimptr)
+        {
+          strptr++;
+          trimptr = trimchars;
+          continue;
+        }
+      trimptr++;
     }
-    trimptr++;
-  }
-
   trimptr = trimchars;
-  
-  /*!
-  *Here we push the string back to occupy the potencial
-  *empty spaces created at the beginning of the string.
-  *If the string was completly trimmed (if(!(*strptr))),
-  *just return an empty string. 
-  *If no 'holes' were created (!if(str!=strptr)) just move
-  *the pointer to the tail of the string to check there now.
-  */
-  if(str != strptr)      //Holes were created
-  {
-    if(!(*strptr))    //Full trim
+
+  if (str != strptr)
     {
-      *str = 0;
-      return;
+      if (!(*strptr))
+        {
+          *str = 0;
+          return;
+        }
+      while (*strptr)
+        {
+          *str = *strptr;
+          str++;
+          strptr++;
+        }
     }
-    while(*strptr)
+  else
     {
-      *str = *strptr;
-      str++;
-      strptr++;
+      while (*str)
+        str++;
     }
-  }else          //No holes were created
-  {
-    while(*str)
-      str++;
-  }
-  
-  /*!
-  *Now str-1 is exactly at the end of the string, we'll start trim from
-  *there then.
-  */
+
   str--;
-  /*!
-  *Here we trim the characters of the tail of the string.
-  *Just cycle through the trimchars and compare,
-  *if we find a char in the str, decrement the str to
-  *check the previous char, and set the trimchars to the beggining.
-  *The first time it fails to find a char in str, it just leaves.
-  *Note: Here we only check *trimptr in the while loop and not *str,
-  *that's because i know there is at least one character in there that
-  *isn't on trimchars, the character that stoped the first trim up there,
-  *so that character will allways be reach before str's NULL.
-  */
-  while(*trimptr)
-  {
-    if(*str == *trimptr)
+
+  while (*trimptr)
     {
-      str--;
-      trimptr = trimchars;
-      continue;
+      if (*str == *trimptr)
+        {
+          str--;
+          trimptr = trimchars;
+          continue;
+        }
+      trimptr++;
     }
-    trimptr++;
-  }
-  *(str + 1) = 0;        //Now to finish up
+  *(str + 1) = 0;
 }
 
 /*!
- *Set the buffer passed to the next line.
- *A new line is the first character after \n.
+ * Set the buffer passed to the next line.
+ * A new line is the first character after \n.
  */
-void gotoNextLine(char** cmd)
+void gotoNextLine (char** cmd)
 {
-  while(*(*cmd++) != '\n')
-    if(**cmd == '\0')
+  while (*(*cmd++) != '\n')
+    if (**cmd == '\0')
       break;
 
 }
@@ -697,19 +663,19 @@ void translateEscapeString(char *str)
   i = 0;
   j = 0;
   while (str[i] != 0)
-  {
-    if ((str[i] == '%') && (str[i + 1] != 0) && (str[i + 2] != 0))
     {
-      str[j] =(char) (16 * hexVal(str[i + 1]) + hexVal(str[i + 2]));
-      i = i + 3;
-    }
-    else
-    {
-      str[j] = str[i];
-      i++;
+      if ((str[i] == '%') && (str[i + 1] != 0) && (str[i + 2] != 0))
+        {
+          str[j] =(char) (16 * hexVal(str[i + 1]) + hexVal(str[i + 2]));
+          i = i + 3;
+        }
+      else
+        {
+          str[j] = str[i];
+          i++;
+        }
+      j++;
     }
-    j++;
-  }
   str[j] = 0;
 }
 
@@ -723,19 +689,19 @@ void translateEscapeString(string& str)
   j = 0;
   len = str.length();
   while (len--)
-  {
-    if ((str[i] == '%') && (str[i + 1] != 0) && (str[i + 2] != 0))
     {
-      str[j] =(char) (16 * hexVal(str[i + 1]) + hexVal(str[i + 2]));
-      i = i + 3;
-    }
-    else
-    {
-      str[j] = str[i];
-      i++;
+      if ((str[i] == '%') && (str[i + 1] != 0) && (str[i + 2] != 0))
+        {
+          str[j] =(char) (16 * hexVal(str[i + 1]) + hexVal(str[i + 2]));
+          i = i + 3;
+        }
+      else
+        {
+          str[j] = str[i];
+          i++;
+        }
+      j++;
     }
-    j++;
-  }
   str[j] = 0;
 }
 
@@ -747,17 +713,17 @@ int hexVal(char ch)
   if (ch >= '0' && ch <= '9')
     return ch - '0';
   else
-  {
-    if (ch >= 'a' && ch <= 'f')
-      return ch - 'a' + 10;
-    else
     {
-      if (ch >= 'A' && ch <= 'F')
-        return ch - 'A' + 10;
+      if (ch >= 'a' && ch <= 'f')
+        return ch - 'a' + 10;
       else
-        return 0;
+        {
+          if (ch >= 'A' && ch <= 'F')
+            return ch - 'A' + 10;
+          else
+            return 0;
+        }
     }
-  }
 }
 
 /*!
@@ -769,26 +735,26 @@ int hexToInt(const char *str)
   register const char *cp;
   cp = str;
   if (*cp == '\0')
-      return 0;
+    return 0;
   u = 0;
 
-  while (*cp != '\0') 
-  {
-    if (!isxdigit((int)*cp))
-      return 0;
+  while (*cp != '\0')
+    {
+      if (!isxdigit((int)*cp))
+        return 0;
 
-    if (u >= 0x10000000)
+      if (u >= 0x10000000)
         return 0;
 
-    u <<= 4;
+      u <<= 4;
 
-    if (*cp <= '9')  
+      if (*cp <= '9')
         u += *cp++ - '0';
-    else if (*cp >= 'a')
+      else if (*cp >= 'a')
         u += *cp++ - 'a' + 10;
-    else
+      else
         u += *cp++ - 'A' + 10;
-  }
+    }
   return u;
 }
 /*!
@@ -797,28 +763,29 @@ int hexToInt(const char *str)
 int getCharInString(const char* str, const char* characters, int max)
 {
   int i, j;
-  
-  if(max)
-  {
-    for(i = 0; (i < max) && (str[i]); i++ )
+
+  if (max)
     {
-      for(j = 0; characters[j]; j++)
-      {
-        if(str[i] == characters[j])
-          return i;
-      }
+      for (i = 0; (i < max) && (str[i]); i++ )
+        {
+          for (j = 0; characters[j]; j++)
+            {
+              if (str[i] == characters[j])
+                return i;
+            }
+        }
     }
-  }else
-  {  
-    for(i = 0; str[i]; i++ )
+  else
     {
-      for(j = 0; characters[j]; j++)
-      {
-        if(str[i] == characters[j])
-          return i;
-      }
+      for (i = 0; str[i]; i++ )
+        {
+          for (j = 0; characters[j]; j++)
+            {
+              if (str[i] == characters[j])
+                return i;
+            }
+        }
     }
-  }
   return -1;
 }
 
@@ -826,82 +793,83 @@ int getCharInString(const char* str, const char* 
characters, int max)
  *Get the offset to the first '\\r' or '\\n'.
  *Returns -1 on errors.
  */
-int getEndLine(const char* str, int max)
+int getEndLine (const char* str, int max)
 {
   int i;
-  
-  if(max)
-  {
-    for(i = 0; (i < max) && (str[i]); i++ )
+
+  if (max)
     {
-      if((str[i]=='\r') || (str[i]=='\n'))
-        return i;
+      for (i = 0; (i < max) && (str[i]); i++ )
+        {
+          if ((str[i] == '\r') || (str[i] == '\n'))
+            return i;
+        }
     }
-  }else
-  {
-    for(i = 0; str[i]; i++ )
+  else
     {
-      if((str[i] == '\r') || (str[i] == '\n'))
-        return i;
+      for (i = 0; str[i]; i++ )
+        {
+          if ((str[i] == '\r') || (str[i] == '\n'))
+            return i;
+        }
     }
-  }
   return -1;
 }
 
 /*!
- *Compares two strings and returns a value indicating their relationship. 
+ *Compares two strings and returns a value indicating their relationship.
  *This function ignores case.
  *Returns = 0 if [A] is identical to [B].
  *Returns < 0 if [A] is less than [B].
  *Returns > 0 if [A] is greater than [B].
  */
-int stringcmpi(string const &a, string const &b)
+int stringcmpi (string const &a, string const &b)
 {
-  return strcmpi(a.c_str(), b.c_str());
+  return strcmpi (a.c_str (), b.c_str ());
 }
 
 /*!
- *Compares two strings and returns a value indicating their relationship. 
+ *Compares two strings and returns a value indicating their relationship.
  *This function ignores case.
  *Returns = 0 if [A] is identical to [B].
  *Returns < 0 if [A] is less than [B].
  *Returns > 0 if [A] is greater than [B].
  */
-int stringcmpi(string const &a, const char* b)
+int stringcmpi (string const &a, const char* b)
 {
-  return strcmpi(a.c_str(), b);
+  return strcmpi (a.c_str (), b);
 }
 
 /*!
- *Compares two strings and returns a value indicating their relationship. 
+ *Compares two strings and returns a value indicating their relationship.
  *This function values the strings case too.
  *Returns = 0 if [A] is identical to [B].
  *Returns < 0 if [A] is less than [B].
  *Returns > 0 if [A] is greater than [B].
  */
-int stringcmp(const string& a, const string& b)
+int stringcmp (const string& a, const string& b)
 {
-  return strcmp(a.c_str(), b.c_str());
+  return strcmp (a.c_str (), b.c_str ());
 }
 
 /*!
- *Compares two strings and returns a value indicating their relationship. 
+ *Compares two strings and returns a value indicating their relationship.
  *This function values the strings case too.
  *Returns = 0 if [A] is identical to [B].
  *Returns < 0 if [A] is less than [B].
  *Returns > 0 if [A] is greater than [B].
  */
-int stringcmp(string const &a, const char* b)
+int stringcmp (string const &a, const char* b)
 {
-  return strcmp(a.c_str(), b);
+  return strcmp (a.c_str (), b);
 }
 
-#ifndef WIN32 
+#ifndef WIN32
 char* strupr(char * s)
 {
-    unsigned int len = strlen(s);
-    for(register unsigned int i = 0; i < len; i++)
-       s[i] = toupper(s[i]);
-    return s;
+  unsigned int len = strlen(s);
+  for (register unsigned int i = 0; i < len; i++)
+    s[i] = toupper(s[i]);
+  return s;
 }
 #endif
diff --git a/myserver/src/protocol/http/http_headers.cpp 
b/myserver/src/protocol/http/http_headers.cpp
index 8f6be37..e935b51 100755
--- a/myserver/src/protocol/http/http_headers.cpp
+++ b/myserver/src/protocol/http/http_headers.cpp
@@ -877,13 +877,13 @@ int HttpHeaders::readReqAuthLine (HttpRequestHeader 
*request,
         return 400;
       do
         {
-          StrTrim (digestToken, (char*)" ");
+          trim (digestToken, (char*)" ");
           if (!strcmpi (digestToken, (char*)"nonce"))
             {
               digestToken = strtok (NULL, (char*)"," );
               if (digestToken)
                 {
-                  StrTrim (digestToken, (char*)"\" ");
+                  trim (digestToken, (char*)"\" ");
                   myserver_strlcpy (request->digestNonce,digestToken,48 + 1);
                 }
             }
@@ -892,7 +892,7 @@ int HttpHeaders::readReqAuthLine (HttpRequestHeader 
*request,
               digestToken = strtok (NULL, (char*)"," );
               if (digestToken)
                 {
-                  StrTrim (digestToken, (char*)"\" ");
+                  trim (digestToken, (char*)"\" ");
                   myserver_strlcpy (request->digestOpaque,digestToken,48 + 1);
                 }
             }
@@ -901,7 +901,7 @@ int HttpHeaders::readReqAuthLine (HttpRequestHeader 
*request,
               digestToken = strtok (NULL, (char*)"\r\n," );
               if (digestToken)
                 {
-                  StrTrim (digestToken, (char*)"\" ");
+                  trim (digestToken, (char*)"\" ");
                   myserver_strlcpy (request->digestUri,digestToken,1024 + 1);
                 }
             }
@@ -910,7 +910,7 @@ int HttpHeaders::readReqAuthLine (HttpRequestHeader 
*request,
               digestToken = strtok (NULL, (char*)"\r\n," );
               if (digestToken)
                 {
-                  StrTrim (digestToken, (char*)"\" ");
+                  trim (digestToken, (char*)"\" ");
                   myserver_strlcpy (request->digestMethod,digestToken,16 + 1);
                 }
             }
@@ -919,7 +919,7 @@ int HttpHeaders::readReqAuthLine (HttpRequestHeader 
*request,
               digestToken = strtok (NULL, (char*)"\r\n," );
               if (digestToken)
                 {
-                  StrTrim (digestToken,(char*)"\" ");
+                  trim (digestToken,(char*)"\" ");
                   myserver_strlcpy (request->digestQop,digestToken,16 + 1);
                 }
             }
@@ -928,7 +928,7 @@ int HttpHeaders::readReqAuthLine (HttpRequestHeader 
*request,
               digestToken = strtok (NULL, (char*)"\r\n," );
               if (digestToken)
                 {
-                  StrTrim (digestToken, (char*)"\" ");
+                  trim (digestToken, (char*)"\" ");
                   myserver_strlcpy (request->digestRealm,digestToken,48 + 1);
                 }
             }
@@ -937,7 +937,7 @@ int HttpHeaders::readReqAuthLine (HttpRequestHeader 
*request,
               digestToken = strtok (NULL, (char*)"\r\n," );
               if (digestToken)
                 {
-                  StrTrim (digestToken, (char*)" \"");
+                  trim (digestToken, (char*)" \"");
                   myserver_strlcpy (request->digestCnonce, digestToken, 48 + 
1);
                 }
             }
@@ -946,7 +946,7 @@ int HttpHeaders::readReqAuthLine (HttpRequestHeader 
*request,
               digestToken = strtok (NULL, (char*)"\r\n," );
               if (digestToken)
                 {
-                  StrTrim (digestToken, (char*)"\" ");
+                  trim (digestToken, (char*)"\" ");
                   myserver_strlcpy (request->digestUsername, digestToken, 48 + 
1);
                   connection->setLogin (digestToken);
                 }
@@ -956,7 +956,7 @@ int HttpHeaders::readReqAuthLine (HttpRequestHeader 
*request,
               digestToken = strtok (NULL, "\r\n," );
               if (digestToken)
                 {
-                  StrTrim (digestToken, (char*)"\" ");
+                  trim (digestToken, (char*)"\" ");
                   myserver_strlcpy (request->digestResponse,digestToken,48 + 
1);
                 }
             }
@@ -965,7 +965,7 @@ int HttpHeaders::readReqAuthLine (HttpRequestHeader 
*request,
               digestToken = strtok (NULL, (char*)"\r\n," );
               if (digestToken)
                 {
-                  StrTrim (digestToken, (char*)"\" ");
+                  trim (digestToken, (char*)"\" ");
                   myserver_strlcpy (request->digestNc, digestToken, 10 + 1);
                 }
             }



commit 142ea49d9a8945ec00c312bc680929bb755960a5
Author: Giuseppe Scrivano <address@hidden>
Date:   Sun Aug 9 11:41:56 2009 +0200

    Refactoring: removed comments that were interpreted as inline documentation 
by doxygen and code re-formatted

diff --git a/myserver/src/base/find_data/find_data.cpp 
b/myserver/src/base/find_data/find_data.cpp
index 92b7786..a33d86e 100644
--- a/myserver/src/base/find_data/find_data.cpp
+++ b/myserver/src/base/find_data/find_data.cpp
@@ -29,31 +29,31 @@ extern "C"
 using namespace std;
 
 /*!
- *Initialize class members.
+ * Initialize class members.
  */
-FindData::FindData()
+FindData::FindData ()
 {
 #ifdef WIN32
   ff = 0;
 #else
-  dirName.empty();
+  dirName.empty ();
   dh = 0;
 #endif
 }
 
 /*!
- *free class members.
+ * D'ctor.
  */
-FindData::~FindData()
+FindData::~FindData ()
 {
 
 }
 
 /*!
- *find the first file using its name.
- *Return -1 or errors.
+ * Find the first file using its name.
+ * Return -1 or errors.
  */
-int FindData::findfirst(const char *filename)
+int FindData::findfirst (const char *filename)
 {
 #ifdef WIN32
   string filenameStar;
@@ -63,17 +63,17 @@ int FindData::findfirst(const char *filename)
   filenameStar.erase (slashBackSlash + 1);
   filenameStar.append ("\\*");
 
-  ff = _findfirst(filenameStar.c_str(), &fd );
+  ff = _findfirst (filenameStar.c_str (), &fd );
   if(ff!=-1)
-  {
-    name = fd.name;
-    attrib = fd.attrib;
-    time_write = fd.time_write;
-    size = fd.size ;
-    return 0;
-  }
+    {
+      name = fd.name;
+      attrib = fd.attrib;
+      time_write = fd.time_write;
+      size = fd.size ;
+      return 0;
+    }
   else
-      return ff;
+    return ff;
 
 #else
    struct dirent * dirInfo;
@@ -118,15 +118,15 @@ int FindData::findfirst(const char *filename)
 }
 
 /*!
- *find the next file in the directory.
+ * Find the next file in the directory.
  */
 int FindData::findnext ()
 {
 #ifdef WIN32
   if (!ff)
     return -1;
-  int ret = _findnext (ff, &fd)? -1 : 0 ;
-  if (ret!=-1)
+  int ret = _findnext (ff, &fd) ? -1 : 0 ;
+  if (ret != -1)
   {
     name = fd.name;
     attrib = fd.attrib;
@@ -168,21 +168,21 @@ int FindData::findnext ()
 }
 
 /*!
- *free the used resources.
+ * Free the used resources.
  */
-int FindData::findclose()
+int FindData::findclose ()
 {
 #ifdef WIN32
   int ret;
-  if(!ff)
+  if (!ff)
     return -1;
-  ret = _findclose(ff);
+  ret = _findclose (ff);
   ff = 0;
   return ret;
 #else
-  if(dh)
-    closedir(dh);
-   dirName.empty();
-   return 0;
+  if (dh)
+    closedir (dh);
+  dirName.empty ();
+  return 0;
 #endif
 }
diff --git a/myserver/src/base/home_dir/home_dir.cpp 
b/myserver/src/base/home_dir/home_dir.cpp
index a1621b0..fc3c93f 100755
--- a/myserver/src/base/home_dir/home_dir.cpp
+++ b/myserver/src/base/home_dir/home_dir.cpp
@@ -24,59 +24,62 @@ along with this program.  If not, see 
<http://www.gnu.org/licenses/>.
 
 
 #ifdef WIN32
-#include <userenv.h>
+# include <userenv.h>
 #endif
-extern "C" {
+
+extern "C"
+{
 #include <string.h>
 #include <stdlib.h>
 #include <stdarg.h>
 #include <stdio.h>
 
 #ifdef GETPWNAM
-#include <pwd.h>
+# include <pwd.h>
 #endif
 
 #ifndef WIN32
-#include <errno.h>
-#include <netdb.h>
-#include <unistd.h>
-#include <signal.h>
+# include <errno.h>
+# include <netdb.h>
+# include <unistd.h>
+# include <signal.h>
 #ifdef HAVE_PTHREAD
-#include <pthread.h>
+# include <pthread.h>
 #endif
+
 #include <sys/wait.h>
 #endif
 }
 
-#include <sys/types.h>
-
 #ifdef WIN32
-#include <direct.h>
+# include <direct.h>
 #endif
 
+#include <sys/types.h>
+
 /*!
- *Class constructor.
+ * Class constructor.
  */
-HomeDir::HomeDir()
+HomeDir::HomeDir ()
 {
 #ifdef WIN32
-  data.assign("");
+  data.assign ("");
 #elif !GETPWNAM
-  data.clear();
+  data.clear ();
 #endif
   timestamp = 0;
   loaded = 0;
 
-  loadMutex.init();
+  loadMutex.init ();
 }
 
 /*!
- *Destroy th object.
+ * D'tor.
  */
-HomeDir::~HomeDir()
+HomeDir::~HomeDir ()
 {
-  clear();
-  loadMutex.destroy();
+  clear ();
+  loadMutex.destroy ();
 }
 
 /*!
@@ -85,16 +88,16 @@ HomeDir::~HomeDir()
 void HomeDir::clear()
 {
 #ifdef WIN32
-  data.assign("");
+  data.assign ("");
 #elif !GETPWNAM
-  HashMap<string, string*>::Iterator i = data.begin();
-  for( ; i != data.end(); i++)
-  {
-    string* val = *i;
-    if(val)
-      delete val;
-  }
-  data.clear();
+  HashMap<string, string*>::Iterator i = data.begin ();
+  for (; i != data.end (); i++)
+    {
+      string* val = *i;
+      if (val)
+        delete val;
+    }
+  data.clear ();
   timestamp = 0;
 #endif
   loaded = 0;
@@ -103,38 +106,38 @@ void HomeDir::clear()
 /*!
  *Public wrapper to loadImpl.
  */
-int HomeDir::load()
+int HomeDir::load ()
 {
   int ret;
-  loadMutex.lock();
+  loadMutex.lock ();
   
-  ret = loadImpl();
+  ret = loadImpl ();
 
-  loadMutex.unlock();
+  loadMutex.unlock ();
   return ret;
 }
 
 /*!
- *Load the internal buffer.
+ * Load the internal buffer.
  */
-int HomeDir::loadImpl()
+int HomeDir::loadImpl ()
 {
 #ifdef WIN32
   DWORD len = 64;
   char *buf;
   buf = new char[len];
 
-  if(GetProfilesDirectory(buf, &len) == FALSE)
-  {
-    delete [] buf;
-    buf = new char[len];
-    if(GetProfilesDirectory(buf, &len) == FALSE)
+  if (GetProfilesDirectory(buf, &len) == FALSE)
     {
-      delete [] buf; 
-      return 1;                               
+      delete [] buf;
+      buf = new char[len];
+      if (GetProfilesDirectory(buf, &len) == FALSE)
+        {
+          delete [] buf;
+          return 1;
+        }
     }
-  }
-  data.assign(buf);
+  data.assign (buf);
 #elif !GETPWNAM
   File usersFile;
   u_long size;
@@ -142,74 +145,74 @@ int HomeDir::loadImpl()
   u_long read;
   u_long counter;
 
-  clear();
+  clear ();
 
-  if (usersFile.openFile("/etc/passwd", File::READ | 
-                         File::OPEN_IF_EXISTS))
+  if (usersFile.openFile ("/etc/passwd", File::READ |
+                          File::OPEN_IF_EXISTS))
     return 1;
-  size = usersFile.getFileSize();
-  timestamp = usersFile.getLastModTime();
+  size = usersFile.getFileSize ();
+  timestamp = usersFile.getLastModTime ();
   if (size == (u_long) -1)
-  {
-    usersFile.close();
-    return 1;
-  }
+    {
+      usersFile.close ();
+      return 1;
+    }
 
   buffer = new char[size+1]; 
 
   usersFile.read (buffer, size, &read);
   buffer[read] = '\0';
 
- for (counter = 0; counter < read; counter++)
-   if (buffer[counter] == ':')
-     buffer[counter] = '\0';
+  for (counter = 0; counter < read; counter++)
+    if (buffer[counter] == ':')
+      buffer[counter] = '\0';
 
   for (counter = 0; counter < size;)
-  {
-    char *username = 0;
-    char *home = 0;
-    string sUsername;
-    string *sHome;
-    string *old;
-
-    if (buffer[counter] == '#')
     {
-      while (buffer[counter++] != '\n');
-      continue;
-    }
+      char *username = 0;
+      char *home = 0;
+      string sUsername;
+      string *sHome;
+      string *old;
+
+      if (buffer[counter] == '#')
+        {
+          while (buffer[counter++] != '\n');
+          continue;
+        }
 
-     /* Username.  */
-    username = &buffer[counter];
+      /* Username.  */
+      username = &buffer[counter];
 
-    while (buffer[counter++] != '\0');
-    /* Password.  */
+      while (buffer[counter++] != '\0');
+      /* Password.  */
 
-    while (buffer[counter++] != '\0');
-    /* User ID.  */
+      while (buffer[counter++] != '\0');
+      /* User ID.  */
 
-    while (buffer[counter++] != '\0');
-    /* Group ID.  */
+      while (buffer[counter++] != '\0');
+      /* Group ID.  */
 
-    while (buffer[counter++] != '\0');
-    /* Info.  */
+      while (buffer[counter++] != '\0');
+      /* Info.  */
 
-    while (buffer[counter++] != '\0');
-    /* Home.  */
+      while (buffer[counter++] != '\0');
+      /* Home.  */
 
-    home = &buffer[counter++];
-    sUsername = string (username);
-    sHome = new string (home);
+      home = &buffer[counter++];
+      sUsername = string (username);
+      sHome = new string (home);
 
-    old = data.put (sUsername, sHome);
+      old = data.put (sUsername, sHome);
 
-    if (old)
-      delete old;
+      if (old)
+        delete old;
 
-    while (buffer[counter++] != '\0');
-    /* Shell.  */
+      while (buffer[counter++] != '\0');
+      /* Shell.  */
 
-    while (buffer[counter++] != '\n');
-    /* Next tuple.  */
+      while (buffer[counter++] != '\n');
+      /* Next tuple.  */
   }
   delete [] buffer;
   usersFile.close ();
@@ -220,13 +223,13 @@ int HomeDir::loadImpl()
 }
 
 /*!
- *Get the home directory for a specified user and write
- *it directly to the supplied buffer.
- *\param userName The user name.
- *\param out The buffer where write.
- *\return 0 on success.
+ * Get the home directory for a specified user and write
+ * it directly to the supplied buffer.
+ * \param userName The user name.
+ * \param out The buffer where write.
+ * \return 0 on success.
  */
-int HomeDir::getHomeDir(string& userName, string& out)
+int HomeDir::getHomeDir (string& userName, string& out)
 {
 #ifdef WIN32
   out.assign (data);
@@ -255,19 +258,16 @@ int HomeDir::getHomeDir(string& userName, string& out)
     return 1;
 
   if (getTicks () - lastCheckTime > MYSERVER_SEC (1))
-  {
-    if(FilesUtility::getLastModTime ("/etc/passwd") != timestamp)
-      load ();
-    lastCheckTime = getTicks ();
-  }
+    {
+      if (FilesUtility::getLastModTime ("/etc/passwd") != timestamp)
+        load ();
+      lastCheckTime = getTicks ();
+    }
   res = data.get (userName);
   if (res)
-  {
-    out.assign (*res);
-  }
+      out.assign (*res);
   else
     out.assign ("");
 #endif
-
   return 0;
 }
diff --git a/myserver/src/base/pipe/pipe.cpp b/myserver/src/base/pipe/pipe.cpp
index 4341d06..3171019 100644
--- a/myserver/src/base/pipe/pipe.cpp
+++ b/myserver/src/base/pipe/pipe.cpp
@@ -21,21 +21,22 @@ along with this program.  If not, see 
<http://www.gnu.org/licenses/>.
 #include <include/base/pipe/pipe.h>
 
 #ifndef WIN32
-extern "C" {
-#include <fcntl.h>
-#include <unistd.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <errno.h>
-#include <stdio.h>
-#include <fcntl.h>
-#include <stdlib.h>
-#include <string.h>
-#include <math.h>
-#include <time.h>
+extern "C"
+{
+# include <fcntl.h>
+# include <unistd.h>
+# include <sys/types.h>
+# include <sys/stat.h>
+# include <errno.h>
+# include <stdio.h>
+# include <fcntl.h>
+# include <stdlib.h>
+# include <string.h>
+# include <math.h>
+# include <time.h>
 }
 #else
-#include <windows.h>
+# include <windows.h>
 #endif
 
 #include <string>
diff --git a/myserver/src/protocol/http/http.cpp 
b/myserver/src/protocol/http/http.cpp
index 93f18ce..917bffd 100644
--- a/myserver/src/protocol/http/http.cpp
+++ b/myserver/src/protocol/http/http.cpp
@@ -51,23 +51,22 @@ using namespace std;
 extern "C"
 {
 #ifdef WIN32
-#include <direct.h>
-#include <errno.h>
+# include <direct.h>
+# include <errno.h>
 #endif
 
 #ifndef WIN32
-#include <string.h>
-#include <errno.h>
+# include <string.h>
+# include <errno.h>
 #endif
 }
 
 static HttpStaticData staticHttp;
 
 /*!
- *Get a pointer to a structure shared among all the instances.
+ * Get a pointer to a structure shared among all the instances.
  */
-HttpStaticData*
-Http::getStaticData ()
+HttpStaticData* Http::getStaticData ()
 {
   return &staticHttp;
 }
@@ -77,10 +76,9 @@ HttpStaticData::HttpStaticData () { }
 HttpStaticData::~HttpStaticData () { }
 
 /*!
- *Build a response for an OPTIONS request.
+ * Build a response for an OPTIONS request.
  */
-int
-Http::optionsHTTPRESOURCE (string& filename, int yetmapped)
+int Http::optionsHTTPRESOURCE (string& filename, int yetmapped)
 {
   int ret;
   string time;
@@ -136,10 +134,9 @@ Http::optionsHTTPRESOURCE (string& filename, int yetmapped)
 }
 
 /*!
- *Handle the HTTP TRACE command.
+ * Handle the HTTP TRACE command.
  */
-int
-Http::traceHTTPRESOURCE (string& filename, int yetmapped)
+int Http::traceHTTPRESOURCE (string& filename, int yetmapped)
 {
   int ret;
   char tmpStr[12];
@@ -170,7 +167,7 @@ Http::traceHTTPRESOURCE (string& filename, int yetmapped)
               << "Content-Type: message/http\r\n"
               << "Accept-Ranges: bytes\r\n\r\n";
 
-      /*! Send our HTTP header.  */
+      /* Send our HTTP header.  */
       ret = td->connection->socket->send (td->secondaryBuffer->getBuffer (),
                                           (u_long) 
td->secondaryBuffer->getLength (), 0);
       if (ret == SOCKET_ERROR)
@@ -183,7 +180,7 @@ Http::traceHTTPRESOURCE (string& filename, int yetmapped)
           return 0;
         }
 
-      /*! Send the client request header as the HTTP body.  */
+      /* Send the client request header as the HTTP body.  */
       ret = td->connection->socket->send (td->buffer->getBuffer (),
                                           contentLength, 0);
       if (ret == SOCKET_ERROR)
@@ -205,12 +202,11 @@ Http::traceHTTPRESOURCE (string& filename, int yetmapped)
 }
 
 /*!
- *Check if the method is allowed.
- *\param method The HTTP method name.
- *\return true if it is allowed.
+ * Check if the method is allowed.
+ * \param method The HTTP method name.
+ * \return true if it is allowed.
  */
-bool
-Http::allowMethod (const char *method)
+bool Http::allowMethod (const char *method)
 {
   char name[64];
   sprintf (name, "http.%s.allow", method);
@@ -225,40 +221,35 @@ Http::allowMethod (const char *method)
 }
 
 /*!
- *Get the timeout for the cgi.
+ * Get the timeout for the cgi.
  */
-u_long
-Http::getTimeout ()
+u_long Http::getTimeout ()
 {
   return staticHttp.timeout;
 }
 
 /*!
- *Main function to handle the HTTP PUT command.
+ * Main function to handle the HTTP PUT command.
  */
-int
-Http::putHTTPRESOURCE (string& filename,
-                       int sysReq,
-                       int onlyHeader,
-                       int yetmapped)
+int Http::putHTTPRESOURCE (string& filename, int sysReq, int onlyHeader,
+                           int yetmapped)
 {
   return sendHTTPResource (filename, sysReq, onlyHeader, yetmapped);
 }
 
 /*!
- *Get the file permissions mask.
- *\param filename Resource to access.
- *\param directory Directory where the resource is.
- *\param file The file specified by the resource.
- *\param filenamePath Complete path to the file.
- *\param yetmapped Is the resource mapped to the localfilesystem?
- *\param permissions Permission mask for this resource.
- *\return Return 200 on success.
- *\return Any other value is the HTTP error code.
+ * Get the file permissions mask.
+ * \param filename Resource to access.
+ * \param directory Directory where the resource is.
+ * \param file The file specified by the resource.
+ * \param filenamePath Complete path to the file.
+ * \param yetmapped Is the resource mapped to the localfilesystem?
+ * \param permissions Permission mask for this resource.
+ * \return Return 200 on success.
+ * \return Any other value is the HTTP error code.
  */
-int
-Http::getFilePermissions (string& filename, string& directory, string& file,
-                          string &filenamePath, int yetmapped, int* 
permissions)
+int Http::getFilePermissions (string& filename, string& directory, string& 
file,
+                              string &filenamePath, int yetmapped, int* 
permissions)
 {
   try
     {
@@ -273,29 +264,25 @@ Http::getFilePermissions (string& filename, string& 
directory, string& file,
       td->securityToken.setResource (&filenamePath);
       td->securityToken.setDirectory (&directory);
 
-      /*!
-       *td->filenamePath is the file system mapped path while filename
-       *is the uri requested.
-       *systemrequest is 1 if the file is in the system directory.
-       *If filename is already mapped on the file system don't map it again.
+      /*
+       * td->filenamePath is the file system mapped path while filename
+       * is the uri requested.
+       * systemrequest is 1 if the file is in the system directory.
+       * If filename is already mapped on the file system don't map it again.
        */
       if (yetmapped)
-        {
-          filenamePath.assign (filename);
-        }
+        filenamePath.assign (filename);
       else
         {
           int ret;
-          /*!
-           *If the client tries to access files that aren't in the web 
directory
-           *send a HTTP 401 error page.
+          /*
+           * If the client tries to access files that aren't in the web 
directory
+           * send a HTTP 401 error page.
            */
           translateEscapeString (filename);
           if ((filename[0] != '\0') &&
               (FilesUtility::getPathRecursionLevel (filename) < 1))
-            {
-              return 401;
-            }
+            return 401;
 
           ret = getPath (filenamePath, filename, 0);
 
@@ -305,21 +292,17 @@ Http::getFilePermissions (string& filename, string& 
directory, string& file,
 
       if (FilesUtility::isLink (td->filenamePath.c_str ()))
         {
-          const char *perm = td->securityToken.getHashedData 
("symlinks.follow", MYSERVER_VHOST_CONF |
-                                                              
MYSERVER_SERVER_CONF, "NO");
+          const char *perm = td->securityToken.getHashedData 
("symlinks.follow", 
+                              MYSERVER_VHOST_CONF | MYSERVER_SERVER_CONF, 
"NO");
 
           if (!perm || strcmpi (perm, "YES"))
             return raiseHTTPError (401);
         }
 
       if (FilesUtility::isDirectory (filenamePath.c_str ()))
-        {
-          directory.assign (filenamePath);
-        }
+        directory.assign (filenamePath);
       else
-        {
-          FilesUtility::splitPath (filenamePath, directory, file);
-        }
+        FilesUtility::splitPath (filenamePath, directory, file);
 
       if (td->connection->protocolBuffer == 0)
         {
@@ -342,14 +325,14 @@ Http::getFilePermissions (string& filename, string& 
directory, string& file,
         }
       else
         {
-          /* The default user is Guest with a null password. */
+          /* The default user is Guest with a null password.  */
           user.assign ("Guest");
           password.assign ("");
         }
       if (*permissions == -1)
         {
           td->connection->host->warningsLogWrite (
-                                                  "HTTP<ERROR>: Error reading 
security file.");
+                                   "HTTP<ERROR>: Error reading security 
file.");
           return 500;
         }
 
@@ -368,15 +351,13 @@ Http::getFilePermissions (string& filename, string& 
directory, string& file,
       SecurityDomain * domains[] = {&auth, &httpReqSecDom, NULL};
 
       Server::getInstance ()->getSecurityManager ()->getPermissionMask 
(&(td->securityToken),
-                                                                        
domains,
-                                                                        
validator, authMethod);
+                                                         domains, validator, 
authMethod);
 
-      const char *authType = td->securityToken.getHashedData ("http.auth", 
MYSERVER_SECURITY_CONF |
-                                                              
MYSERVER_VHOST_CONF |
-                                                              
MYSERVER_SERVER_CONF);
+      const char *authType = td->securityToken.getHashedData ("http.auth",
+           MYSERVER_SECURITY_CONF | MYSERVER_VHOST_CONF | 
MYSERVER_SERVER_CONF);
       *permissions = td->securityToken.getMask ();
 
-      /*! Check if we have to use digest for the current directory. */
+      /* Check if we have to use digest for the current directory.  */
       if (authType && !strcmpi (authType, "Digest"))
         {
           HttpUserData* hud = (HttpUserData*) td->connection->protocolBuffer;
@@ -396,11 +377,9 @@ Http::getFilePermissions (string& filename, string& 
directory, string& file,
             }
           td->authScheme = HTTP_AUTH_SCHEME_DIGEST;
         }
-        /*! By default use the Basic authentication scheme. */
+        /* By default use the Basic authentication scheme. */
       else
-        {
-          td->authScheme = HTTP_AUTH_SCHEME_BASIC;
-        }
+        td->authScheme = HTTP_AUTH_SCHEME_BASIC;
     }
   catch (...)
     {
@@ -417,7 +396,7 @@ Http::getFilePermissions (string& filename, string& 
directory, string& file,
                                                     MYSERVER_VHOST_CONF |
                                                     MYSERVER_SERVER_CONF);
 
-  /*! If a throttling rate was specifed use it.  */
+  /* If a throttling rate was specifed use it.  */
   if (tr)
     td->connection->socket->setThrottling (atoi (tr));
 
@@ -425,15 +404,14 @@ Http::getFilePermissions (string& filename, string& 
directory, string& file,
 }
 
 /*!
- *Preprocess a HTTP request.
- *\param filename Resource to access.
- *\param yetmapped Is the resource mapped to the localfilesystem?
- *\param permissions Permission mask for this resource.
- *\return Return 200 on success.
- *\return Any other value is the HTTP error code.
+ * Preprocess a HTTP request.
+ * \param filename Resource to access.
+ * \param yetmapped Is the resource mapped to the localfilesystem?
+ * \param permissions Permission mask for this resource.
+ * \return Return 200 on success.
+ * \return Any other value is the HTTP error code.
  */
-int
-Http::preprocessHttpRequest (string& filename, int yetmapped, int* permissions)
+int Http::preprocessHttpRequest (string& filename, int yetmapped, int* 
permissions)
 {
   string directory;
   string file;
@@ -471,12 +449,12 @@ Http::preprocessHttpRequest (string& filename, int 
yetmapped, int* permissions)
       for (u_long i = 0;;)
         {
           /*
-           *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.
+           * 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 there is the '/' character check if dirscan is a file.
            */
 
           u_long next = td->filenamePath.find ('/', i + 1);
@@ -493,9 +471,7 @@ Http::preprocessHttpRequest (string& filename, int 
yetmapped, int* permissions)
                   td->filenamePath.erase (next);
                 }
               else
-                {
-                  td->pathInfo.assign ("");
-                }
+                td->pathInfo.assign ("");
 
               break;
             }
@@ -503,8 +479,7 @@ Http::preprocessHttpRequest (string& filename, int 
yetmapped, int* permissions)
           if (next >= filenamePathLen)
             break;
 
-          if (mimeLoc ||
-              !FilesUtility::isDirectory (curr.c_str ()))
+          if (mimeLoc || !FilesUtility::isDirectory (curr.c_str ()))
             {
               td->pathInfo.assign (&(td->filenamePath.c_str ()[next]));
               td->filenamePath.erase (next);
@@ -550,22 +525,18 @@ Http::preprocessHttpRequest (string& filename, int 
yetmapped, int* permissions)
 }
 
 /*!
- *Delete the resource identified by filename.
+ * Delete the resource identified by filename.
  */
-int
-Http::deleteHTTPRESOURCE (string& filename,
-                          int sysReq,
-                          int onlyHeader,
+int Http::deleteHTTPRESOURCE (string& filename, int sysReq, int onlyHeader,
                           int yetmapped)
 {
   return sendHTTPResource (filename, sysReq, onlyHeader, yetmapped);
 }
 
 /*!
- *Check the Digest authorization
+ * Check the Digest authorization
  */
-u_long
-Http::checkDigest ()
+u_long Http::checkDigest ()
 {
   Md5 md5;
   char A1[48];
@@ -573,7 +544,7 @@ Http::checkDigest ()
   char response[48];
   char *uri;
   u_long digestCount;
-  /*! Return 0 if the password is different.  */
+  /* Return 0 if the password is different.  */
   if (td->request.digestOpaque[0] && strcmp (td->request.digestOpaque,
                                              ((HttpUserData*) 
td->connection->protocolBuffer)->opaque))
     return 0;
@@ -592,7 +563,7 @@ Http::checkDigest ()
   md5.init ();
   td->secondaryBuffer->setLength (0);
   *td->secondaryBuffer << td->request.digestUsername << ":" << 
td->request.digestRealm
-          << ":" << td->securityToken.getNeededPassword ();
+                       << ":" << td->securityToken.getNeededPassword ();
 
   md5.update ((unsigned char const*) td->secondaryBuffer->getBuffer (),
               (unsigned int) td->secondaryBuffer->getLength ());
@@ -627,7 +598,7 @@ Http::checkDigest ()
 }
 
 /*!
- *Create the buffer.
+ * Create the buffer.
  */
 HttpUserData::HttpUserData ()
 {
@@ -635,12 +606,12 @@ HttpUserData::HttpUserData ()
 }
 
 /*!
- *Destroy the buffer.
+ * Destroy the buffer.
  */
 HttpUserData::~HttpUserData () { }
 
 /*!
- *Reset the structure.
+ * Reset the structure.
  */
 void
 HttpUserData::reset ()
@@ -655,22 +626,22 @@ HttpUserData::reset ()
 }
 
 /*!
- *Main function to send a resource to a client.
+ * Main function to send a resource to a client.
  */
 int
 Http::sendHTTPResource (string& uri, int systemrequest, int onlyHeader,
                         int yetmapped)
 {
-  /*!
-   *With this code we manage a request of a file or a directory or anything
-   *that we must send over the HTTP.
+  /*
+   * With this code we manage a request of a file or a directory or anything
+   * that we must send over the HTTP.
    */
   string filename;
   const char *cgiManager;
   int ret;
   HttpDataHandler *manager;
 
-  /*! By default allows only few actions. */
+  /* By default allows only few actions.  */
   td->permissions = MYSERVER_PERMISSION_READ | MYSERVER_PERMISSION_BROWSE;
 
   try
@@ -705,8 +676,6 @@ Http::sendHTTPResource (string& uri, int systemrequest, int 
onlyHeader,
           cgiManager = "";
         }
 
-
-
       if (td->mime && (manager = staticHttp.dynManagerList.getHttpManager 
(td->mime->cmdName)))
         return manager->send (td, td->filenamePath.c_str (), cgiManager,
                               td->mime->selfExecuted, onlyHeader);
@@ -744,10 +713,9 @@ Http::sendHTTPResource (string& uri, int systemrequest, 
int onlyHeader,
 }
 
 /*!
- *Log the access using the Common Log Format or the Combined one.
+ * Log the access using the Common Log Format or the Combined one.
  */
-int
-Http::logHTTPaccess ()
+int Http::logHTTPaccess ()
 {
   char tmpStrInt[12];
 
@@ -817,7 +785,7 @@ Http::logHTTPaccess ()
       *td->secondaryBuffer << "\n" << end_str;
 #endif
       /*!
-       *Request the access to the log file then append the message.
+       * Request the access to the log file then append the message.
        */
       if (td->connection->host)
         {
@@ -833,12 +801,10 @@ Http::logHTTPaccess ()
 }
 
 /*!
- *This is the HTTP protocol main procedure to parse a request
- *over HTTP.
+ * This is the HTTP protocol main procedure to parse a request over HTTP.
  */
-int
-Http::controlConnection (ConnectionPtr a, char* /*b1*/, char* /*b2*/,
-                         int bs1, int bs2, u_long nbtr, u_long id)
+int Http::controlConnection (ConnectionPtr a, char* /*b1*/, char* /*b2*/,
+                             int bs1, int bs2, u_long nbtr, u_long id)
 {
   int retvalue = -1;
   int ret = 0;
@@ -877,27 +843,28 @@ Http::controlConnection (ConnectionPtr a, char* /*b1*/, 
char* /*b2*/,
       }
       td->other.clear ();
 
-      /*!
-       *Reset the request and response structures.
+      /*
+       * Reset the request and response structures.
        */
       HttpHeaders::resetHTTPRequest (&td->request);
       HttpHeaders::resetHTTPResponse (&td->response);
 
-      /*! Reset the HTTP status once per request. */
+      /* Reset the HTTP status once per request. */
       td->response.httpStatus = 200;
 
-      /*!
-       *If the connection must be removed, remove it.
+      /*
+       * If the connection must be removed, remove it.
        */
       if (td->connection->getToRemove ())
         {
           switch (td->connection->getToRemove ())
             {
-              /*! Remove the connection from the list.  */
+              /* Remove the connection from the list.  */
             case CONNECTION_REMOVE_OVERLOAD:
               retvalue = raiseHTTPError (503);
               logHTTPaccess ();
               return ClientsThread::DELETE_CONNECTION;
+
             default:
               return ClientsThread::DELETE_CONNECTION;
             }
@@ -909,7 +876,7 @@ Http::controlConnection (ConnectionPtr a, char* /*b1*/, 
char* /*b2*/,
                                                                 &(td->request),
                                                                 
td->connection);
 
-      /*! -1 means the request is not complete yet. */
+      /* -1 means the request is not complete yet. */
       if (validRequest == -1)
         {
           return ClientsThread::INCOMPLETE_REQUEST;
@@ -918,29 +885,27 @@ Http::controlConnection (ConnectionPtr a, char* /*b1*/, 
char* /*b2*/,
       if (a->protocolBuffer)
         ((HttpUserData*) a->protocolBuffer)->digestChecked = 0;
 
-      /*!
-       *If the validRequest cointains an error code send it to the user.
-       */
+      /* If the validRequest cointains an error code send it to the user.  */
       if (validRequest != 200)
         {
           retvalue = raiseHTTPError (validRequest);
           logHTTPaccess ();
           return ClientsThread::DELETE_CONNECTION;
         }
-      /*! Be sure that we can handle the HTTP version.  */
+      /* Be sure that we can handle the HTTP version.  */
       if ((td->request.ver.compare ("HTTP/1.1")) &&
           (td->request.ver.compare ("HTTP/1.0")) &&
           (td->request.ver.compare ("HTTP/0.9")))
         {
           raiseHTTPError (505);
           logHTTPaccess ();
-          /*! Remove the connection from the list.  */
+          /* Remove the connection from the list.  */
           return ClientsThread::DELETE_CONNECTION;
         }
 
       td->response.ver.assign (td->request.ver.c_str ());
 
-      /*! Do not use Keep-Alive with HTTP version older than 1.1.  */
+      /* Do not use Keep-Alive with HTTP version older than 1.1.  */
       if (td->request.ver.compare ("HTTP/1.1"))
         {
           HttpRequestHeader::Entry *connection =
@@ -952,9 +917,9 @@ Http::controlConnection (ConnectionPtr a, char* /*b1*/, 
char* /*b2*/,
             }
         }
 
-      /*!
-       *For methods that accept data after the HTTP header set the correct
-       *pointer and create a file containing the informations after the header.
+      /*
+       * For methods that accept data after the HTTP header set the correct
+       * pointer and create a file containing the informations after the 
header.
        */
       FilesUtility::temporaryFileName (td->id, td->inputDataPath);
       FilesUtility::temporaryFileName (td->id, td->outputDataPath);
@@ -969,7 +934,7 @@ Http::controlConnection (ConnectionPtr a, char* /*b1*/, 
char* /*b2*/,
           int ret;
           int httpErrorCode;
 
-          /*! Be sure that the client can handle the 100 status code.  */
+          /* Be sure that the client can handle the 100 status code.  */
           if (nbtr == td->nHeaderChars && td->request.contentLength.compare 
("0") &&
               td->request.ver.compare ("HTTP/1.0"))
             {
@@ -1006,14 +971,14 @@ Http::controlConnection (ConnectionPtr a, char* /*b1*/, 
char* /*b2*/,
           td->request.uriOptsPtr = 0;
         }
 
-      /*! If return value is not configured propertly.  */
+      /* If return value is not configured propertly.  */
       if (retvalue == -1)
         {
-          /*!
-           *How is expressly said in the RFC2616 a client that sends an
-           *HTTP/1.1 request MUST sends a Host header.
-           *Servers MUST reports a 400 (Bad request) error if an HTTP/1.1
-           *request does not include a Host request-header.
+          /*
+           * How is expressly said in the RFC2616 a client that sends an
+           * HTTP/1.1 request MUST sends a Host header.
+           * Servers MUST reports a 400 (Bad request) error if an HTTP/1.1
+           * request does not include a Host request-header.
            */
           HttpRequestHeader::Entry *host = td->request.other.get ("Host");
 
@@ -1021,18 +986,14 @@ Http::controlConnection (ConnectionPtr a, char* /*b1*/, 
char* /*b2*/,
               ((host && host->value->length () == 0) || (host == 0)))
             {
               raiseHTTPError (400);
-              /*!
-               *If the inputData file was not closed close it.
-               */
+              /* If the inputData file was not closed close it.  */
               if (td->inputData.getHandle ())
                 {
                   td->inputData.close ();
                   FilesUtility::deleteFile (td->inputDataPath);
                 }
 
-              /*!
-               *If the outputData file was not closed close it.
-               */
+              /* If the outputData file was not closed close it.  */
               if (td->outputData.getHandle ())
                 {
                   td->outputData.close ();
@@ -1043,12 +1004,10 @@ Http::controlConnection (ConnectionPtr a, char* /*b1*/, 
char* /*b2*/,
             }
           else
             {
-              /*!
-               *Find the virtual host to check both host name and IP value.
-               */
+              /* Find the virtual host to check both host name and IP value.  
*/
               Vhost* newHost = Server::getInstance ()->getVhosts ()->getVHost 
(host ?
-                                                                               
host->value->c_str () : "",
-                                                                               
a->getLocalIpAddr (), a->getLocalPort ());
+                                                           host->value->c_str 
() : "",
+                                            a->getLocalIpAddr (), 
a->getLocalPort ());
               if (a->host)
                 a->host->removeRef ();
               a->host = newHost;
@@ -1061,7 +1020,7 @@ Http::controlConnection (ConnectionPtr a, char* /*b1*/, 
char* /*b2*/,
                   Server::getInstance ()->logWriteln (errMsg.c_str (), 
MYSERVER_LOG_MSG_ERROR);
 
                   raiseHTTPError (400);
-                  /*!
+                  /*
                    *If the inputData file was not closed close it.
                    */
                   if (td->inputData.getHandle ())
@@ -1069,9 +1028,8 @@ Http::controlConnection (ConnectionPtr a, char* /*b1*/, 
char* /*b2*/,
                       td->inputData.close ();
                       FilesUtility::deleteFile (td->inputDataPath);
                     }
-                  /*!
-                   *If the outputData file was not closed close it.
-                   */
+
+                   /* If the outputData file was not closed close it.  */
                   if (td->outputData.getHandle ())
                     {
                       td->outputData.close ();
@@ -1097,13 +1055,11 @@ Http::controlConnection (ConnectionPtr a, char* /*b1*/, 
char* /*b2*/,
               if (documentRoot.length ())
                 {
                   const char *useHomeDir = td->securityToken.getHashedData 
("http.use_home_directory",
-                                                                            
MYSERVER_VHOST_CONF |
-                                                                            
MYSERVER_SERVER_CONF, "YES");
+                                                   MYSERVER_VHOST_CONF | 
MYSERVER_SERVER_CONF, "YES");
 
 
                   const char *homeDir = td->securityToken.getHashedData 
("http.home_directory",
-                                                                         
MYSERVER_VHOST_CONF |
-                                                                         
MYSERVER_SERVER_CONF,
+                                                   MYSERVER_VHOST_CONF | 
MYSERVER_SERVER_CONF,
                                                                          
"public_html");
 
                   if (strcmpi (useHomeDir, "YES"))
@@ -1127,7 +1083,7 @@ Http::controlConnection (ConnectionPtr a, char* /*b1*/, 
char* /*b2*/,
                 }
             }
 
-          /*!
+          /*
            *Check if there is a limit for the number of connections in the
            *virtual host A value of zero means no limit.
            */
@@ -1144,21 +1100,17 @@ Http::controlConnection (ConnectionPtr a, char* /*b1*/, 
char* /*b2*/,
                     retvalue = raiseHTTPError (500);
                     logHTTPaccess ();
                     return retvalue ? ClientsThread::KEEP_CONNECTION
-                            : ClientsThread::DELETE_CONNECTION;
+                                    : ClientsThread::DELETE_CONNECTION;
                   }
               }
           }
 
           if (td->request.isKeepAlive ())
             {
-              /*!
-               *Support for HTTP pipelining.
-               */
+              /* Support for HTTP pipelining.  */
               if (contentLength == 0)
                 {
-                  /*!
-                   *connectionBuffer is 8 KB, so don't copy more bytes.
-                   */
+                  /*  connectionBuffer is 8 KB, so don't copy more bytes.  */
                   u_long bufferStrLen = strlen (td->buffer->getBuffer ());
                   u_long remainingData = 0;
 
@@ -1187,9 +1139,9 @@ Http::controlConnection (ConnectionPtr a, char* /*b1*/, 
char* /*b2*/,
               retvalue = ClientsThread::DELETE_CONNECTION;
             }
 
-          /*!
-           *Set the throttling rate for the socket. This setting can be
-           *changed later.
+          /*
+           * Set the throttling rate for the socket. This setting can be
+           * changed later.
            */
           if (a->host->getThrottlingRate () == (u_long) - 1)
             a->socket->setThrottling (Server::getInstance 
()->getThrottlingRate ());
@@ -1271,17 +1223,14 @@ Http::controlConnection (ConnectionPtr a, char* /*b1*/, 
char* /*b2*/,
           logHTTPaccess ();
         }
 
-      /*
-       *If the inputData file was not closed close it.
-       */
+      /* If the inputData file was not closed close it.  */
       if (td->inputData.getHandle ())
         {
           td->inputData.close ();
           FilesUtility::deleteFile (td->inputDataPath);
         }
-      /*
-       *If the outputData file was not closed close it.
-       */
+
+       /* If the outputData file was not closed close it.  */
       if (td->outputData.getHandle ())
         {
           td->outputData.close ();
@@ -1311,10 +1260,9 @@ Http::controlConnection (ConnectionPtr a, char* /*b1*/, 
char* /*b2*/,
 }
 
 /*!
- *Compute the Digest outputting it to a buffer.
+ * Compute the Digest outputting it to a buffer.
  */
-void
-Http::computeDigest (char* out, char* buffer)
+void Http::computeDigest (char* out, char* buffer)
 {
   Md5 md5;
   if (!out)
@@ -1327,10 +1275,9 @@ Http::computeDigest (char* out, char* buffer)
 }
 
 /*!
- *Send to the client an authorization request.
+ * Send to the client an authorization request.
  */
-int
-Http::requestAuthorization ()
+int Http::requestAuthorization ()
 {
   Md5 md5;
   string time;
@@ -1368,7 +1315,7 @@ Http::requestAuthorization ()
       myserver_strlcpy (((HttpUserData*) 
td->connection->protocolBuffer)->realm,
                         host ? host->value->c_str () : "", 48);
 
-      /*! Just a random string.  */
+      /* Just a random string.  */
       md5Str[0] = (char) td->id;
       md5Str[1] = (char) ((clock () >> 24) & 0xFF);
       md5Str[2] = (char) ((clock () >> 16) & 0xFF);
@@ -1408,9 +1355,7 @@ Http::requestAuthorization ()
     }
   else
     {
-      /*!
-       *Send a non implemented error page if the auth scheme is not known.
-       */
+      /* Send a non implemented error page if the auth scheme is not known.  */
       return raiseHTTPError (501);
     }
   *td->secondaryBuffer << "Date: ";
@@ -1427,11 +1372,10 @@ Http::requestAuthorization ()
 }
 
 /*!
- *Sends an error page to the client.
- *Nonzero to keep the connection.
+ * Sends an error page to the client.
+ * Nonzero to keep the connection.
  */
-int
-Http::raiseHTTPError (int ID)
+int Http::raiseHTTPError (int ID)
 {
   try
     {
@@ -1485,9 +1429,7 @@ Http::raiseHTTPError (int ID)
           ostringstream nURL;
           int isPortSpecified = 0;
           const char* hostStr = host ? host->value->c_str () : "";
-          /*!
-           *Change the URI to reflect the default file name.
-           */
+           /* Change the URI to reflect the default file name.  */
           nURL << protocolPrefix << hostStr;
           for (int i = 0; hostStr[i]; i++)
             {
@@ -1538,7 +1480,7 @@ Http::raiseHTTPError (int ID)
 
       HttpErrors::getErrorMessage (ID, errorMessage);
 
-      /*! Send only the header (and the body if specified). */
+      /* Send only the header (and the body if specified).  */
       {
         const char* value = td->securityToken.getHashedData ("http.error_body",
                                                              
MYSERVER_VHOST_CONF |
@@ -1588,10 +1530,9 @@ Http::raiseHTTPError (int ID)
 }
 
 /*!
- *Send a hard wired 500 error when we have a system error
+ * Send a hard wired 500 error when we have a system error
  */
-int
-Http::sendHTTPhardError500 ()
+int Http::sendHTTPhardError500 ()
 {
   MemBuf tmp;
   char tmpStr[12];
@@ -1633,11 +1574,10 @@ Internal Server Error\n\
   getRFC822GMTTime (time, HTTP_RESPONSE_DATE_DIM);
   *td->secondaryBuffer << time;
   *td->secondaryBuffer << "\r\n\r\n";
-  /*! Send the header.  */
+
   if (td->connection->socket->send (td->secondaryBuffer->getBuffer (),
                                     (u_long) td->secondaryBuffer->getLength 
(), 0) != -1)
     {
-      /*! Send the body.  */
       if (!td->onlyHeader)
         td->connection->socket->send (hardHTML, (u_long) strlen (hardHTML), 0);
     }
@@ -1645,11 +1585,10 @@ Internal Server Error\n\
 }
 
 /*!
- *Returns the MIME type passing its extension.
- *Returns zero if the file is registered.
+ * Returns the MIME type passing its extension.
+ * Returns zero if the file is registered.
  */
-MimeRecord*
-Http::getMIME (string &filename)
+MimeRecord* Http::getMIME (string &filename)
 {
   if (staticHttp.allowVhostMime && td->connection->host->isMIME ())
     {
@@ -1660,16 +1599,12 @@ Http::getMIME (string &filename)
 }
 
 /*!
- *Map an URL to the machine file system. Return 200 on success.
- *Any other return value is the HTTP error.
+ * Map an URL to the machine file system. Return 200 on success.
+ * Any other return value is the HTTP error.
  */
-int
-Http::getPath (HttpThreadContext* td, string& filenamePath, const char 
*filename,
-               int systemrequest)
+int Http::getPath (HttpThreadContext* td, string& filenamePath,
+                   const char *filename, int systemrequest)
 {
-  /*
-   *If it is a system request, search the file in the system directory.
-   */
   if (systemrequest)
     {
       if (!strlen (td->getVhostSys ())
@@ -1682,26 +1617,23 @@ Http::getPath (HttpThreadContext* td, string& 
filenamePath, const char *filename
         filenamePath.append ("/");
       filenamePath.append (filename);
     }
-    /*
-     *Else the file is in the web directory.
-     */
   else
     {
       if (filename[0])
         {
           const char *root;
           /*
-           *uri starting with a /sys/ will use the system directory as
-           *the root path. Be sure to don't allow access to the system root
-           *but only to subdirectories.
+           * uri starting with a /sys/ will use the system directory as
+           * the root path. Be sure to don't allow access to the system root
+           * but only to subdirectories.
            */
           if (filename[0] == '/' && filename[1] == 's' && filename[2] == 'y'
               && filename[3] == 's' && filename[4] == '/')
             {
               root = td->getVhostSys ();
               /*
-               *Do not allow access to the system directory root but only
-               *to subdirectories.
+               * Do not allow access to the system directory root but only
+               * to subdirectories.
                */
               if (FilesUtility::getPathRecursionLevel (filename) < 2)
                 {
@@ -1730,25 +1662,23 @@ Http::getPath (HttpThreadContext* td, string& 
filenamePath, const char *filename
 }
 
 /*!
- *If a directory is accessed try in order:
+ * If a directory is accessed try in order:
  *
- *1) The default files in order.
- *2) The directory content.
- *3) An error.
+ * 1) The default files in order.
+ * 2) The directory content.
+ * 3) An error.
  *
- *\param uri The accessed URI.
- *\param permissions The permission mask for the client.
- *\param onlyHeader specify if the client requested only the header.
+ * \param uri The accessed URI.
+ * \param permissions The permission mask for the client.
+ * \param onlyHeader specify if the client requested only the header.
  */
-int
-Http::processDefaultFile (string& uri, int permissions, int onlyHeader)
+int Http::processDefaultFile (string& uri, int permissions, int onlyHeader)
 {
   int i;
   int ret;
   string key ("http.default_file");
   NodeTree<string> *node = td->securityToken.getNodeTree (key,
-                                                          MYSERVER_VHOST_CONF |
-                                                          
MYSERVER_SERVER_CONF, NULL);
+                     MYSERVER_VHOST_CONF | MYSERVER_SERVER_CONF, NULL);
 
 
   if (node)
@@ -1756,8 +1686,7 @@ Http::processDefaultFile (string& uri, int permissions, 
int onlyHeader)
       list<NodeTree<string>*> *children = node->getChildren ();
 
       for (list<NodeTree<string>*>::iterator it = children->begin ();
-              it != children->end ();
-              it++)
+           it != children->end (); it++)
         {
           ostringstream defaultFileName;
           const string *file = (*it)->getValue ();
@@ -1787,7 +1716,7 @@ Http::processDefaultFile (string& uri, int permissions, 
int onlyHeader)
               if (td->request.uriOpts.length ())
                 nUrl << "?" << td->request.uriOpts;
 
-              /*! Send a redirect to the new location.  */
+              /* Send a redirect to the new location.  */
               if (sendHTTPRedirect (nUrl.str ().c_str ()))
                 ret = 1;
               else
@@ -1810,10 +1739,9 @@ Http::processDefaultFile (string& uri, int permissions, 
int onlyHeader)
 }
 
 /*!
- *Send a redirect message to the client.
+ * Send a redirect message to the client.
  */
-int
-Http::sendHTTPRedirect (const char *newURL)
+int Http::sendHTTPRedirect (const char *newURL)
 {
   string time;
   HttpRequestHeader::Entry *connection = td->request.other.get ("Connection");
@@ -1847,10 +1775,9 @@ Http::sendHTTPRedirect (const char *newURL)
 }
 
 /*!
- *Send a non-modified message to the client.
+ * Send a non-modified message to the client.
  */
-int
-Http::sendHTTPNonModified ()
+int Http::sendHTTPNonModified ()
 {
   string time;
   HttpRequestHeader::Entry *connection = td->request.other.get ("Connection");
@@ -1879,10 +1806,9 @@ Http::sendHTTPNonModified ()
 }
 
 /*!
- *Send a 401 error.
+ * Send a 401 error.
  */
-int
-Http::sendAuth ()
+int Http::sendAuth ()
 {
   if (td->connection->getnTries () > 2)
     {
@@ -1896,17 +1822,16 @@ Http::sendAuth ()
 }
 
 /*!
- *Load the HTTP protocol.
+ * Load the HTTP protocol.
  */
-int
-Http::loadProtocolStatic (XmlParser* languageParser)
+int Http::loadProtocolStatic (XmlParser* languageParser)
 {
   const char *data = NULL;
   string pluginsResource (Server::getInstance ()->getExternalPath ());
 
   /*
-   *Store defaults value.
-   *By default use GZIP with files bigger than a MB.
+   * Store defaults value.
+   * By default use GZIP with files bigger than a MB.
    */
   staticHttp.timeout = MYSERVER_SEC (15);
 
@@ -1941,10 +1866,9 @@ Http::loadProtocolStatic (XmlParser* languageParser)
 }
 
 /*!
- *Unload the HTTP protocol.
+ * Unload the HTTP protocol.
  */
-int
-Http::unLoadProtocolStatic (XmlParser* languageParser)
+int Http::unLoadProtocolStatic (XmlParser* languageParser)
 {
   /* Unload the errors.  */
   HttpErrors::unLoad ();
@@ -1955,11 +1879,10 @@ Http::unLoadProtocolStatic (XmlParser* languageParser)
 }
 
 /*!
- *Returns the name of the protocol. If an out buffer
- *is defined fullfill it with the name too.
+ * Returns the name of the protocol. If an out buffer
+ * is defined fullfill it with the name too.
  */
-char*
-Http::registerNameImpl (char* out, int len)
+char* Http::registerNameImpl (char* out, int len)
 {
   if (out)
     {
@@ -1969,7 +1892,7 @@ Http::registerNameImpl (char* out, int len)
 }
 
 /*!
- *Constructor for the class http.
+ * Constructor for the class http.
  */
 Http::Http ()
 {
@@ -1990,7 +1913,7 @@ Http::Http ()
 }
 
 /*!
- *Destructor for the http class.
+ * Destructor for the http class.
  */
 Http::~Http ()
 {
@@ -1998,10 +1921,9 @@ Http::~Http ()
 }
 
 /*!
- *Clean the used memory.
+ * Clean the used memory.
  */
-void
-Http::clean ()
+void Http::clean ()
 {
   td->filenamePath.assign ("");
   td->pathInfo.assign ("");
diff --git a/myserver/src/protocol/http/http_headers.cpp 
b/myserver/src/protocol/http/http_headers.cpp
index 37ee6af..8f6be37 100755
--- a/myserver/src/protocol/http/http_headers.cpp
+++ b/myserver/src/protocol/http/http_headers.cpp
@@ -39,19 +39,19 @@ extern "C"
 }
 
 /*!
- *Builds an HTTP header string starting from an HttpResponseHeader structure.
- *\param str The buffer where write the HTTP header.
- *\param response the HttpResponseHeader where the HTTP data is.
+ * Builds an HTTP header string starting from an HttpResponseHeader structure.
+ * \param str The buffer where write the HTTP header.
+ * \param response the HttpResponseHeader where the HTTP data is.
  *
- *\return The number of bytes written to STR.
+ * \return The number of bytes written to STR.
  */
-u_long HttpHeaders::buildHTTPResponseHeader (char *str, 
+u_long HttpHeaders::buildHTTPResponseHeader (char *str,
                                              HttpResponseHeader* response)
 {
   /*
-   *Here we build the HTTP response header.
-   *Passing a HttpResponseHeader struct this builds an header string.
-   *Every directive ends with a \r\n sequence.
+   * Here we build the HTTP response header.
+   * Passing a HttpResponseHeader struct this builds an header string.
+   * Every directive ends with a \r\n sequence.
    */
   char *pos = str;
   const int MAX = MYSERVER_KB (8);
@@ -62,12 +62,12 @@ u_long HttpHeaders::buildHTTPResponseHeader (char *str,
       HttpErrors::getErrorMessage (response->httpStatus, response->errorType);
     }
     pos += sprintf (str, "%s %i %s\r\nStatus: %s\r\n", response->ver.c_str (),
-                    response->httpStatus, response->errorType.c_str (), 
+                    response->httpStatus, response->errorType.c_str (),
                     response->errorType.c_str () );
   }
   else
     pos += sprintf (str,"%s 200 OK\r\n",response->ver.c_str ());
-  
+
   if (response->serverName.length ())
     {
       pos += myserver_strlcpy (pos, "Server: ", MAX-(long)(pos-str));
@@ -84,7 +84,7 @@ u_long HttpHeaders::buildHTTPResponseHeader (char *str,
   if (response->lastModified.length ())
     {
       pos += myserver_strlcpy (pos,"Last-Modified: ", MAX-(long)(pos-str));
-      pos += myserver_strlcpy (pos, response->lastModified.c_str (), 
+      pos += myserver_strlcpy (pos, response->lastModified.c_str (),
                                MAX-(long)(pos-str));
       pos += myserver_strlcpy (pos,"\r\n", MAX-(long)(pos-str));
     }
@@ -92,7 +92,7 @@ u_long HttpHeaders::buildHTTPResponseHeader (char *str,
   if (response->connection.length ())
     {
       pos += myserver_strlcpy (pos,"Connection: ", MAX-(long)(pos-str));
-      pos += myserver_strlcpy (pos, response->connection.c_str (), 
+      pos += myserver_strlcpy (pos, response->connection.c_str (),
                              MAX-(long)(pos-str));
       pos += myserver_strlcpy (pos, "\r\n", MAX-(long)(pos-str));
     }
@@ -104,8 +104,8 @@ u_long HttpHeaders::buildHTTPResponseHeader (char *str,
   if (response->contentLength.length ())
     {
       /*
-       *Do not specify the Content-Length field if it is used
-       *the chunked Transfer-Encoding.
+       * Do not specify the Content-Length field if it is used
+       * the chunked Transfer-Encoding.
        */
       HttpResponseHeader::Entry *e = response->other.get ("Transfer-Encoding");
 
@@ -129,8 +129,8 @@ u_long HttpHeaders::buildHTTPResponseHeader (char *str,
         break;
           cookie.assign ("Set-Cookie: ");
           cookie.append (token, len);
-          cookie.append ("\r\n");  
-          pos += myserver_strlcpy (pos, cookie.c_str (), MAX-(long)(pos-str)); 
 
+          cookie.append ("\r\n");
+          pos += myserver_strlcpy (pos, cookie.c_str (), MAX-(long)(pos-str));
           token += len + 1;
         }
     }
@@ -173,14 +173,14 @@ u_long HttpHeaders::buildHTTPResponseHeader (char *str,
   if (response->location.length ())
     {
       pos += myserver_strlcpy (pos, "Location: ", MAX - (long)(pos - str));
-      pos += myserver_strlcpy (pos, response->location.c_str (), 
+      pos += myserver_strlcpy (pos, response->location.c_str (),
                                MAX - (long)(pos-str));
       pos += myserver_strlcpy (pos, "\r\n", MAX - (long)(pos - str));
     }
 
   if (response->other.size ())
     {
-      HashMap<string, HttpResponseHeader::Entry*>::Iterator it = 
+      HashMap<string, HttpResponseHeader::Entry*>::Iterator it =
         response->other.begin();
     for (; it != response->other.end(); it++)
       {
@@ -195,25 +195,19 @@ u_long HttpHeaders::buildHTTPResponseHeader (char *str,
       }
     }
 
-  /*
-   *MyServer supports the bytes range.
-   */
   pos += myserver_strlcpy (pos, "Accept-Ranges: bytes\r\n", 
MAX-(long)(pos-str));
-  
-  /*
-   *The HTTP header ends with a \r\n sequence.
-   */
+
   pos += myserver_strlcpy (pos, "\r\n", MAX-(long)(pos-str));
 
   return (pos - str);
 }
 
 /*!
- *Builds an HTTP header string starting from an HttpRequestHeader structure.
- *\param str The buffer where write the HTTP header.
- *\param request the HttpRequestHeader where the HTTP data is.
+ * Builds an HTTP header string starting from an HttpRequestHeader structure.
+ * \param str The buffer where write the HTTP header.
+ * \param request the HttpRequestHeader where the HTTP data is.
  *
- *\return The number of bytes written to STR.
+ * \return The number of bytes written to STR.
  */
 u_long HttpHeaders::buildHTTPRequestHeader (char * str,HttpRequestHeader* 
request)
 {
@@ -225,74 +219,68 @@ u_long HttpHeaders::buildHTTPRequestHeader (char * 
str,HttpRequestHeader* reques
   pos += myserver_strlcpy (pos, " ", MAX-(long)(pos-str));
   pos += myserver_strlcpy (pos, request->uri.c_str (), MAX-(long)(pos-str));
   pos += myserver_strlcpy (pos, " ", MAX-(long)(pos-str));
-
   if (request->uriOpts.length () > 0)
-  {
-    pos += myserver_strlcpy (pos, "?", MAX-(long)(pos-str));
-    pos += myserver_strlcpy (pos, request->uriOpts.c_str (), 
MAX-(long)(pos-str));
-    pos += myserver_strlcpy (pos, " ", MAX-(long)(pos-str));
-
-  }
+    {
+      pos += myserver_strlcpy (pos, "?", MAX-(long)(pos-str));
+      pos += myserver_strlcpy (pos, request->uriOpts.c_str (), 
MAX-(long)(pos-str));
+      pos += myserver_strlcpy (pos, " ", MAX-(long)(pos-str));
+    }
 
   pos += myserver_strlcpy (pos, request->ver.c_str (), MAX-(long)(pos-str));
   pos += myserver_strlcpy (pos, "\r\n", MAX-(long)(pos-str));
-  
-  /* Authorization.  */
+
   if (request->auth.length () > 0)
-  {
-    pos += myserver_strlcpy (pos, "Authorization: ", MAX-(long)(pos-str));
-    pos += myserver_strlcpy (pos, request->auth.c_str (), MAX-(long)(pos-str));
-    pos += myserver_strlcpy (pos, "\r\n", MAX-(long)(pos-str));
-  }
+    {
+      pos += myserver_strlcpy (pos, "Authorization: ", MAX-(long)(pos-str));
+      pos += myserver_strlcpy (pos, request->auth.c_str (), 
MAX-(long)(pos-str));
+      pos += myserver_strlcpy (pos, "\r\n", MAX-(long)(pos-str));
+    }
 
-  /* Content-Length.  */
   if (request->contentLength.length () > 0)
-  {
-    pos += myserver_strlcpy (pos, "Content-Length: ", MAX-(long)(pos-str));
-    pos += myserver_strlcpy (pos, request->contentLength.c_str (), 
MAX-(long)(pos-str));
-    pos += myserver_strlcpy (pos, "\r\n", MAX-(long)(pos-str));
-  }
-
-  /* Range.  */
-  if (request->rangeType.length () > 0)
-  {
-    char buffer[12];
-    pos += myserver_strlcpy (pos, "Range: ", MAX-(long)(pos-str));
-    pos += myserver_strlcpy (pos, request->rangeType.c_str (), 
MAX-(long)(pos-str));
-    pos += myserver_strlcpy (pos, " ", MAX-(long)(pos-str));
-
-    if (request->rangeByteBegin != (u_long)-1)
     {
-      sprintf(buffer, "%lu", request->rangeByteBegin);
-      pos += myserver_strlcpy (pos, buffer, MAX-(long)(pos-str));
+      pos += myserver_strlcpy (pos, "Content-Length: ", MAX-(long)(pos-str));
+      pos += myserver_strlcpy (pos, request->contentLength.c_str (), 
MAX-(long)(pos-str));
+      pos += myserver_strlcpy (pos, "\r\n", MAX-(long)(pos-str));
     }
 
-    pos += myserver_strlcpy (pos, "-", MAX-(long)(pos-str));
-
-    if (request->rangeByteEnd != (u_long)-1)
+  if (request->rangeType.length () > 0)
     {
-      sprintf(buffer, "%lu", request->rangeByteEnd);
-      pos += myserver_strlcpy (pos, buffer, MAX-(long)(pos-str));
-    }
+      char buffer[12];
+      pos += myserver_strlcpy (pos, "Range: ", MAX-(long)(pos-str));
+      pos += myserver_strlcpy (pos, request->rangeType.c_str (), 
MAX-(long)(pos-str));
+      pos += myserver_strlcpy (pos, " ", MAX-(long)(pos-str));
+
+      if (request->rangeByteBegin != (u_long)-1)
+        {
+          sprintf(buffer, "%lu", request->rangeByteBegin);
+          pos += myserver_strlcpy (pos, buffer, MAX-(long)(pos-str));
+        }
 
-    pos += myserver_strlcpy (pos, "\r\n", MAX-(long)(pos-str));
+      pos += myserver_strlcpy (pos, "-", MAX-(long)(pos-str));
+      if (request->rangeByteEnd != (u_long)-1)
+        {
+          sprintf(buffer, "%lu", request->rangeByteEnd);
+          pos += myserver_strlcpy (pos, buffer, MAX-(long)(pos-str));
+        }
+      pos += myserver_strlcpy (pos, "\r\n", MAX-(long)(pos-str));
   }
 
   if (request->other.size())
   {
-    HashMap<string, HttpRequestHeader::Entry*>::Iterator it = 
+    HashMap<string, HttpRequestHeader::Entry*>::Iterator it =
       request->other.begin();
+
     for(; it != request->other.end(); it++)
-    {
-      HttpRequestHeader::Entry *e = *it;
-      if (e)
       {
-        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, "\r\n", MAX-(long)(pos-str));
+        HttpRequestHeader::Entry *e = *it;
+        if (e)
+          {
+            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, "\r\n", MAX-(long)(pos-str));
+          }
       }
-    }
   }
   pos += myserver_strlcpy (pos, "\r\n", MAX-(long)(pos-str));
   return (pos - str);
@@ -300,51 +288,51 @@ u_long HttpHeaders::buildHTTPRequestHeader (char * 
str,HttpRequestHeader* reques
 
 
 /*!
- *Set the defaults value for a HttpResponseHeader structure.
- *\param response The HTTP response header structure to fullfill with
- *the default data.
+ * Set the defaults value for a HttpResponseHeader structure.
+ * \param response The HTTP response header structure to fullfill with
+ * the default data.
  */
 void HttpHeaders::buildDefaultHTTPResponseHeader(HttpResponseHeader* response)
 {
   string date;
   resetHTTPResponse(response);
   /*!
-   *By default use:
-   *-# the MIME type of the page equal to text/html.
-   *-# the version of the HTTP protocol to 1.1.
-   *-# the date of the page and the expire date to the current time.
-   *-# set the name of the server.
-   *-# set the page that it is not an error page.
+   * By default use:
+   * -# the MIME type of the page equal to text/html.
+   * -# the version of the HTTP protocol to 1.1.
+   * -# the date of the page and the expire date to the current time.
+   * -# set the name of the server.
+   * -# set the page that it is not an error page.
    */
-  response->contentType.assign("text/html");
-  response->ver.assign("HTTP/1.1");
+  response->contentType.assign ("text/html");
+  response->ver.assign ("HTTP/1.1");
   getRFC822GMTTime(date,HTTP_RESPONSE_DATE_DIM);
-  response->date.assign(date);
-  response->dateExp.assign(date);
-  response->serverName.assign("GNU MyServer ");
+  response->date.assign (date);
+  response->dateExp.assign (date);
+  response->serverName.assign ("GNU MyServer ");
   response->serverName.append(MYSERVER_VERSION);
 }
 
 /*!
- *Set the defaults value for a HttpResponseHeader structure.
- *\param request The HTTP response header structure to fullfill with
- *the default data.
+ * Set the defaults value for a HttpResponseHeader structure.
+ * \param request The HTTP response header structure to fullfill with
+ * the default data.
  */
 void HttpHeaders::buildDefaultHTTPRequestHeader(HttpRequestHeader* request)
 {
-  request->cmd.assign("GET");
-  request->ver.assign("HTTP/1.1");
-  request->uri.assign("/");
+  request->cmd.assign ("GET");
+  request->ver.assign ("HTTP/1.1");
+  request->uri.assign ("/");
 
   /* HTTP/1.1 MUST specify a host.  */
   request->setValue("Host", "localhost");
-  request->uriOpts.assign("");
+  request->uriOpts.assign ("");
   request->uriOptsPtr = 0;
 }
 
 /*!
- *Reset all the HTTP_REQUEST_HEADER structure members.
- *\param request the HTTP request header to free.
+ * Reset all the HTTP_REQUEST_HEADER structure members.
+ * \param request the HTTP request header to free.
  */
 void HttpHeaders::resetHTTPRequest(HttpRequestHeader *request)
 {
@@ -352,8 +340,8 @@ void HttpHeaders::resetHTTPRequest(HttpRequestHeader 
*request)
 }
 
 /*!
- *Reset all the HttpResponseHeader structure members.
- *\param response the HTTP response header to free.
+ * Reset all the HttpResponseHeader structure members.
+ * \param response the HTTP response header to free.
  */
 void HttpHeaders::resetHTTPResponse(HttpResponseHeader *response)
 {
@@ -361,11 +349,11 @@ void HttpHeaders::resetHTTPResponse(HttpResponseHeader 
*response)
 }
 
 /*!
- *Controls if the req string is a valid HTTP response header.
- *Returns 0 if req is an invalid header, a non-zero value if is a valid header.
- *\param res the buffer with the HTTP header.
- *\param nLinesptr is a value of the lines number in the HEADER.
- *\param ncharsptr is a value of the characters number in the HEADER.
+ * Controls if the req string is a valid HTTP response header.
+ * Returns 0 if req is an invalid header, a non-zero value if is a valid 
header.
+ * \param res the buffer with the HTTP header.
+ * \param nLinesptr is a value of the lines number in the HEADER.
+ * \param ncharsptr is a value of the characters number in the HEADER.
  */
 int HttpHeaders::validHTTPResponse(const char *res, u_long* nLinesptr, u_long* 
ncharsptr)
 {
@@ -376,75 +364,70 @@ int HttpHeaders::validHTTPResponse(const char *res, 
u_long* nLinesptr, u_long* n
   if (res == 0)
     return 0;
   /*
-   *Count the number of lines in the header.
+   * Count the number of lines in the header.
    */
   for(i = 0; res[i]; i++)
   {
     if (res[i]=='\n')
     {
-      if ((res[i+2] == '\n') || (res[i+1] == '\0') || (res[i+1] == '\n'))
+      if ((res[i+2] == '\n') || (res[i + 1] == '\0') || (res[i + 1] == '\n'))
         break;
       nLines++;
     }
     else
     {
       /*
-       *If a line contains more than 4160 characters we consider the 
-       *header invalid.
+       * If a line contains more than 4160 characters we consider the
+       * header invalid.
        */
       if (nLinechars >= 4160)
           return 0;
         nLinechars++;
     }
   }
-  
-  /*
-   *Set the output variables.
-   */
+
+  /* Set the output variables.  */
   *nLinesptr = nLines;
   *ncharsptr = i + 3;
 
   if (nLines == 0)
     return 0;
 
-  /*
-   *Return if is a valid request header.
-   */
+  /* Return if is a valid request header.  */
   return 1;
 }
 
 
 /*!
- *Build the HTTP REQUEST HEADER string.
- *If no input is setted the input is the main buffer of the 
- *HttpThreadContext structure.
- *Returns 200 if is a valid request.
- *Returns -1 if the request is incomplete.
- *Any other returned value is the HTTP error.
- *\param input buffer with the HTTP header.
- *\param inputSize Size of the buffer
- *\param nHeaderChars Real size of the header.
- *\param request HTTP request structure to fullfill with data.
- *\param connection The current connection.
+ * Build the HTTP REQUEST HEADER string.
+ * If no input is setted the input is the main buffer of the
+ * HttpThreadContext structure.
+ * Returns 200 if is a valid request.
+ * Returns -1 if the request is incomplete.
+ * Any other returned value is the HTTP error.
+ * \param input buffer with the HTTP header.
+ * \param inputSize Size of the buffer
+ * \param nHeaderChars Real size of the header.
+ * \param request HTTP request structure to fullfill with data.
+ * \param connection The current connection.
  */
 int HttpHeaders::buildHTTPRequestHeaderStruct(const char* input,
                                               u_long inputSize,
                                               u_long* nHeaderChars,
-                                              HttpRequestHeader *request, 
+                                              HttpRequestHeader *request,
                                               Connection* connection)
 {
-  /*!
+  /*
    *In this function there is the HTTP protocol parse.
    *The request is mapped into a HttpRequestHeader structure
    *And at the end of this each command is treated
    *differently. We use this mode to parse the HTTP
    *cause especially in the CGI is requested a continous
    *access to HTTP header data.
-   *Before mapping the header in the structure 
+   *Before mapping the header in the structure
    *control if this is a regular request.
    *The HTTP header ends with a \r\n\r\n sequence.
    */
-  
   u_long i = 0,j = 0;
   int max = 0;
   u_long nLines, maxTotchars;
@@ -460,8 +443,8 @@ int HttpHeaders::buildHTTPRequestHeaderStruct(const char* 
input,
   int lineControlled = 0;
 
   /*
-   *TokenOff is the length of the token starting from 
-   *the location token.  
+   *TokenOff is the length of the token starting from
+   *the location token.
    */
   int tokenOff;
 
@@ -479,270 +462,259 @@ int HttpHeaders::buildHTTPRequestHeaderStruct(const 
char* input,
     /* Keep trace of first line for logging. */
     tokenOff = getEndLine(input, HTTP_REQUEST_URI_DIM);
     if (tokenOff > 0)
-      request->uri.assign( input, min(HTTP_REQUEST_URI_DIM, tokenOff) );
+      request->uri.assign ( input, min(HTTP_REQUEST_URI_DIM, tokenOff) );
     else
-      request->uri.assign(input, HTTP_REQUEST_URI_DIM );
+      request->uri.assign (input, HTTP_REQUEST_URI_DIM );
     return validRequest;
   }
 
   /* Get the first token, this is the HTTP command.*/
   tokenOff = getCharInString(token, cmdSeps, HTTP_REQUEST_CMD_DIM);
-  
+
   if (tokenOff == -1)
-  {
-    /* Keep trace of first line for logging.  */
-    tokenOff = getEndLine(token, HTTP_REQUEST_URI_DIM);
-    if (tokenOff > 0)
-      request->uri.assign(input, min(HTTP_REQUEST_URI_DIM, tokenOff) );
-    else
-      request->uri.assign(input, HTTP_REQUEST_URI_DIM );
-  }
-  
-  do
-  {
-    if (tokenOff== -1 )
-      return 400;
-    
-    /* Copy the HTTP field(this is the command if we are on the first line).  
*/
-    myserver_strlcpy (command, token, min(commandSize, tokenOff + 1) );
-  
-    token += tokenOff;
-    
-    if (*token == ':')
-      token++;
-    while(*token == ' ')
-      token++;
-    nLineControlled++;
-    lineControlled = 0;
+    {
+      /* Keep trace of first line for logging.  */
+      tokenOff = getEndLine(token, HTTP_REQUEST_URI_DIM);
+      if (tokenOff > 0)
+        request->uri.assign (input, min(HTTP_REQUEST_URI_DIM, tokenOff) );
+      else
+        request->uri.assign (input, HTTP_REQUEST_URI_DIM );
+    }
 
-    if (nLineControlled == 1)
+  do
     {
-      int containOpts = 0;
-      u_long lenToken = tokenOff;
-      /*
-       *The first line has the form:
-       *GET /index.html HTTP/1.1
-       */
-      lineControlled = 1;
-      
-      /* Copy the method type.  */
-      request->cmd.assign(command, min(HTTP_REQUEST_CMD_DIM, tokenOff));
-      tokenOff = getEndLine(token, 
-                            HTTP_REQUEST_VER_DIM + HTTP_REQUEST_URI_DIM+10);
-      lenToken = tokenOff;
-      if (tokenOff == -1)
-      {
-        request->ver.clear();
-        request->cmd.clear();
-        tokenOff = getEndLine(input, HTTP_REQUEST_URI_DIM);
-        if (tokenOff > 0)
-          request->uri.assign(input, min(HTTP_REQUEST_URI_DIM, tokenOff) );
-        else
-          request->uri.assign(input, HTTP_REQUEST_URI_DIM );
+      if (tokenOff== -1 )
         return 400;
-      }
-      if (tokenOff > maxUri)
-      {
-        request->ver.clear();
-        request->cmd.clear();
-        tokenOff = getEndLine(input, HTTP_REQUEST_URI_DIM);
-        if (tokenOff > 0)
-          request->uri.assign(input, min(HTTP_REQUEST_URI_DIM, tokenOff) );
-        else
-          request->uri.assign(input, HTTP_REQUEST_URI_DIM );
-        return 400;
-      }
-      max=(int)tokenOff;
-      while((token[max] != ' ') && (lenToken - max < HTTP_REQUEST_VER_DIM))
-        max--;
-      for(i=0; ((int)i < max) && (i < HTTP_REQUEST_URI_DIM); i++)
-      {
-        if (token[i] == '?')
-        {
-          containOpts = 1;
-          break;
-        }
-        else if (token[i] == ' ')
-        {
-          break;
-        }
-      }
 
-      /*
-       *If a uri was specified store it. If it wasn't specified 
-       *return an invalid header value.
-       */
-      if (i)
-        request->uri.assign(token, i);
-      else
-      {
-        request->ver.clear();
-        request->cmd.clear();
-        tokenOff = getEndLine(input, HTTP_REQUEST_URI_DIM);
-        if (tokenOff > 0)
-          request->uri.assign(input, min(HTTP_REQUEST_URI_DIM, tokenOff) );
-        else
-          request->uri.assign(input, HTTP_REQUEST_URI_DIM );
-        return 400;
-      }  
+      /* Copy the HTTP field(this is the command if we are on the first line). 
 */
+      myserver_strlcpy (command, token, min(commandSize, tokenOff + 1) );
 
-      /* If the uri contains some query data determine how long it is. */
-      if (containOpts)
-      {
-        j = getEndLine(&token[i], HTTP_REQUEST_URI_DIM);
-        for(j = 0; ((int)(i+j+1)<max) && (j<HTTP_REQUEST_URI_OPTS_DIM-1);j++)
+      token += tokenOff;
+
+      if (*token == ':')
+        token++;
+      while(*token == ' ')
+        token++;
+      nLineControlled++;
+      lineControlled = 0;
+
+      if (nLineControlled == 1)
         {
-          ++j;
-        }
-      }
+          int containOpts = 0;
+          u_long lenToken = tokenOff;
+          /*
+           *The first line has the form:
+           *GET /index.html HTTP/1.1
+           */
+          lineControlled = 1;
+
+          /* Copy the method type.  */
+          request->cmd.assign (command, min(HTTP_REQUEST_CMD_DIM, tokenOff));
+          tokenOff = getEndLine(token, HTTP_REQUEST_VER_DIM
+                                + HTTP_REQUEST_URI_DIM + 10);
+          lenToken = tokenOff;
+          if (tokenOff == -1)
+            {
+              request->ver.clear ();
+              request->cmd.clear ();
+              tokenOff = getEndLine (input, HTTP_REQUEST_URI_DIM);
+              if (tokenOff > 0)
+                request->uri.assign (input, min (HTTP_REQUEST_URI_DIM, 
tokenOff));
+              else
+                request->uri.assign (input, HTTP_REQUEST_URI_DIM );
+              return 400;
+            }
+          if (tokenOff > maxUri)
+            {
+              request->ver.clear();
+              request->cmd.clear();
+              tokenOff = getEndLine(input, HTTP_REQUEST_URI_DIM);
+              if (tokenOff > 0)
+                request->uri.assign (input, min(HTTP_REQUEST_URI_DIM, 
tokenOff) );
+              else
+                request->uri.assign (input, HTTP_REQUEST_URI_DIM );
+              return 400;
+            }
+          max = (int)tokenOff;
+          while ((token[max] != ' ') && (lenToken - max < 
HTTP_REQUEST_VER_DIM))
+            max--;
 
-      /*
-       *Save the query data and seek the cursor at the end of it. Start copying
-       *from the second byte(do not store the  ? character).
-       */
-      request->uriOpts.assign(&token[i+1], j);
-      i+=j+1;
+          for (i = 0; ((int)i < max) && (i < HTTP_REQUEST_URI_DIM); i++)
+            {
+              if (token[i] == '?')
+                {
+                  containOpts = 1;
+                  break;
+                }
+              else if (token[i] == ' ')
+                break;
+            }
 
-      /*
-       *Seek the cursor at the end of the spaces. Do not allow more than 
-       *10 spaces character between the uri token and the HTTP version. 
-       */
-      for(j = 0; j < 10; j++)
-      {
-        if (token[i]==' ')
-          i++;
-        else 
-          break;
-      }
-      /*
-       *If there are more than 10 black spaces store the entire line 
-       *for logging then return an invalid header value.
-       */
-      if (j == 10)
-      {
-        request->ver.clear();
-        request->cmd.clear();
-        tokenOff = getEndLine(input, HTTP_REQUEST_URI_DIM);
-        if (tokenOff > 0)
-          request->uri.assign(input, min(HTTP_REQUEST_URI_DIM, tokenOff) );
-        else
-          request->uri.assign(input, HTTP_REQUEST_URI_DIM );
-        return 400;
-      }
+          /*
+           * If a uri was specified store it. If it wasn't specified
+           * return an invalid header value.
+           */
+          if (i)
+            request->uri.assign (token, i);
+          else
+            {
+              request->ver.clear ();
+              request->cmd.clear ();
+              tokenOff = getEndLine (input, HTTP_REQUEST_URI_DIM);
+              if (tokenOff > 0)
+                request->uri.assign (input, min (HTTP_REQUEST_URI_DIM, 
tokenOff));
+              else
+                request->uri.assign (input, HTTP_REQUEST_URI_DIM);
+              return 400;
+            }
 
-      /* Count how long the version token is. */
-      j=i;
-      while((i-j < HTTP_REQUEST_VER_DIM) && (token[i]!='\r') 
-            && (token[i]!='\n'))
-        i++;
+          /* If the uri contains some query data determine how long it is. */
+          if (containOpts)
+            {
+              j = getEndLine (&token[i], HTTP_REQUEST_URI_DIM);
+              for(j = 0; ((int)(i + j + 1) < max) && (j < 
HTTP_REQUEST_URI_OPTS_DIM-1); j++)
+                ++j;
+            }
 
-      /* Save the HTTP version. */
-      if (i-j)
-        request->ver.assign(&token[j], i-j);
+          /*
+           * Save the query data and seek the cursor at the end of it. Start 
copying
+           * from the second byte(do not store the  ? character).
+           */
+          request->uriOpts.assign (&token[i + 1], j);
+          i += j + 1;
+
+          /*
+           * Seek the cursor at the end of the spaces. Do not allow more than
+           * 10 spaces character between the uri token and the HTTP version.
+           */
+          for(j = 0; j < 10; j++)
+            {
+              if (token[i]==' ')
+                i++;
+              else
+                break;
+            }
+          /*
+           * If there are more than 10 black spaces store the entire line
+           * for logging then return an invalid header value.
+           */
+          if (j == 10)
+            {
+              request->ver.clear ();
+              request->cmd.clear ();
+              tokenOff = getEndLine (input, HTTP_REQUEST_URI_DIM);
+              if (tokenOff > 0)
+                request->uri.assign (input, min(HTTP_REQUEST_URI_DIM, 
tokenOff) );
+              else
+                request->uri.assign (input, HTTP_REQUEST_URI_DIM);
+              return 400;
+            }
 
-      /*
-       *If the version is not specified or it is too long store 
-       *some information for logging then return an invalid header value. 
-       */
-      if ((!j) || ( (i-j) == HTTP_REQUEST_VER_DIM ))
-      {
-        request->ver.clear();
-        request->cmd.clear();   
-        tokenOff = getEndLine(input, HTTP_REQUEST_URI_DIM);
-        if (tokenOff > 0)
-          request->uri.assign(input, min(HTTP_REQUEST_URI_DIM, tokenOff) );
-        else
-          request->uri.assign(input, HTTP_REQUEST_URI_DIM );
-        return 400;
-      }
-      
-      /* Store if the requested uri terminates with a slash character. */
-      request->uriEndsWithSlash = request->uri[(request->uri.length 
())-1]=='/';
+          /* Count how long the version token is. */
+          j = i;
+          while ((i - j < HTTP_REQUEST_VER_DIM) && (token[i]!='\r')
+                 && (token[i]!='\n'))
+            i++;
+
+          /* Save the HTTP version. */
+          if (i - j)
+            request->ver.assign (&token[j], i - j);
+
+          /*
+           * If the version is not specified or it is too long store
+           * some information for logging then return an invalid header value.
+           */
+          if ((!j) || ( (i-j) == HTTP_REQUEST_VER_DIM ))
+            {
+              request->ver.clear ();
+              request->cmd.clear ();
+              tokenOff = getEndLine (input, HTTP_REQUEST_URI_DIM);
+              if (tokenOff > 0)
+                request->uri.assign (input, min (HTTP_REQUEST_URI_DIM, 
tokenOff) );
+              else
+                request->uri.assign (input, HTTP_REQUEST_URI_DIM );
+              return 400;
+            }
 
-      /*
-       *Do not maintain any slash character if the uri has them at 
-       *the begin or at the end.
-       */
-      request->uri=trimRight(request->uri, " /");
-      request->uriOpts=trim(request->uriOpts, " ");
+          /* Store if the requested uri terminates with a slash character. */
+          request->uriEndsWithSlash = request->uri[(request->uri.length ())-1] 
== '/';
 
-    }else
-    /* Authorization.  */
-    if (!strcmpi(command,"Authorization"))
-    {
-      int ret = readReqAuthLine (request, connection, token, &tokenOff);
-      if (ret)
-        return ret;
-      lineControlled = 1;
-    }else
-    /* Content-Length.  */
-    if (!strcmpi(command, (char*)"Content-Length"))
-    {
-      tokenOff = getEndLine(token, HTTP_REQUEST_CONTENT_LENGTH_DIM);
-      if (tokenOff==-1)
-        return 400;
-      lineControlled = 1;
-      request->contentLength.assign(token,tokenOff);
-    }else
-    /* Range.  */
-    if (!strcmpi(command, (char*)"Range"))
-    {
-      int ret = readReqRangeLine (request, connection, token, &tokenOff);
-      if (ret)
-        return ret;
-      lineControlled = 1;
-    }else
-    if (!lineControlled)
-    {
-      tokenOff = getEndLine(token, maxTotchars);
-      if (tokenOff==-1)
-        return 400;
-      
-      {
-        string cmdStr(command);
-        HttpRequestHeader::Entry *old = request->other.get(cmdStr);
-        if (old)
+          /*
+           * Do not maintain any slash character if the uri has them at
+           * the begin or at the end.
+           */
+          request->uri=trimRight (request->uri, " /");
+          request->uriOpts=trim (request->uriOpts, " ");
+        }
+      else if (!strcmpi (command,"Authorization"))
         {
-          old->value->append(", ");
-          old->value->append(token, 
-                             std::min(static_cast<int>(HTTP_RESPONSE_OTHER_DIM
-                                                       - old->value->length()),
-                                      static_cast<int>(tokenOff)));
+          int ret = readReqAuthLine (request, connection, token, &tokenOff);
+          if (ret)
+            return ret;
+          lineControlled = 1;
         }
-        else
+      else if (!strcmpi (command, (char*)"Content-Length"))
         {
-          HttpRequestHeader::Entry *e = new HttpRequestHeader::Entry(); 
-          if (e)
-          {
-            e->name->assign(command, HTTP_RESPONSE_OTHER_DIM);
-            e->value->assign(token, 
-                             std::min(HTTP_RESPONSE_OTHER_DIM, tokenOff));
-            request->other.put(cmdStr, e);
-          }
+          tokenOff = getEndLine(token, HTTP_REQUEST_CONTENT_LENGTH_DIM);
+          if (tokenOff == -1)
+            return 400;
+          lineControlled = 1;
+          request->contentLength.assign (token,tokenOff);
         }
-      }
+      else if (!strcmpi(command, (char*)"Range"))
+        {
+          int ret = readReqRangeLine (request, connection, token, &tokenOff);
+          if (ret)
+            return ret;
+          lineControlled = 1;
+        }
+      else if (!lineControlled)
+        {
+          tokenOff = getEndLine(token, maxTotchars);
+          if (tokenOff==-1)
+            return 400;
+
+          string cmdStr(command);
+          HttpRequestHeader::Entry *old = request->other.get(cmdStr);
+          if (old)
+            {
+              old->value->append(", ");
+              old->value->append(token,
+                                 
std::min(static_cast<int>(HTTP_RESPONSE_OTHER_DIM
+                                                           - 
old->value->length()),
+                                          static_cast<int>(tokenOff)));
+            }
+          else
+            {
+              HttpRequestHeader::Entry *e = new HttpRequestHeader::Entry();
+              if (e)
+                {
+                  e->name->assign (command, HTTP_RESPONSE_OTHER_DIM);
+                  e->value->assign (token,
+                                   std::min(HTTP_RESPONSE_OTHER_DIM, 
tokenOff));
+                  request->other.put (cmdStr, e);
+                }
+            }
+        }
+      token += tokenOff + 2;
+      tokenOff = getCharInString(token, ":", maxTotchars);
     }
-    token+= tokenOff + 2;
-    tokenOff = getCharInString(token, ":", maxTotchars);
-  }while (((u_long)(token - input) < maxTotchars) && token[0] != '\r');
+  while (((u_long)(token - input) < maxTotchars) && token[0] != '\r');
 
-  /*
-   *END REQUEST STRUCTURE BUILD.
-   */
   *nHeaderChars = maxTotchars;
   return 200;
 }
 
 /*!
- *Parse the range line in a HTTP request.
- *\param request HttpRequest object to fill.
- *\param connection Pointer to a connection structure.
- *\param token Pointer to the beginning of the authorization line.
- *\param lenOut Pointer to an itneger to keep the line length.
- *\return 0 on success, any other value is the HTTP error.
+ * Parse the range line in a HTTP request.
+ * \param request HttpRequest object to fill.
+ * \param connection Pointer to a connection structure.
+ * \param token Pointer to the beginning of the authorization line.
+ * \param lenOut Pointer to an itneger to keep the line length.
+ * \return 0 on success, any other value is the HTTP error.
  */
-int HttpHeaders::readReqRangeLine (HttpRequestHeader *request, 
-                                   Connection *connection, 
+int HttpHeaders::readReqRangeLine (HttpRequestHeader *request,
+                                   Connection *connection,
                                    const char *token,
                                    int *lenOut)
 {
@@ -756,27 +728,27 @@ int HttpHeaders::readReqRangeLine (HttpRequestHeader 
*request,
   int tokenOff = getEndLine(token, HTTP_REQUEST_RANGE_TYPE_DIM + 30);
   if (tokenOff ==-1)
     return 400;
-  
+
   *lenOut = tokenOff;
 
   do
     {
       i++;
     }
-  while((*(++localToken) != '=') && (i < HTTP_REQUEST_RANGE_TYPE_DIM));
+  while ((*(++localToken) != '=') && (i < HTTP_REQUEST_RANGE_TYPE_DIM));
 
-  request->rangeType.assign(token, i);
+  request->rangeType.assign (token, i);
 
   i = 0;
   localToken++;
-  
+
   do
     {
       rangeByteBegin[i++] = *localToken;
       rangeByteBegin[i] = '\0';
     }
-  while((*(++localToken) != '-') && (i<12) && (*localToken != '\r'));
-  
+  while ((*(++localToken) != '-') && (i<12) && (*localToken != '\r'));
+
   i = 0;
   localToken++;
   do
@@ -784,32 +756,27 @@ int HttpHeaders::readReqRangeLine (HttpRequestHeader 
*request,
       rangeByteEnd[i++] = *localToken;
       rangeByteEnd[i] = '\0';
     }
-  while((*(++localToken) != '\r' )&&(i<12));
+  while ((*(++localToken) != '\r' )&&(i<12));
 
-  for(i=0;i < static_cast<int>(request->rangeType.length ()); i++)
+  for (i = 0; i < static_cast<int>(request->rangeType.length ()); i++)
     if (request->rangeType[i] == '=')
       request->rangeType[i] = '\0';
-  
+
   for(i = 0; i < static_cast<int>(strlen (rangeByteBegin)); i++)
     if (rangeByteBegin[i] == '=')
       rangeByteBegin[i] = '\0';
-  
+
   for(i = 0; i < static_cast<int>(strlen (rangeByteEnd)); i++)
     if (rangeByteEnd[i]== '=')
       rangeByteEnd[i]='\0';
-      
+
   if (rangeByteBegin[0] == 0)
-    {
-      request->rangeByteBegin=0;
-    }      
+    request->rangeByteBegin=0;
   else
-    {
-      request->rangeByteBegin = (u_long)atol(rangeByteBegin); 
-    }
+    request->rangeByteBegin = (u_long)atol(rangeByteBegin);
+
   if (rangeByteEnd[0] == '\r')
-    {
-      request->rangeByteEnd = 0;
-    }
+    request->rangeByteEnd = 0;
   else
     {
       request->rangeByteEnd = (u_long)atol(rangeByteEnd);
@@ -821,46 +788,46 @@ int HttpHeaders::readReqRangeLine (HttpRequestHeader 
*request,
 }
 
 /*!
- *Parse the authorization line in a HTTP request.
- *\param request HttpRequest object to fill.
- *\param connection Pointer to a connection structure.
- *\param token Pointer to the beginning of the authorization line.
- *\param lenOut Pointer to an itneger to keep the line length.
- *\return 0 on success, any other value is the HTTP error.
+ * Parse the authorization line in a HTTP request.
+ * \param request HttpRequest object to fill.
+ * \param connection Pointer to a connection structure.
+ * \param token Pointer to the beginning of the authorization line.
+ * \param lenOut Pointer to an itneger to keep the line length.
+ * \return 0 on success, any other value is the HTTP error.
  */
-int HttpHeaders::readReqAuthLine (HttpRequestHeader *request, 
+int HttpHeaders::readReqAuthLine (HttpRequestHeader *request,
                                   Connection *connection,
                                   const char *token,
                                   int *lenOut)
 {
-  while(*token==' ')
+  while (*token==' ')
     token++;
-  int tokenOff = getCharInString(token, " ", HTTP_REQUEST_AUTH_DIM);
-  
+  int tokenOff = getCharInString (token, " ", HTTP_REQUEST_AUTH_DIM);
+
   if (tokenOff==-1)
     return 400;
 
-  request->auth.assign(token, tokenOff);
-  connection->setLogin("");
-  connection->setPassword("");
+  request->auth.assign (token, tokenOff);
+  connection->setLogin ("");
+  connection->setPassword ("");
 
   if (!request->auth.compare("Basic"))
     {
       u_long i;
       const char *base64 = &token[6];
-      int len = getEndLine(base64, 64);
+      int len = getEndLine (base64, 64);
       const char *tmp = base64 + len - 1;
       const char* lsecondaryBuffer;
       const char* lsecondaryBufferOr;
       char login[32];
-      char password[32]; 
+      char password[32];
       CBase64Utils base64Utils;
-    
+
       if (len == -1)
-        return 400;    
-      
+        return 400;
+
       login[0] = password[0] = '\0';
-        
+
       while (len > 0 && (*tmp == '\r' || *tmp == '\n'))
         {
           tmp--;
@@ -868,152 +835,146 @@ int HttpHeaders::readReqAuthLine (HttpRequestHeader 
*request,
         }
       if (len <= 1)
         return 400;
-      
+
       lsecondaryBuffer = base64Utils.decode(base64, &len);
       lsecondaryBufferOr = lsecondaryBuffer;
-   
+
       for(i = 0; (*lsecondaryBuffer != ':') && (i < 32);i++)
-        {
-          login[i] = *lsecondaryBuffer++;
-        }
+        login[i] = *lsecondaryBuffer++;
+
       login[i] = '\0';
-      
+
       lsecondaryBuffer++;
       for(i = 0; (*lsecondaryBuffer) && (i < 31); i++)
-        {
-          password[i] = *lsecondaryBuffer++;
-        }
+        password[i] = *lsecondaryBuffer++;
+
       password[i] = '\0';
-      
-      connection->setLogin(login);
-      connection->setPassword(password);
+      connection->setLogin (login);
+      connection->setPassword (password);
       delete lsecondaryBufferOr;
-      *lenOut = tokenOff = getEndLine(token, 100);
+      *lenOut = tokenOff = getEndLine (token, 100);
     }
-  else if (!request->auth.compare("Digest"))
+  else if (!request->auth.compare ("Digest"))
     {
       char *digestBuff;
       char *digestToken;
       token += tokenOff;
-      
       while(*token == ' ')
         token++;
 
       *lenOut = tokenOff = getEndLine(token, 1024);
-
       if (tokenOff == -1)
-        return 400;    
-
-      digestBuff=new char[tokenOff+1];
+        return 400;
 
+      digestBuff = new char[tokenOff + 1];
       if (!digestBuff)
         return 400;
 
-      memcpy(digestBuff, token, tokenOff);
-      digestBuff[tokenOff]='\0';
-      digestToken = strtok( digestBuff, "=" );
+      memcpy (digestBuff, token, tokenOff);
+      digestBuff[tokenOff] = '\0';
+      digestToken = strtok (digestBuff, "=" );
       if (!digestToken)
         return 400;
       do
         {
-          StrTrim(digestToken, (char*)" ");
-          if (!strcmpi(digestToken, (char*)"nonce"))
+          StrTrim (digestToken, (char*)" ");
+          if (!strcmpi (digestToken, (char*)"nonce"))
             {
-              digestToken = strtok( NULL, (char*)"," );
+              digestToken = strtok (NULL, (char*)"," );
               if (digestToken)
                 {
-                  StrTrim(digestToken, (char*)"\" ");
-                  myserver_strlcpy (request->digestNonce,digestToken,48+1);
+                  StrTrim (digestToken, (char*)"\" ");
+                  myserver_strlcpy (request->digestNonce,digestToken,48 + 1);
                 }
             }
-          else if (!strcmpi(digestToken, (char*)"opaque"))
+          else if (!strcmpi (digestToken, (char*)"opaque"))
             {
-              digestToken = strtok( NULL, (char*)"," );
+              digestToken = strtok (NULL, (char*)"," );
               if (digestToken)
                 {
-                  StrTrim(digestToken, (char*)"\" ");
-                  myserver_strlcpy (request->digestOpaque,digestToken,48+1);
+                  StrTrim (digestToken, (char*)"\" ");
+                  myserver_strlcpy (request->digestOpaque,digestToken,48 + 1);
                 }
             }
           else if (!strcmpi(digestToken, (char*)"uri"))
             {
-              digestToken = strtok( NULL, (char*)"\r\n," );
+              digestToken = strtok (NULL, (char*)"\r\n," );
               if (digestToken)
                 {
-                  StrTrim(digestToken, (char*)"\" ");
-                  myserver_strlcpy (request->digestUri,digestToken,1024+1);
+                  StrTrim (digestToken, (char*)"\" ");
+                  myserver_strlcpy (request->digestUri,digestToken,1024 + 1);
                 }
             }
           else if (!strcmpi(digestToken, (char*)"method"))
             {
-              digestToken = strtok( NULL, (char*)"\r\n," );
+              digestToken = strtok (NULL, (char*)"\r\n," );
               if (digestToken)
                 {
-                  StrTrim(digestToken, (char*)"\" ");
-                  myserver_strlcpy (request->digestMethod,digestToken,16+1);
+                  StrTrim (digestToken, (char*)"\" ");
+                  myserver_strlcpy (request->digestMethod,digestToken,16 + 1);
                 }
-            }  
+            }
           else if (!strcmpi(digestToken, (char*)"qop"))
             {
-              digestToken = strtok( NULL, (char*)"\r\n," );
+              digestToken = strtok (NULL, (char*)"\r\n," );
               if (digestToken)
                 {
-                  StrTrim(digestToken,(char*)"\" ");
-                  myserver_strlcpy (request->digestQop,digestToken,16+1);
+                  StrTrim (digestToken,(char*)"\" ");
+                  myserver_strlcpy (request->digestQop,digestToken,16 + 1);
                 }
-            }          
-          else if (!strcmpi(digestToken, (char*)"realm"))
+            }
+          else if (!strcmpi (digestToken, (char*)"realm"))
             {
-              digestToken = strtok( NULL, (char*)"\r\n," );
+              digestToken = strtok (NULL, (char*)"\r\n," );
               if (digestToken)
                 {
-                  StrTrim(digestToken, (char*)"\" ");
-                  myserver_strlcpy (request->digestRealm,digestToken,48+1);
+                  StrTrim (digestToken, (char*)"\" ");
+                  myserver_strlcpy (request->digestRealm,digestToken,48 + 1);
                 }
             }
           else if (!strcmpi(digestToken, (char*)"cnonce"))
             {
-              digestToken = strtok( NULL, (char*)"\r\n," );
+              digestToken = strtok (NULL, (char*)"\r\n," );
               if (digestToken)
                 {
-                  StrTrim(digestToken, (char*)" \"");
-                  myserver_strlcpy (request->digestCnonce, digestToken, 48+1);
+                  StrTrim (digestToken, (char*)" \"");
+                  myserver_strlcpy (request->digestCnonce, digestToken, 48 + 
1);
                 }
             }
-          else if (!strcmpi(digestToken, (char*)"username"))
+          else if (!strcmpi (digestToken, (char*)"username"))
             {
-              digestToken = strtok( NULL, (char*)"\r\n," );
+              digestToken = strtok (NULL, (char*)"\r\n," );
               if (digestToken)
                 {
-                  StrTrim(digestToken, (char*)"\" ");
-                  myserver_strlcpy (request->digestUsername, digestToken, 
48+1);
-                  connection->setLogin(digestToken);
+                  StrTrim (digestToken, (char*)"\" ");
+                  myserver_strlcpy (request->digestUsername, digestToken, 48 + 
1);
+                  connection->setLogin (digestToken);
                 }
             }
           else if (!strcmpi(digestToken, (char*)"response"))
             {
-              digestToken = strtok( NULL, "\r\n," );
+              digestToken = strtok (NULL, "\r\n," );
               if (digestToken)
                 {
-                  StrTrim(digestToken, (char*)"\" ");
-                  myserver_strlcpy (request->digestResponse,digestToken,48+1);
+                  StrTrim (digestToken, (char*)"\" ");
+                  myserver_strlcpy (request->digestResponse,digestToken,48 + 
1);
                 }
             }
-          else if (!strcmpi(digestToken, (char*)"nc"))
+          else if (!strcmpi (digestToken, (char*)"nc"))
             {
-              digestToken = strtok( NULL, (char*)"\r\n," );
+              digestToken = strtok (NULL, (char*)"\r\n," );
               if (digestToken)
                 {
-                  StrTrim(digestToken, (char*)"\" ");
-                  myserver_strlcpy (request->digestNc,digestToken,10+1);
+                  StrTrim (digestToken, (char*)"\" ");
+                  myserver_strlcpy (request->digestNc, digestToken, 10 + 1);
                 }
             }
-          else 
+          else
             {
-              digestToken = strtok( NULL, (char*)"\r\n," );
+              digestToken = strtok (NULL, (char*)"\r\n," );
             }
           /* Update digestToken.  */
-          digestToken = strtok( NULL, (char*)"=" );
+          digestToken = strtok (NULL, (char*)"=" );
         }while(digestToken);
       delete  [] digestBuff;
     }
@@ -1022,7 +983,7 @@ int HttpHeaders::readReqAuthLine (HttpRequestHeader 
*request,
 
 /*!
  *Build the HTTP RESPONSE HEADER string.
- *If no input is specified the input is the main buffer of the 
+ *If no input is specified the input is the main buffer of the
  *HttpThreadContext structure.
  *Return 0 on invalid input or internal errors.
  *\param input The buffer with the HTTP header data.
@@ -1030,7 +991,7 @@ int HttpHeaders::readReqAuthLine (HttpRequestHeader 
*request,
  *\param nbtr Bytes of the header.
  */
 int HttpHeaders::buildHTTPResponseHeaderStruct(const char *input,
-                                               HttpResponseHeader *response, 
+                                               HttpResponseHeader *response,
                                                u_long *nbtr)
 {
   /*!
@@ -1041,7 +1002,7 @@ int HttpHeaders::buildHTTPResponseHeaderStruct(const char 
*input,
    *differently. We use this mode for parse the HTTP
    *cause especially in the CGI is requested a continous
    *HTTP header access.
-   *Before mapping the header in the structure 
+   *Before mapping the header in the structure
    *control if this is a regular response.
    */
   char *newInput;
@@ -1067,8 +1028,8 @@ int HttpHeaders::buildHTTPResponseHeaderStruct(const char 
*input,
     if (!newInput)
       return 0;
     /*
-     * FIXME: 
-     * Don't alloc new memory but simply use a no-destructive parsing.  
+     * FIXME:
+     * Don't alloc new memory but simply use a no-destructive parsing.
      */
     memcpy(newInput, input, maxTotchars);
     newInput[maxTotchars] = '\0';
@@ -1078,16 +1039,16 @@ int HttpHeaders::buildHTTPResponseHeaderStruct(const 
char *input,
     return 0;
 
   token = (char*) input;
-  
+
   /* Check if is specified the first line containing the HTTP status.  */
   if ((input[0] == 'H') && (input[1] == 'T') && (input[2] == 'T')
      &&(input[3] == 'P') && (input[4] == '/'))
   {
     containStatusLine = 1;
-    token = strtok( token, " " );
+    token = strtok ( token, " " );
   }
   else
-    token = strtok( token, ": ,\t\n\r" );
+    token = strtok ( token, ": ,\t\n\r" );
   do
   {
     if (!token)
@@ -1101,207 +1062,192 @@ int HttpHeaders::buildHTTPResponseHeaderStruct(const 
char *input,
      *Copy the HTTP command.
      */
     myserver_strlcpy (command, token, 96);
-    
+
     nLineControlled++;
     if ((nLineControlled == 1) && containStatusLine)
-    {
-      lineControlled = 1;
-      /* Copy the HTTP version.  */
-      response->ver.assign(command);
-    
-      token = strtok( NULL, " ,\t\n\r" );
-      if (token)
-        response->httpStatus = atoi(token);
-      
-      token = strtok( NULL, "\r\n\0" );
-      if (token)
-        response->errorType.assign(token);
-
-    }else
-    /* Server.  */
-    if (!strcmpi(command,"Server"))
-    {
-      token = strtok( NULL, "\r\n\0" );
-      lineControlled = 1;
+      {
+        lineControlled = 1;
+        /* Copy the HTTP version.  */
+        response->ver.assign (command);
 
-      while(token && *token == ' ')
-        token++;
+        token = strtok (NULL, " ,\t\n\r" );
+        if (token)
+          response->httpStatus = atoi(token);
 
-      if (token)
-        response->serverName.assign(token);
-    }else
-    /* Location  */
-    if (!strcmpi(command,"Location"))
-    {
-      token = strtok( NULL, "\r\n\0" );
-      lineControlled = 1;
+        token = strtok (NULL, "\r\n\0" );
+        if (token)
+          response->errorType.assign (token);
+      }
+    else if (!strcmpi(command,"Server"))
+      {
+        token = strtok (NULL, "\r\n\0" );
+        lineControlled = 1;
 
-      while(token && *token == ' ')
-        token++;
+        while (token && *token == ' ')
+          token++;
 
-      if (token)
-        response->location.assign(token);
-    }else
-    /* Last-Modified.  */
-    if (!strcmpi(command,"Last-Modified"))
-    {
-      token = strtok( NULL, "\r\n\0" );
-      lineControlled = 1;
+        if (token)
+          response->serverName.assign (token);
+      }
+    else if (!strcmpi(command,"Location"))
+      {
+        token = strtok (NULL, "\r\n\0" );
+        lineControlled = 1;
 
-      while(token && *token == ' ')
-        token++;
+        while (token && *token == ' ')
+          token++;
 
-      if (token)
-        response->lastModified.assign(token);
-    }else
-    /* Status.  */
-    if (!strcmpi(command,"Status"))
-    {
-      token = strtok( NULL, "\r\n\0" );
-      lineControlled = 1;
+        if (token)
+          response->location.assign (token);
+      }
+    else if (!strcmpi(command,"Last-Modified"))
+      {
+        token = strtok (NULL, "\r\n\0" );
+        lineControlled = 1;
 
-      while(token && *token == ' ')
-        token++;
+        while (token && *token == ' ')
+          token++;
 
-      /*! If the response status is different from 200 don't modify it. */
-      if (response->httpStatus == 200)
         if (token)
-          response->httpStatus = atoi(token);
-    }else
-    /* Date.  */
-    if (!strcmpi(command,"Date"))
-    {
-      token = strtok( NULL, "\r\n\0" );
-      lineControlled = 1;
+          response->lastModified.assign (token);
+    }
+    else if (!strcmpi(command,"Status"))
+      {
+        token = strtok (NULL, "\r\n\0" );
+        lineControlled = 1;
 
-      while(token && *token == ' ')
-        token++;
+        while (token && *token == ' ')
+          token++;
 
-      if (token)
-        response->date.assign(token);
-    }else
-    /* Content-Type.  */
-    if (!strcmpi(command,"Content-Type"))
-    {
-      token = strtok( NULL, "\r\n\0" );
-      lineControlled = 1;
+        /*! If the response status is different from 200 don't modify it. */
+        if (response->httpStatus == 200)
+          if (token)
+            response->httpStatus = atoi(token);
+      }
+    else if (!strcmpi(command,"Date"))
+      {
+        token = strtok (NULL, "\r\n\0" );
+        lineControlled = 1;
 
-      while(token && *token == ' ')
-        token++;
+        while (token && *token == ' ')
+          token++;
 
-      if (token)
-        response->contentType.assign(token);
-    }else
-    /* MIME-Version.  */
-    if (!strcmpi(command,"MIME-Version"))
-    {
-      token = strtok( NULL, "\r\n\0" );
-      lineControlled = 1;
+        if (token)
+          response->date.assign (token);
+      }
+    else if (!strcmpi(command,"Content-Type"))
+      {
+        token = strtok (NULL, "\r\n\0" );
+        lineControlled = 1;
 
-      while(token && *token == ' ')
-        token++;
+        while (token && *token == ' ')
+          token++;
 
-      if (token)
-        response->mimeVer.assign(token);
-    }else
-    /* Set-Cookie.  */
-    if (!strcmpi(command,"Set-Cookie"))
-    {
-      token = strtok( NULL, "\r\n\0" );
-      lineControlled = 1;
+        if (token)
+          response->contentType.assign (token);
+      }
+    else if (!strcmpi(command,"MIME-Version"))
+      {
+        token = strtok (NULL, "\r\n\0" );
+        lineControlled = 1;
 
-      while(token && *token == ' ')
-        token++;
+        while (token && *token == ' ')
+          token++;
 
-      if (token)
+        if (token)
+          response->mimeVer.assign (token);
+      }
+    else if (!strcmpi(command,"Set-Cookie"))
       {
-        /* Divide multiple cookies.  */
-        response->cookie.append(token );
-        response->cookie.append("\n");
+        token = strtok (NULL, "\r\n\0" );
+        lineControlled = 1;
+
+        while (token && *token == ' ')
+          token++;
+
+        if (token)
+          {
+            /* Divide multiple cookies.  */
+            response->cookie.append(token );
+            response->cookie.append("\n");
+          }
       }
-    }else
-    /* Content-Length.  */
-    if (!strcmpi(command,"Content-Length"))
-    {
-      token = strtok( NULL, "\r\n\0" );
-      lineControlled = 1;
+    else if (!strcmpi (command, "Content-Length"))
+      {
+        token = strtok (NULL, "\r\n\0" );
+        lineControlled = 1;
 
-      while(token && *token == ' ')
-        token++;
+        while (token && *token == ' ')
+          token++;
 
-      response->contentLength.assign(token);
-    }else
-    /* Connection.  */
-    if (!strcmpi(command,"Connection"))
-    {
-      token = strtok( NULL, "\r\n\0" );
-      lineControlled = 1;
-
-      if (token)
-        response->connection.assign(token);
-    }else
-    /* Expires.  */
-    if (!strcmpi(command,"Expires"))
-    {
-      token = strtok( NULL, "\r\n\0" );
-      lineControlled = 1;
-      if (token)
-        response->dateExp.assign(token);
-    }
+        response->contentLength.assign (token);
+      }
+    else if (!strcmpi (command, "Connection"))
+      {
+        token = strtok (NULL, "\r\n\0" );
+        lineControlled = 1;
+
+        if (token)
+          response->connection.assign (token);
+      }
+    else if (!strcmpi (command,"Expires"))
+      {
+        token = strtok (NULL, "\r\n\0" );
+        lineControlled = 1;
+        if (token)
+          response->dateExp.assign (token);
+      }
     /*
      *If the line is not controlled arrive with the token
      *at the end of the line.
      */
     if ( (!lineControlled) &&  ((!containStatusLine) || (nLineControlled != 
1)))
-    {
-      token = strtok(NULL, "\r\n");
-
-      while(token && *token == ' ')
-        token++;
-
-      if (token)
       {
-        HttpResponseHeader::Entry *e;
-        if (strlen (command) > HTTP_RESPONSE_OTHER_DIM || 
-           strlen (token) > HTTP_RESPONSE_OTHER_DIM)
-          return 0;
+        token = strtok (NULL, "\r\n");
 
-        e = new HttpResponseHeader::Entry(); 
-        if (e)
-        {
-          e->name->assign(command);
-          e->value->assign(token);
+        while(token && *token == ' ')
+          token++;
+
+        if (token)
           {
-            HttpResponseHeader::Entry *old = 0;
-            string cmdString(command);
-            old = response->other.put(cmdString, e);
-            if (old)
-              delete old;
+            HttpResponseHeader::Entry *e;
+            if (strlen (command) > HTTP_RESPONSE_OTHER_DIM ||
+                strlen (token) > HTTP_RESPONSE_OTHER_DIM)
+              return 0;
+
+            e = new HttpResponseHeader::Entry();
+            if (e)
+              {
+                e->name->assign (command);
+                e->value->assign (token);
+                {
+                  HttpResponseHeader::Entry *old = 0;
+                  string cmdString (command);
+                  old = response->other.put (cmdString, e);
+                  if (old)
+                    delete old;
+                }
+              }
           }
-        }
       }
-    }
-    token = strtok(NULL, cmdSeps);
-
-  }while(token && ((u_long)(token - input) < maxTotchars));
+    token = strtok (NULL, cmdSeps);
+  }
+  while (token && ((u_long)(token - input) < maxTotchars));
 
-  /*
-   *END REQUEST STRUCTURE BUILD.
-   */
   *nbtr = maxTotchars;
   delete [] input;
   return validResponse;
 }
 
 /*!
- *Controls if the req string is a valid HTTP request header.
- *Returns 200 if is a valid request.
- *Returns -1 if the request is incomplete.
- *Any other returned value is the HTTP error.
- *\param req The buffer with the HTTP request.
- *\param size Size of the request buffer.
- *\param nLinesptr Lines in the header.
- *\param ncharsptr Characters in the header.
+ * Controls if the req string is a valid HTTP request header.
+ * Returns 200 if is a valid request.
+ * Returns -1 if the request is incomplete.
+ * Any other returned value is the HTTP error.
+ * \param req The buffer with the HTTP request.
+ * \param size Size of the request buffer.
+ * \param nLinesptr Lines in the header.
+ * \param ncharsptr Characters in the header.
  */
 int HttpHeaders::validHTTPRequest(const char *req, u_long size,
                                   u_long* nLinesptr, u_long* ncharsptr)
@@ -1310,10 +1256,10 @@ int HttpHeaders::validHTTPRequest(const char *req, 
u_long size,
   u_long nLinechars = 0;
   nLinechars = 0;
   u_long nLines = 0;
-  
+
   if (req == 0)
     return 400;
-  
+
   for(;i < MYSERVER_KB(8); i++)
   {
     if (req[i] == '\n')
@@ -1324,9 +1270,9 @@ int HttpHeaders::validHTTPRequest(const char *req, u_long 
size,
           return 400;
         break;
       }
-      /* 
-       *If the lines number is greater than 25 we consider 
-       *the header invalid.
+      /*
+       * If the lines number is greater than 25 we consider
+       * the header invalid.
       */
       if (nLines >= 25)
         return 400;
@@ -1337,7 +1283,8 @@ int HttpHeaders::validHTTPRequest(const char *req, u_long 
size,
       return -1;
 
     /*
-    *If a line contains more than 2048 characters then the header is 
considered invalid.
+    * If a line contains more than 2048 characters then the
+    * header is considered invalid.
     */
     if (nLinechars >= 2048)
     {
@@ -1352,7 +1299,7 @@ int HttpHeaders::validHTTPRequest(const char *req, u_long 
size,
   /* Set the output variables.  */
   *nLinesptr = nLines;
   *ncharsptr = i+3;
-  
+
   /* Return if is a valid request header.  */
   return 200;
 }

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

Summary of changes:
 myserver/include/base/string/securestr.h    |   11 +-
 myserver/include/base/string/stringutils.h  |  103 ++--
 myserver/src/base/find_data/find_data.cpp   |   56 +-
 myserver/src/base/home_dir/home_dir.cpp     |  208 +++---
 myserver/src/base/pipe/pipe.cpp             |   27 +-
 myserver/src/base/string/securestr.cpp      |  155 ++--
 myserver/src/base/string/stringutils.cpp    |  762 ++++++++---------
 myserver/src/protocol/http/http.cpp         |  452 ++++------
 myserver/src/protocol/http/http_headers.cpp | 1239 +++++++++++++--------------
 9 files changed, 1427 insertions(+), 1586 deletions(-)


hooks/post-receive
-- 
GNU MyServer




reply via email to

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