myserver-commit
[Top][All Lists]
Advanced

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

[myserver-commit] [2790] Removed global variable versionOfSoftware.


From: Giuseppe Scrivano
Subject: [myserver-commit] [2790] Removed global variable versionOfSoftware.
Date: Sat, 06 Sep 2008 19:58:20 +0000

Revision: 2790
          http://svn.sv.gnu.org/viewvc/?view=rev&root=myserver&revision=2790
Author:   gscrivano
Date:     2008-09-06 19:58:19 +0000 (Sat, 06 Sep 2008)

Log Message:
-----------
Removed global variable versionOfSoftware.  It closes the task #8586

Ticket Links:
:-----------
    http://savannah.gnu.org/task/?8586

Modified Paths:
--------------
    trunk/myserver/SConstruct
    trunk/myserver/configure.in
    trunk/myserver/generate_myserver_dev.pl
    trunk/myserver/include/http_handler/wincgi/wincgi.h
    trunk/myserver/include/protocol/http/env/env.h
    trunk/myserver/src/http_handler/http_dir/http_dir.cpp
    trunk/myserver/src/http_handler/isapi/isapi.cpp
    trunk/myserver/src/myserver.cpp
    trunk/myserver/src/protocol/control/control_protocol.cpp
    trunk/myserver/src/protocol/http/env/env.cpp
    trunk/myserver/src/protocol/http/http.cpp
    trunk/myserver/src/protocol/http/http_headers.cpp
    trunk/myserver/src/server/server.cpp
    trunk/myserver/stdafx.h

Modified: trunk/myserver/SConstruct
===================================================================
--- trunk/myserver/SConstruct   2008-09-06 18:27:49 UTC (rev 2789)
+++ trunk/myserver/SConstruct   2008-09-06 19:58:19 UTC (rev 2790)
@@ -26,9 +26,7 @@
 
 import string
  
-PKG_NAME = "MyServer"
-MYSERVER_VERSION = "0.9.0"
-PKG_VERSION = MYSERVER_VERSION + "-" + "rc2"
+MYSERVER_VERSION = "GNU MyServer 0.9.0"
 
 SVN_TRUNK = "svn://svn.savannah.gnu.org/myserver/trunk"
 HOMEPAGE = "http://www.gnu.org/software/myserver/";
@@ -39,7 +37,7 @@
 ddir = ARGUMENTS.get('destdir', "#/release")
 plugin = ARGUMENTS.get('plugin', "")
 
