Created some queue types. Source sync.
This commit is contained in:
parent
cd428909b8
commit
e6ccda8bca
20
Flow.cpp
Normal file
20
Flow.cpp
Normal file
@ -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));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
26
Flow.h
Normal file
26
Flow.h
Normal file
@ -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
|
@ -17,5 +17,4 @@ namespace http {
|
|||||||
return coreutils::ZString(actionId, sizeof(actionId));
|
return coreutils::ZString(actionId, sizeof(actionId));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1 +1,2 @@
|
|||||||
#ifndef __FlowPoint_h__
|
#ifndef __FlowPoint_h__
|
||||||
|
|
||||||
|
20
FlowQueue.cpp
Normal file
20
FlowQueue.cpp
Normal file
@ -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));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
26
FlowQueue.h
Normal file
26
FlowQueue.h
Normal file
@ -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
|
@ -8,7 +8,7 @@ namespace http {
|
|||||||
|
|
||||||
HTTPEntryPoints::HTTPEntryPoints() : index("testview1"), notfound("testview1") {}
|
HTTPEntryPoints::HTTPEntryPoints() : index("testview1"), notfound("testview1") {}
|
||||||
|
|
||||||
coreutils::ZString HTTPEntryPoints::getView(coreutils::ZString &uri) {
|
coreutils::ZString HTTPEntryPoints::getFlow(coreutils::ZString &uri) {
|
||||||
if(uri == "/") {
|
if(uri == "/") {
|
||||||
return index;
|
return index;
|
||||||
}
|
}
|
||||||
|
@ -13,7 +13,7 @@ namespace http {
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
HTTPEntryPoints();
|
HTTPEntryPoints();
|
||||||
coreutils::ZString getView(coreutils::ZString &uri);
|
coreutils::ZString getFlow(coreutils::ZString &uri);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
coreutils::ZString index;
|
coreutils::ZString index;
|
||||||
|
@ -23,8 +23,10 @@ namespace http {
|
|||||||
// TODO: What should we do if we receive a request on a GET and there is a session variable?
|
// 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
|
// 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: 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.
|
// TODO: Allow entry points to specify pages in the page cache or do we treat pages as automatic entry points.
|
||||||
|
BIN
HTTPServer
Executable file
BIN
HTTPServer
Executable file
Binary file not shown.
2
main.cpp
2
main.cpp
@ -21,7 +21,7 @@ int main(int argc, char **argv) {
|
|||||||
|
|
||||||
http::HTTPSessions httpSessions;
|
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));
|
core::ConsoleServer console(ePoll, core::IPAddress(ipAddress, 1027));
|
||||||
|
|
||||||
console.commands.add(ePoll, "threads");
|
console.commands.add(ePoll, "threads");
|
||||||
|
@ -2,12 +2,12 @@
|
|||||||
"action": "default",
|
"action": "default",
|
||||||
"text": "Default Flow",
|
"text": "Default Flow",
|
||||||
"queues": [
|
"queues": [
|
||||||
{
|
{
|
||||||
"type": "XQ",
|
"type": "XQ",
|
||||||
"view": "default",
|
"view": "default",
|
||||||
"actions": [
|
"actions": [
|
||||||
{
|
{
|
||||||
"
|
"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user