*) cursor jumps now to searchbox on searchpages again

*) added missing private IP-ranges for APIPA/Zeroconf and 172.16.0.0–172.31.255.255
*) Changed some seed-download-errors to warnings

git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@3086 6c8d7289-2bf4-0310-a012-ef5d649a1542
pull/1/head
rramthun 18 years ago
parent e17591acc3
commit 1a525710c1

@ -26,7 +26,7 @@
<h2>Detailed&nbsp;Search</h2>
<form class="dsearch" action="DetailedSearch.html" method="get" enctype="multipart/form-data">
<fieldset>
<input type="text" name="search" value="#[search]#" size="50" maxlength="250" />
<input type="text" name="search" id="search" value="#[search]#" size="50" maxlength="250" />
<input type="submit" name="Enter" value="Search" />
</fieldset>
<fieldset>

@ -19,7 +19,7 @@
<form class="search" action="yacysearch.html" method="get" name="searchform">
<fieldset class="maininput">
<input type="hidden" name="display" value="#[display]#" />
<input name="search" type="text" size="52" maxlength="80" value="#[former]#" />
<input name="search" id="search" type="text" size="52" maxlength="80" value="#[former]#" />
<input type="submit" name="Enter" value="Search" />
<input type="hidden" name="former" value="#[former]#" /><br />
<input type="radio" name="contentdom" value="text" #(contentdomCheckText)#::checked="checked"#(/contentdomCheckText)# />Text&nbsp;&nbsp;

@ -411,22 +411,31 @@ public final class serverCore extends serverAbstractThread implements serverThre
return isNotLocal(url.getHost());
}
public static boolean isNotLocal(String ip) {
// generate ip address if ip is given by host
assert (ip != null);
/**
* Checks if a given address (hostname or IP) is *not* a local address
*
* @param address Address to check
* @return boolean, true if address is public, false if address is private
*/
public static boolean isNotLocal(String address) {
assert (address != null);
// check local ip addresses
if ((ip.equals("localhost")) ||
(ip.startsWith("127")) ||
(ip.startsWith("192.168")) ||
(ip.startsWith("10."))
if ((address.equals("localhost")) ||
(address.startsWith("127")) ||
(address.startsWith("192.168")) ||
(address.startsWith("10.")) ||
(address.startsWith("169.254")) ||
//172.16.0.0172.31.255.255 (I think this is faster than a regex)
(address.startsWith("172.16")) || (address.startsWith("172.17")) || (address.startsWith("172.18")) || (address.startsWith("172.19")) || (address.startsWith("172.20")) || (address.startsWith("172.21")) || (address.startsWith("172.22")) || (address.startsWith("172.23")) || (address.startsWith("172.24")) || (address.startsWith("172.25")) || (address.startsWith("172.26")) || (address.startsWith("172.27")) || (address.startsWith("172.28")) || (address.startsWith("172.29")) || (address.startsWith("172.30")) || (address.startsWith("172.31"))
) return false;
// make a dns resolve
final InetAddress clientAddress = httpc.dnsResolve(ip);
// make a dns resolve if a hostname is given and check again
final InetAddress clientAddress = httpc.dnsResolve(address);
if (clientAddress != null) {
if ((clientAddress.isAnyLocalAddress()) || (clientAddress.isLoopbackAddress())) return false;
if (ip.charAt(0) > '9') ip = clientAddress.getHostAddress();
if (address.charAt(0) > '9') address = clientAddress.getHostAddress();
}
// finally check if there are other local IP adresses that are not in the standard IP range
@ -434,7 +443,7 @@ public final class serverCore extends serverAbstractThread implements serverThre
if (localAddresses[i].equals(clientAddress)) return false;
}
// the address must be a gloabl IP address
// the address must be a global address
return true;
}
@ -526,7 +535,8 @@ public final class serverCore extends serverAbstractThread implements serverThre
}
public void freemem() {
// do nothing; FIXME: can we something here to flush memory?
// FIXME: can we something here to flush memory? Idea: Reduce the size of some of our various caches.
System.gc();
}
// class body

@ -193,7 +193,7 @@ public class yacyPeerActions {
url = new URL(seedListFileURL);
header = httpc.whead(url, url.getHost(), this.bootstrapLoadTimeout, null, null, this.sb.remoteProxyConfig,reqHeader);
if ((header == null) || (header.lastModified() == null)) {
yacyCore.log.logInfo("BOOTSTRAP: seed-list URL " + seedListFileURL + " not available");
yacyCore.log.logWarning("BOOTSTRAP: seed-list URL " + seedListFileURL + " not available");
} else if ((header.age() > 86400000) && (ssc > 0)) {
yacyCore.log.logInfo("BOOTSTRAP: seed-list URL " + seedListFileURL + " too old (" + (header.age() / 86400000) + " days)");
} else {
@ -214,10 +214,12 @@ public class yacyPeerActions {
yacyCore.log.logInfo("BOOTSTRAP: " + lc + " seeds from seed-list URL " + seedListFileURL + ", AGE=" + (header.age() / 3600000) + "h");
}
} catch (IOException e) {
// this is when wget fails, commonly because of timeout
yacyCore.log.logWarning("BOOTSTRAP: failed to load seeds from seed-list URL " + seedListFileURL + ": " + e.getMessage());
} catch (Exception e) {
// this is when wget fails; may be because of missing internet connection
// we do nothing here and go silently over it
yacyCore.log.logSevere("BOOTSTRAP: failed to load seeds from seed-list URL " + seedListFileURL);
yacyCore.log.logSevere("BOOTSTRAP: failed to load seeds from seed-list URL " + seedListFileURL + ": " + e.getMessage());
}
}
}

Loading…
Cancel
Save