X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fmodules%2Fm_httpd.cpp;h=bbd9f1275d98f365812009f6d25fcd4918c944d8;hb=9e64fb83aab4f4c0c6964fcdbef4bca0846e930a;hp=30612f64493ffa2f420370f748fc2a7c2311a9e3;hpb=f3d80041f68417cc10d8e7575659468b30009f22;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/modules/m_httpd.cpp b/src/modules/m_httpd.cpp index 30612f644..bbd9f1275 100644 --- a/src/modules/m_httpd.cpp +++ b/src/modules/m_httpd.cpp @@ -30,7 +30,7 @@ class ModuleHttpServer; static ModuleHttpServer* HttpModule; static bool claimed; -static std::set sockets; +static insp::intrusive_list 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 { 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::const_iterator i = sockets.begin(); i != sockets.end(); ++i) + for (insp::intrusive_list::const_iterator i = sockets.begin(); i != sockets.end(); ++i) { HttpServerSocket* sock = *i; sock->AddToCull();