Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

3.x: Fix #7783: max-payload-size is parsed as an Integer #7895

Merged
merged 1 commit into from
Oct 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -600,7 +600,7 @@ default B config(Config config) {
config.get("backlog").asInt().ifPresent(this::backlog);
config.get("max-header-size").asInt().ifPresent(this::maxHeaderSize);
config.get("max-initial-line-length").asInt().ifPresent(this::maxInitialLineLength);
config.get("max-payload-size").asInt().ifPresent(this::maxPayloadSize);
config.get("max-payload-size").asLong().ifPresent(this::maxPayloadSize);

DeprecatedConfig.get(config, "timeout-millis", "timeout")
.asInt()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2020, 2022 Oracle and/or its affiliates.
* Copyright (c) 2020, 2023 Oracle and/or its affiliates.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -17,6 +17,7 @@
package io.helidon.webserver;

import java.nio.charset.Charset;
import java.util.Map;
import java.util.concurrent.CompletionException;
import java.util.concurrent.Flow;
import java.util.concurrent.TimeUnit;
Expand All @@ -25,6 +26,8 @@
import io.helidon.common.http.DataChunk;
import io.helidon.common.http.Http;
import io.helidon.common.http.MediaType;
import io.helidon.config.Config;
import io.helidon.config.ConfigSources;
import io.helidon.webclient.WebClient;
import io.helidon.webclient.WebClientRequestBuilder;
import io.helidon.webclient.WebClientResponse;
Expand Down Expand Up @@ -190,6 +193,18 @@ public void testMixedGoodAndBadPayloads() {
assertThat(response.status().code(), is(Http.Status.OK_200.code()));
}

/**
* Verify fix for 7783
*/
@Test
public void testMaxLongMaxPayloadSizeFromConfig() {
final long MAX_PAYLOAD_SIZE = Long.MAX_VALUE;
Config justConfig = Config.just(ConfigSources.create(Map.of("max-payload-size", Long.toString(MAX_PAYLOAD_SIZE))).build());
WebServer webServer = WebServer.builder().config(justConfig).build();
assertThat(webServer.configuration().namedSocket(WebServer.DEFAULT_SOCKET_NAME).get().maxPayloadSize(),
is(Long.MAX_VALUE));
}

/**
* Publishes the same chunk multiple times. If number of times is greater than
* one, Helidon will send content using chunked encoding.
Expand Down
Loading