diff --git a/Debug/main.cpp.o b/Debug/main.cpp.o index 03b08e6..209ca57 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 91f73d1..b51af63 100644 --- a/Debug/main.cpp.o.d +++ b/Debug/main.cpp.o.d @@ -5,19 +5,18 @@ 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/IPAddressList.h \ - ../ServerCore/EPoll.h ../ServerCore/Exception.h ../ServerCore/File.h \ - ../ServerCore/Log.h ../ServerCore/IPAddress.h HTTPService.h \ - ../ServerCore/Service.h HTTPSessions.h HTTPRequest.h \ - ../CoreUtils/PString.h ../CoreUtils/includes ../CoreUtils/IMFMessage.h \ - ../CoreUtils/PString.h ../CoreUtils/IMFHeader.h \ - ../CoreUtils/IMFRequest.h ../CoreUtils/IMFBody.h \ - ../CoreUtils/IMFRequest.h ../CoreUtils/IMFResponse.h \ - ../CoreUtils/IMFMessage.h HTTPPageList.h ../ServerCore/Session.h \ - __index.h HTTPPage.h HTTPSession.h ../JET/Variables.h __script.h \ - __editview.h __style.h __setupadmin.h __favicon_ico.h __welcome.h \ - __mainmenu.h __newview.h __configure.h HTTPHandler.h \ - ../ServerCore/Command.h + ../ServerCore/CommandList.h ../ServerCore/EPoll.h \ + ../ServerCore/Exception.h ../ServerCore/File.h ../ServerCore/Log.h \ + ../ServerCore/IPAddress.h HTTPService.h ../ServerCore/Service.h \ + HTTPSessions.h HTTPRequest.h ../CoreUtils/PString.h \ + ../CoreUtils/includes ../CoreUtils/IMFMessage.h ../CoreUtils/PString.h \ + ../CoreUtils/IMFHeader.h ../CoreUtils/IMFRequest.h \ + ../CoreUtils/IMFBody.h ../CoreUtils/IMFRequest.h \ + ../CoreUtils/IMFResponse.h ../CoreUtils/IMFMessage.h HTTPPageList.h \ + ../ServerCore/Session.h __index.h HTTPPage.h HTTPSession.h \ + ../JET/Variables.h __script.h __editview.h __style.h __setupadmin.h \ + __favicon_ico.h __welcome.h __mainmenu.h __newview.h __configure.h \ + HTTPHandler.h ../ServerCore/Command.h ../ServerCore/includes: @@ -53,8 +52,6 @@ Debug/main.cpp.o: main.cpp ../ServerCore/includes ../ServerCore/EPoll.h \ ../ServerCore/CommandList.h: -../ServerCore/IPAddressList.h: - ../ServerCore/EPoll.h: ../ServerCore/Exception.h: diff --git a/HTTPHandler.cpp b/HTTPHandler.cpp index 1d4b4d1..97e67f4 100644 --- a/HTTPHandler.cpp +++ b/HTTPHandler.cpp @@ -3,19 +3,32 @@ #include "HTTPService.h" #include "HTTPRequest.h" #include "PString.h" +#include "IMFFormData.h" #include "Log.h" namespace http { int HTTPHandler::processCommand(std::string request, core::Session *session, std::stringstream &data) { + core::Log(core::LOG_DEBUG_1) << request; + coreutils::PString request1(request); HTTPRequest httpRequest(request1); - + HTTPSession *httpSession = ((HTTPService &)session->service).httpSessions.findSessionByHeader(httpRequest); std::stringstream content; if(((HTTPService &)session->service).pageList.processRequest(httpRequest, session, httpSession, content)) { + + std::string contentType = httpRequest.getHeader("Content-Type"); + core::Log(core::LOG_DEBUG_1) << contentType; + if(contentType == "multipart/form-data") { + coreutils::IMFFormData *formdata = (coreutils::IMFFormData *)httpRequest.getBody(); + core::Log(core::LOG_DEBUG_1) << formdata->getCount() << ":" << formdata->toString(); + std::cout << formdata->getByName("name") << std::endl; + + } + httpRequest.response.setCode("200"); httpRequest.response.setText("OK"); data << httpRequest.response.getResponse(content.str()); diff --git a/HTTPServer.mk b/HTTPServer.mk index b6b704d..2433614 100644 --- a/HTTPServer.mk +++ b/HTTPServer.mk @@ -5,22 +5,22 @@ ## Debug ProjectName :=HTTPServer ConfigurationName :=Debug -WorkspacePath :=/home/bradarant/barant -ProjectPath :=/home/bradarant/barant/HTTPServer +WorkspacePath :=/home/barant/Development/BMA/server_core +ProjectPath :=/home/barant/Development/BMA/server_core/HTTPServer IntermediateDirectory :=./Debug OutDir := $(IntermediateDirectory) CurrentFileName := CurrentFilePath := CurrentFileFullPath := User :=Brad Arant -Date :=01/08/19 -CodeLitePath :=/home/bradarant/.codelite -LinkerName :=/usr/bin/x86_64-linux-gnu-g++ -SharedObjectLinkerName :=/usr/bin/x86_64-linux-gnu-g++ -shared -fPIC +Date :=02/08/19 +CodeLitePath :=/home/barant/.codelite +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 @@ -31,7 +31,7 @@ OutputFile :=$(IntermediateDirectory)/$(ProjectName) Preprocessors := ObjectSwitch :=-o ArchiveOutputSwitch := -PreprocessOnlySwitch :=-E +PreprocessOnlySwitch :=-E ObjectsFileList :="HTTPServer.txt" PCHCompileFlags := MakeDirCommand :=mkdir -p @@ -47,13 +47,13 @@ LibPath := $(LibraryPathSwitch). $(LibraryPathSwitch)../ServerCor ## 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 +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 ## @@ -92,7 +92,7 @@ PreBuild: ## Objects ## $(IntermediateDirectory)/main.cpp$(ObjectSuffix): main.cpp $(IntermediateDirectory)/main.cpp$(DependSuffix) - $(CXX) $(IncludePCH) $(SourceSwitch) "/home/bradarant/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 @@ -100,7 +100,7 @@ $(IntermediateDirectory)/main.cpp$(PreprocessSuffix): main.cpp $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/main.cpp$(PreprocessSuffix) main.cpp $(IntermediateDirectory)/HTTPSession.cpp$(ObjectSuffix): HTTPSession.cpp $(IntermediateDirectory)/HTTPSession.cpp$(DependSuffix) - $(CXX) $(IncludePCH) $(SourceSwitch) "/home/bradarant/barant/HTTPServer/HTTPSession.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/HTTPSession.cpp$(ObjectSuffix) $(IncludePath) + $(CXX) $(IncludePCH) $(SourceSwitch) "/home/barant/Development/BMA/server_core/HTTPServer/HTTPSession.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/HTTPSession.cpp$(ObjectSuffix) $(IncludePath) $(IntermediateDirectory)/HTTPSession.cpp$(DependSuffix): HTTPSession.cpp @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/HTTPSession.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/HTTPSession.cpp$(DependSuffix) -MM HTTPSession.cpp @@ -108,7 +108,7 @@ $(IntermediateDirectory)/HTTPSession.cpp$(PreprocessSuffix): HTTPSession.cpp $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/HTTPSession.cpp$(PreprocessSuffix) HTTPSession.cpp $(IntermediateDirectory)/HTTPSessions.cpp$(ObjectSuffix): HTTPSessions.cpp $(IntermediateDirectory)/HTTPSessions.cpp$(DependSuffix) - $(CXX) $(IncludePCH) $(SourceSwitch) "/home/bradarant/barant/HTTPServer/HTTPSessions.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/HTTPSessions.cpp$(ObjectSuffix) $(IncludePath) + $(CXX) $(IncludePCH) $(SourceSwitch) "/home/barant/Development/BMA/server_core/HTTPServer/HTTPSessions.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/HTTPSessions.cpp$(ObjectSuffix) $(IncludePath) $(IntermediateDirectory)/HTTPSessions.cpp$(DependSuffix): HTTPSessions.cpp @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/HTTPSessions.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/HTTPSessions.cpp$(DependSuffix) -MM HTTPSessions.cpp @@ -116,7 +116,7 @@ $(IntermediateDirectory)/HTTPSessions.cpp$(PreprocessSuffix): HTTPSessions.cpp $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/HTTPSessions.cpp$(PreprocessSuffix) HTTPSessions.cpp $(IntermediateDirectory)/HTTPHandler.cpp$(ObjectSuffix): HTTPHandler.cpp $(IntermediateDirectory)/HTTPHandler.cpp$(DependSuffix) - $(CXX) $(IncludePCH) $(SourceSwitch) "/home/bradarant/barant/HTTPServer/HTTPHandler.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/HTTPHandler.cpp$(ObjectSuffix) $(IncludePath) + $(CXX) $(IncludePCH) $(SourceSwitch) "/home/barant/Development/BMA/server_core/HTTPServer/HTTPHandler.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/HTTPHandler.cpp$(ObjectSuffix) $(IncludePath) $(IntermediateDirectory)/HTTPHandler.cpp$(DependSuffix): HTTPHandler.cpp @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/HTTPHandler.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/HTTPHandler.cpp$(DependSuffix) -MM HTTPHandler.cpp @@ -124,7 +124,7 @@ $(IntermediateDirectory)/HTTPHandler.cpp$(PreprocessSuffix): HTTPHandler.cpp $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/HTTPHandler.cpp$(PreprocessSuffix) HTTPHandler.cpp $(IntermediateDirectory)/HTTPPageList.cpp$(ObjectSuffix): HTTPPageList.cpp $(IntermediateDirectory)/HTTPPageList.cpp$(DependSuffix) - $(CXX) $(IncludePCH) $(SourceSwitch) "/home/bradarant/barant/HTTPServer/HTTPPageList.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/HTTPPageList.cpp$(ObjectSuffix) $(IncludePath) + $(CXX) $(IncludePCH) $(SourceSwitch) "/home/barant/Development/BMA/server_core/HTTPServer/HTTPPageList.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/HTTPPageList.cpp$(ObjectSuffix) $(IncludePath) $(IntermediateDirectory)/HTTPPageList.cpp$(DependSuffix): HTTPPageList.cpp @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/HTTPPageList.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/HTTPPageList.cpp$(DependSuffix) -MM HTTPPageList.cpp diff --git a/HTTPServer.project b/HTTPServer.project index 7476bcb..d17bb32 100644 --- a/HTTPServer.project +++ b/HTTPServer.project @@ -54,7 +54,7 @@ - + diff --git a/__configure.h b/__configure.h index 8a33a05..2b8d60c 100644 --- a/__configure.h +++ b/__configure.h @@ -24,7 +24,7 @@ namespace http { data << " " << std::endl; data << "

Session Id: " << httpSession->getSessionId() << "" << std::endl; data << "
The configuration has not yet been established for this web site.

" << std::endl; - data << " " << std::endl; + data << " " << std::endl; data << " " << std::endl; httpRequest.response.addHeader("Content-Type", "text/html");