extended the maximum header size to 16k to prevent http error 431

pull/588/head
Michael Peter Christen 1 year ago
parent 0554056c63
commit 195bd2e444

@ -69,14 +69,17 @@ public class YaCyHttpServer {
/** /**
* @param port TCP Port to listen for http requests * @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(); final Switchboard sb = Switchboard.getSwitchboard();
this.server = new Server(); this.server = new Server();
final int cores = ProcessorUtils.availableProcessors(); 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 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); final ServerConnector connector = new ServerConnector(this.server, null, null, null, acceptors, -1, hcf);
connector.setPort(port); connector.setPort(port);
connector.setHost(host); connector.setHost(host);
@ -84,6 +87,7 @@ public class YaCyHttpServer {
connector.setIdleTimeout(9000); // timout in ms when no bytes send / received connector.setIdleTimeout(9000); // timout in ms when no bytes send / received
connector.setAcceptQueueSize(128); connector.setAcceptQueueSize(128);
this.server.addConnector(connector); this.server.addConnector(connector);
@ -325,8 +329,6 @@ public class YaCyHttpServer {
public void run() { public void run() {
if (milsec > 0) try { if (milsec > 0) try {
Thread.sleep(milsec); Thread.sleep(milsec);
} catch (final InterruptedException e) {
ConcurrentLog.logException(e);
} catch (final Exception e) { } catch (final Exception e) {
ConcurrentLog.logException(e); ConcurrentLog.logException(e);
} }

Loading…
Cancel
Save