Distributed Peer-to-Peer Web Search Engine and Intranet Search Appliance
Java decentralizedintranet-searchintranet-search-enginep2pp2p-networkprivacyprivacy-protectionsearch-enginesearchenginewebweb-search-enginewebsearchwebseearch-engine
Support for preferred https in peers communication on more operations
lucciomanc35d0568b6ce
diff --git a/htroot/sharedBlacklist_p.java b/htroot/sharedBlacklist_p.javaindex fb49ac9de..8e1a73455 100644--- a/htroot/sharedBlacklist_p.java+++ b/htroot/sharedBlacklist_p.java@@ -56,6 +56,7 @@ import net.yacy.repository.Blacklist;import net.yacy.repository.BlacklistHostAndPath;import net.yacy.repository.Blacklist.BlacklistType;import net.yacy.search.Switchboard;+import net.yacy.search.SwitchboardConstants;import net.yacy.search.query.SearchEventCache;import net.yacy.server.serverObjects;import net.yacy.server.serverSwitch;@@ -140,11 +141,29 @@ public class sharedBlacklist_p {if( sb.peers != null ){ //no nullpointer error..final Seed seed = sb.peers.getConnected(hash);if (seed != null) {- final String IP = seed.getIP();- final String Port = seed.get(Seed.PORT, "8090");- final String peerName = seed.get(Seed.NAME, "<" + IP + ":" + Port + ">");- prop.putHTML("page_source", peerName);- downloadURLOld = "http://" + IP + ":" + Port + "/yacy/list.html?col=black";+ final Set<String> ips = seed.getIPs();+ if(!ips.isEmpty()) {+ final String IP = ips.iterator().next();+ final String Port = seed.get(Seed.PORT, "8090");+ final String peerName = seed.get(Seed.NAME, "<" + IP + ":" + Port + ">");+ prop.putHTML("page_source", peerName);++ downloadURLOld = seed.getPublicURL(IP,+ sb.getConfigBool(SwitchboardConstants.REMOTESEARCH_HTTPS_PREFERRED,+ SwitchboardConstants.REMOTESEARCH_HTTPS_PREFERRED_DEFAULT)) + "/yacy/list.html?col=black";++ // download the blacklist+ try {+ // get List+ final DigestURL u = new DigestURL(downloadURLOld);++ otherBlacklist = FileUtils.strings(u.get(agent, null, null));+ } catch (final Exception e) {+ prop.put("status", STATUS_PEER_UNKNOWN);+ prop.putHTML("status_name", hash);+ prop.put("page", "1");+ }+ }} else {prop.put("status", STATUS_PEER_UNKNOWN);//YaCy-Peer not foundprop.putHTML("status_name", hash);@@ -155,20 +174,6 @@ public class sharedBlacklist_p {prop.putHTML("status_name", hash);prop.put("page", "1");}-- if (downloadURLOld != null) {- // download the blacklist- try {- // get List- final DigestURL u = new DigestURL(downloadURLOld);-- otherBlacklist = FileUtils.strings(u.get(agent, null, null));- } catch (final Exception e) {- prop.put("status", STATUS_PEER_UNKNOWN);- prop.putHTML("status_name", hash);- prop.put("page", "1");- }- }} else if (post.containsKey("url")) {/* ======================================================* Download the blacklist from URLdiff --git a/source/net/yacy/search/AutoSearch.java b/source/net/yacy/search/AutoSearch.javaindex c8791d48e..9e214b394 100644--- a/source/net/yacy/search/AutoSearch.java+++ b/source/net/yacy/search/AutoSearch.java@@ -244,7 +244,18 @@ public class AutoSearch extends AbstractBusyThread {* @param seed the peer to ask*/private void processSingleTarget(Seed seed) {- ConcurrentLog.fine(AutoSearch.class.getName(), "ask " + seed.getIP() + " " + seed.getName() + " for query=" + currentQuery);+ final Set<String> ips = seed.getIPs();+ if(ips.isEmpty()) {+ ConcurrentLog.warn(AutoSearch.class.getName(), "no known IP address for peer " + seed.getName());+ return;+ }+ final String ip = ips.iterator().next();+ ConcurrentLog.fine(AutoSearch.class.getName(), "ask " + ip + " " + seed.getName() + " for query=" + currentQuery);++ final boolean preferHttps = this.sb.getConfigBool(SwitchboardConstants.REMOTESEARCH_HTTPS_PREFERRED,+ SwitchboardConstants.REMOTESEARCH_HTTPS_PREFERRED_DEFAULT);++ final String targetBaseURL = seed.getPublicURL(ip, preferHttps);if (seed.getFlagSolrAvailable()) { // do a solr querySolrDocumentList docList = null;@@ -259,7 +270,7 @@ public class AutoSearch extends AbstractBusyThread {SwitchboardConstants.FEDERATED_SERVICE_SOLR_INDEXING_AUTHENTICATED_ALLOW_SELF_SIGNED,SwitchboardConstants.FEDERATED_SERVICE_SOLR_INDEXING_AUTHENTICATED_ALLOW_SELF_SIGNED_DEFAULT);- RemoteInstance instance = new RemoteInstance("http://" + seed.getPublicAddress(seed.getIP()) + "/solr/", null, null, 10000, trustSelfSignedOnAuthenticatedServer); // this is a 'patch configuration' which considers 'solr' as default collection+ RemoteInstance instance = new RemoteInstance(targetBaseURL + "/solr/", null, null, 10000, trustSelfSignedOnAuthenticatedServer); // this is a 'patch configuration' which considers 'solr' as default collectiontry {SolrConnector solrConnector = new RemoteSolrConnector(instance,sb.getConfigBool(SwitchboardConstants.REMOTE_SOLR_BINARY_RESPONSE_ENABLED,@@ -288,7 +299,7 @@ public class AutoSearch extends AbstractBusyThread {} catch (Throwable eee) {}} else { // do a yacysearch.rss query- final String rssSearchServiceURL = "http://" + seed.getPublicAddress(seed.getIP()) + "/yacysearch.rss";+ final String rssSearchServiceURL = targetBaseURL + "/yacysearch.rss";try {RSSFeed feed = loadSRURSS(rssSearchServiceURL,