From e506479063e02c2c5f915e8586999828a4cbfb87 Mon Sep 17 00:00:00 2001 From: reger Date: Sun, 21 Aug 2016 01:22:25 +0200 Subject: [PATCH] skip overhead to resolve "" ip and protect against NPE in yacy/message servlet --- htroot/yacy/message.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htroot/yacy/message.java b/htroot/yacy/message.java index 9f0aba076..2446225af 100644 --- a/htroot/yacy/message.java +++ b/htroot/yacy/message.java @@ -71,8 +71,8 @@ public final class message { if (!Protocol.authentifyRequest(post, env)) return prop; final String process = post.get("process", "permission"); - final String clientip = header.get(HeaderFramework.CONNECTION_PROP_CLIENTIP, ""); // read an artificial header addendum - final InetAddress ias = Domains.dnsResolve(clientip); + final String clientip = header.get(HeaderFramework.CONNECTION_PROP_CLIENTIP); // read an artificial header addendum + final InetAddress ias = clientip != null ? Domains.dnsResolve(clientip) : null; final int messagesize = 10240; final int attachmentsize = 0; @@ -116,7 +116,7 @@ public final class message { //Date remoteTime = yacyCore.parseUniversalDate((String) post.get(yacySeed.MYTIME)); // read remote time Seed otherSeed; try { - otherSeed = Seed.genRemoteSeed(otherSeedString, false, ias.getHostAddress()); + otherSeed = Seed.genRemoteSeed(otherSeedString, false, ias == null ? null : ias.getHostAddress()); } catch (final IOException e) { prop.put("response", "-1"); // don't accept messages for bad seeds return prop;