Skip to content

Commit 1ca9e2c

Browse files
committed
Working
1 parent 3f3c003 commit 1ca9e2c

File tree

1 file changed

+15
-12
lines changed

1 file changed

+15
-12
lines changed

src/main/java/io/fusionauth/http/server/HTTPServerConfiguration.java

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -226,16 +226,7 @@ public int getMaxRequestBodySize() {
226226
* @return the maximum size of the HTTP request header in bytes. This configuration does not affect the HTTP response header. Defaults to
227227
* 128 Kilobytes.
228228
*/
229-
// TODO : Naming : Preamble
230229
public int getMaxRequestHeaderSize() {
231-
// TODO : Notes:
232-
// https://docs.aws.amazon.com/elasticloadbalancing/latest/application/load-balancer-limits.html
233-
// AWS Request header max is 64k, and is fixed.
234-
// AWS Response header max is 32k, and is fixed.
235-
// AWS single header max size is 16k, and is fixed.
236-
// https://docs.fastly.com/products/network-services-resource-limits
237-
// Fastly Request header max is 128k.
238-
// Fastly Response header max is 128k.
239230
return maxRequestHeaderSize;
240231
}
241232

@@ -361,6 +352,7 @@ public boolean isCompressByDefault() {
361352
*/
362353
@Override
363354
public HTTPServerConfiguration withBaseDir(Path baseDir) {
355+
Objects.requireNonNull(baseDir, "You cannot set the base dir to null");
364356
this.baseDir = baseDir;
365357
return this;
366358
}
@@ -426,7 +418,6 @@ public HTTPServerConfiguration withInitialReadTimeout(Duration duration) {
426418
throw new IllegalArgumentException("The client timeout duration must be greater than 0");
427419
}
428420

429-
430421
this.initialReadTimeoutDuration = duration;
431422
return this;
432423
}
@@ -505,6 +496,10 @@ public HTTPServerConfiguration withMaxPendingSocketConnections(int maxPendingSoc
505496
*/
506497
@Override
507498
public HTTPServerConfiguration withMaxRequestBodySize(int maxRequestBodySize) {
499+
if (maxRequestBodySize != -1 && maxRequestBodySize <= 0) {
500+
throw new IllegalArgumentException("The maximum request body size must be greater than 0. Set to -1 to disable this limitation.");
501+
}
502+
508503
this.maxRequestBodySize = maxRequestBodySize;
509504
return this;
510505
}
@@ -514,6 +509,10 @@ public HTTPServerConfiguration withMaxRequestBodySize(int maxRequestBodySize) {
514509
*/
515510
@Override
516511
public HTTPServerConfiguration withMaxRequestHeaderSize(int maxRequestHeaderSize) {
512+
if (maxRequestHeaderSize != -1 && maxRequestHeaderSize <= 0) {
513+
throw new IllegalArgumentException("The maximum request header size must be greater than 0. Set to -1 to disable this limitation.");
514+
}
515+
517516
this.maxRequestHeaderSize = maxRequestHeaderSize;
518517
return this;
519518
}
@@ -535,8 +534,12 @@ public HTTPServerConfiguration withMaxRequestsPerConnection(int maxRequestsPerCo
535534
* {@inheritDoc}
536535
*/
537536
@Override
538-
public HTTPServerConfiguration withMaxResponseChunkSize(int size) {
539-
this.maxResponseChunkSize = size;
537+
public HTTPServerConfiguration withMaxResponseChunkSize(int maxResponseChunkSize) {
538+
if (maxResponseChunkSize < 128) {
539+
throw new IllegalArgumentException("The maximum chunk size must be greater than or equal to 128.");
540+
}
541+
542+
this.maxResponseChunkSize = maxResponseChunkSize;
540543
return this;
541544
}
542545

0 commit comments

Comments
 (0)