summaryrefslogtreecommitdiff
path: root/include/HttpServ.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/HttpServ.h')
-rw-r--r--include/HttpServ.h44
1 files changed, 44 insertions, 0 deletions
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