diff --git a/CMakeLists.txt b/CMakeLists.txt deleted file mode 100644 index 08481ac..0000000 --- a/CMakeLists.txt +++ /dev/null @@ -1,11 +0,0 @@ -cmake_minimum_required(VERSION 3.0.0) -project(JETServer VERSION 0.1.0) - -include(CTest) -enable_testing() - -add_executable(JETServer main.cpp) - -set(CPACK_PROJECT_NAME ${PROJECT_NAME}) -set(CPACK_PROJECT_VERSION ${PROJECT_VERSION}) -include(CPack) diff --git a/Flow.cpp b/Flow.cpp index f9cf5fe..032aa3c 100644 --- a/Flow.cpp +++ b/Flow.cpp @@ -1,19 +1,19 @@ -#include "FlowAction.h" +#include "Flow.h" namespace http { - FlowAction::FlowAction() { + Flow::Flow() { int len = strlen(hex); for(int ix = 0; ix < sizeof(actionId); ++ix) { actionId[ix] = hex[random() % len]; } } - bool FlowAction::action(HTTPParameters &p) { + bool Flow::action(HTTPParameters &p) { return true; } - coreutils::ZString FlowAction::getId() { + coreutils::ZString Flow::getId() { return coreutils::ZString(actionId, sizeof(actionId)); } diff --git a/FlowQueue.cpp b/FlowQueue.cpp index f9cf5fe..0a930db 100644 --- a/FlowQueue.cpp +++ b/FlowQueue.cpp @@ -1,19 +1,19 @@ -#include "FlowAction.h" +#include "FlowQueue.h" namespace http { - FlowAction::FlowAction() { + FlowQueue::FlowQueue() { int len = strlen(hex); for(int ix = 0; ix < sizeof(actionId); ++ix) { actionId[ix] = hex[random() % len]; } } - bool FlowAction::action(HTTPParameters &p) { + bool FlowQueue::process() { return true; } - coreutils::ZString FlowAction::getId() { + coreutils::ZString FlowQueue::getId() { return coreutils::ZString(actionId, sizeof(actionId)); } diff --git a/HTTPConnection.h b/HTTPConnection.h index 7f3ef79..207c641 100644 --- a/HTTPConnection.h +++ b/HTTPConnection.h @@ -10,7 +10,7 @@ namespace http { public: - HTTPConnection(core::EPoll &ePoll, core::TCPServer &server) : TCPSession(ePoll, server, "HTTP Connection") {} + HTTPConnection(core::EPoll &ePoll, core::TCPServer *server) : TCPSession(ePoll, server, "HTTP Connection") {} void onDataReceived(coreutils::ZString &data) override { protocol(data); diff --git a/HTTPGETHandler.cpp b/HTTPGETHandler.cpp index 323ef47..7381727 100644 --- a/HTTPGETHandler.cpp +++ b/HTTPGETHandler.cpp @@ -14,11 +14,11 @@ namespace http { HTTPRequest httpRequest(request); - HTTPSession *httpSession = static_cast(session.server).httpSessions.findSessionByHeader(httpRequest); + HTTPSession *httpSession = static_cast(session.server)->httpSessions.findSessionByHeader(httpRequest); std::stringstream content; - HTTPParameters p(httpRequest, session, *httpSession, content, ((HTTPServer &)session.server).actionList); + HTTPParameters p(httpRequest, session, *httpSession, content, ((HTTPServer *)session.server)->actionList); // TODO: What should we do if we receive a request on a GET and there is a session variable? // If its an entry point then is it an image or link to a downloadable content that was issued @@ -32,7 +32,7 @@ namespace http { // TODO: Allow entry points to specify pages in the page cache or do we treat pages as automatic entry points. try { - static_cast(session.server).pageList.processRequest(p); + static_cast(session.server)->pageList.processRequest(p); httpRequest.response.setCode("200"); httpRequest.response.setText("OK"); } diff --git a/HTTPPOSTHandler.cpp b/HTTPPOSTHandler.cpp index e991da3..84c3d21 100644 --- a/HTTPPOSTHandler.cpp +++ b/HTTPPOSTHandler.cpp @@ -14,14 +14,14 @@ namespace http { HTTPRequest httpRequest(request); - HTTPSession *httpSession = ((HTTPServer &)(session.server)).httpSessions.findSessionByHeader(httpRequest); + HTTPSession *httpSession = ((HTTPServer *)(session.server))->httpSessions.findSessionByHeader(httpRequest); std::stringstream content; - HTTPParameters p(httpRequest, session, *httpSession, content, ((HTTPServer &)(session.server)).actionList); + HTTPParameters p(httpRequest, session, *httpSession, content, ((HTTPServer *)(session.server))->actionList); try { - ((HTTPServer &)(session.server)).actionList.processRequest(p); + ((HTTPServer *)(session.server))->actionList.processRequest(p); httpRequest.response.setCode("200"); httpRequest.response.setText("OK"); } diff --git a/HTTPPUTHandler.cpp b/HTTPPUTHandler.cpp index 8691726..1b93bfd 100644 --- a/HTTPPUTHandler.cpp +++ b/HTTPPUTHandler.cpp @@ -12,13 +12,13 @@ namespace http { HTTPRequest httpRequest(request); - HTTPSession *httpSession = static_cast(session.server).httpSessions.findSessionByHeader(httpRequest); + HTTPSession *httpSession = static_cast(session.server)->httpSessions.findSessionByHeader(httpRequest); std::stringstream content; - HTTPParameters p(httpRequest, session, *httpSession, content, ((HTTPServer &)session.server).actionList); + HTTPParameters p(httpRequest, session, *httpSession, content, ((HTTPServer *)session.server)->actionList); try { - ((HTTPServer &)(session.server)).pageList.processRequest(p); + ((HTTPServer *)(session.server))->pageList.processRequest(p); httpRequest.response.setCode("200"); httpRequest.response.setText("OK"); } diff --git a/HTTPServer b/HTTPServer index 129a09e..c461dca 100755 Binary files a/HTTPServer and b/HTTPServer differ diff --git a/HTTPServer.cpp b/HTTPServer.cpp index e4eb784..be116b7 100644 --- a/HTTPServer.cpp +++ b/HTTPServer.cpp @@ -10,7 +10,7 @@ namespace http { } core::TCPSession * HTTPServer::getSocketAccept(core::EPoll &epoll) { - return new HTTPConnection(ePoll, *this); + return new HTTPConnection(ePoll, this); } }