]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/m_http_client.cpp
Damn strict typing to hell
[user/henk/code/inspircd.git] / src / modules / m_http_client.cpp
index 35b93b5818c480359e55e47133661ab567727b5d..a2f80687fa4306ca927f188ef67e3dd6254399bf 100644 (file)
@@ -56,14 +56,16 @@ class HTTPResolver : public Resolver
        {
        }
        
-       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;
        }
 };
 
@@ -174,10 +176,10 @@ bool HTTPSocket::ParseURL(const std::string &iurl)
        
        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:')