-destdir = ddir + "/" + PKG_NAME.lower() + "-" + PKG_VERSION
+destdir = ddir
 
 listinc=[
       '/usr/local/include',
@@ -112,8 +110,6 @@
     if not conf.__dict__.has_key('Define'):
         conf.Define = Define_helper
 
-    conf.Define("PACKAGE_NAME", '"' + PKG_NAME + '"')
-    conf.Define("PACKAGE_VERSION", '"' + PKG_VERSION + '"')
     conf.Define("MYSERVER_VERSION", '"' + MYSERVER_VERSION + '"')
 
     if not conf.CheckLib("libxml2"):
@@ -311,7 +307,7 @@
 
     #Prepare the package.
     if command == "package":
-        filename = PKG_NAME.lower() + "-" + PKG_VERSION + ".tar.gz"
+        filename = MYSERVER_VERSION.lower() + ".tar.gz"
         env = Environment(TARFLAGS = '-c -z')
         env.Tar(ddir + "/" + filename, destdir)
 

Modified: trunk/myserver/configure.in
===================================================================
--- trunk/myserver/configure.in 2008-09-06 18:27:49 UTC (rev 2789)
+++ trunk/myserver/configure.in 2008-09-06 19:58:19 UTC (rev 2790)
@@ -1,7 +1,6 @@
-dnl MySever configuration script
+dnl GNU MySever configuration script
 dnl
-dnl MyServer
-dnl http://www.myserverproject.net/
+dnl GNU MyServer
 dnl
 dnl Copyright (C) 2002-2008 Free Software Foundation, Inc.
 dnl This program is free software; you can redistribute it and/or modify
@@ -17,7 +16,7 @@
 dnl You should have received a copy of the GNU General Public License
 dnl along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
-AC_INIT([MyServer], [0.9.0-rc2], [http://www.myserverproject.net/])
+AC_INIT([MyServer], [0.9.0-rc2], address@hidden)
 AC_PREREQ([2.50])
 AM_CONFIG_HEADER(config.h)
 CFLAGS="${CFLAGS=}"
@@ -33,7 +32,7 @@
 MYSERVER_MINOR_VERSION=9
 MYSERVER_MICRO_VERSION=0
 
-MYSERVER_VERSION="${MYSERVER_MAJOR_VERSION}.${MYSERVER_MINOR_VERSION}.${MYSERVER_MICRO_VERSION}"
+MYSERVER_VERSION="GNU MyServer 
${MYSERVER_MAJOR_VERSION}.${MYSERVER_MINOR_VERSION}.${MYSERVER_MICRO_VERSION}"
 
 AC_SUBST(MYSERVER_MAJOR_VERSION)
 AC_SUBST(MYSERVER_MINOR_VERSION)

Modified: trunk/myserver/generate_myserver_dev.pl
===================================================================
--- trunk/myserver/generate_myserver_dev.pl     2008-09-06 18:27:49 UTC (rev 
2789)
+++ trunk/myserver/generate_myserver_dev.pl     2008-09-06 19:58:19 UTC (rev 
2790)
@@ -37,8 +37,8 @@
 PrivateResource=myserver_private.rc
 ResourceIncludes=
 MakeIncludes=
-Compiler=
-CppCompiler=
+Compiler=-DMYSERVER_VERSION=\"GNU MyServer 0.9\"
+CppCompiler=-DMYSERVER_VERSION=\"GNU MyServer 0.9\"
 Linker=-lz.dll -llibxml2 -liconv -lintl -lssl -lcrypto -lrx -lgdi32 -lwininet 
-lwsock32 -luserenv -levent -rdynamic_@@_
 IsCpp=1
 Icon=
@@ -63,11 +63,11 @@
 Build=3
 LanguageID=1033
 CharsetID=1252
-CompanyName=MyServer Project
+CompanyName=Free Software Foundation Inc.
 FileVersion=0.9.0
-FileDescription=MyServer webserver
+FileDescription=GNU MyServer webserver
 InternalName=
-LegalCopyright=MyServer Team
+LegalCopyright=Free Software Foundation Inc.
 LegalTrademarks=
 OriginalFilename=myserver.exe
 ProductName=MyServer

Modified: trunk/myserver/include/http_handler/wincgi/wincgi.h
===================================================================
--- trunk/myserver/include/http_handler/wincgi/wincgi.h 2008-09-06 18:27:49 UTC 
(rev 2789)
+++ trunk/myserver/include/http_handler/wincgi/wincgi.h 2008-09-06 19:58:19 UTC 
(rev 2790)
@@ -25,8 +25,6 @@
 #include <include/protocol/http/http_headers.h>
 #include <include/protocol/http/http_data_handler.h>
 
-extern const char *versionOfSoftware;
-
 class WinCgi : public HttpDataHandler
 {
 private:

Modified: trunk/myserver/include/protocol/http/env/env.h
===================================================================
--- trunk/myserver/include/protocol/http/env/env.h      2008-09-06 18:27:49 UTC 
(rev 2789)
+++ trunk/myserver/include/protocol/http/env/env.h      2008-09-06 19:58:19 UTC 
(rev 2790)
@@ -23,8 +23,6 @@
 #include <include/protocol/http/http_headers.h>
 #include <include/protocol/http/http_data_handler.h>
 
-extern const char *versionOfSoftware;
-
 class Env
 {
 public:

Modified: trunk/myserver/src/http_handler/http_dir/http_dir.cpp
===================================================================
--- trunk/myserver/src/http_handler/http_dir/http_dir.cpp       2008-09-06 
18:27:49 UTC (rev 2789)
+++ trunk/myserver/src/http_handler/http_dir/http_dir.cpp       2008-09-06 
19:58:19 UTC (rev 2790)
@@ -487,8 +487,8 @@
   }
 
   td->buffer2->setLength(0);
-  *td->buffer2 << "</table>\r\n<hr />\r\n<address>GNU MyServer " 
-               << versionOfSoftware;
+  *td->buffer2 << "</table>\r\n<hr />\r\n<address>"
+               << MYSERVER_VERSION;
               
   if(host && host->value->length())
   {    

Modified: trunk/myserver/src/http_handler/isapi/isapi.cpp
===================================================================
--- trunk/myserver/src/http_handler/isapi/isapi.cpp     2008-09-06 18:27:49 UTC 
(rev 2789)
+++ trunk/myserver/src/http_handler/isapi/isapi.cpp     2008-09-06 19:58:19 UTC 
(rev 2790)
@@ -713,7 +713,7 @@
   if(valLen + 30 < maxLen)
     valLen += sprintf(&ValStr[valLen], 
                       "SERVER_SIGNATURE:<address>%s</address>\n",
-                      versionOfSoftware);
+                      MYSERVER_VERSION);
   else if(valLen + 30 < maxLen) 
     return 0;
 

Modified: trunk/myserver/src/myserver.cpp
===================================================================
--- trunk/myserver/src/myserver.cpp     2008-09-06 18:27:49 UTC (rev 2789)
+++ trunk/myserver/src/myserver.cpp     2008-09-06 19:58:19 UTC (rev 2790)
@@ -58,14 +58,6 @@
 void RunAsService();
 static char *path;
 
-/*
- *Change this to reflect the version of the software.
- */
-#ifdef MYSERVER_VERSION
-const char *versionOfSoftware = MYSERVER_VERSION;
-#else
-const char *versionOfSoftware = "0.9.0";
-#endif
 int argn;
 char **argv;
 void registerSignals();
@@ -276,7 +268,7 @@
   /* If the version flag is up, show the version and exit.  */
   if(input.version)
   {
-    cout << "GNU MyServer "<< versionOfSoftware << endl;
+    cout << MYSERVER_VERSION << endl;
     
     cout 
 #ifdef __DATE__
@@ -292,7 +284,7 @@
   {       
     if(!strcmpi(argv[1], "VERSION"))
     {
-      cout << "MyServer " << versionOfSoftware << endl;
+      cout << MYSERVER_VERSION << endl;
       return 0;
     }
     if(!strcmpi(argv[1], "CONSOLE"))

Modified: trunk/myserver/src/protocol/control/control_protocol.cpp
===================================================================
--- trunk/myserver/src/protocol/control/control_protocol.cpp    2008-09-06 
18:27:49 UTC (rev 2789)
+++ trunk/myserver/src/protocol/control/control_protocol.cpp    2008-09-06 
19:58:19 UTC (rev 2790)
@@ -21,6 +21,7 @@
 #include <include/base/md5/md5.h>
 #include <include/server/server.h>
 #include <include/base/find_data/find_data.h>
+#include <include/base/string/securestr.h>
 #include <include/plugin/protocol/protocols_manager.h>
 #include <include/protocol/control/control_errors.h>
 #include <include/base/string/stringutils.h>
@@ -43,8 +44,6 @@
 
 using namespace std;
 
-extern const char *versionOfSoftware;
-
 char ControlProtocol::adminLogin[64] = "";
 char ControlProtocol::adminPassword[64] = "";
 int  ControlProtocol::controlEnabled = 0;
@@ -104,10 +103,10 @@
   tmpPassword[0]='\0';
   Md5 md5;
 
-  /*! Is the value in the config file still in MD5? */
+  /* Is the value in the config file still in MD5?  */
   int adminNameMD5ized = 0;
 
-  /*! Is the value in the config file still in MD5? */
+  /* Is the value in the config file still in MD5?  */
   int adminPasswordMD5ized = 0;
 
   char *data = 0;
@@ -126,26 +125,26 @@
     controlEnabled = 0;
   }
 
-  data=configurationFileManager.getValue("CONTROL_ADMIN");
+  data = configurationFileManager.getValue("CONTROL_ADMIN");
   if(data)
   {
     strncpy(tmpName, data, 64);
   }  
 
-  data=configurationFileManager.getValue("CONTROL_PASSWORD");
+  data = configurationFileManager.getValue("CONTROL_PASSWORD");
   if(data)
   {
     strncpy(tmpPassword, data, 64);
   }  
 
-  data=configurationFileManager.getAttr("CONTROL_ADMIN", "MD5");
+  data = configurationFileManager.getAttr("CONTROL_ADMIN", "MD5");
   if(data)
   {
     if(strcmpi(data, "YES") == 0)
       adminNameMD5ized = 1;
   }  
 
-  data=configurationFileManager.getAttr("CONTROL_PASSWORD", "MD5");
+  data = configurationFileManager.getAttr("CONTROL_PASSWORD", "MD5");
   if(data)
   {
     if(strcmpi(data, "YES") == 0)
@@ -174,7 +173,6 @@
     md5.end(adminPassword);
   }
 
-  
   configurationFileManager.close();
   return 0;
 }
@@ -234,17 +232,16 @@
   /* Output file. */
   File *Ofile = 0;
 
-
   /* Use control_header to parse the request. */
   ControlHeader header;
 
-  /*! Is the specified command a know one? */
+  /* Is the specified command a know one? */
   int knownCommand;
   if(a->getToRemove())
   {
     switch(a->getToRemove())
     {
-      /*! Remove the connection from the list. */
+      /* Remove the connection from the list. */
       case CONNECTION_REMOVE_OVERLOAD:
         sendResponse(b2, bs2, a, CONTROL_SERVER_BUSY, header, 0);
         return 0;
@@ -256,7 +253,7 @@
 
   ret = header.parse_header(b1, nbtr, &realHeaderLength);
 
-  /*! 
+  /*
    *On errors remove the connection from the connections list.
    *For return values look at protocol/control/control_errors.h.
    *Returning 0 from the controlConnection we will remove the connection
@@ -264,7 +261,7 @@
    */
   if(ret != CONTROL_OK)
   {
-    /*! parse_header returns -1 on an incomplete header. */
+    /* parse_header returns -1 on an incomplete header.  */
     if(ret == -1)
     {
       return 2;
@@ -318,10 +315,10 @@
     }
   }
 
-  /*! Check if there are other bytes waiting to be read. */
+  /* Check if there are other bytes waiting to be read. */
   if(specified_length && (specified_length != static_cast<int>(nbtr - 
realHeaderLength) ))
   {
-    /*! Check if we can read all the specified data. */
+    /* Check if we can read all the specified data. */
     while(specified_length != static_cast<int>(nbtr - realHeaderLength))
     {
       if(a->socket->bytesToRead())
@@ -368,7 +365,7 @@
       }
       else
       {
-        /*! Wait a bit. */
+        /* Wait a bit.  */
         Thread::wait(2);
       }
     }
@@ -395,10 +392,10 @@
      
   authorized = checkAuth(header);
 
-  /*! 
+  /* 
    *If the client is not authorized remove the connection.
    */
-  if(authorized ==0)
+  if(authorized == 0)
   {
     strcpy(b2,"Control: Bad authorization");
     addToErrorLog(a,b2, strlen(b2), header);
@@ -412,7 +409,7 @@
     sendResponse(b2, bs2, a, CONTROL_AUTH, header, 0);
     return 0;
   }
-  /*! 
+  /*
    *If the specified length is different from the length that the 
    *server can read, remove the connection.
    */
@@ -436,7 +433,7 @@
 
   knownCommand = 0;
 
-  /*! 
+  /* 
    *Create an out file. This can be used by commands that
    *needs it.
    */
@@ -556,7 +553,7 @@
     FilesUtility::deleteFile(IfilePath.str().c_str());
     FilesUtility::deleteFile(OfilePath.str().c_str());
     connection = header.getConnection();
-    /*! 
+    /* 
      *If the Keep-Alive was specified keep the connection in the
      *active connections list.
      */
@@ -598,7 +595,7 @@
   string time;
   ostringstream out;
   ThreadID id = Thread::threadID();
-  /*!
+  /*
    *Check that the verbosity is at least 1.
    */
   if(Server::getInstance()->getVerbosity() < 1)
@@ -660,7 +657,7 @@
   }
   if(outFile)
     dataLength = outFile->getFileSize();
-  /*! Build and send the first line. */
+  /* Build and send the first line.  */
 #ifdef HAVE_SNPRINTF
   snprintf(buffer, buffersize,
 #else
@@ -675,7 +672,7 @@
     return -1;
   }
 
-  /*! Build and send the Length line. */
+  /* Build and send the Length line.  */
 #ifdef HAVE_SNPRINTF
   snprintf(buffer, buffersize,
 #else
@@ -691,7 +688,7 @@
     return -1;
   }
 
-  /*! Send the end of the header. */
+  /* Send the end of the header.  */
   err = conn->socket->send("\r\n", 2, 0);
   if(err == -1)
   {
@@ -700,7 +697,7 @@
     return -1;
   }
 
-  /*! Flush the content of the file if any. */
+  /* Flush the content of the file if any.  */
   if(dataLength)
   {
     int dataToSend = dataLength;
@@ -864,10 +861,10 @@
   const char *filename = 0;
   File localfile;
   int ret = 0;
-  /*! # of bytes read. */
+  /* # of bytes read.  */
   u_long nbr = 0;
 
-  /*! # of bytes written. */
+  /* # of bytes written.  */
   u_long nbw = 0;
 
   if(!strcmpi(fn, "myserver.xml"))
@@ -884,7 +881,7 @@
   }
   else if(!FilesUtility::fileExists(fn))
   {
-    /*! If we cannot find the file send the right error ID. */
+    /* If we cannot find the file send the right error ID.  */
     string msg;
     msg.assign("Control: Requested file doesn't exist ");
     msg.append(fn);
@@ -898,7 +895,7 @@
   
   ret = localfile.openFile(filename, File::MYSERVER_OPEN_READ | 
File::MYSERVER_OPEN_IFEXISTS);
 
-  /*! An internal server error happens. */
+  /* An internal server error happens.  */
   if(ret)
   {
     string msg;
@@ -919,7 +916,7 @@
       return CONTROL_INTERNAL;
     }
 
-    /*! Break the loop when we can't read no more data.*/
+    /* Break the loop when we can't read no more data.  */
     if(!nbr)
       break;
     
@@ -950,9 +947,9 @@
   File localfile;
   int isAutoRebootToEnable = Server::getInstance()->isAutorebootEnabled();
   int ret = 0;
-  /*! # of bytes read. */
+  /*! # of bytes read.  */
   u_long nbr = 0;
-  /*! # of bytes written. */
+  /*! # of bytes written.  */
   u_long nbw = 0;
   Server::getInstance()->disableAutoReboot();
   if(!strcmpi(fn, "myserver.xml"))
@@ -972,10 +969,10 @@
     filename = fn;    
   }  
 
-  /*! Remove the file before create it. */
+  /* Remove the file before create it.  */
   ret = FilesUtility::deleteFile(filename);
 
-  /*! An internal server error happens. */
+  /* An internal server error happens.  */
   if(ret)
   {
     strcpy(b1,"Control: Error deleting the file");
@@ -989,7 +986,7 @@
 
   ret = localfile.openFile(filename, File::MYSERVER_OPEN_WRITE | 
File::MYSERVER_OPEN_ALWAYS);
 
-  /*! An internal server error happens. */
+  /* An internal server error happens.  */
   if(ret)
   {
     string msg;
@@ -1016,7 +1013,7 @@
       return CONTROL_INTERNAL;
     }
 
-    /*! Break the loop when we can't read no more data.*/
+    /* Break the loop when we can't read no more data.  */
     if(!nbr)
       break;
     
@@ -1075,7 +1072,7 @@
     string filename;
     string ext;
     u_long nbw = 0;
-    /*! Do not show files starting with a dot. */
+    /* Do not show files starting with a dot.  */
     if(fd.name[0]=='.')
       continue;
  
@@ -1105,16 +1102,12 @@
 /*!
  *Return the current MyServer version.
  */
-int ControlProtocol::getVersion(ConnectionPtr a, File* out, char *b1,int bs1, 
+int ControlProtocol::getVersion(ConnectionPtr a, File* out, char *b1, int bs1, 
                                 ControlHeader& header)
 {
   u_long nbw;
-#ifdef HAVE_SNPRINTF
-  snprintf(b1, bs1,
-#else
-  sprintf(b1, 
-#endif
-          "MyServer %s", versionOfSoftware);
+  
+  myserver_strlcpy(b1, MYSERVER_VERSION, bs1);
  
   return out->writeToFile(b1, strlen(b1), &nbw);
 }

Modified: trunk/myserver/src/protocol/http/env/env.cpp
===================================================================
--- trunk/myserver/src/protocol/http/env/env.cpp        2008-09-06 18:27:49 UTC 
(rev 2789)
+++ trunk/myserver/src/protocol/http/env/env.cpp        2008-09-06 19:58:19 UTC 
(rev 2790)
@@ -53,7 +53,7 @@
   HttpRequestHeader::Entry* reqEntry = NULL;
 
   memCgi.setExternalBuffer(cgiEnv, td->buffer2->getRealLength());
-  memCgi << "SERVER_SOFTWARE=GNU MyServer " << versionOfSoftware;
+  memCgi << "SERVER_SOFTWARE=" << MYSERVER_VERSION;
 
 #ifdef WIN32
   memCgi << " (WIN32)";
@@ -71,9 +71,7 @@
   memCgi << Server::getInstance()->getServerName();
   
   memCgi << end_str << "SERVER_SIGNATURE=";
-  memCgi << "<address>GNU MyServer ";
-  memCgi << versionOfSoftware;
-  memCgi << "</address>";
+  memCgi << "<address>" << MYSERVER_VERSION << "</address>";
   
   memCgi << end_str << "SERVER_PROTOCOL=";
   memCgi << td->request.ver.c_str();  

Modified: trunk/myserver/src/protocol/http/http.cpp
===================================================================
--- trunk/myserver/src/protocol/http/http.cpp   2008-09-06 18:27:49 UTC (rev 
2789)
+++ trunk/myserver/src/protocol/http/http.cpp   2008-09-06 19:58:19 UTC (rev 
2790)
@@ -94,20 +94,20 @@
     td->buffer2->setLength(0);
     *td->buffer2 <<  "HTTP/1.1 200 OK\r\n";
     *td->buffer2 << "Date: " << time ;
-    *td->buffer2 <<  "\r\nServer: MyServer "  << versionOfSoftware ;
+    *td->buffer2 <<  "\r\nServer: "<< MYSERVER_VERSION;
     if(connection && connection->value->length())
-      *td->buffer2 << "\r\nConnection:" << connection->value->c_str() ;
-    *td->buffer2 <<"\r\nContent-Length: 0\r\nAccept-Ranges: bytes\r\n";
-    *td->buffer2 << "Allow: " << methods;
+      *td->buffer2 << "\r\nConnection:" << connection->value->c_str() << 
"\r\n";
+    *td->buffer2 <<"Content-Length: 0\r\nAccept-Ranges: bytes\r\n";
+    *td->buffer2 << "Allow: " << methods << "\r\n";
 
     /*!
      *Check if the TRACE command is allowed on the virtual host.
      */
     if(allowHTTPTRACE())
-      *td->buffer2 << ", TRACE\r\n\r\n";
-    else
-      *td->buffer2 << "\r\n\r\n";
+      *td->buffer2 << ", TRACE\r\n";
 
+    *td->buffer2 << "r\n";
+
     /*! Send the HTTP header. */
     ret = td->connection->socket->send(td->buffer2->getBuffer(),
                                       (u_long)td->buffer2->getLength(), 0);
@@ -143,14 +143,14 @@
       return raiseHTTPError(401);
     td->buffer2->setLength(0);
     *td->buffer2 << "HTTP/1.1 200 OK\r\n";
-    *td->buffer2 << "Date: " << time ;
-    *td->buffer2 << "\r\nServer: MyServer " << versionOfSoftware ;
+    *td->buffer2 << "Date: " << time << "\r\n";
+    *td->buffer2 << "Server: " << MYSERVER_VERSION  << "\r\n";
     connection = td->request.other.get("Connection");
     if(connection && connection->value->length())
-      *td->buffer2 << "\r\nConnection:" << connection->value->c_str();
-    *td->buffer2 <<"\r\nContent-Length:" << tmp
-                << "\r\nContent-Type: message/http\r\n"
-                << "Accept-Ranges: bytes\r\n\r\n";
+      *td->buffer2 << "Connection:" << connection->value->c_str() << "\r\n";
+    *td->buffer2 <<"Content-Length:" << tmp << "\r\n"
+                 << "Content-Type: message/http\r\n"
+                 << "Accept-Ranges: bytes\r\n\r\n";
 
     /*! Send our HTTP header.  */
     ret = td->connection->socket->send(td->buffer2->getBuffer(),
@@ -1856,11 +1856,13 @@
   td->response.httpStatus = 401;
   td->buffer2->setLength(0);
   *td->buffer2 << "HTTP/1.1 401 Unauthorized\r\n"
-              << "Accept-Ranges: bytes\r\nServer: MyServer " ;
-  *td->buffer2 << versionOfSoftware ;
-  *td->buffer2 << "\r\nContent-Type: text/html\r\nConnection: ";
+               << "Accept-Ranges: bytes\r\n";
+  *td->buffer2 << "Server: " << MYSERVER_VERSION << "\r\n";
+  *td->buffer2 << "Content-Type: text/html\r\n"
+               << "Connection: ";
   *td->buffer2 << (connection ? connection->value->c_str() : "");
   *td->buffer2 << "\r\nContent-Length: 0\r\n";
+
   if(td->authScheme == HTTP_AUTH_SCHEME_BASIC)
   {
     *td->buffer2 <<  "WWW-Authenticate: Basic realm=\""
@@ -2131,9 +2133,9 @@
   *td->buffer << td->connection->getIpAddr() ;
   *td->buffer << "\r\n";
   td->buffer2->setLength(0);
-  *td->buffer2 << "HTTP/1.1 500 System Error\r\nServer: MyServer ";
-  *td->buffer2 << versionOfSoftware;
-  *td->buffer2 <<" \r\nContent-Type: text/html\r\nContent-Length: ";
+  *td->buffer2 << "HTTP/1.1 500 System Error\r\n";
+  *td->buffer2 << "Server: " << MYSERVER_VERSION << "\r\n";
+  *td->buffer2 <<" Content-Type: text/html\r\nContent-Length: ";
   tmp.intToStr((int)strlen(hardHTML), tmpStr, 12);
   *td->buffer2 << tmp;
   *td->buffer2 << "\r\n";
@@ -2262,7 +2264,7 @@
   td->response.httpStatus = 302;
   td->buffer2->setLength(0);
   *td->buffer2 << "HTTP/1.1 302 Moved\r\nAccept-Ranges: bytes\r\n"
-              << "Server: MyServer "  << versionOfSoftware << "\r\n"
+              << "Server: "  << MYSERVER_VERSION << "\r\n"
               << "Content-Type: text/html\r\n"
               << "Location: " << newURL << "\r\n"
               << "Content-Length: 0\r\n";
@@ -2294,7 +2296,7 @@
   td->response.httpStatus = 304;
   td->buffer2->setLength(0);
   *td->buffer2 << "HTTP/1.1 304 Not Modified\r\nAccept-Ranges: bytes\r\n"
-              << "Server: MyServer "  << versionOfSoftware <<  "\r\n";
+              << "Server: "  << MYSERVER_VERSION << "\r\n";
 
   if(connection && !stringcmpi(connection->value->c_str(), "keep-alive"))
     *td->buffer2 << "Connection: keep-alive\r\n";

Modified: trunk/myserver/src/protocol/http/http_headers.cpp
===================================================================
--- trunk/myserver/src/protocol/http/http_headers.cpp   2008-09-06 18:27:49 UTC 
(rev 2789)
+++ trunk/myserver/src/protocol/http/http_headers.cpp   2008-09-06 19:58:19 UTC 
(rev 2790)
@@ -75,8 +75,8 @@
   }
   else
   {
-    pos += myserver_strlcpy(pos, "Server: GNU MyServer ", MAX-(long)(pos-str));
-    pos += myserver_strlcpy(pos, versionOfSoftware,  MAX-(long)(pos-str));
+    pos += myserver_strlcpy(pos, "Server: ", MAX-(long)(pos-str));
+    pos += myserver_strlcpy(pos, MYSERVER_VERSION,  MAX-(long)(pos-str));
     pos += myserver_strlcpy(pos, "\r\n", MAX-(long)(pos-str));
   }
 
@@ -292,7 +292,6 @@
 void HttpHeaders::buildDefaultHTTPResponseHeader(HttpResponseHeader* response)
 {
   string date;
-  ostringstream stream;
   resetHTTPResponse(response);
   /*!
    *By default use:
@@ -307,8 +306,7 @@
   getRFC822GMTTime(date,HTTP_RESPONSE_DATE_DIM);
   response->date.assign(date);
   response->dateExp.assign(date);
-  stream << "MyServer " << versionOfSoftware;
-  response->serverName.assign(stream.str());
+  response->serverName.assign(MYSERVER_VERSION);
 }
 
 /*!

Modified: trunk/myserver/src/server/server.cpp
===================================================================
--- trunk/myserver/src/server/server.cpp        2008-09-06 18:27:49 UTC (rev 
2789)
+++ trunk/myserver/src/server/server.cpp        2008-09-06 19:58:19 UTC (rev 
2790)
@@ -162,8 +162,8 @@
     try
     {
       string softwareSignature;
-      softwareSignature.assign("************GNU MyServer ");
-      softwareSignature.append(versionOfSoftware);
+      softwareSignature.assign("************");
+      softwareSignature.append(MYSERVER_VERSION);
       softwareSignature.append("************");
 
       i = softwareSignature.length();

Modified: trunk/myserver/stdafx.h
===================================================================
--- trunk/myserver/stdafx.h     2008-09-06 18:27:49 UTC (rev 2789)
+++ trunk/myserver/stdafx.h     2008-09-06 19:58:19 UTC (rev 2790)
@@ -80,7 +80,6 @@
 typedef unsigned char u_char;
 
 typedef void* HANDLE;
-extern const char *versionOfSoftware;
 
 #ifndef SOCKET_ERROR
 #define SOCKET_ERROR -1






reply via email to

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