Skip to content

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

reject bad solr requests

Michael Peter Christenc91c67c3cdec
diff --git a/htroot/solr/select.java b/htroot/solr/select.java
index 8ec27c6d4..00f872490 100644
--- a/htroot/solr/select.java
+++ b/htroot/solr/select.java
@@ -144,6 +144,10 @@ public class select {
// check post
if (post == null) return null;
+ if (post.size() > 100) {
+ Log.logWarning("select", "rejected bad-formed search request with " + post.size() + " properties from " + header.refererHost());
+ return null; // prevent the worst hacks here...
+ }
sb.intermissionAllThreads(3000); // tell all threads to do nothing for a specific time
// get the ranking profile id
diff --git a/source/net/yacy/server/serverObjects.java b/source/net/yacy/server/serverObjects.java
index 81ec43501..cb42c355f 100644
--- a/source/net/yacy/server/serverObjects.java
+++ b/source/net/yacy/server/serverObjects.java
@@ -112,6 +112,10 @@ public class serverObjects implements Serializable, Cloneable {
this.put(ACTION_AUTHENTICATE, ADMIN_AUTHENTICATE_MSG);
}
+ public int size() {
+ return this.map.toNamedList().size() / 2;
+ }
+
public void clear() {
this.map.getMap().clear();
}