summaryrefslogtreecommitdiff
path: root/src/modules
diff options
context:
space:
mode:
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2007-11-11 20:15:21 +0000
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2007-11-11 20:15:21 +0000
commit4cfe4cbc62dfca59dba74f0e6811fd09e31609df (patch)
tree71d6ad60cf1475e8f8ddfd65ca276ce5c0d5df67 /src/modules
parent8bc6254a5912f544c99623f0473d6f025f61b7b9 (diff)
Hmm
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@8579 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/modules')
-rw-r--r--src/modules/m_http_client.cpp30
1 files changed, 9 insertions, 21 deletions
diff --git a/src/modules/m_http_client.cpp b/src/modules/m_http_client.cpp
index d7722caff..62dfe6831 100644
--- a/src/modules/m_http_client.cpp
+++ b/src/modules/m_http_client.cpp
@@ -51,16 +51,20 @@ class HTTPResolver : public Resolver
{
private:
HTTPSocket *socket;
+ std::string orig;
public:
HTTPResolver(HTTPSocket *socket, InspIRCd *Instance, const string &hostname, bool &cached, Module* me) : Resolver(Instance, hostname, DNS_QUERY_FORWARD, cached, me), socket(socket)
{
ServerInstance->Log(DEBUG,"HTTPResolver::HTTPResolver");
+ orig = hostname;
}
void OnLookupComplete(const string &result, unsigned int ttl, bool cached, int resultnum = 0)
{
if (!resultnum)
socket->Connect(result);
+ else
+ socket->Connect(orig);
}
void OnError(ResolverError e, const string &errmsg)
@@ -146,23 +150,10 @@ bool HTTPSocket::DoRequest(HTTPClientRequest *req)
this->port = url.port;
strlcpy(this->host, url.domain.c_str(), MAXBUF);
- in_addr addy1;
-#ifdef IPV6
- in6_addr addy2;
- if ((inet_aton(this->host, &addy1) > 0) || (inet_pton(AF_INET6, this->host, &addy2) > 0))
-#else
- if (inet_aton(this->host, &addy1) > 0)
-#endif
- {
- bool cached;
- HTTPResolver* r = new HTTPResolver(this, Server, url.domain, cached, (Module*)Mod);
- Instance->AddResolver(r, cached);
- return true;
- }
- else
- {
- this->Connect(url.domain);
- }
+ bool cached;
+ HTTPResolver* r = new HTTPResolver(this, Server, url.domain, cached, (Module*)Mod);
+ Instance->AddResolver(r, cached);
+ return true;
return true;
}
@@ -288,11 +279,8 @@ bool HTTPSocket::OnDataReady()
Instance->Log(DEBUG,"HTTPSocket::OnDataReady()");
char *data = this->Read();
- if (!data)
- {
- this->Close();
+ if (!data || !*data)
return false;
- }
if (this->status < HTTP_DATA)
{