mirror of
https://github.com/yacy/yacy_search_server.git
synced 2024-09-19 00:01:41 +02:00
catch ip-format exception on wrong server access setting ip filter
as reported in http://mantis.tokeek.de/view.php?id=713 to prevent abort of initialization. This jetty/whitelist ipaccesshandler accepts currently only ipv4
This commit is contained in:
parent
b32bcdf344
commit
3151cda3a5
|
@ -205,12 +205,16 @@ public class Jetty9HttpServerImpl implements YaCyHttpServer {
|
|||
int i=0;
|
||||
while (st.hasMoreTokens()) {
|
||||
String ip = st.nextToken();
|
||||
iphandler.addWhite(ip);
|
||||
try {
|
||||
iphandler.addWhite(ip); // accepts only ipv4
|
||||
} catch (IllegalArgumentException nex) { // catch number format exception on non ipv4 input
|
||||
ConcurrentLog.severe("SERVER", "Server Access Settings - IP filter: " + nex.getMessage());
|
||||
continue;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
if (i > 0) {
|
||||
iphandler.addWhite("127.0.0.1"); // allow localhost (loopback addr)
|
||||
iphandler.setServer(server);
|
||||
iphandler.setHandler(crashHandler);
|
||||
server.setHandler(iphandler);
|
||||
ConcurrentLog.info("SERVER","activated IP access restriction to: [127.0.0.1," + white +"] (this works only correct with start parameter -Djava.net.preferIPv4Stack=true)");
|
||||
|
|
Loading…
Reference in New Issue
Block a user