]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/m_httpd.cpp
m_spanningtree Only unserialize() METADATA if the object type matches ExtensionItem...
[user/henk/code/inspircd.git] / src / modules / m_httpd.cpp
index 30612f64493ffa2f420370f748fc2a7c2311a9e3..bbd9f1275d98f365812009f6d25fcd4918c944d8 100644 (file)
@@ -30,7 +30,7 @@ class ModuleHttpServer;
 
 static ModuleHttpServer* HttpModule;
 static bool claimed;
-static std::set<HttpServerSocket*> sockets;
+static insp::intrusive_list<HttpServerSocket> sockets;
 
 /** HTTP socket states
  */
@@ -43,7 +43,7 @@ enum HttpState
 
 /** A socket used for HTTP transport
  */
-class HttpServerSocket : public BufferedSocket, public Timer
+class HttpServerSocket : public BufferedSocket, public Timer, public insp::intrusive_list_node<HttpServerSocket>
 {
        HttpState InternalState;
        std::string ip;
@@ -269,7 +269,7 @@ class HttpServerSocket : public BufferedSocket, public Timer
                                continue;
                        }
 
-                       std::string cheader = reqbuffer.substr(hbegin, hend - hbegin);
+                       std::string cheader(reqbuffer, hbegin, hend - hbegin);
 
                        std::string::size_type fieldsep = cheader.find(':');
                        if ((fieldsep == std::string::npos) || (fieldsep == 0) || (fieldsep == cheader.length() - 1))
@@ -300,7 +300,7 @@ class HttpServerSocket : public BufferedSocket, public Timer
 
                        if (reqbuffer.length() >= postsize)
                        {
-                               postdata = reqbuffer.substr(0, postsize);
+                               postdata.assign(reqbuffer, 0, postsize);
                                reqbuffer.erase(0, postsize);
                        }
                        else if (!reqbuffer.empty())
@@ -397,13 +397,13 @@ class ModuleHttpServer : public Module
                int port;
                std::string incomingip;
                irc::sockets::satoap(*client, incomingip, port);
-               sockets.insert(new HttpServerSocket(nfd, incomingip, from, client, server, timeoutsec));
+               sockets.push_front(new HttpServerSocket(nfd, incomingip, from, client, server, timeoutsec));
                return MOD_RES_ALLOW;
        }
 
        CullResult cull() CXX11_OVERRIDE
        {
-               for (std::set<HttpServerSocket*>::const_iterator i = sockets.begin(); i != sockets.end(); ++i)
+               for (insp::intrusive_list<HttpServerSocket>::const_iterator i = sockets.begin(); i != sockets.end(); ++i)
                {
                        HttpServerSocket* sock = *i;
                        sock->AddToCull();