Continued development...

This commit is contained in:
Brad Arant 2019-08-02 15:42:27 -07:00
parent 6ff2713abe
commit 0fe3a30221
6 changed files with 46 additions and 36 deletions

Binary file not shown.

View File

@ -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:

View File

@ -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());

View File

@ -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

View File

@ -54,7 +54,7 @@
<Library Value="uuid"/>
</Linker>
<ResourceCompiler Options="" Required="no"/>
<General OutputFile="$(IntermediateDirectory)/$(ProjectName)" IntermediateDirectory="./Debug" Command="./$(ProjectName)" CommandArguments="" UseSeparateDebugArgs="no" DebugArguments="" WorkingDirectory="$(IntermediateDirectory)" PauseExecWhenProcTerminates="yes" IsGUIProgram="no" IsEnabled="yes"/>
<General OutputFile="$(IntermediateDirectory)/$(ProjectName)" IntermediateDirectory="./Debug" Command="./Debug/$(ProjectName)" CommandArguments="" UseSeparateDebugArgs="no" DebugArguments="" WorkingDirectory="$(IntermediateDirectory)" PauseExecWhenProcTerminates="yes" IsGUIProgram="no" IsEnabled="yes"/>
<BuildSystem Name="Default"/>
<Environment EnvVarSetName="&lt;Use Defaults&gt;" DbgSetName="&lt;Use Defaults&gt;">
<![CDATA[]]>

View File

@ -24,7 +24,7 @@ namespace http {
data << " </div>" << std::endl;
data << " <br><br>Session Id: " << httpSession->getSessionId() << "" << std::endl;
data << " <br>The configuration has not yet been established for this web site.</p>" << std::endl;
data << " <input type=\"button\" onmousedown=\"process('/mainmenu','setupadmin', 'main'); return true;\" name=\"button1\" value=\"Update Configuration\">" << std::endl;
data << " <input type=\"button\" onmousedown=\"process('/mainmenu','configure', 'main'); return true;\" name=\"button1\" value=\"Update Configuration\">" << std::endl;
data << " </div></form>" << std::endl;
httpRequest.response.addHeader("Content-Type", "text/html");