From 83cdf056c1a0247a6715f641a64155279bac3318 Mon Sep 17 00:00:00 2001 From: borg-0300 Date: Fri, 1 Dec 2006 20:59:24 +0000 Subject: [PATCH] check for valid static IP git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@3038 6c8d7289-2bf4-0310-a012-ef5d649a1542 --- htroot/SettingsAck_p.java | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/htroot/SettingsAck_p.java b/htroot/SettingsAck_p.java index 8195eedeb..8af76049d 100644 --- a/htroot/SettingsAck_p.java +++ b/htroot/SettingsAck_p.java @@ -291,17 +291,27 @@ public class SettingsAck_p { // server access if (post.containsKey("serveraccount")) { - + // static IP - String staticIP = (String)post.get("staticIP"); - if(staticIP.equals("")){ - serverCore.useStaticIP=false; - }else{ - serverCore.useStaticIP=true; + String staticIP = ((String) post.get("staticIP")).trim(); + if (staticIP.length() == 0) { + serverCore.useStaticIP = false; + } else { + if (staticIP.startsWith("http://")) { + if (staticIP.length() > 7) { staticIP = staticIP.substring(7); } else { staticIP = ""; } + } else if (staticIP.startsWith("https://")) { + if (staticIP.length() > 8) { staticIP = staticIP.substring(8); } else { staticIP = ""; } + } + if (staticIP.indexOf(":") > 0) { + staticIP = staticIP.substring(0, staticIP.indexOf(":")); + } else { + staticIP = ""; + } + serverCore.useStaticIP = true; } + yacyCore.seedDB.mySeed.put(yacySeed.IP, staticIP); env.setConfig("staticIP", staticIP); - if (staticIP.length() > 0) yacyCore.seedDB.mySeed.put(yacySeed.IP, staticIP); - + // server access data String filter = ((String) post.get("serverfilter")).trim(); /*String user = (String) post.get("serveruser");