From 8346d0774d2d1e076038db27f65f1d082a460f16 Mon Sep 17 00:00:00 2001 From: Pixel Date: Thu, 20 Sep 2001 23:27:01 +0000 Subject: Initial revision --- include/HttpServ.h | 44 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 include/HttpServ.h (limited to 'include/HttpServ.h') diff --git a/include/HttpServ.h b/include/HttpServ.h new file mode 100644 index 0000000..71dc4eb --- /dev/null +++ b/include/HttpServ.h @@ -0,0 +1,44 @@ +#ifndef __HTTPSERV_H__ +#define __HTTPSERV_H__ +#ifdef __cplusplus + +#include "Socket.h" +#include "String.h" +#include "Exceptions.h" +#include "Variables.h" +#include "Action.h" + +/* + * La classe HttpServ. Le constructueur (int, const String &) indique le port + * et le nom du serveur à indiquer dans les entetes HTTP. + * + * Une fois lance, il suffit de lancer MainLoop en indiquant le menu principal, + * qui est obligatoirement statique et doit posseder l'url /bin/start. + */ + +class HttpServ : public Base { + public: + HttpServ(int = 1500, const String & = String("GruiK Server v0.1")); + ~HttpServ() {} + void MainLoop(Action *); + private: + String GetMime(const String &); + void ProcessRequest(Action *); + bool ParseUri(String &, String &, Socket &); + void ParseVars(Socket &, int); + void ShowError(Socket &); + void SendHeads(Socket &, const String &); + void SendRedirect(Socket &); + String name; + Socket Listener; + Variables * Vars; + int localport; + bool bad; +}; + +extern String endhl, endnl; + +#else +#error This only works with a C++ compiler +#endif +#endif -- cgit v1.2.3