diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..37fecde
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,5 @@
+Debug
+Release
+*~
+*.o
+*.o.d
diff --git a/Debug/HTTPServer b/Debug/HTTPServer
index 106f548..3d84f9f 100755
Binary files a/Debug/HTTPServer and b/Debug/HTTPServer differ
diff --git a/Debug/main.cpp.o b/Debug/main.cpp.o
index 931d340..1f889a6 100644
Binary files a/Debug/main.cpp.o and b/Debug/main.cpp.o differ
diff --git a/Debug/main.cpp.o.d b/Debug/main.cpp.o.d
index 0748a3b..2ad6da9 100644
--- a/Debug/main.cpp.o.d
+++ b/Debug/main.cpp.o.d
@@ -5,12 +5,11 @@ Debug/main.cpp.o: main.cpp ../ServerCore/includes ../ServerCore/EPoll.h \
../ServerCore/IPAddress.h ../ServerCore/SessionFilter.h \
../ServerCore/Command.h ../ServerCore/ConsoleServer.h \
../ServerCore/TCPServerSocket.h ../ServerCore/Service.h \
- ../ServerCore/CommandList.h ../ServerCore/EPoll.h HTTPServer.h \
- ../ServerCore/TCPServerSocket.h ../ServerCore/Session.h \
+ ../ServerCore/CommandList.h ../ServerCore/EPoll.h \
+ ../ServerCore/Exception.h ../ServerCore/File.h ../ServerCore/Log.h \
../ServerCore/IPAddress.h HTTPService.h ../ServerCore/Service.h _GET.h \
- ../ServerCore/Command.h ../ServerCore/Header.h ../ServerCore/Response.h \
- _POST.h ../ServerCore/Exception.h ../ServerCore/File.h \
- ../ServerCore/Log.h
+ ../ServerCore/Command.h ../ServerCore/Session.h ../ServerCore/Header.h \
+ ../ServerCore/Response.h _POST.h
../ServerCore/includes:
@@ -48,11 +47,11 @@ Debug/main.cpp.o: main.cpp ../ServerCore/includes ../ServerCore/EPoll.h \
../ServerCore/EPoll.h:
-HTTPServer.h:
+../ServerCore/Exception.h:
-../ServerCore/TCPServerSocket.h:
+../ServerCore/File.h:
-../ServerCore/Session.h:
+../ServerCore/Log.h:
../ServerCore/IPAddress.h:
@@ -64,14 +63,10 @@ _GET.h:
../ServerCore/Command.h:
+../ServerCore/Session.h:
+
../ServerCore/Header.h:
../ServerCore/Response.h:
_POST.h:
-
-../ServerCore/Exception.h:
-
-../ServerCore/File.h:
-
-../ServerCore/Log.h:
diff --git a/HTTPServer.h b/HTTPServer.h
deleted file mode 100644
index 1d89c62..0000000
--- a/HTTPServer.h
+++ /dev/null
@@ -1,27 +0,0 @@
-#ifndef __HTTPServer_h__
-#define __HTTPServer_h__
-
-#include "includes"
-#include "EPoll.h"
-#include "TCPServerSocket.h"
-#include "Session.h"
-#include "IPAddress.h"
-#include "HTTPService.h"
-
-namespace http {
-
- class HTTPServer : public core::TCPServerSocket {
-
- public:
- HTTPServer(core::EPoll &ePoll, core::IPAddress address) : core::TCPServerSocket(ePoll, address) {}
-
- protected:
- core::Service * getService() override {
- return new HTTPService(*this);
- }
-
- };
-
-}
-
-#endif
diff --git a/HTTPServer.mk b/HTTPServer.mk
index 2db7714..61505a6 100644
--- a/HTTPServer.mk
+++ b/HTTPServer.mk
@@ -2,25 +2,25 @@
## Auto Generated makefile by CodeLite IDE
## any manual changes will be erased
##
-## Release
+## Debug
ProjectName :=HTTPServer
-ConfigurationName :=Release
-WorkspacePath :=/home/barant/barant
-ProjectPath :=/home/barant/barant/HTTPServer
-IntermediateDirectory :=./Release
+ConfigurationName :=Debug
+WorkspacePath :=/home/barant/Development/BMA/server_core
+ProjectPath :=/home/barant/Development/BMA/server_core/HTTPServer
+IntermediateDirectory :=./Debug
OutDir := $(IntermediateDirectory)
CurrentFileName :=
CurrentFilePath :=
CurrentFileFullPath :=
-User :=
-Date :=03/03/19
+User :=Brad Arant
+Date :=12/03/19
CodeLitePath :=/home/barant/.codelite
-LinkerName :=/usr/bin/x86_64-linux-gnu-g++
-SharedObjectLinkerName :=/usr/bin/x86_64-linux-gnu-g++ -shared -fPIC
+LinkerName :=g++
+SharedObjectLinkerName :=g++ -shared -fPIC
ObjectSuffix :=.o
DependSuffix :=.o.d
-PreprocessSuffix :=.i
-DebugSwitch :=-g
+PreprocessSuffix :=.o.i
+DebugSwitch :=-gstab
IncludeSwitch :=-I
LibrarySwitch :=-l
OutputSwitch :=-o
@@ -28,32 +28,32 @@ LibraryPathSwitch :=-L
PreprocessorSwitch :=-D
SourceSwitch :=-c
OutputFile :=$(IntermediateDirectory)/$(ProjectName)
-Preprocessors :=$(PreprocessorSwitch)NDEBUG
+Preprocessors :=
ObjectSwitch :=-o
ArchiveOutputSwitch :=
-PreprocessOnlySwitch :=-E
+PreprocessOnlySwitch :=-E
ObjectsFileList :="HTTPServer.txt"
PCHCompileFlags :=
MakeDirCommand :=mkdir -p
LinkOptions :=
-IncludePath := $(IncludeSwitch). $(IncludeSwitch). $(IncludeSwitch)../ServerCore
+IncludePath := $(IncludeSwitch). $(IncludeSwitch). $(IncludeSwitch)../ServerCore/
IncludePCH :=
RcIncludePath :=
Libs := $(LibrarySwitch)ServerCore $(LibrarySwitch)pthread
ArLibs := "ServerCore" "pthread"
-LibPath := $(LibraryPathSwitch). $(LibraryPathSwitch)../ServerCore/Debug
+LibPath := $(LibraryPathSwitch). $(LibraryPathSwitch)../ServerCore/Debug/
##
## Common variables
## AR, CXX, CC, AS, CXXFLAGS and CFLAGS can be overriden using an environment variables
##
-AR := /usr/bin/x86_64-linux-gnu-ar rcu
-CXX := /usr/bin/x86_64-linux-gnu-g++
-CC := /usr/bin/x86_64-linux-gnu-gcc
-CXXFLAGS := -O2 -Wall $(Preprocessors)
-CFLAGS := -O2 -Wall $(Preprocessors)
+AR := ar rcus
+CXX := g++
+CC := gcc
+CXXFLAGS := -g -O0 -Wall $(Preprocessors)
+CFLAGS := -g -O0 -Wall $(Preprocessors)
ASFLAGS :=
-AS := /usr/bin/x86_64-linux-gnu-as
+AS := as
##
@@ -79,11 +79,11 @@ $(OutputFile): $(IntermediateDirectory)/.d $(Objects)
$(LinkerName) $(OutputSwitch)$(OutputFile) @$(ObjectsFileList) $(LibPath) $(Libs) $(LinkOptions)
MakeIntermediateDirs:
- @test -d ./Release || $(MakeDirCommand) ./Release
+ @test -d ./Debug || $(MakeDirCommand) ./Debug
$(IntermediateDirectory)/.d:
- @test -d ./Release || $(MakeDirCommand) ./Release
+ @test -d ./Debug || $(MakeDirCommand) ./Debug
PreBuild:
@@ -92,7 +92,7 @@ PreBuild:
## Objects
##
$(IntermediateDirectory)/main.cpp$(ObjectSuffix): main.cpp $(IntermediateDirectory)/main.cpp$(DependSuffix)
- $(CXX) $(IncludePCH) $(SourceSwitch) "/home/barant/barant/HTTPServer/main.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/main.cpp$(ObjectSuffix) $(IncludePath)
+ $(CXX) $(IncludePCH) $(SourceSwitch) "/home/barant/Development/BMA/server_core/HTTPServer/main.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/main.cpp$(ObjectSuffix) $(IncludePath)
$(IntermediateDirectory)/main.cpp$(DependSuffix): main.cpp
@$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/main.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/main.cpp$(DependSuffix) -MM main.cpp
@@ -105,6 +105,6 @@ $(IntermediateDirectory)/main.cpp$(PreprocessSuffix): main.cpp
## Clean
##
clean:
- $(RM) -r ./Release/
+ $(RM) -r ./Debug/
diff --git a/HTTPServer.project b/HTTPServer.project
index ea0ba7f..42b0f89 100644
--- a/HTTPServer.project
+++ b/HTTPServer.project
@@ -3,7 +3,6 @@
-
@@ -109,4 +108,6 @@
+
+
diff --git a/HTTPServer.txt b/HTTPServer.txt
index 65da2a2..6716386 100644
--- a/HTTPServer.txt
+++ b/HTTPServer.txt
@@ -1 +1 @@
-./Release/main.cpp.o
+./Debug/main.cpp.o
diff --git a/HTTPService.h b/HTTPService.h
index 7d1492b..a03e224 100644
--- a/HTTPService.h
+++ b/HTTPService.h
@@ -2,18 +2,15 @@
#define __HTTPService_h__
#include "Service.h"
-//#include "HTTPServer.h"
#include "_GET.h"
#include "_POST.h"
namespace http {
-
- class HTTPServer;
-
+
class HTTPService : public core::Service {
public:
- HTTPService(HTTPServer &server) : core::Service((core::TCPServerSocket &)server) {
+ HTTPService() {
commands.add(get, "GET ");
commands.add(post, "POST ");
}
diff --git a/main.cpp b/main.cpp
index 69dfef5..b164d9b 100644
--- a/main.cpp
+++ b/main.cpp
@@ -1,11 +1,11 @@
#include "includes"
#include "EPoll.h"
#include "ConsoleServer.h"
-#include "HTTPServer.h"
#include "Exception.h"
#include "File.h"
#include "Log.h"
#include "IPAddress.h"
+#include "HTTPService.h"
int main(int argc, char **argv) {
@@ -18,12 +18,14 @@ int main(int argc, char **argv) {
core::EPoll ePoll;
- http::HTTPServer http(ePoll, core::IPAddress(ipAddress, 8090));
+ http::HTTPService httpService;
+ core::TCPServerSocket http(ePoll, httpService, core::IPAddress(ipAddress, 8090));
- core::ConsoleServer console(ePoll, core::IPAddress(ipAddress, 1027));
- console.service->commands.add(ePoll);
- console.service->commands.add(http);
- console.service->commands.add(console);
+ core::Service consoleService;
+ core::ConsoleServer console(ePoll, consoleService, core::IPAddress(ipAddress, 1027));
+ consoleService.commands.add(ePoll);
+ consoleService.commands.add(http);
+ consoleService.commands.add(console);
ePoll.start(4, 1000);
while(true)