]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/m_httpd.cpp
Convert more modules
[user/henk/code/inspircd.git] / src / modules / m_httpd.cpp
index b2ede661957941c32e50a862a4da5949cc424958..ed02c0a5c5745da51921803e303974da814253a2 100644 (file)
@@ -11,9 +11,9 @@
  * ---------------------------------------------------
  */
 
+#include "inspircd.h"
 #include <algorithm>
 #include "modules.h"
-#include "inspircd.h"
 #include "httpd.h"
 
 /* $ModDesc: Provides HTTP serving facilities to modules */
@@ -233,7 +233,7 @@ class HttpServerSocket : public InspSocket
 
                        if (headers.str().find("\r\n\r\n") != std::string::npos)
                        {
-                               if (request_type == "")
+                               if (request_type.empty())
                                {
                                        headers >> request_type;
                                        headers >> uri;
@@ -246,7 +246,7 @@ class HttpServerSocket : public InspSocket
                                if ((InternalState == HTTP_SERVE_WAIT_REQUEST) && (request_type == "POST"))
                                {
                                        /* Do we need to fetch postdata? */
-                                       postdata = "";
+                                       postdata.clear();
                                        InternalState = HTTP_SERVE_RECV_POSTDATA;
                                        std::string header_item;
                                        while (headers >> header_item)
@@ -371,12 +371,14 @@ class ModuleHttpServer : public Module
                        port = c.ReadInteger("http", "port", i, true);
                        indexfile = c.ReadValue("http", "index", i);
                        index = new FileReader(ServerInstance, indexfile);
+                       if (!index->Exists())
+                               throw ModuleException("Can't read index file: "+indexfile);
                        http = new HttpServerSocket(ServerInstance, bindip, port, true, 0, index);
                        httpsocks.push_back(http);
                }
        }
 
-       ModuleHttpServer(InspIRCd* Me) : Module::Module(Me)
+       ModuleHttpServer(InspIRCd* Me) : Module(Me)
        {
                ReadConfig();
        }
@@ -435,7 +437,7 @@ class ModuleHttpServerFactory : public ModuleFactory
 };
 
 
-extern "C" void * init_module( void )
+extern "C" DllExport void * init_module( void )
 {
        return new ModuleHttpServerFactory;
 }