diff --git a/Flow.cpp b/Flow.cpp new file mode 100644 index 0000000..f9cf5fe --- /dev/null +++ b/Flow.cpp @@ -0,0 +1,20 @@ +#include "FlowAction.h" + +namespace http { + + FlowAction::FlowAction() { + int len = strlen(hex); + for(int ix = 0; ix < sizeof(actionId); ++ix) { + actionId[ix] = hex[random() % len]; + } + } + + bool FlowAction::action(HTTPParameters &p) { + return true; + } + + coreutils::ZString FlowAction::getId() { + return coreutils::ZString(actionId, sizeof(actionId)); + } + +} diff --git a/Flow.h b/Flow.h new file mode 100644 index 0000000..32e19bb --- /dev/null +++ b/Flow.h @@ -0,0 +1,26 @@ +#ifndef __Flow_h__ +# define __Flow_h__ + +#include "HTTPParameters.h" +#include "MString.h" + +namespace http { + + class Flow { + + public: + Flow(); + + virtual bool action(HTTPParameters &p); + + coreutils::ZString getId(); + + protected: + char actionId[64]; + const char *hex = "0123456789ABCDEF"; + + }; + +} + +#endif diff --git a/FlowAction.cpp b/FlowAction.cpp index ccaefef..f9cf5fe 100644 --- a/FlowAction.cpp +++ b/FlowAction.cpp @@ -17,5 +17,4 @@ namespace http { return coreutils::ZString(actionId, sizeof(actionId)); } - } diff --git a/FlowPoint.h b/FlowPoint.h index 8183cc2..b6dd06a 100644 --- a/FlowPoint.h +++ b/FlowPoint.h @@ -1 +1,2 @@ #ifndef __FlowPoint_h__ + diff --git a/FlowQueue.cpp b/FlowQueue.cpp new file mode 100644 index 0000000..f9cf5fe --- /dev/null +++ b/FlowQueue.cpp @@ -0,0 +1,20 @@ +#include "FlowAction.h" + +namespace http { + + FlowAction::FlowAction() { + int len = strlen(hex); + for(int ix = 0; ix < sizeof(actionId); ++ix) { + actionId[ix] = hex[random() % len]; + } + } + + bool FlowAction::action(HTTPParameters &p) { + return true; + } + + coreutils::ZString FlowAction::getId() { + return coreutils::ZString(actionId, sizeof(actionId)); + } + +} diff --git a/FlowQueue.h b/FlowQueue.h new file mode 100644 index 0000000..cd56549 --- /dev/null +++ b/FlowQueue.h @@ -0,0 +1,26 @@ +#ifndef __FlowQueue_h__ +# define __FlowQueue_h__ + +#include "HTTPParameters.h" +#include "ZString.h" + +namespace http { + + class FlowQueue { + + public: + FlowQueue(); + + virtual bool process(); + + coreutils::ZString getId(); + + protected: + char actionId[64]; + const char *hex = "0123456789ABCDEF"; + + }; + +} + +#endif diff --git a/HTTPEntryPoints.cpp b/HTTPEntryPoints.cpp index 179e536..24257bf 100644 --- a/HTTPEntryPoints.cpp +++ b/HTTPEntryPoints.cpp @@ -8,7 +8,7 @@ namespace http { HTTPEntryPoints::HTTPEntryPoints() : index("testview1"), notfound("testview1") {} - coreutils::ZString HTTPEntryPoints::getView(coreutils::ZString &uri) { + coreutils::ZString HTTPEntryPoints::getFlow(coreutils::ZString &uri) { if(uri == "/") { return index; } diff --git a/HTTPEntryPoints.h b/HTTPEntryPoints.h index b0906d1..575e35f 100644 --- a/HTTPEntryPoints.h +++ b/HTTPEntryPoints.h @@ -13,7 +13,7 @@ namespace http { public: HTTPEntryPoints(); - coreutils::ZString getView(coreutils::ZString &uri); + coreutils::ZString getFlow(coreutils::ZString &uri); private: coreutils::ZString index; diff --git a/HTTPGETHandler.cpp b/HTTPGETHandler.cpp index c5adf1a..323ef47 100644 --- a/HTTPGETHandler.cpp +++ b/HTTPGETHandler.cpp @@ -22,9 +22,11 @@ namespace http { // 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 - // by the page? Referer must point to the proper entity. + // by the page? Referer must point to the proper entity. + // + // DOCUMENT: The root entry point should always be a GET request to root page. - entryPoints.processCommand(p); +// entryPoints.processCommand(p); // TODO: Right here we need to do a lookup to the entry table. File requests need an entry point URL to serve. // TODO: Allow entry points to specify pages in the page cache or do we treat pages as automatic entry points. diff --git a/HTTPServer b/HTTPServer new file mode 100755 index 0000000..129a09e Binary files /dev/null and b/HTTPServer differ diff --git a/main.cpp b/main.cpp index fa6d6a8..bb500a2 100644 --- a/main.cpp +++ b/main.cpp @@ -21,7 +21,7 @@ int main(int argc, char **argv) { http::HTTPSessions httpSessions; - http::HTTPServer http(ePoll, core::IPAddress(ipAddress, 80), httpSessions); + http::HTTPServer http(ePoll, core::IPAddress(ipAddress, 8080), httpSessions); core::ConsoleServer console(ePoll, core::IPAddress(ipAddress, 1027)); console.commands.add(ePoll, "threads"); diff --git a/static_flow.json b/static_flow.json index feaf2e5..b3ff881 100644 --- a/static_flow.json +++ b/static_flow.json @@ -2,12 +2,12 @@ "action": "default", "text": "Default Flow", "queues": [ - { - "type": "XQ", - "view": "default", - "actions": [ - { - " + { + "type": "XQ", + "view": "default", + "actions": [ + { + " } ] }