Skip to content

Commit 698b15c

Browse files
authored
Merge pull request quarkusio#47860 from geoand/quarkusio#47483
Deal with max headers size in Amazon Lambda
2 parents 2ecaedd + 1fedf26 commit 698b15c

File tree

2 files changed

+20
-1
lines changed

2 files changed

+20
-1
lines changed

extensions/amazon-lambda/event-server/src/main/java/io/quarkus/amazon/lambda/runtime/MockEventServer.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import java.io.IOException;
55
import java.util.HashSet;
66
import java.util.Locale;
7+
import java.util.Optional;
78
import java.util.Set;
89
import java.util.UUID;
910
import java.util.concurrent.BlockingQueue;
@@ -16,9 +17,11 @@
1617
import java.util.concurrent.TimeUnit;
1718
import java.util.concurrent.atomic.AtomicBoolean;
1819

20+
import org.eclipse.microprofile.config.ConfigProvider;
1921
import org.jboss.logging.Logger;
2022

2123
import io.netty.handler.codec.http.HttpHeaderNames;
24+
import io.quarkus.runtime.configuration.MemorySize;
2225
import io.vertx.core.Vertx;
2326
import io.vertx.core.VertxOptions;
2427
import io.vertx.core.buffer.Buffer;
@@ -71,6 +74,11 @@ public void start(int port) {
7174
vertx = Vertx.vertx(new VertxOptions().setMaxWorkerExecuteTime(60).setMaxWorkerExecuteTimeUnit(TimeUnit.MINUTES));
7275
HttpServerOptions options = new HttpServerOptions();
7376
options.setPort(port == 0 ? -1 : port);
77+
Optional<MemorySize> maybeMaxHeadersSize = ConfigProvider.getConfig()
78+
.getOptionalValue("quarkus.http.limits.max-header-size", MemorySize.class);
79+
if (maybeMaxHeadersSize.isPresent()) {
80+
options.setMaxHeaderSize(maybeMaxHeadersSize.get().asBigInteger().intValueExact());
81+
}
7482
httpServer = vertx.createHttpServer(options);
7583
router = Router.router(vertx);
7684
setupRoutes();

extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/VertxHttpRecorder.java

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
import jakarta.enterprise.inject.spi.CDI;
3939

4040
import org.crac.Resource;
41+
import org.eclipse.microprofile.config.ConfigProvider;
4142
import org.jboss.logging.Logger;
4243

4344
import io.netty.bootstrap.ServerBootstrap;
@@ -1535,7 +1536,7 @@ public void initChannel(VirtualChannel ch) throws Exception {
15351536
return duplicated;
15361537
},
15371538
null,
1538-
new HttpServerOptions(),
1539+
createVirtualHttpServerOptions(),
15391540
chctx,
15401541
rootContext,
15411542
"localhost",
@@ -1546,6 +1547,16 @@ public void initChannel(VirtualChannel ch) throws Exception {
15461547

15471548
ch.pipeline().addLast("handler", handler);
15481549
}
1550+
1551+
private static HttpServerOptions createVirtualHttpServerOptions() {
1552+
var result = new HttpServerOptions();
1553+
Optional<MemorySize> maybeMaxHeadersSize = ConfigProvider.getConfig()
1554+
.getOptionalValue("quarkus.http.limits.max-header-size", MemorySize.class);
1555+
if (maybeMaxHeadersSize.isPresent()) {
1556+
result.setMaxHeaderSize(maybeMaxHeadersSize.get().asBigInteger().intValueExact());
1557+
}
1558+
return result;
1559+
}
15491560
});
15501561

15511562
// Start the server.

0 commit comments

Comments
 (0)