Distributed Peer-to-Peer Web Search Engine and Intranet Search Appliance
Java decentralizedintranet-searchintranet-search-enginep2pp2p-networkprivacyprivacy-protectionsearch-enginesearchenginewebweb-search-enginewebsearchwebseearch-engine
removed non-working realm setting in http client (auth for localhost was added in previous commit)
Michael Peter Christen2939b479864d
diff --git a/htroot/CrawlStartScanner_p.java b/htroot/CrawlStartScanner_p.javaindex 400824c19..b02027ff0 100644--- a/htroot/CrawlStartScanner_p.java+++ b/htroot/CrawlStartScanner_p.java@@ -215,7 +215,6 @@ public class CrawlStartScanner_pWorkTables.execAPICall(Domains.LOCALHOST,(int) sb.getConfigLong("port", 8090),- sb.getConfig(SwitchboardConstants.ADMIN_ACCOUNT_B64MD5, ""),path,pk);}@@ -261,7 +260,6 @@ public class CrawlStartScanner_pWorkTables.execAPICall(Domains.LOCALHOST,(int) sb.getConfigLong("port", 8090),- sb.getConfig(SwitchboardConstants.ADMIN_ACCOUNT_B64MD5, ""),path,u.hash());}diff --git a/htroot/Table_API_p.java b/htroot/Table_API_p.javaindex 7eb114925..d755503cd 100644--- a/htroot/Table_API_p.java+++ b/htroot/Table_API_p.java@@ -206,7 +206,7 @@ public class Table_API_p {}// now call the api URLs and store the result status- final Map<String, Integer> l = sb.tables.execAPICalls(Domains.LOCALHOST, (int) sb.getConfigLong("port", 8090), sb.getConfig(SwitchboardConstants.ADMIN_ACCOUNT_B64MD5, ""), pks);+ final Map<String, Integer> l = sb.tables.execAPICalls(Domains.LOCALHOST, (int) sb.getConfigLong("port", 8090), pks);// construct result tableprop.put("showexec", l.isEmpty() ? 0 : 1);diff --git a/source/net/yacy/cora/protocol/http/HTTPClient.java b/source/net/yacy/cora/protocol/http/HTTPClient.javaindex 0181f93d6..f3c8eb218 100644--- a/source/net/yacy/cora/protocol/http/HTTPClient.java+++ b/source/net/yacy/cora/protocol/http/HTTPClient.java@@ -49,7 +49,6 @@ import net.yacy.cora.protocol.ClientIdentification;import net.yacy.cora.protocol.ConnectionInfo;import net.yacy.cora.protocol.Domains;import net.yacy.cora.protocol.HeaderFramework;-import net.yacy.cora.protocol.RequestHeader;import net.yacy.search.Switchboard;import net.yacy.search.SwitchboardConstants;@@ -112,7 +111,6 @@ public class HTTPClient {private HttpUriRequest currentRequest = null;private long upbytes = 0L;private String host = null;- private String realm = null;public HTTPClient(final ClientIdentification.Agent agent) {@@ -304,15 +302,6 @@ public class HTTPClient {reqConfBuilder.setRelativeRedirectsAllowed(redirecting);}- /**- * This method sets the authorization realm for the request- *- * @param realm- */- public void setRealm(final String realm) {- this.realm = realm;- }-/*** This method GETs a page from the server.*@@ -708,10 +697,7 @@ public class HTTPClient {httpUriRequest.setHeader(entry.getKey(),entry.getValue());}}- if (this.host != null)- httpUriRequest.setHeader(HTTP.TARGET_HOST, this.host);- if (this.realm != null)- httpUriRequest.setHeader(RequestHeader.AUTHORIZATION, "Basic " + this.realm);+ if (this.host != null) httpUriRequest.setHeader(HTTP.TARGET_HOST, this.host);httpUriRequest.setHeader("Connection", "close"); // don't keep alive, prevent CLOSE_WAIT state}diff --git a/source/net/yacy/data/WorkTables.java b/source/net/yacy/data/WorkTables.javaindex 0c3692393..b495bc16e 100644--- a/source/net/yacy/data/WorkTables.java+++ b/source/net/yacy/data/WorkTables.java@@ -218,10 +218,9 @@ public class WorkTables extends Tables {* @param realm authentification realm* @return a map of the called urls and the http status code of the api call or -1 if any other IOException occurred*/- public Map<String, Integer> execAPICalls(String host, int port, String realm, Collection<String> pks) {+ public Map<String, Integer> execAPICalls(String host, int port, Collection<String> pks) {// now call the api URLs and store the result statusfinal HTTPClient client = new HTTPClient(ClientIdentification.yacyInternetCrawlerAgent);- client.setRealm(realm);client.setTimout(120000);Tables.Row row;String url;@@ -250,10 +249,9 @@ public class WorkTables extends Tables {return l;}- public static int execAPICall(String host, int port, String realm, String path, byte[] pk) {+ public static int execAPICall(String host, int port, String path, byte[] pk) {// now call the api URLs and store the result statusfinal HTTPClient client = new HTTPClient(ClientIdentification.yacyInternetCrawlerAgent);- client.setRealm(realm);client.setTimout(120000);String url = "http://" + host + ":" + port + path;if (pk != null) url += "&" + WorkTables.TABLE_API_COL_APICALL_PK + "=" + UTF8.String(pk);@@ -274,10 +272,10 @@ public class WorkTables extends Tables {* @param realm authentification realm* @return the http status code of the api call or -1 if any other IOException occurred*/- public int execAPICall(String pk, String host, int port, String realm) {+ public int execAPICall(String pk, String host, int port) {ArrayList<String> pks = new ArrayList<String>();pks.add(pk);- Map<String, Integer> m = execAPICalls(host, port, realm, pks);+ Map<String, Integer> m = execAPICalls(host, port, pks);if (m.isEmpty()) return -1;return m.values().iterator().next().intValue();}diff --git a/source/net/yacy/data/ymark/YMarkCrawlStart.java b/source/net/yacy/data/ymark/YMarkCrawlStart.javaindex 1eea74ea9..2c2dc3681 100644--- a/source/net/yacy/data/ymark/YMarkCrawlStart.java+++ b/source/net/yacy/data/ymark/YMarkCrawlStart.java@@ -110,8 +110,8 @@ public class YMarkCrawlStart extends HashMap<String,String>{}}- public int exec(final String host, final int port, final String realm) {- return this.worktables.execAPICall(this.apicall_pk, host, port, realm);+ public int exec(final String host, final int port) {+ return this.worktables.execAPICall(this.apicall_pk, host, port);}private void load() {diff --git a/source/net/yacy/search/Switchboard.java b/source/net/yacy/search/Switchboard.javaindex a055dbf81..6d32f401f 100644--- a/source/net/yacy/search/Switchboard.java+++ b/source/net/yacy/search/Switchboard.java@@ -2457,7 +2457,7 @@ public final class Switchboard extends serverSwitch {startupAction = false;// execute api calls- final Map<String, Integer> callResult = this.tables.execAPICalls("localhost", (int) getConfigLong("port", 8090), getConfig(SwitchboardConstants.ADMIN_ACCOUNT_B64MD5, ""), pks);+ final Map<String, Integer> callResult = this.tables.execAPICalls("localhost", (int) getConfigLong("port", 8090), pks);for ( final Map.Entry<String, Integer> call : callResult.entrySet() ) {this.log.info("Scheduler executed api call, response " + call.getValue() + ": " + call.getKey());}