From c6e1befbcac9653f93f6c0a0400b97863343d577 Mon Sep 17 00:00:00 2001 From: luccioman Date: Fri, 15 Dec 2017 17:03:35 +0100 Subject: [PATCH] Restored peer URL host name stripping removed from previous commit. Still useful for peers with IPv6 addresses. --- source/net/yacy/peers/Protocol.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source/net/yacy/peers/Protocol.java b/source/net/yacy/peers/Protocol.java index 8f5345681..cbc23babc 100644 --- a/source/net/yacy/peers/Protocol.java +++ b/source/net/yacy/peers/Protocol.java @@ -237,7 +237,7 @@ public final class Protocol { } else { try { // patch the remote peer address to avoid that remote peers spoof the network with wrong addresses - String host = targetBaseURL.getHost(); + String host = Domains.stripToHostName(targetBaseURL.getHost()); InetAddress ie = Domains.dnsResolve(host); otherPeer = Seed.genRemoteSeed(seed, false, ie.getHostAddress()); if ( !otherPeer.hash.equals(targetHash) ) { @@ -346,7 +346,7 @@ public final class Protocol { } else { try { if ( i == 1 ) { - String host = targetBaseURL.getHost(); + String host = Domains.stripToHostName(targetBaseURL.getHost()); InetAddress ia = Domains.dnsResolve(host); if (ia == null) continue; host = ia.getHostAddress(); // the actual address of the target as we had been successful when contacting them is patched here