diff options
Diffstat (limited to 'lib/HttpServ.cc')
-rw-r--r-- | lib/HttpServ.cc | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/lib/HttpServ.cc b/lib/HttpServ.cc index 84078e0..3bec28f 100644 --- a/lib/HttpServ.cc +++ b/lib/HttpServ.cc @@ -7,9 +7,18 @@ String endhl = "\r\n", endnl = "\n"; -HttpServ::HttpServ(int port, const String & nname) : name(nname), localport(port) { - Listener.SetLocal("", port); - Listener.Listen(); +HttpServ::HttpServ(int port, const String & nname) throw (GeneralException) : name(nname), localport(port) { + bool r = true; + + r = Listener.SetLocal("", port); + if (r) { + r = Listener.Listen(); + } + + if (!r) { + throw GeneralException("Initialisation of the Mini HTTP-Server failed."); + } + cerr << "Mini HTTP-Server '" << name << "' ready and listening for port " << port << endl; } @@ -128,7 +137,7 @@ void HttpServ::ParseVars(Handle * s, int len) { s->read(&l, 1); t += l; } - cerr << "Post variables line: '" <<t << "'\n"; + cerr << "Post variables line: '" << t << "'\n"; // Les variables sont sous la forme 'var1=val1&var2=val2&val3=var3'. Donc le nombre d'occurences @@ -180,7 +189,7 @@ void HttpServ::ParseVars(Handle * s, int len) { bool HttpServ::ParseUri(String & file, String & domain, Handle * s) { String t, Uri; bool post = false; - char * p = NULL; + const char * p = NULL; ssize_t sppos; *s >> t; |