int port;
};
-class HTTPSocket : public InspSocket
+class HTTPSocket : public BufferedSocket
{
private:
InspIRCd *Server;
{
}
- void OnLookupComplete(const string &result, unsigned int ttl, bool cached)
+ void OnLookupComplete(const string &result, unsigned int ttl, bool cached, int resultnum = 0)
{
- socket->Connect(result);
+ if (!resultnum)
+ socket->Connect(result);
}
void OnError(ResolverError e, const string &errmsg)
{
- delete socket;
+ if (ServerInstance->SocketCull.find(socket) == ServerInstance->SocketCull.end())
+ ServerInstance->SocketCull[socket] = socket;
}
};
};
HTTPSocket::HTTPSocket(InspIRCd *Instance, ModuleHTTPClient *Mod)
- : InspSocket(Instance), Server(Instance), Mod(Mod), status(HTTP_CLOSED)
+ : BufferedSocket(Instance), Server(Instance), Mod(Mod), status(HTTP_CLOSED)
{
this->ClosePending = false;
this->port = 80;
for (int p = 0;; p++)
{
- std::string part = tokenizer.GetToken();
- if (part.empty() && tokenizer.StreamEnd())
+ std::string part;
+ if (!tokenizer.GetToken(part))
break;
-
+
if ((p == 0) && (part[part.length() - 1] == ':'))
{
// Protocol ('http:')