More development.
This commit is contained in:
parent
f4938937d1
commit
74d3229ee7
2
.gitignore
vendored
2
.gitignore
vendored
@ -3,3 +3,5 @@ Release
|
||||
*~
|
||||
*.o
|
||||
*.o.d
|
||||
*.mk
|
||||
|
||||
|
BIN
Debug/main.cpp.o
BIN
Debug/main.cpp.o
Binary file not shown.
@ -1,11 +1,11 @@
|
||||
#include "_GET.h"
|
||||
#include "HTTPHandler.h"
|
||||
#include "HTTPSession.h"
|
||||
#include "HTTPService.h"
|
||||
#include "Log.h"
|
||||
|
||||
namespace http {
|
||||
|
||||
int _GET::processCommand(std::string request, core::Session *session, std::stringstream &data) {
|
||||
int HTTPHandler::processCommand(std::string request, core::Session *session, std::stringstream &data) {
|
||||
|
||||
core::Header header(request);
|
||||
core::Response response;
|
@ -1,5 +1,5 @@
|
||||
#ifndef ___GET_h__
|
||||
#define ___GET_h__
|
||||
#ifndef __HTTPHandler_h__
|
||||
#define __HTTPHandler_h__
|
||||
|
||||
#include "Command.h"
|
||||
#include "Session.h"
|
||||
@ -9,7 +9,7 @@
|
||||
|
||||
namespace http {
|
||||
|
||||
class _GET : public core::Command {
|
||||
class HTTPHandler : public core::Command {
|
||||
|
||||
public:
|
||||
int processCommand(std::string request, core::Session *session, std::stringstream &data) override;
|
@ -5,16 +5,16 @@
|
||||
## Debug
|
||||
ProjectName :=HTTPServer
|
||||
ConfigurationName :=Debug
|
||||
WorkspacePath :=/home/barant/barant
|
||||
ProjectPath :=/home/barant/barant/HTTPServer
|
||||
WorkspacePath :=/home/bradarant/barant
|
||||
ProjectPath :=/home/bradarant/barant/HTTPServer
|
||||
IntermediateDirectory :=./Debug
|
||||
OutDir := $(IntermediateDirectory)
|
||||
CurrentFileName :=
|
||||
CurrentFilePath :=
|
||||
CurrentFileFullPath :=
|
||||
User :=
|
||||
Date :=05/18/19
|
||||
CodeLitePath :=/home/barant/.codelite
|
||||
User :=Brad Arant
|
||||
Date :=22/05/19
|
||||
CodeLitePath :=/home/bradarant/.codelite
|
||||
LinkerName :=/usr/bin/x86_64-linux-gnu-g++
|
||||
SharedObjectLinkerName :=/usr/bin/x86_64-linux-gnu-g++ -shared -fPIC
|
||||
ObjectSuffix :=.o
|
||||
@ -60,7 +60,7 @@ AS := /usr/bin/x86_64-linux-gnu-as
|
||||
## User defined environment variables
|
||||
##
|
||||
CodeLiteDir:=/usr/share/codelite
|
||||
Objects0=$(IntermediateDirectory)/main.cpp$(ObjectSuffix) $(IntermediateDirectory)/HTTPSession.cpp$(ObjectSuffix) $(IntermediateDirectory)/HTTPSessions.cpp$(ObjectSuffix) $(IntermediateDirectory)/_GET.cpp$(ObjectSuffix) $(IntermediateDirectory)/src__POST.cpp$(ObjectSuffix)
|
||||
Objects0=$(IntermediateDirectory)/main.cpp$(ObjectSuffix) $(IntermediateDirectory)/HTTPSession.cpp$(ObjectSuffix) $(IntermediateDirectory)/HTTPSessions.cpp$(ObjectSuffix) $(IntermediateDirectory)/HTTPHandler.cpp$(ObjectSuffix)
|
||||
|
||||
|
||||
|
||||
@ -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/bradarant/barant/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/barant/barant/HTTPServer/HTTPSession.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/HTTPSession.cpp$(ObjectSuffix) $(IncludePath)
|
||||
$(CXX) $(IncludePCH) $(SourceSwitch) "/home/bradarant/barant/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,28 +108,20 @@ $(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/barant/barant/HTTPServer/HTTPSessions.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/HTTPSessions.cpp$(ObjectSuffix) $(IncludePath)
|
||||
$(CXX) $(IncludePCH) $(SourceSwitch) "/home/bradarant/barant/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
|
||||
|
||||
$(IntermediateDirectory)/HTTPSessions.cpp$(PreprocessSuffix): HTTPSessions.cpp
|
||||
$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/HTTPSessions.cpp$(PreprocessSuffix) HTTPSessions.cpp
|
||||
|
||||
$(IntermediateDirectory)/_GET.cpp$(ObjectSuffix): _GET.cpp $(IntermediateDirectory)/_GET.cpp$(DependSuffix)
|
||||
$(CXX) $(IncludePCH) $(SourceSwitch) "/home/barant/barant/HTTPServer/_GET.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/_GET.cpp$(ObjectSuffix) $(IncludePath)
|
||||
$(IntermediateDirectory)/_GET.cpp$(DependSuffix): _GET.cpp
|
||||
@$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/_GET.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/_GET.cpp$(DependSuffix) -MM _GET.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)
|
||||
$(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
|
||||
|
||||
$(IntermediateDirectory)/_GET.cpp$(PreprocessSuffix): _GET.cpp
|
||||
$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/_GET.cpp$(PreprocessSuffix) _GET.cpp
|
||||
|
||||
$(IntermediateDirectory)/src__POST.cpp$(ObjectSuffix): src/_POST.cpp $(IntermediateDirectory)/src__POST.cpp$(DependSuffix)
|
||||
$(CXX) $(IncludePCH) $(SourceSwitch) "/home/barant/barant/HTTPServer/src/_POST.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/src__POST.cpp$(ObjectSuffix) $(IncludePath)
|
||||
$(IntermediateDirectory)/src__POST.cpp$(DependSuffix): src/_POST.cpp
|
||||
@$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/src__POST.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/src__POST.cpp$(DependSuffix) -MM src/_POST.cpp
|
||||
|
||||
$(IntermediateDirectory)/src__POST.cpp$(PreprocessSuffix): src/_POST.cpp
|
||||
$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/src__POST.cpp$(PreprocessSuffix) src/_POST.cpp
|
||||
$(IntermediateDirectory)/HTTPHandler.cpp$(PreprocessSuffix): HTTPHandler.cpp
|
||||
$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/HTTPHandler.cpp$(PreprocessSuffix) HTTPHandler.cpp
|
||||
|
||||
|
||||
-include $(IntermediateDirectory)/*$(DependSuffix)
|
||||
|
@ -4,18 +4,16 @@
|
||||
<Dependencies/>
|
||||
<VirtualDirectory Name="src">
|
||||
<File Name="HTTPService.h"/>
|
||||
<File Name="_GET.h"/>
|
||||
<File Name="_POST.h"/>
|
||||
<File Name="main.cpp"/>
|
||||
<File Name="HTTPSession.h"/>
|
||||
<File Name="HTTPSession.cpp"/>
|
||||
<File Name="HTTPSessions.h"/>
|
||||
<File Name="HTTPSessions.cpp"/>
|
||||
<File Name="_GET.cpp"/>
|
||||
<File Name="src/__index.h"/>
|
||||
<File Name="src/__setupadmin.h"/>
|
||||
<File Name="src/PageService.h" ExcludeProjConfig=""/>
|
||||
<File Name="src/_POST.cpp"/>
|
||||
<File Name="HTTPHandler.cpp"/>
|
||||
<File Name="HTTPHandler.h"/>
|
||||
</VirtualDirectory>
|
||||
<Dependencies Name="Debug"/>
|
||||
<Dependencies Name="Release"/>
|
||||
|
@ -3,9 +3,9 @@
|
||||
|
||||
#include "Service.h"
|
||||
#include "HTTPSessions.h"
|
||||
#include "PageService.h"
|
||||
#include "Exception.h"
|
||||
#include "_GET.h"
|
||||
#include "_POST.h"
|
||||
#include "HTTPHandler.h"
|
||||
|
||||
namespace http {
|
||||
|
||||
@ -13,16 +13,15 @@ namespace http {
|
||||
|
||||
public:
|
||||
HTTPService() {
|
||||
commands.add(get, "GET ");
|
||||
commands.add(post, "POST ");
|
||||
commands.add(httpHandler, "GET ");
|
||||
commands.add(httpHandler, "POST ");
|
||||
}
|
||||
|
||||
HTTPSessions httpSessions;
|
||||
// PageService pageService;
|
||||
PageService pageService;
|
||||
|
||||
private:
|
||||
_GET get;
|
||||
_POST post;
|
||||
HTTPHandler httpHandler;
|
||||
|
||||
};
|
||||
|
||||
|
20
_POST.h
20
_POST.h
@ -1,20 +0,0 @@
|
||||
#ifndef ___POST_h__
|
||||
#define ___POST_h__
|
||||
|
||||
#include "Command.h"
|
||||
#include "Session.h"
|
||||
#include "Header.h"
|
||||
#include "Response.h"
|
||||
|
||||
namespace http {
|
||||
|
||||
class _POST : public core::Command {
|
||||
|
||||
public:
|
||||
int processCommand(std::string request, core::Session *session, std::stringstream &data) override;
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
@ -2,7 +2,6 @@
|
||||
#define __PageService_h__
|
||||
|
||||
#include "Service.h"
|
||||
#include "Exception.h"
|
||||
#include "__index.h"
|
||||
#include "__setupadmin.h"
|
||||
|
||||
|
@ -1,28 +0,0 @@
|
||||
#include "_POST.h"
|
||||
#include "HTTPSession.h"
|
||||
#include "HTTPService.h"
|
||||
#include "Log.h"
|
||||
|
||||
namespace http {
|
||||
|
||||
int _POST::processCommand(std::string request, core::Session *session, std::stringstream &data) {
|
||||
|
||||
core::Header header(request);
|
||||
core::Response response;
|
||||
|
||||
core::Log(core::LOG_DEBUG_1) << header.getPath() << " " << header.getCGIData();
|
||||
|
||||
HTTPSession *httpSession = ((HTTPService &)session->service).httpSessions.findSessionByHeader(header, response);
|
||||
|
||||
std::stringstream content;
|
||||
// ((HTTPService &)session->service).pageService.processRequest(header.getPath(), content);
|
||||
|
||||
response.setProtocol(header.requestProtocol());
|
||||
response.setCode("200");
|
||||
response.setText("OK");
|
||||
response.setMimeType("text/html");
|
||||
data << response.getResponse(content.str());
|
||||
return 0;
|
||||
}
|
||||
|
||||
}
|
@ -5,13 +5,13 @@ namespace http {
|
||||
|
||||
class __index : core::Command {
|
||||
|
||||
int processCommand(std::string request, core::Session *session) override {
|
||||
session.out << "<http><head></head><body style=\"background: #006; color: #fff;\">\
|
||||
int processCommand(std::string request, core::Session *session, std::stringstream &data) override {
|
||||
|
||||
data << "<http><head></head><body style=\"background: #006; color: #fff;\">\
|
||||
<form action=\"setupadmin\"><div style=\"background: #44C; text: #888; padding: 20px;\"><p>You have successfully set up a JETServer.\
|
||||
<br>Session Id: " + httpSession->getSessionId() + "\
|
||||
<br>The configuration has not yet been established for this web site.</p>\
|
||||
<button>Configure</button>\
|
||||
</div></form></body></html>";
|
||||
session.send();
|
||||
}
|
||||
}
|
@ -5,14 +5,14 @@ namespace http {
|
||||
|
||||
class __setupadmin : core::Command {
|
||||
|
||||
int processCommand(std::string request, core::Session *session) override {
|
||||
session.out << "<http><head></head><body style=\"background: #006; color: #fff;\">\
|
||||
int processCommand(std::string request, core::Session *session, std::stringstream &data) override {
|
||||
|
||||
data << "<http><head></head><body style=\"background: #006; color: #fff;\">\
|
||||
<form action=\"setupadmin\"><div style=\"background: #44C; text: #888; padding: 20px;\"><p>Please enter credential information\
|
||||
for the security officer.<br><input type=\"text\" name=\"username\" size=\"50\">\
|
||||
<br>Session Id: " + httpSession->getSessionId() + "\
|
||||
<br>The configuration has not yet been established for this web site.</p>\
|
||||
<button>Configure</button>\
|
||||
</div></form></body></html>";
|
||||
session.send();
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user