From 644573cfc4d0641bf497dcb093c4b267de24cfcd Mon Sep 17 00:00:00 2001 From: Michael Peter Christen Date: Tue, 7 Jan 2014 21:52:19 +0100 Subject: [PATCH] using the adminAccountUserName from yacy.conf within apicall.sh --- bin/apicall.sh | 5 +++-- source/net/yacy/cora/protocol/Domains.java | 23 +--------------------- 2 files changed, 4 insertions(+), 24 deletions(-) diff --git a/bin/apicall.sh b/bin/apicall.sh index 676491f5a..c0951ad81 100755 --- a/bin/apicall.sh +++ b/bin/apicall.sh @@ -1,12 +1,13 @@ #!/bin/bash cd "`dirname $0`" port=$(grep ^port= ../DATA/SETTINGS/yacy.conf |cut -d= -f2) +admin=$(grep ^adminAccountUserName= ../DATA/SETTINGS/yacy.conf |cut -d= -f2) pw=$(grep ^adminAccountBase64MD5= ../DATA/SETTINGS/yacy.conf |cut -d= -f2) if which curl &>/dev/null; then - curl -s -u admin:$pw "http://127.0.0.1:$port/$1" + curl -s -u $admin:$pw "http://127.0.0.1:$port/$1" elif which wget &>/dev/null; then - wget -q -t 1 --timeout=120 --http-user admin --http-password pw "http://127.0.0.1:$port/$1" -O - + wget -q -t 1 --timeout=120 --http-user $admin --http-password $pw "http://127.0.0.1:$port/$1" -O - else exit 1 fi diff --git a/source/net/yacy/cora/protocol/Domains.java b/source/net/yacy/cora/protocol/Domains.java index 30b0475e7..69c448ccf 100644 --- a/source/net/yacy/cora/protocol/Domains.java +++ b/source/net/yacy/cora/protocol/Domains.java @@ -638,10 +638,6 @@ public class Domains { if ((host == null) || host.isEmpty()) return null; host = host.toLowerCase().trim(); - // try to simply parse the address -// InetAddress ip = InetAddress.getByName(host); -// if (ip != null) return ip; - // trying to resolve host by doing a name cache lookup InetAddress ip = NAME_CACHE_HIT.get(host); if (ip != null) { @@ -685,14 +681,6 @@ public class Domains { NAME_CACHE_HIT.insertIfAbsent(host, i); cacheHit_Insert++; return host; - /* - // call i.getHostName() using concurrency to interrupt execution in case of a time-out - try { - //TimeoutRequest.getHostName(i, 1000); - } catch (final ExecutionException e) { - return i.getHostAddress(); - } - */ } /** @@ -716,15 +704,6 @@ public class Domains { public static InetAddress dnsResolve(final String host0) { if (host0 == null || host0.isEmpty()) return null; final String host = host0.toLowerCase().trim(); - // try to simply parse the address - InetAddress ip; -// try { -// ip = InetAddress.getByName(host); -// return ip; -// } catch (UnknownHostException e1) { -// // we expected that InetAddress.getByName may fail if this is not a raw address. -// // We silently ignore this and go on. -// } /* if (MemoryControl.shortStatus()) { @@ -734,7 +713,7 @@ public class Domains { */ // try to resolve host by doing a name cache lookup - ip = NAME_CACHE_HIT.get(host); + InetAddress ip = NAME_CACHE_HIT.get(host); if (ip != null) { //System.out.println("DNSLOOKUP-CACHE-HIT(CONC) " + host); cacheHit_Hit++;