Skip to content

Distributed Peer-to-Peer Web Search Engine and Intranet Search Appliance

added authentication to automated API call

orbiter599c3766c4cb
diff --git a/htroot/Table_API_p.java b/htroot/Table_API_p.java
index 0b0b07193..6e7b24d4c 100644
--- a/htroot/Table_API_p.java
+++ b/htroot/Table_API_p.java
@@ -74,7 +74,7 @@ public class Table_API_p {
Tables.Row row = sb.tables.select(WorkTables.TABLE_API_NAME, pk.getBytes());
if (row != null) {
String url = "http://localhost:" + sb.getConfig("port", "8080") + new String(row.from(WorkTables.TABLE_API_COL_URL));
- result = client.GET(url);
+ result = client.GET(url, Long.MAX_VALUE, sb.getConfig("adminAccountBase64MD5", ""));
l.put(url, result.getStatusCode());
}
} catch (IOException e) {
diff --git a/source/de/anomic/http/client/Client.java b/source/de/anomic/http/client/Client.java
index 95e6213cd..1f332d575 100644
--- a/source/de/anomic/http/client/Client.java
+++ b/source/de/anomic/http/client/Client.java
@@ -233,7 +233,7 @@ public class Client {
apacheHttpClient.getParams().setIntParameter(HttpMethodParams.HEAD_BODY_CHECK_TIMEOUT, timeout);
apacheHttpClient.setConnectionTimeout(timeout);
}
-
+
/**
* should redirects automatically be followed?
*
@@ -276,6 +276,14 @@ public class Client {
get.getParams().setCookiePolicy(CookiePolicy.IGNORE_COOKIES);
return execute(get);
}
+
+ public ResponseContainer GET(final String uri, long maxfilesize, String realm) throws IOException {
+ final HttpMethod get = new ClientGetMethod(uri, maxfilesize);
+ get.setFollowRedirects(followRedirects);
+ get.getParams().setCookiePolicy(CookiePolicy.IGNORE_COOKIES);
+ get.setRequestHeader("Authorization", "realm=" + realm);
+ return execute(get);
+ }
/**
* This method gets only the header of a page.