From 195bd2e444748d818c340cb02a88514c3a5a36e0 Mon Sep 17 00:00:00 2001 From: Michael Peter Christen Date: Sat, 19 Aug 2023 15:21:24 +0200 Subject: [PATCH] extended the maximum header size to 16k to prevent http error 431 --- source/net/yacy/http/YaCyHttpServer.java | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/source/net/yacy/http/YaCyHttpServer.java b/source/net/yacy/http/YaCyHttpServer.java index 9f59cc18d..0f6beddee 100644 --- a/source/net/yacy/http/YaCyHttpServer.java +++ b/source/net/yacy/http/YaCyHttpServer.java @@ -69,14 +69,17 @@ public class YaCyHttpServer { /** * @param port TCP Port to listen for http requests */ - public YaCyHttpServer(final int port, String host) { + public YaCyHttpServer(final int port, final String host) { final Switchboard sb = Switchboard.getSwitchboard(); this.server = new Server(); final int cores = ProcessorUtils.availableProcessors(); final int acceptors = Math.max(1, Math.min(4, cores/2)); // original: Math.max(1, Math.min(4,cores/8)); - final HttpConnectionFactory hcf = new HttpConnectionFactory(); + + final HttpConfiguration httpConfig = new HttpConfiguration(); + httpConfig.setRequestHeaderSize(16384); + final HttpConnectionFactory hcf = new HttpConnectionFactory(httpConfig); final ServerConnector connector = new ServerConnector(this.server, null, null, null, acceptors, -1, hcf); connector.setPort(port); connector.setHost(host); @@ -84,6 +87,7 @@ public class YaCyHttpServer { connector.setIdleTimeout(9000); // timout in ms when no bytes send / received connector.setAcceptQueueSize(128); + this.server.addConnector(connector); @@ -325,8 +329,6 @@ public class YaCyHttpServer { public void run() { if (milsec > 0) try { Thread.sleep(milsec); - } catch (final InterruptedException e) { - ConcurrentLog.logException(e); } catch (final Exception e) { ConcurrentLog.logException(e); }