* | Inspire Internet Relay Chat Daemon |
* +------------------------------------+
*
- * InspIRCd: (C) 2002-2007 InspIRCd Development Team
+ * InspIRCd: (C) 2002-2008 InspIRCd Development Team
* See: http://www.inspircd.org/wiki/index.php/Credits
*
* This program is free but copyrighted software; see
HTTPSocket *socket;
std::string orig;
public:
- HTTPResolver(HTTPSocket *s, InspIRCd *Instance, const string &hostname, bool &cached, Module* me) : Resolver(Instance, hostname, DNS_QUERY_FORWARD, cached, me), socket(s)
+ HTTPResolver(HTTPSocket *s, InspIRCd *Instance, const std::string &hostname, bool &cached, Module* me) : Resolver(Instance, hostname, DNS_QUERY_FORWARD, cached, me), socket(s)
{
- ServerInstance->Log(DEBUG,"HTTPResolver::HTTPResolver");
+ ServerInstance->Log(DEBUG,">>>>>>>>>>>>>>>>>> HTTPResolver::HTTPResolver <<<<<<<<<<<<<<<");
orig = hostname;
}
- void OnLookupComplete(const string &result, unsigned int ttl, bool cached, int resultnum = 0)
+ void OnLookupComplete(const std::string &result, unsigned int ttl, bool cached, int resultnum = 0)
{
- ServerInstance->Log(DEBUG,"HTTPResolver::OnLookupComplete");
+ ServerInstance->Log(DEBUG,"************* HTTPResolver::OnLookupComplete ***************");
if (!resultnum)
socket->Connect(result);
else
socket->OnClose();
}
- void OnError(ResolverError e, const string &errmsg)
+ void OnError(ResolverError e, const std::string &errmsg)
{
- ServerInstance->Log(DEBUG,"HTTPResolver::OnError");
+ ServerInstance->Log(DEBUG,"!!!!!!!!!!!!!!!! HTTPResolver::OnError: %s", errmsg.c_str());
socket->OnClose();
}
};
-typedef vector<HTTPSocket*> HTTPList;
+typedef std::vector<HTTPSocket*> HTTPList;
class ModuleHTTPClient : public Module
{
this->port = 80;
response = NULL;
closed = false;
+ timeout_val = 10;
}
HTTPSocket::~HTTPSocket()
bool cached;
HTTPResolver* r = new HTTPResolver(this, Server, url.domain, cached, (Module*)Mod);
Instance->AddResolver(r, cached);
- Instance->Log(DEBUG,"Resolver added");
+ Instance->Log(DEBUG,"Resolver added, cached=%d", cached);
}
else
Connect(url.domain);
return true;
}
-void HTTPSocket::Connect(const string &ip)
+void HTTPSocket::Connect(const std::string &ip)
{
this->response = new HTTPClientResponse((Module*)Mod, req.GetSource() , url.url, 0, "");
bool HTTPSocket::OnDataReady()
{
- Instance->Log(DEBUG,"HTTPSocket::OnDataReady()");
+ Instance->Log(DEBUG,"HTTPSocket::OnDataReady() for %s", url.url.c_str());
char *data = this->Read();
if (!data)