diff --git a/GNUmakefile b/GNUmakefile
index 00778a8f5..338470592 100644
--- a/GNUmakefile
+++ b/GNUmakefile
@@ -145,7 +145,6 @@ endif
INCLUDE = -I.\
-Isource\
-Isource/md5\
- -IWebServer\
-Isource/items\
-Isource/blocks\
-Itolua++-1.0.93/src/lib\
@@ -167,7 +166,7 @@ INCLUDE = -I.\
# 2012_11_08 _X: Removed: squirrel_3_0_1_stable
-SOURCES := $(shell find CryptoPP lua-5.1.4 jsoncpp-src-0.5.0 zlib-1.2.7 source tolua++-1.0.93 iniFile WebServer expat '(' -name '*.cpp' -o -name '*.c' ')')
+SOURCES := $(shell find CryptoPP lua-5.1.4 jsoncpp-src-0.5.0 zlib-1.2.7 source tolua++-1.0.93 iniFile expat '(' -name '*.cpp' -o -name '*.c' ')')
SOURCES := $(filter-out %minigzip.c %lua.c %tolua.c %toluabind.c %LeakFinder.cpp %StackWalker.cpp %example.c,$(SOURCES))
OBJECTS := $(patsubst %.c,$(BUILDDIR)%.o,$(SOURCES))
OBJECTS := $(patsubst %.cpp,$(BUILDDIR)%.o,$(OBJECTS))
diff --git a/VC2008/MCServer.sln b/VC2008/MCServer.sln
index 6466fdddd..aeabaf252 100644
--- a/VC2008/MCServer.sln
+++ b/VC2008/MCServer.sln
@@ -2,7 +2,6 @@ Microsoft Visual Studio Solution File, Format Version 10.00
# Visual C++ Express 2008
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "MCServer", "MCServer.vcproj", "{32012054-0C96-4C43-AB27-174FF8E72D66}"
ProjectSection(ProjectDependencies) = postProject
- {9A476537-42C0-4848-AB40-15CFE83D17A8} = {9A476537-42C0-4848-AB40-15CFE83D17A8}
{082E8185-7B3A-4945-8C82-9132341A329D} = {082E8185-7B3A-4945-8C82-9132341A329D}
{5FCFAF8D-FF2C-456D-A72C-1D76F913AD96} = {5FCFAF8D-FF2C-456D-A72C-1D76F913AD96}
{3423EC9A-52E4-4A4D-9753-EDEBC38785EF} = {3423EC9A-52E4-4A4D-9753-EDEBC38785EF}
@@ -19,8 +18,6 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Lua", "Lua.vcproj", "{082E8
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ToLua", "ToLua.vcproj", "{EEAB54AD-114C-4AB8-8482-0A52D502BD35}"
EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "WebServer", "WebServer.vcproj", "{9A476537-42C0-4848-AB40-15CFE83D17A8}"
-EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "CryptoPP", "CryptoPP.vcproj", "{3423EC9A-52E4-4A4D-9753-EDEBC38785EF}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "expat", "expat.vcproj", "{5FCFAF8D-FF2C-456D-A72C-1D76F913AD96}"
@@ -73,14 +70,6 @@ Global
{EEAB54AD-114C-4AB8-8482-0A52D502BD35}.Release profiled|Win32.Build.0 = Release profiled|Win32
{EEAB54AD-114C-4AB8-8482-0A52D502BD35}.Release|Win32.ActiveCfg = Release|Win32
{EEAB54AD-114C-4AB8-8482-0A52D502BD35}.Release|Win32.Build.0 = Release|Win32
- {9A476537-42C0-4848-AB40-15CFE83D17A8}.Debug profiled|Win32.ActiveCfg = Debug profiled|Win32
- {9A476537-42C0-4848-AB40-15CFE83D17A8}.Debug profiled|Win32.Build.0 = Debug profiled|Win32
- {9A476537-42C0-4848-AB40-15CFE83D17A8}.Debug|Win32.ActiveCfg = Debug|Win32
- {9A476537-42C0-4848-AB40-15CFE83D17A8}.Debug|Win32.Build.0 = Debug|Win32
- {9A476537-42C0-4848-AB40-15CFE83D17A8}.Release profiled|Win32.ActiveCfg = Release profiled|Win32
- {9A476537-42C0-4848-AB40-15CFE83D17A8}.Release profiled|Win32.Build.0 = Release profiled|Win32
- {9A476537-42C0-4848-AB40-15CFE83D17A8}.Release|Win32.ActiveCfg = Release|Win32
- {9A476537-42C0-4848-AB40-15CFE83D17A8}.Release|Win32.Build.0 = Release|Win32
{3423EC9A-52E4-4A4D-9753-EDEBC38785EF}.Debug profiled|Win32.ActiveCfg = Debug|Win32
{3423EC9A-52E4-4A4D-9753-EDEBC38785EF}.Debug profiled|Win32.Build.0 = Debug|Win32
{3423EC9A-52E4-4A4D-9753-EDEBC38785EF}.Debug|Win32.ActiveCfg = Debug|Win32
diff --git a/VC2008/WebServer.cbp b/VC2008/WebServer.cbp
deleted file mode 100644
index 41fb405c2..000000000
--- a/VC2008/WebServer.cbp
+++ /dev/null
@@ -1,77 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/VC2008/WebServer.vcproj b/VC2008/WebServer.vcproj
deleted file mode 100644
index 601d2f554..000000000
--- a/VC2008/WebServer.vcproj
+++ /dev/null
@@ -1,374 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/WebServer/Events.cpp b/WebServer/Events.cpp
deleted file mode 100644
index 30eb731f9..000000000
--- a/WebServer/Events.cpp
+++ /dev/null
@@ -1,125 +0,0 @@
-
-#include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules
-
-#include "Events.h"
-
-
-
-
-
-cEvents::cEvents( unsigned int a_NumEvents /* = 1 */ )
- : m_NumEvents( a_NumEvents )
-#ifndef _WIN32
- , m_bNamed( false )
-#endif
-{
- if( m_NumEvents < 1 ) m_NumEvents = 1;
-
-#ifdef _WIN32
- m_Handle = new HANDLE[ m_NumEvents ];
- for( unsigned int i = 0; i < m_NumEvents; i++)
- {
- ((HANDLE*)m_Handle)[i] = CreateEvent( 0, FALSE, FALSE, 0 );
- }
-#else
- m_Handle = new sem_t*[ m_NumEvents ];
- for( unsigned int i = 0; i < m_NumEvents; i++)
- {
-
- sem_t* & HandlePtr = ((sem_t**)m_Handle)[i];
- HandlePtr = new sem_t;
-
- if( sem_init( HandlePtr, 0, 0 ) )
- {
- LOG("WARNING cEvents: Could not create unnamed semaphore, fallback to named.");
- m_bNamed = true;
- delete HandlePtr; // named semaphores return their own address
-
- char c_Str[32];
- sprintf( c_Str, "cEvents%p", &HandlePtr );
- HandlePtr = sem_open( c_Str, O_CREAT, 777, 0 );
- if( HandlePtr == SEM_FAILED )
- LOG("ERROR: Could not create Event. (%i)", errno);
- else
- if( sem_unlink( c_Str ) != 0 )
- LOG("ERROR: Could not unlink cEvents. (%i)", errno);
- }
- }
-#endif
-}
-
-
-
-
-
-cEvents::~cEvents()
-{
-#ifdef _WIN32
- for( unsigned int i = 0; i < m_NumEvents; i++ )
- {
- CloseHandle( ((HANDLE*)m_Handle)[i] );
- }
- delete [] (HANDLE*)m_Handle;
-#else
- for( unsigned int i = 0; i < m_NumEvents; i++ )
- {
- if( m_bNamed )
- {
- sem_t* & HandlePtr = ((sem_t**)m_Handle)[i];
- char c_Str[32];
- sprintf( c_Str, "cEvents%p", &HandlePtr );
- // LOG("Closing event: %s", c_Str );
- // LOG("Sem ptr: %p", HandlePtr );
- if( sem_close( HandlePtr ) != 0 )
- {
- LOG("ERROR: Could not close cEvents. (%i)", errno);
- }
- }
- else
- {
- sem_destroy( ((sem_t**)m_Handle)[i] );
- delete ((sem_t**)m_Handle)[i];
- }
- }
- delete [] (sem_t**)m_Handle; m_Handle = 0;
-#endif
-}
-
-
-
-
-
-void cEvents::Wait()
-{
-#ifdef _WIN32
- WaitForMultipleObjects( m_NumEvents, (HANDLE*)m_Handle, true, INFINITE );
-#else
- for(unsigned int i = 0; i < m_NumEvents; i++)
- {
- if( sem_wait( ((sem_t**)m_Handle)[i] ) != 0 )
- {
- LOG("ERROR: Could not wait for cEvents. (%i)", errno);
- }
- }
-#endif
-}
-
-
-
-
-
-void cEvents::Set(unsigned int a_EventNum /* = 0 */)
-{
-#ifdef _WIN32
- SetEvent( ((HANDLE*)m_Handle)[a_EventNum] );
-#else
- if( sem_post( ((sem_t**)m_Handle)[a_EventNum] ) != 0 )
- {
- LOG("ERROR: Could not set cEvents. (%i)", errno);
- }
-#endif
-}
-
-
-
-
diff --git a/WebServer/Events.h b/WebServer/Events.h
deleted file mode 100644
index 352dc4056..000000000
--- a/WebServer/Events.h
+++ /dev/null
@@ -1,18 +0,0 @@
-#pragma once
-
-class cEvents
-{
-public:
- cEvents( unsigned int a_NumEvents = 1 );
- ~cEvents();
-
- void Wait();
- void Set(unsigned int a_EventNum = 0);
-private:
- unsigned int m_NumEvents;
- void* m_Handle; // HANDLE[] pointer
-
-#ifndef _WIN32
- bool m_bNamed;
-#endif
-};
diff --git a/WebServer/Globals.cpp b/WebServer/Globals.cpp
deleted file mode 100644
index 13c6ae709..000000000
--- a/WebServer/Globals.cpp
+++ /dev/null
@@ -1,10 +0,0 @@
-
-// Globals.cpp
-
-// This file is used for precompiled header generation in MSVC environments
-
-#include "Globals.h"
-
-
-
-
diff --git a/WebServer/Globals.h b/WebServer/Globals.h
deleted file mode 100644
index d60f34720..000000000
--- a/WebServer/Globals.h
+++ /dev/null
@@ -1,15 +0,0 @@
-
-// Globals.h
-
-// This file gets included from every module in the project, so that global symbols may be introduced easily
-// Also used for precompiled header generation in MSVC environments
-
-
-
-
-
-#include "../source/Globals.h"
-
-
-
-
diff --git a/WebServer/Socket.cpp b/WebServer/Socket.cpp
deleted file mode 100644
index 82c76a8f1..000000000
--- a/WebServer/Socket.cpp
+++ /dev/null
@@ -1,376 +0,0 @@
-/*
- Socket.cpp
-
- Copyright (C) 2002-2004 René Nyffenegger
-
- This source code is provided 'as-is', without any express or implied
- warranty. In no event will the author be held liable for any damages
- arising from the use of this software.
-
- Permission is granted to anyone to use this software for any purpose,
- including commercial applications, and to alter it and redistribute it
- freely, subject to the following restrictions:
-
- 1. The origin of this source code must not be misrepresented; you must not
- claim that you wrote the original source code. If you use this source code
- in a product, an acknowledgment in the product documentation would be
- appreciated but is not required.
-
- 2. Altered source versions must be plainly marked as such, and must not be
- misrepresented as being the original source code.
-
- 3. This notice may not be removed or altered from any source distribution.
-
- René Nyffenegger rene.nyffenegger@adp-gmbh.ch
-*/
-
-/*
- Note on point 2:
- THIS IS NOT THE ORIGINAL SOURCE1!!1!!!~!!~`1ONE!!`1
-*/
-
-#include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules
-
-#include "Socket.h"
-#include
-
-#ifndef _WIN32
- #include
- #include
- #include
- #define SD_SEND 0x01
-#else
- #define MSG_NOSIGNAL (0)
-#endif
-
-#ifdef __MAC_NA
- #define MSG_NOSIGNAL (0)
-#endif
-
-#ifndef MSG_NOSIGNAL
- #define MSG_NOSIGNAL 0
-#endif // MSG_NOSIGNAL
-
-using namespace std;
-
-int Socket::nofSockets_= 0;
-
-
-
-
-
-void Socket::Start()
-{
- #ifdef _WIN32
- if (!nofSockets_)
- {
- WSADATA info;
- if (WSAStartup(MAKEWORD(2,0), &info))
- {
- throw "Could not start WSA";
- }
- }
- #endif
- ++nofSockets_;
-}
-
-
-
-
-
-void Socket::End()
-{
-#ifdef _WIN32
- WSACleanup();
-#endif
-}
-
-
-
-
-
-Socket::Socket() :
- s_(INVALID_SOCKET)
-{
- Start();
- // UDP: use SOCK_DGRAM instead of SOCK_STREAM
- s_ = socket(AF_INET,SOCK_STREAM,0);
-
- if (!IsValid())
- {
-#if !defined(ANDROID_NDK)
- throw "INVALID_SOCKET";
-#endif
- }
-
- refCounter_ = new int(1);
-}
-
-
-
-
-
-Socket::Socket(SOCKET s) : s_(s)
-{
- Start();
- refCounter_ = new int(1);
-};
-
-
-
-
-
-Socket::~Socket()
-{
- if (! --(*refCounter_))
- {
- Close();
- delete refCounter_;
- }
-
- --nofSockets_;
- if (!nofSockets_)
- {
- End();
- }
-}
-
-
-
-
-
-Socket::Socket(const Socket& o)
-{
- refCounter_=o.refCounter_;
- (*refCounter_)++;
- s_ =o.s_;
-
- nofSockets_++;
-}
-
-
-
-
-
-Socket& Socket::operator=(Socket& o)
-{
- (*o.refCounter_)++;
-
- refCounter_ = o.refCounter_;
- s_ = o.s_;
-
- nofSockets_++;
-
- return *this;
-}
-
-
-
-
-
-bool Socket::IsValid(void) const
-{
- #ifdef _WIN32
- return (s_ != INVALID_SOCKET);
- #else
- return (s_ >= 0);
- #endif
-}
-
-
-
-
-
-void Socket::Close( bool a_WaitSend /* = false */ )
-{
- if (IsValid())
- {
- if (a_WaitSend)
- {
- assert( shutdown(s_, SD_SEND ) == 0 );
- char c;
- while( recv(s_, &c, 1, 0 ) > 0 )
- {}
- }
-
- #ifndef _WIN32
- // Linux needs to shut the socket down first, otherwise the socket keeps blocking accept() and select() calls!
- // Ref.: http://forum.mc-server.org/showthread.php?tid=344
- if (shutdown(s_, SHUT_RDWR) != 0)
- {
- LOGWARN("Error on shutting down socket %d", s_);
- }
- #endif // _WIN32
-
- closesocket(s_);
-
- s_ = INVALID_SOCKET;
- }
-}
-
-
-
-
-
-std::string Socket::ReceiveLine()
-{
- std::string ret;
- while (1)
- {
- char r;
-
- if (recv(s_, &r, 1, 0) <= 0 )
- {
- return "";
- }
- ret += r;
- if (r == '\n') return ret;
- }
-}
-
-
-
-
-
-std::string Socket::ReceiveBytes( unsigned int a_Length )
-{
- std::string ret;
- while( ret.size() < a_Length )
- {
- char r;
-
- if (recv(s_, &r, 1, 0) <= 0 )
- {
- return "";
- }
- ret += r;
- }
- return ret;
-}
-
-
-
-
-
-void Socket::SendLine(std::string s)
-{
- s += '\n';
- if( send(s_,s.c_str(),s.length(),MSG_NOSIGNAL) <= 0 )
- {
- //printf("SendLine Socket error!! \n" );
- Close();
- }
-}
-
-
-
-
-
-void Socket::SendBytes(const std::string& s)
-{
- if( send(s_,s.c_str(),s.length(), MSG_NOSIGNAL) <= 0 )
- {
- //printf("SendBytes Socket error!! \n" );
- Close();
- }
-}
-
-
-
-
-
-SocketServer::SocketServer(int port, int connections, TypeSocket type)
-{
- sockaddr_in sa;
-
- memset(&sa, 0, sizeof(sa));
-
- sa.sin_family = PF_INET;
- sa.sin_port = htons(port);
- s_ = socket(AF_INET, SOCK_STREAM, 0);
-
- if (!IsValid())
- {
- LOG("WebServer: INVALID_SOCKET");
- }
-
- if(type==NonBlockingSocket)
- {
- return;
- }
-
- #ifdef _WIN32
- char yes = 1;
- #else
- int yes = 1;
- #endif
-
- if (setsockopt(s_,SOL_SOCKET,SO_REUSEADDR,&yes,sizeof(int)) == -1)
- {
- LOG("WebServer: setsockopt == -1");
- return;
- }
-
- /* bind the socket to the internet address */
- if (bind(s_, (sockaddr *)&sa, sizeof(sockaddr_in)) == SOCKET_ERROR)
- {
- closesocket(s_);
- LOG("WebServer: INVALID_SOCKET");
- }
-
- listen(s_, connections);
-}
-
-
-
-
-
-Socket* SocketServer::Accept()
-{
- Socket * r = new Socket(accept(s_, 0, 0));
- if (!r->IsValid())
- {
- delete r;
- r = NULL;
- }
-
- return r;
-}
-
-
-
-
-
-SocketSelect::SocketSelect(Socket const * const s1, Socket const * const s2, TypeSocket type)
-{
- FD_ZERO(&fds_);
- SOCKET Highest = s1->s_;
- FD_SET(const_cast(s1)->s_,&fds_);
- if(s2)
- {
- FD_SET(const_cast(s2)->s_,&fds_);
- if (s2->s_ > Highest)
- {
- Highest = s2->s_;
- }
- }
- if (select(Highest + 1, &fds_, NULL, NULL, NULL) == SOCKET_ERROR)
- {
-#if !defined(ANDROID_NDK)
- throw "Error in select";
-#endif
- }
-}
-
-
-
-
-
-bool SocketSelect::Readable(Socket const* const s)
-{
- return (FD_ISSET(s->s_,&fds_) != 0);
-}
-
-
-
-
diff --git a/WebServer/Socket.h b/WebServer/Socket.h
deleted file mode 100644
index b144659c7..000000000
--- a/WebServer/Socket.h
+++ /dev/null
@@ -1,127 +0,0 @@
-/*
- Socket.h
-
- Copyright (C) 2002-2004 René Nyffenegger
-
- This source code is provided 'as-is', without any express or implied
- warranty. In no event will the author be held liable for any damages
- arising from the use of this software.
-
- Permission is granted to anyone to use this software for any purpose,
- including commercial applications, and to alter it and redistribute it
- freely, subject to the following restrictions:
-
- 1. The origin of this source code must not be misrepresented; you must not
- claim that you wrote the original source code. If you use this source code
- in a product, an acknowledgment in the product documentation would be
- appreciated but is not required.
-
- 2. Altered source versions must be plainly marked as such, and must not be
- misrepresented as being the original source code.
-
- 3. This notice may not be removed or altered from any source distribution.
-
- René Nyffenegger rene.nyffenegger@adp-gmbh.ch
-*/
-
-/*
- Note on point 2:
- THIS IS NOT THE ORIGINAL SOURCE1!!1!!!~!!~`1ONE!!`1
-*/
-
-#ifndef SOCKET_H
-#define SOCKET_H
-
-
-
-
-
-#ifndef _WIN32
- typedef int SOCKET;
- #define SOCKET_ERROR (-1)
- #define INVALID_SOCKET (-1)
- #define closesocket close
-#endif // !_WIN32
-
-
-
-
-
-enum TypeSocket {BlockingSocket, NonBlockingSocket};
-
-
-
-
-
-class Socket
-{
-public:
-
- virtual ~Socket();
- Socket(const Socket&);
- Socket& operator=(Socket&);
-
- std::string ReceiveLine();
- std::string ReceiveBytes( unsigned int a_Length );
-
- bool IsValid(void) const;
-
- void Close( bool a_WaitSend = false );
-
- // The parameter of SendLine is not a const reference
- // because SendLine modifes the std::string passed.
- void SendLine (std::string);
-
- // The parameter of SendBytes is a const reference
- // because SendBytes does not modify the std::string passed
- // (in contrast to SendLine).
- void SendBytes(const std::string&);
-
-protected:
- friend class SocketServer;
- friend class SocketSelect;
-
- Socket(SOCKET s);
- Socket();
-
-
- SOCKET s_;
-
- int* refCounter_;
-
-private:
- static void Start();
- static void End();
- static int nofSockets_;
-};
-
-
-
-
-
-class SocketServer :
- public Socket
-{
-public:
- SocketServer(int port, int connections, TypeSocket type=BlockingSocket);
-
- Socket* Accept();
-};
-
-
-
-
-
-// http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winsock/wsapiref_2tiq.asp
-class SocketSelect
-{
-public:
- SocketSelect(Socket const * const s1, Socket const * const s2=NULL, TypeSocket type=BlockingSocket);
-
- bool Readable(Socket const * const s);
-
-private:
- fd_set fds_;
-};
-
-#endif
diff --git a/WebServer/StdHelpers.cpp b/WebServer/StdHelpers.cpp
deleted file mode 100644
index 63e48a7d2..000000000
--- a/WebServer/StdHelpers.cpp
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- stdHelpers.cpp
-
- Copyright (C) 2002-2004 René Nyffenegger
-
- This source code is provided 'as-is', without any express or implied
- warranty. In no event will the author be held liable for any damages
- arising from the use of this software.
-
- Permission is granted to anyone to use this software for any purpose,
- including commercial applications, and to alter it and redistribute it
- freely, subject to the following restrictions:
-
- 1. The origin of this source code must not be misrepresented; you must not
- claim that you wrote the original source code. If you use this source code
- in a product, an acknowledgment in the product documentation would be
- appreciated but is not required.
-
- 2. Altered source versions must be plainly marked as such, and must not be
- misrepresented as being the original source code.
-
- 3. This notice may not be removed or altered from any source distribution.
-
- René Nyffenegger rene.nyffenegger@adp-gmbh.ch
-*/
-
-/*
- Note on point 2:
- THIS IS NOT THE ORIGINAL SOURCE1!!1!!!~!!~`1ONE!!`1
-*/
-
-#include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules
-
-#include "StdHelpers.h"
-#include
-
-std::string ReplaceInStr(const std::string& in, const std::string& search_for, const std::string& replace_with) {
- std::string ret = in;
-
- std::string::size_type pos = ret.find(search_for);
-
- while (pos != std::string::npos) {
- ret = ret.replace(pos, search_for.size(), replace_with);
- pos = pos - search_for.size() + replace_with.size() + 1;
- pos = ret.find(search_for, pos);
- }
-
- return ret;
-}
-
-// std:toupper and std::tolower are overloaded. Well...
-// http://gcc.gnu.org/ml/libstdc++/2002-11/msg00180.html
-char toLower_ (char c) { return std::tolower(c); }
-char toUpper_ (char c) { return std::toupper(c); }
-
-void ToUpper(std::string& s) {
- std::transform(s.begin(), s.end(), s.begin(),toUpper_);
-}
-
-void ToLower(std::string& s) {
- std::transform(s.begin(), s.end(), s.begin(),toLower_);
-}
diff --git a/WebServer/StdHelpers.h b/WebServer/StdHelpers.h
deleted file mode 100644
index 1011881f8..000000000
--- a/WebServer/StdHelpers.h
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- stdHelpers.h
-
- Copyright (C) 2002-2005 René Nyffenegger
-
- This source code is provided 'as-is', without any express or implied
- warranty. In no event will the author be held liable for any damages
- arising from the use of this software.
-
- Permission is granted to anyone to use this software for any purpose,
- including commercial applications, and to alter it and redistribute it
- freely, subject to the following restrictions:
-
- 1. The origin of this source code must not be misrepresented; you must not
- claim that you wrote the original source code. If you use this source code
- in a product, an acknowledgment in the product documentation would be
- appreciated but is not required.
-
- 2. Altered source versions must be plainly marked as such, and must not be
- misrepresented as being the original source code.
-
- 3. This notice may not be removed or altered from any source distribution.
-
- René Nyffenegger rene.nyffenegger@adp-gmbh.ch
-*/
-
-/*
- Note on point 2:
- THIS IS NOT THE ORIGINAL SOURCE1!!1!!!~!!~`1ONE!!`1
-*/
-
-#ifndef STDHELPERS_H__
-#define STDHELPERS_H__
-
-#include
-#include
-
-std::string ReplaceInStr(const std::string& in, const std::string& search_for, const std::string& replace_with);
-
-void ToUpper(std::string& s);
-void ToLower(std::string& s);
-
-template
-T To(std::string const& s) {
- T ret;
-
- std::stringstream stream;
- stream << s;
- stream >> ret;
-
- return ret;
-}
-
-template
-std::string StringFrom(T const& t) {
- std::string ret;
-
- std::stringstream stream;
- stream << t;
- stream >> ret;
-
- return ret;
-}
-
-#endif
\ No newline at end of file
diff --git a/WebServer/Tracer.h b/WebServer/Tracer.h
deleted file mode 100644
index c13d5128f..000000000
--- a/WebServer/Tracer.h
+++ /dev/null
@@ -1,113 +0,0 @@
-/*
- Tracer.h
-
- Copyright (C) 2002-2004 René Nyffenegger
-
- This source code is provided 'as-is', without any express or implied
- warranty. In no event will the author be held liable for any damages
- arising from the use of this software.
-
- Permission is granted to anyone to use this software for any purpose,
- including commercial applications, and to alter it and redistribute it
- freely, subject to the following restrictions:
-
- 1. The origin of this source code must not be misrepresented; you must not
- claim that you wrote the original source code. If you use this source code
- in a product, an acknowledgment in the product documentation would be
- appreciated but is not required.
-
- 2. Altered source versions must be plainly marked as such, and must not be
- misrepresented as being the original source code.
-
- 3. This notice may not be removed or altered from any source distribution.
-
- The most current version of Tracer.h can be found at
- http://www.adp-gmbh.ch/cpp/common/Tracer.html
-
- René Nyffenegger rene.nyffenegger@adp-gmbh.ch
-*/
-
-/*
- Note on point 2:
- THIS IS NOT THE ORIGINAL SOURCE1!!1!!!~!!~`1ONE!!`1
-*/
-
-#ifndef TRACER_H__
-#define TRACER_H__
-
-#ifdef DO_TRACE
-
-#include
-#include
-
-#include
-
-#define StartTrace(x) TraceFunc_::StartTrace_(x)
-#define Trace(x) dummy_____for_trace_func______.Trace_(x)
-#define Trace2(x,y) dummy_____for_trace_func______.Trace_(x,y)
-#define TraceFunc(x) TraceFunc_ dummy_____for_trace_func______(x)
-#define TraceFunc2(x,y) TraceFunc_ dummy_____for_trace_func______(x,y)
-
-class TraceFunc_ {
- std::string func_name_;
- public:
- /*
- Calling TraceFunc_ indents the output until the enclosing scope ( {...} )
- is left.
- */
- TraceFunc_(std::string const&);
- TraceFunc_(std::string const&, std::string const& something);
- ~TraceFunc_();
-
- /*
- Creates the trace output file named by filename.
- Must be called before any other tracing function.
- Use the StartTrace macro for it.
- */
- static void StartTrace_(std::string const& filename);
-
- template
- void Trace_(T const& t) {
- DWORD d;
- std::string indent_s;
- std::stringstream s;
-
- s << t;
-
- for (int i=0; i< indent; i++) indent_s += " ";
-
- ::WriteFile(trace_file_,indent_s.c_str(), indent_s.size(), &d, 0);
- ::WriteFile(trace_file_, s.str().c_str(), s.str().size() ,&d, 0);
- ::WriteFile(trace_file_,"\x0a",1,&d,0);
- }
-
- template
- void Trace_(T const& t, U const& u) {
- std::string indent_s;
- std::stringstream s;
-
- s << t;
- s << u;
- Trace_(s.str());
- }
-
- static int indent;
- /* trace_file_ is a HANDLE for the file in which the traced output goes.
- The file is opened (that is, created) by calling StartTrace_.
- Better yet, use the StartTrace macro
- to create the file.
- */
- static HANDLE trace_file_;
-};
-
-#else
-
-#define StartTrace(x)
-#define Trace(x)
-#define Trace2(x,y)
-#define TraceFunc(x)
-#define TraceFunc2(x,y)
-
-#endif
-
-#endif // TRACER_H__
diff --git a/WebServer/UrlHelper.cpp b/WebServer/UrlHelper.cpp
deleted file mode 100644
index 3ed5660b0..000000000
--- a/WebServer/UrlHelper.cpp
+++ /dev/null
@@ -1,169 +0,0 @@
-/*
- UrlHelper.cpp
-
- Copyright (C) 2002-2004 René Nyffenegger
-
- This source code is provided 'as-is', without any express or implied
- warranty. In no event will the author be held liable for any damages
- arising from the use of this software.
-
- Permission is granted to anyone to use this software for any purpose,
- including commercial applications, and to alter it and redistribute it
- freely, subject to the following restrictions:
-
- 1. The origin of this source code must not be misrepresented; you must not
- claim that you wrote the original source code. If you use this source code
- in a product, an acknowledgment in the product documentation would be
- appreciated but is not required.
-
- 2. Altered source versions must be plainly marked as such, and must not be
- misrepresented as being the original source code.
-
- 3. This notice may not be removed or altered from any source distribution.
-
- René Nyffenegger rene.nyffenegger@adp-gmbh.ch
-*/
-
-/*
- Note on point 2:
- THIS IS NOT THE ORIGINAL SOURCE1!!1!!!~!!~`1ONE!!`1
-*/
-
-#include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules
-
-#include "UrlHelper.h"
-#include "Tracer.h"
-#include "StdHelpers.h"
-
-#include
-#include
-
-bool RemoveProtocolFromUrl(std::string const& url, std::string& protocol, std::string& rest) {
- TraceFunc("RemoveProtocolFromUrl");
- Trace(std::string("url='")+url+"'");
- std::string::size_type pos_colon = url.find(":");
-
- if (pos_colon == std::string::npos) {
- rest = url;
- return false;
- }
-
- if (url.size() < pos_colon + 2) {
- rest = url;
- return false;
- }
-
- if (url[pos_colon+1] != '/' ||
- url[pos_colon+2] != '/') {
- rest = url;
- return false;
- }
-
- protocol = url.substr(0,pos_colon);
- rest = url.substr(3+pos_colon); // Skipping three characters ( '://' )
-
- return true;
-}
-
-void SplitGetReq(std::string get_req, std::string& path, std::map& params) {
- TraceFunc("SplitGetReq");
-
- // Remove trailing newlines
- if (get_req[get_req.size()-1] == '\x0d' ||
- get_req[get_req.size()-1] == '\x0a')
- get_req=get_req.substr(0, get_req.size()-1);
-
- if (get_req[get_req.size()-1] == '\x0d' ||
- get_req[get_req.size()-1] == '\x0a')
- get_req=get_req.substr(0, get_req.size()-1);
-
- // Remove potential Trailing HTTP/1.x
- if (get_req.size() > 7) {
- if (get_req.substr(get_req.size()-8, 7) == "HTTP/1.") {
- get_req=get_req.substr(0, get_req.size()-9);
- }
- }
-
- std::string::size_type qm = get_req.find("?");
- if (qm != std::string::npos) {
- std::string url_params = get_req.substr(qm+1);
-
- path = get_req.substr(0, qm);
-
- // Appending a '&' so that there are as many '&' as name-value pairs.
- // It makes it easier to split the url for name value pairs, he he he
- url_params += "&";
-
- std::string::size_type next_amp = url_params.find("&");
-
- while (next_amp != std::string::npos) {
- std::string name_value = url_params.substr(0,next_amp);
- url_params = url_params.substr(next_amp+1);
- next_amp = url_params.find("&");
-
- std::string::size_type pos_equal = name_value.find("=");
-
- std::string nam = name_value.substr(0,pos_equal);
- std::string val = name_value.substr(pos_equal+1);
-
- std::string::size_type pos_plus;
- while ( (pos_plus = val.find("+")) != std::string::npos ) {
- val.replace(pos_plus, 1, " ");
- }
-
- while ( (pos_plus = val.find("%20")) != std::string::npos ) {
- val.replace(pos_plus, 3, " ");
- }
-
- // Replacing %xy notation
- std::string::size_type pos_hex = 0;
- while ( (pos_hex = val.find("%", pos_hex)) != std::string::npos ) {
- std::stringstream h;
- h << val.substr(pos_hex+1, 2);
- h << std::hex;
-
- int i;
- h>>i;
-
- std::stringstream f;
- f << static_cast(i);
- std::string s;
- f >> s;
-
- val.replace(pos_hex, 3, s);
- pos_hex ++;
- }
-
- params.insert(std::map::value_type(nam, val));
- }
- }
- else {
- path = get_req;
- }
-}
-
-void SplitUrl(std::string const& url, std::string& protocol, std::string& server, std::string& path) {
- TraceFunc("SplitUrl");
- RemoveProtocolFromUrl(url, protocol, server);
-
- if (protocol == "http") {
- std::string::size_type pos_slash = server.find("/");
-
- if (pos_slash != std::string::npos) {
- Trace("slash found");
- path = server.substr(pos_slash);
- server = server.substr(0, pos_slash);
- }
- else {
- Trace("slash not found");
- path = "/";
- }
- }
- else if (protocol == "file") {
- path = ReplaceInStr(server, "\\", "/");
- server = "";
- }
- else {
- std::cerr << "unknown protocol in SplitUrl: '" << protocol << "'" << std::endl;
- }
-}
diff --git a/WebServer/UrlHelper.h b/WebServer/UrlHelper.h
deleted file mode 100644
index 12f12c6fe..000000000
--- a/WebServer/UrlHelper.h
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- UrlHelper.h
-
- Copyright (C) 2002-2004 René Nyffenegger
-
- This source code is provided 'as-is', without any express or implied
- warranty. In no event will the author be held liable for any damages
- arising from the use of this software.
-
- Permission is granted to anyone to use this software for any purpose,
- including commercial applications, and to alter it and redistribute it
- freely, subject to the following restrictions:
-
- 1. The origin of this source code must not be misrepresented; you must not
- claim that you wrote the original source code. If you use this source code
- in a product, an acknowledgment in the product documentation would be
- appreciated but is not required.
-
- 2. Altered source versions must be plainly marked as such, and must not be
- misrepresented as being the original source code.
-
- 3. This notice may not be removed or altered from any source distribution.
-
- René Nyffenegger rene.nyffenegger@adp-gmbh.ch
-*/
-
-/*
- Note on point 2:
- THIS IS NOT THE ORIGINAL SOURCE1!!1!!!~!!~`1ONE!!`1
-*/
-#ifndef __URL_HELPER_H__
-#define __URL_HELPER_H__
-
-#include
-#include