summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/Domain.h21
-rw-r--r--include/HttpServ.h45
2 files changed, 48 insertions, 18 deletions
diff --git a/include/Domain.h b/include/Domain.h
new file mode 100644
index 0000000..ef103c2
--- /dev/null
+++ b/include/Domain.h
@@ -0,0 +1,21 @@
+#ifndef __DOMAIN_H__
+#define __DOMAIN_H__
+
+#include <BRegex.h>
+#include <HttpServ.h>
+
+class Domain : public Base {
+ public:
+ Domain(const Regex &);
+ virtual ~Domain();
+ static Domain * find_domain(const String & url);
+ void OnTop();
+ virtual void Do(const HttpRequest &) = 0;
+ private:
+ Domain * find_domain_r(const String & url);
+ static Domain * head;
+ Domain * next, * prev;
+ Regex pattern;
+};
+
+#endif
diff --git a/include/HttpServ.h b/include/HttpServ.h
index db454e0..aec3aad 100644
--- a/include/HttpServ.h
+++ b/include/HttpServ.h
@@ -9,23 +9,6 @@
#include <Handle.h>
#include <Exceptions.h>
-class Action;
-class HttpServ : public Task {
- public:
- HttpServ(Action *, int = 1500, const String & = String("GruiK Server v0.2")) throw (GeneralException);
- virtual ~HttpServ();
- virtual String GetName();
-
- protected:
- virtual int Do() throw (GeneralException);
-
- private:
- Socket Listener;
- Action * p;
- String name;
- int localport;
-};
-
class HttpResponse : public Base {
public:
typedef enum {
@@ -51,10 +34,36 @@ class HttpResponse : public Base {
Buffer contents;
bool cache;
- public:
+ private:
String code_to_string();
};
+class HttpRequest : public Base {
+ public:
+ Variables * vars, * headers;
+ String url;
+};
+
+class Action;
+class HttpServ : public Task {
+ public:
+ HttpServ(Action *, int = 1500, const String & = String("GruiK Server v0.2")) throw (GeneralException);
+ virtual ~HttpServ();
+ virtual String GetName();
+ void SetRoot(const String &);
+
+ protected:
+ virtual int Do() throw (GeneralException);
+
+ private:
+ Socket Listener;
+ Action * p;
+ String name;
+ int localport;
+ String root;
+ HttpResponse response;
+};
+
extern String endhl, endnl;
#include <Action.h>