More stuff on HTTPPage structure.
This commit is contained in:
parent
2e67e9ed4a
commit
2a7c27dac5
BIN
Debug/main.cpp.o
BIN
Debug/main.cpp.o
Binary file not shown.
@ -9,9 +9,9 @@ Debug/main.cpp.o: main.cpp ../ServerCore/includes ../ServerCore/EPoll.h \
|
|||||||
../ServerCore/Exception.h ../ServerCore/File.h ../ServerCore/Log.h \
|
../ServerCore/Exception.h ../ServerCore/File.h ../ServerCore/Log.h \
|
||||||
../ServerCore/IPAddress.h HTTPService.h ../ServerCore/Service.h \
|
../ServerCore/IPAddress.h HTTPService.h ../ServerCore/Service.h \
|
||||||
HTTPSessions.h ../ServerCore/Header.h ../ServerCore/Response.h \
|
HTTPSessions.h ../ServerCore/Header.h ../ServerCore/Response.h \
|
||||||
PageList.h ../ServerCore/CommandList.h __index.h __setupadmin.h \
|
PageList.h ../ServerCore/CommandList.h ../ServerCore/Session.h __index.h \
|
||||||
__favicon_ico.h HTTPHandler.h ../ServerCore/Command.h \
|
HTTPPage.h HTTPSession.h __setupadmin.h __favicon_ico.h HTTPHandler.h \
|
||||||
../ServerCore/Session.h
|
../ServerCore/Command.h
|
||||||
|
|
||||||
../ServerCore/includes:
|
../ServerCore/includes:
|
||||||
|
|
||||||
@ -71,8 +71,14 @@ PageList.h:
|
|||||||
|
|
||||||
../ServerCore/CommandList.h:
|
../ServerCore/CommandList.h:
|
||||||
|
|
||||||
|
../ServerCore/Session.h:
|
||||||
|
|
||||||
__index.h:
|
__index.h:
|
||||||
|
|
||||||
|
HTTPPage.h:
|
||||||
|
|
||||||
|
HTTPSession.h:
|
||||||
|
|
||||||
__setupadmin.h:
|
__setupadmin.h:
|
||||||
|
|
||||||
__favicon_ico.h:
|
__favicon_ico.h:
|
||||||
@ -80,5 +86,3 @@ __favicon_ico.h:
|
|||||||
HTTPHandler.h:
|
HTTPHandler.h:
|
||||||
|
|
||||||
../ServerCore/Command.h:
|
../ServerCore/Command.h:
|
||||||
|
|
||||||
../ServerCore/Session.h:
|
|
||||||
|
@ -15,7 +15,7 @@ namespace http {
|
|||||||
HTTPSession *httpSession = ((HTTPService &)session->service).httpSessions.findSessionByHeader(header, response);
|
HTTPSession *httpSession = ((HTTPService &)session->service).httpSessions.findSessionByHeader(header, response);
|
||||||
|
|
||||||
std::stringstream content;
|
std::stringstream content;
|
||||||
if(((HTTPService &)session->service).pageList.processRequest(header.getPath() + " ", session, content)) {
|
if(((HTTPService &)session->service).pageList.processRequest(header.getPath() + " ", session, httpSession, content)) {
|
||||||
response.setProtocol(header.requestProtocol());
|
response.setProtocol(header.requestProtocol());
|
||||||
response.setCode("200");
|
response.setCode("200");
|
||||||
response.setText("OK");
|
response.setText("OK");
|
||||||
|
19
HTTPPage.h
Normal file
19
HTTPPage.h
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
#ifndef __HTTPPage_h__
|
||||||
|
#define __HTTPPage_h__
|
||||||
|
|
||||||
|
#include "HTTPSession.h"
|
||||||
|
|
||||||
|
namespace http {
|
||||||
|
|
||||||
|
class HTTPPage : public core::Object {
|
||||||
|
|
||||||
|
public:
|
||||||
|
virtual int processCommand(std::string request, core::Session *session, HTTPSession *httpSession, std::stringstream &data) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
25
HTTPPageList.cpp
Normal file
25
HTTPPageList.cpp
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
#include "HTTPPageList.h"
|
||||||
|
|
||||||
|
namespace http {
|
||||||
|
|
||||||
|
bool HTTPPageList::processRequest(std::string request, core::Session *session, HTTPSession *httpSession, std::stringstream &data) {
|
||||||
|
for(auto *page : pages) {
|
||||||
|
if(page->check(request)) {
|
||||||
|
page->processCommand(request, session, httpSession, data);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void HTTPPageList::add(HTTPPage &page, std::string name) {
|
||||||
|
page.setName(name);
|
||||||
|
pages.push_back(&command);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void HTTPPageList::remove(HTTPPage &page) {}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
38
HTTPPageList.h
Normal file
38
HTTPPageList.h
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
#ifndef __HTTPPageList_h__
|
||||||
|
#define __HTTPPageList_h__
|
||||||
|
|
||||||
|
#include "Session.h"
|
||||||
|
#include "__index.h"
|
||||||
|
#include "__setupadmin.h"
|
||||||
|
#include "__favicon_ico.h"
|
||||||
|
|
||||||
|
namespace http {
|
||||||
|
|
||||||
|
class HTTPPageList {
|
||||||
|
|
||||||
|
public:
|
||||||
|
HTTPPageList() {
|
||||||
|
add(index, "/ ");
|
||||||
|
add(setupadmin, "/setupadmin ");
|
||||||
|
add(favicon_ico, "/favicon.ico");
|
||||||
|
}
|
||||||
|
|
||||||
|
bool processRequest(std::string request, core::Session *session, HTTPSession *httpSession, std::stringstream &data);
|
||||||
|
|
||||||
|
void add(HTTPPage &page, std::string name = "");
|
||||||
|
|
||||||
|
void remove(HTTPPage &page);
|
||||||
|
|
||||||
|
protected:
|
||||||
|
std::vector<HTTPPage *> pages;
|
||||||
|
|
||||||
|
private:
|
||||||
|
__index index;
|
||||||
|
__setupadmin setupadmin;
|
||||||
|
__favicon_ico favicon_ico;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
@ -5,16 +5,16 @@
|
|||||||
## Debug
|
## Debug
|
||||||
ProjectName :=HTTPServer
|
ProjectName :=HTTPServer
|
||||||
ConfigurationName :=Debug
|
ConfigurationName :=Debug
|
||||||
WorkspacePath :=/home/bradarant/barant
|
WorkspacePath :=/home/barant
|
||||||
ProjectPath :=/home/bradarant/barant/HTTPServer
|
ProjectPath :=/home/barant/barant/HTTPServer
|
||||||
IntermediateDirectory :=./Debug
|
IntermediateDirectory :=./Debug
|
||||||
OutDir := $(IntermediateDirectory)
|
OutDir := $(IntermediateDirectory)
|
||||||
CurrentFileName :=
|
CurrentFileName :=
|
||||||
CurrentFilePath :=
|
CurrentFilePath :=
|
||||||
CurrentFileFullPath :=
|
CurrentFileFullPath :=
|
||||||
User :=Brad Arant
|
User :=root
|
||||||
Date :=31/05/19
|
Date :=05/31/19
|
||||||
CodeLitePath :=/home/bradarant/.codelite
|
CodeLitePath :=/home/barant/.codelite
|
||||||
LinkerName :=/usr/bin/x86_64-linux-gnu-g++
|
LinkerName :=/usr/bin/x86_64-linux-gnu-g++
|
||||||
SharedObjectLinkerName :=/usr/bin/x86_64-linux-gnu-g++ -shared -fPIC
|
SharedObjectLinkerName :=/usr/bin/x86_64-linux-gnu-g++ -shared -fPIC
|
||||||
ObjectSuffix :=.o
|
ObjectSuffix :=.o
|
||||||
@ -60,7 +60,7 @@ AS := /usr/bin/x86_64-linux-gnu-as
|
|||||||
## User defined environment variables
|
## User defined environment variables
|
||||||
##
|
##
|
||||||
CodeLiteDir:=/usr/share/codelite
|
CodeLiteDir:=/usr/share/codelite
|
||||||
Objects0=$(IntermediateDirectory)/main.cpp$(ObjectSuffix) $(IntermediateDirectory)/HTTPSession.cpp$(ObjectSuffix) $(IntermediateDirectory)/HTTPSessions.cpp$(ObjectSuffix) $(IntermediateDirectory)/HTTPHandler.cpp$(ObjectSuffix)
|
Objects0=$(IntermediateDirectory)/main.cpp$(ObjectSuffix) $(IntermediateDirectory)/HTTPSession.cpp$(ObjectSuffix) $(IntermediateDirectory)/HTTPSessions.cpp$(ObjectSuffix) $(IntermediateDirectory)/HTTPHandler.cpp$(ObjectSuffix) $(IntermediateDirectory)/HTTPPageList.cpp$(ObjectSuffix)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -92,7 +92,7 @@ PreBuild:
|
|||||||
## Objects
|
## Objects
|
||||||
##
|
##
|
||||||
$(IntermediateDirectory)/main.cpp$(ObjectSuffix): main.cpp $(IntermediateDirectory)/main.cpp$(DependSuffix)
|
$(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/barant/HTTPServer/main.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/main.cpp$(ObjectSuffix) $(IncludePath)
|
||||||
$(IntermediateDirectory)/main.cpp$(DependSuffix): main.cpp
|
$(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
|
@$(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
|
$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/main.cpp$(PreprocessSuffix) main.cpp
|
||||||
|
|
||||||
$(IntermediateDirectory)/HTTPSession.cpp$(ObjectSuffix): HTTPSession.cpp $(IntermediateDirectory)/HTTPSession.cpp$(DependSuffix)
|
$(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/barant/HTTPServer/HTTPSession.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/HTTPSession.cpp$(ObjectSuffix) $(IncludePath)
|
||||||
$(IntermediateDirectory)/HTTPSession.cpp$(DependSuffix): HTTPSession.cpp
|
$(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
|
@$(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
|
$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/HTTPSession.cpp$(PreprocessSuffix) HTTPSession.cpp
|
||||||
|
|
||||||
$(IntermediateDirectory)/HTTPSessions.cpp$(ObjectSuffix): HTTPSessions.cpp $(IntermediateDirectory)/HTTPSessions.cpp$(DependSuffix)
|
$(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/barant/HTTPServer/HTTPSessions.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/HTTPSessions.cpp$(ObjectSuffix) $(IncludePath)
|
||||||
$(IntermediateDirectory)/HTTPSessions.cpp$(DependSuffix): HTTPSessions.cpp
|
$(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
|
@$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/HTTPSessions.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/HTTPSessions.cpp$(DependSuffix) -MM HTTPSessions.cpp
|
||||||
|
|
||||||
@ -116,13 +116,21 @@ $(IntermediateDirectory)/HTTPSessions.cpp$(PreprocessSuffix): HTTPSessions.cpp
|
|||||||
$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(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)
|
$(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/barant/HTTPServer/HTTPHandler.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/HTTPHandler.cpp$(ObjectSuffix) $(IncludePath)
|
||||||
$(IntermediateDirectory)/HTTPHandler.cpp$(DependSuffix): HTTPHandler.cpp
|
$(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
|
@$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/HTTPHandler.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/HTTPHandler.cpp$(DependSuffix) -MM HTTPHandler.cpp
|
||||||
|
|
||||||
$(IntermediateDirectory)/HTTPHandler.cpp$(PreprocessSuffix): HTTPHandler.cpp
|
$(IntermediateDirectory)/HTTPHandler.cpp$(PreprocessSuffix): HTTPHandler.cpp
|
||||||
$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(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/barant/barant/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
|
||||||
|
|
||||||
|
$(IntermediateDirectory)/HTTPPageList.cpp$(PreprocessSuffix): HTTPPageList.cpp
|
||||||
|
$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/HTTPPageList.cpp$(PreprocessSuffix) HTTPPageList.cpp
|
||||||
|
|
||||||
|
|
||||||
-include $(IntermediateDirectory)/*$(DependSuffix)
|
-include $(IntermediateDirectory)/*$(DependSuffix)
|
||||||
##
|
##
|
||||||
|
@ -13,8 +13,10 @@
|
|||||||
<File Name="HTTPHandler.h"/>
|
<File Name="HTTPHandler.h"/>
|
||||||
<File Name="__setupadmin.h"/>
|
<File Name="__setupadmin.h"/>
|
||||||
<File Name="__index.h"/>
|
<File Name="__index.h"/>
|
||||||
<File Name="PageList.h"/>
|
|
||||||
<File Name="__favicon_ico.h"/>
|
<File Name="__favicon_ico.h"/>
|
||||||
|
<File Name="HTTPPage.h"/>
|
||||||
|
<File Name="HTTPPageList.h"/>
|
||||||
|
<File Name="HTTPPageList.cpp"/>
|
||||||
</VirtualDirectory>
|
</VirtualDirectory>
|
||||||
<Dependencies Name="Debug"/>
|
<Dependencies Name="Debug"/>
|
||||||
<Dependencies Name="Release"/>
|
<Dependencies Name="Release"/>
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
#include "Service.h"
|
#include "Service.h"
|
||||||
#include "HTTPSessions.h"
|
#include "HTTPSessions.h"
|
||||||
#include "PageList.h"
|
#include "HTTPPageList.h"
|
||||||
#include "Exception.h"
|
#include "Exception.h"
|
||||||
#include "HTTPHandler.h"
|
#include "HTTPHandler.h"
|
||||||
|
|
||||||
@ -18,7 +18,7 @@ namespace http {
|
|||||||
}
|
}
|
||||||
|
|
||||||
HTTPSessions httpSessions;
|
HTTPSessions httpSessions;
|
||||||
PageList pageList;
|
HTTPPageList pageList;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
HTTPHandler getHandler;
|
HTTPHandler getHandler;
|
||||||
|
@ -12,7 +12,6 @@ namespace http {
|
|||||||
}
|
}
|
||||||
|
|
||||||
HTTPSession * HTTPSessions::findSessionById(std::string sessionId, core::Response &response) {
|
HTTPSession * HTTPSessions::findSessionById(std::string sessionId, core::Response &response) {
|
||||||
core::Log(core::LOG_DEBUG_1) << "Session Id: " << sessionId << ":" << sessionId.length();
|
|
||||||
HTTPSession *httpSession;
|
HTTPSession *httpSession;
|
||||||
if(sessionId.length() > 0) {
|
if(sessionId.length() > 0) {
|
||||||
httpSession = (HTTPSession *)sessions.find(sessionId)->second;
|
httpSession = (HTTPSession *)sessions.find(sessionId)->second;
|
||||||
|
29
PageList.h
29
PageList.h
@ -1,29 +0,0 @@
|
|||||||
#ifndef __PageList_h__
|
|
||||||
#define __PageList_h__
|
|
||||||
|
|
||||||
#include "CommandList.h"
|
|
||||||
#include "__index.h"
|
|
||||||
#include "__setupadmin.h"
|
|
||||||
#include "__favicon_ico.h"
|
|
||||||
|
|
||||||
namespace http {
|
|
||||||
|
|
||||||
class PageList : public core::CommandList {
|
|
||||||
|
|
||||||
public:
|
|
||||||
PageList() {
|
|
||||||
add(index, "/ ");
|
|
||||||
add(setupadmin, "/setupadmin ");
|
|
||||||
add(favicon_ico, "/favicon.ico");
|
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
|
||||||
__index index;
|
|
||||||
__setupadmin setupadmin;
|
|
||||||
__favicon_ico favicon_ico;
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
|
@ -1,11 +1,13 @@
|
|||||||
#ifndef ____favicon_ico_h__
|
#ifndef ____favicon_ico_h__
|
||||||
#define ____favicon_ico_h__
|
#define ____favicon_ico_h__
|
||||||
|
|
||||||
|
#include "HTTPPage.h"
|
||||||
|
|
||||||
namespace http {
|
namespace http {
|
||||||
|
|
||||||
class __favicon_ico : public core::Command {
|
class __favicon_ico : public HTTPPage {
|
||||||
|
|
||||||
int processCommand(std::string request, core::Session *session, std::stringstream &data) override {
|
int processCommand(std::string request, core::Session *session, HTTPSession *httpSession, std::stringstream &data) override {
|
||||||
|
|
||||||
data << std::string(header_data);
|
data << std::string(header_data);
|
||||||
|
|
||||||
@ -76,8 +78,7 @@ namespace http {
|
|||||||
"````````````````````````````````[`,^I]@W.JXR)*HQ)*HQ)*HQ)*HQ)*HQ"
|
"````````````````````````````````[`,^I]@W.JXR)*HQ)*HQ)*HQ)*HQ)*HQ"
|
||||||
")*HQ)*HQ)*HQ)*HQ)*HQ2[(RLMXX]P@_````````````````````````````````"
|
")*HQ)*HQ)*HQ)*HQ)*HQ2[(RLMXX]P@_````````````````````````````````"
|
||||||
"````````````````````````````````````````^PH_U/,[J-@W@<8T3[4R+*TQ"
|
"````````````````````````````````````````^PH_U/,[J-@W@<8T3[4R+*TQ"
|
||||||
"+ZTQ6;@SA\\@UK=LWV_<\\_@P_````````````````````````````````````````"
|
"+ZTQ6;@SA\\@UK=LWV_<\\_@P_````````````````````````````````````````";
|
||||||
"";
|
|
||||||
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -1,15 +1,17 @@
|
|||||||
#ifndef ____index_h__
|
#ifndef ____index_h__
|
||||||
#define ____index_h__
|
#define ____index_h__
|
||||||
|
|
||||||
|
#include "HTTPPage.h"
|
||||||
|
|
||||||
namespace http {
|
namespace http {
|
||||||
|
|
||||||
class __index : public core::Command {
|
class __index : public HTTPPage {
|
||||||
|
|
||||||
int processCommand(std::string request, core::Session *session, std::stringstream &data) override {
|
int processCommand(std::string request, core::Session *session, HTTPSession *httpSession, std::stringstream &data) override {
|
||||||
|
|
||||||
data << "<http><head></head><body style=\"background: #006; color: #fff;\">\
|
data << "<http><head></head><body style=\"background: #006; color: #fff;\">\
|
||||||
<form action=\"setupadmin\" method=\"POST\"><div style=\"background: #44C; text: #888; padding: 20px;\"><p>You have successfully set up a JETServer.\
|
<form action=\"setupadmin\" method=\"POST\"><div style=\"background: #44C; text: #888; padding: 20px;\"><p>You have successfully set up a JETServer.\
|
||||||
<br>Session Id: \
|
<br>Session Id: " << httpSession->getSessionId() << "\
|
||||||
<br>The configuration has not yet been established for this web site.</p>\
|
<br>The configuration has not yet been established for this web site.</p>\
|
||||||
<button>Configure</button>\
|
<button>Configure</button>\
|
||||||
</div></form></body></html>";
|
</div></form></body></html>";
|
||||||
|
@ -3,14 +3,14 @@
|
|||||||
|
|
||||||
namespace http {
|
namespace http {
|
||||||
|
|
||||||
class __setupadmin : public core::Command {
|
class __setupadmin : public HTTPPage {
|
||||||
|
|
||||||
int processCommand(std::string request, core::Session *session, std::stringstream &data) override {
|
int processCommand(std::string request, core::Session *session, HTTPSession *httpSession, std::stringstream &data) override {
|
||||||
|
|
||||||
data << "<http><head></head><body style=\"background: #006; color: #fff;\">\
|
data << "<http><head></head><body style=\"background: #006; color: #fff;\">\
|
||||||
<form action=\"setupadmin\" method=\"POST\"><div style=\"background: #44C; text: #888; padding: 20px;\"><p>Please enter credential information\
|
<form action=\"setupadmin\" method=\"POST\"><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\">\
|
for the security officer.<br><input type=\"text\" name=\"username\" size=\"50\">\
|
||||||
<br>Session Id: \
|
<br>Session Id: " << httpSession->getSessionId() << "\
|
||||||
<br>The configuration has not yet been established for this web site.</p>\
|
<br>The configuration has not yet been established for this web site.</p>\
|
||||||
<button>Configure</button>\
|
<button>Configure</button>\
|
||||||
</div></form></body></html>";
|
</div></form></body></html>";
|
||||||
|
Loading…
x
Reference in New Issue
Block a user