AddToCull();
}
- std::string Response(int response)
+ std::string Response(unsigned int response)
{
switch (response)
{
}
}
- void SendHTTPError(int response)
+ void SendHTTPError(unsigned int response)
{
HTTPHeaders empty;
std::string data = "<html><head></head><body>Server error "+ConvToStr(response)+": "+Response(response)+"<br>"+
WriteData(data);
}
- void SendHeaders(unsigned long size, int response, HTTPHeaders &rheaders)
+ void SendHeaders(unsigned long size, unsigned int response, HTTPHeaders &rheaders)
{
WriteData(http_version + " "+ConvToStr(response)+" "+Response(response)+"\r\n");
}
}
- void Page(std::stringstream* n, int response, HTTPHeaders *hheaders)
+ void Page(std::stringstream* n, unsigned int response, HTTPHeaders *hheaders)
{
SendHeaders(n->str().length(), response, *hheaders);
WriteData(n->str());
+ Close();
}
void AddToCull()
ModResult OnAcceptConnection(int nfd, ListenSocket* from, irc::sockets::sockaddrs* client, irc::sockets::sockaddrs* server) CXX11_OVERRIDE
{
- if (from->bind_tag->getString("type") != "httpd")
+ if (!stdalgo::string::equalsci(from->bind_tag->getString("type"), "httpd"))
return MOD_RES_PASSTHRU;
- int port;
- std::string incomingip;
- irc::sockets::satoap(*client, incomingip, port);
- sockets.push_front(new HttpServerSocket(nfd, incomingip, from, client, server, timeoutsec));
+
+ sockets.push_front(new HttpServerSocket(nfd, client->addr(), from, client, server, timeoutsec));
return MOD_RES_ALLOW;
}