From 6ce9b0beeb0a9c8dee0246f4fae79c6d5c8219af Mon Sep 17 00:00:00 2001 From: pixel Date: Wed, 9 May 2007 07:12:33 +0000 Subject: First new bricks of a more global domain system. --- include/Domain.h | 21 +++++++++++++++++++++ include/HttpServ.h | 45 +++++++++++++++++++++++++++------------------ 2 files changed, 48 insertions(+), 18 deletions(-) create mode 100644 include/Domain.h (limited to 'include') 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 +#include + +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 #include -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 -- cgit v1.2.3