]> granicus.if.org Git - transmission/commitdiff
(trunk libT) #2819 "announce URLs containing raw IP addresses won't announce/scrape...
authorCharles Kerr <charles@transmissionbt.com>
Thu, 28 Jan 2010 17:24:23 +0000 (17:24 +0000)
committerCharles Kerr <charles@transmissionbt.com>
Thu, 28 Jan 2010 17:24:23 +0000 (17:24 +0000)
libtransmission/web.c

index 1257caaf3001b5f522a5bf54b24fe1224c98afd6..dda2cef4748e4e4757c4d96c18e2703fae680023 100644 (file)
@@ -441,6 +441,7 @@ dns_ipv4_done_cb( int err, char type, int count, int ttl, void * addresses, void
 static void
 doDNS( void * vtask )
 {
+    tr_address addr;
     int port = -1;
     char * host = NULL;
     struct tr_web_task * task = vtask;
@@ -452,7 +453,18 @@ doDNS( void * vtask )
     {
         task->port = port;
         task->host = host;
-        lookup_result = dns_cache_lookup( task, host, &task->resolved_host );
+
+        /* If 'host' is an IPv4 or IPv6 address in text form, use it as-is.
+         * Otherwise, see if its resolved name is in our DNS cache */
+        if( tr_pton( task->host, &addr ) != NULL )
+        {
+            task->resolved_host = task->host;
+            lookup_result = TR_DNS_OK;
+        }
+        else
+        {
+            lookup_result = dns_cache_lookup( task, host, &task->resolved_host );
+        }
     }
 
     if( lookup_result != TR_DNS_UNTESTED )