From dd41b5c257cd54c13db845f2818df226bb21300f Mon Sep 17 00:00:00 2001 From: Charles Kerr Date: Thu, 28 Jan 2010 17:24:23 +0000 Subject: [PATCH] (trunk libT) #2819 "announce URLs containing raw IP addresses won't announce/scrape in 1.82" -- possible fix --- libtransmission/web.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/libtransmission/web.c b/libtransmission/web.c index 1257caaf3..dda2cef47 100644 --- a/libtransmission/web.c +++ b/libtransmission/web.c @@ -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 ) -- 2.40.0