diff --git a/source/de/anomic/yacy/yacyURL.java b/source/de/anomic/yacy/yacyURL.java index 78b35def4..69c99127e 100644 --- a/source/de/anomic/yacy/yacyURL.java +++ b/source/de/anomic/yacy/yacyURL.java @@ -658,18 +658,23 @@ public class yacyURL implements Serializable { public final boolean isCGI() { final String ls = path.toLowerCase(); + int pos; return ls.indexOf(".cgi") >= 0 || ls.indexOf(".exe") >= 0 || - (ls.indexOf("sid") >= 0 && - (ls.indexOf("?sid") >= 0 || ls.indexOf("&sid") >= 0) && - (ls.indexOf("sid=") >= 0 || ls.indexOf("sid%") >= 0)) || + ((pos = ls.indexOf("sid")) > 0 && + (ls.charAt(--pos) == '?' || ls.charAt(pos) == '&') && + (pos += 4) < ls.length() && + (ls.charAt(pos) == '=' || ls.charAt(pos) == '%') + ) || - (ls.indexOf("sessionid") >= 0 && - (ls.indexOf("sessionid=") >= 0 || ls.indexOf("sessionid%") >= 0 || ls.indexOf("sessionid/") >= 0 )) || + ((pos = ls.indexOf("sessionid")) >= 0 && (pos += 10) < ls.length() && + (ls.charAt(--pos) == '=' || ls.charAt(pos) == '%' || ls.charAt(pos) == '/') + ) || - (ls.indexOf("phpsessid") >= 0 && - (ls.indexOf("phpsessid=") >= 0 || ls.indexOf("phpsessid%") >= 0)); + ((pos = ls.indexOf("phpsessid")) >= 0 && (pos += 10) < ls.length() && + (ls.charAt(--pos) == '=' || ls.charAt(pos) == '%') + ); }