From a348146d8f1e9cc3d1cb3c69efa1f2cb6d3011c3 Mon Sep 17 00:00:00 2001 From: Michael Christen Date: Thu, 29 Jun 2023 10:46:05 +0200 Subject: [PATCH] setting connect host to 0.0.0.0 --- source/net/yacy/http/YaCyHttpServer.java | 5 +++-- source/net/yacy/yacy.java | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/source/net/yacy/http/YaCyHttpServer.java b/source/net/yacy/http/YaCyHttpServer.java index cf155cd37..9f59cc18d 100644 --- a/source/net/yacy/http/YaCyHttpServer.java +++ b/source/net/yacy/http/YaCyHttpServer.java @@ -69,7 +69,7 @@ public class YaCyHttpServer { /** * @param port TCP Port to listen for http requests */ - public YaCyHttpServer(final int port) { + public YaCyHttpServer(final int port, String host) { final Switchboard sb = Switchboard.getSwitchboard(); this.server = new Server(); @@ -79,7 +79,8 @@ public class YaCyHttpServer { final HttpConnectionFactory hcf = new HttpConnectionFactory(); final ServerConnector connector = new ServerConnector(this.server, null, null, null, acceptors, -1, hcf); connector.setPort(port); - connector.setName("httpd:"+Integer.toString(port)); + connector.setHost(host); + connector.setName("httpd-" + host + ":" + Integer.toString(port)); connector.setIdleTimeout(9000); // timout in ms when no bytes send / received connector.setAcceptQueueSize(128); diff --git a/source/net/yacy/yacy.java b/source/net/yacy/yacy.java index d43179c0f..c3420a109 100644 --- a/source/net/yacy/yacy.java +++ b/source/net/yacy/yacy.java @@ -298,7 +298,7 @@ public final class yacy { try { // start http server YaCyHttpServer httpServer; - httpServer = new YaCyHttpServer(port); + httpServer = new YaCyHttpServer(port, "0.0.0.0"); httpServer.startupServer(); sb.setHttpServer(httpServer); // TODO: this has no effect on Jetty (but needed to reflect configured value and limit is still used)