|
@@ -99,6 +99,10 @@ final class S3ClientSettings {
|
|
|
static final Setting.AffixSetting<Boolean> USE_PATH_STYLE_ACCESS = Setting.affixKeySetting(PREFIX, "path_style_access",
|
|
|
key -> Setting.boolSetting(key, false, Property.NodeScope));
|
|
|
|
|
|
+ /** Whether chunked encoding should be disabled or not (Default is false). */
|
|
|
+ static final Setting.AffixSetting<Boolean> DISABLE_CHUNKED_ENCODING = Setting.affixKeySetting(PREFIX, "disable_chunked_encoding",
|
|
|
+ key -> Setting.boolSetting(key, false, Property.NodeScope));
|
|
|
+
|
|
|
/** Credentials to authenticate with s3. */
|
|
|
final S3BasicCredentials credentials;
|
|
|
|
|
@@ -134,10 +138,13 @@ final class S3ClientSettings {
|
|
|
/** Whether the s3 client should use path style access. */
|
|
|
final boolean pathStyleAccess;
|
|
|
|
|
|
+ /** Whether chunked encoding should be disabled or not. */
|
|
|
+ final boolean disableChunkedEncoding;
|
|
|
+
|
|
|
private S3ClientSettings(S3BasicCredentials credentials, String endpoint, Protocol protocol,
|
|
|
String proxyHost, int proxyPort, String proxyUsername, String proxyPassword,
|
|
|
int readTimeoutMillis, int maxRetries, boolean throttleRetries,
|
|
|
- boolean pathStyleAccess) {
|
|
|
+ boolean pathStyleAccess, boolean disableChunkedEncoding) {
|
|
|
this.credentials = credentials;
|
|
|
this.endpoint = endpoint;
|
|
|
this.protocol = protocol;
|
|
@@ -149,6 +156,7 @@ final class S3ClientSettings {
|
|
|
this.maxRetries = maxRetries;
|
|
|
this.throttleRetries = throttleRetries;
|
|
|
this.pathStyleAccess = pathStyleAccess;
|
|
|
+ this.disableChunkedEncoding = disableChunkedEncoding;
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -172,6 +180,8 @@ final class S3ClientSettings {
|
|
|
final int newMaxRetries = getRepoSettingOrDefault(MAX_RETRIES_SETTING, normalizedSettings, maxRetries);
|
|
|
final boolean newThrottleRetries = getRepoSettingOrDefault(USE_THROTTLE_RETRIES_SETTING, normalizedSettings, throttleRetries);
|
|
|
final boolean usePathStyleAccess = getRepoSettingOrDefault(USE_PATH_STYLE_ACCESS, normalizedSettings, pathStyleAccess);
|
|
|
+ final boolean newDisableChunkedEncoding = getRepoSettingOrDefault(
|
|
|
+ DISABLE_CHUNKED_ENCODING, normalizedSettings, disableChunkedEncoding);
|
|
|
final S3BasicCredentials newCredentials;
|
|
|
if (checkDeprecatedCredentials(repoSettings)) {
|
|
|
newCredentials = loadDeprecatedCredentials(repoSettings);
|
|
@@ -180,7 +190,8 @@ final class S3ClientSettings {
|
|
|
}
|
|
|
if (Objects.equals(endpoint, newEndpoint) && protocol == newProtocol && Objects.equals(proxyHost, newProxyHost)
|
|
|
&& proxyPort == newProxyPort && newReadTimeoutMillis == readTimeoutMillis && maxRetries == newMaxRetries
|
|
|
- && newThrottleRetries == throttleRetries && Objects.equals(credentials, newCredentials)) {
|
|
|
+ && newThrottleRetries == throttleRetries && Objects.equals(credentials, newCredentials)
|
|
|
+ && newDisableChunkedEncoding == disableChunkedEncoding) {
|
|
|
return this;
|
|
|
}
|
|
|
return new S3ClientSettings(
|
|
@@ -194,7 +205,8 @@ final class S3ClientSettings {
|
|
|
newReadTimeoutMillis,
|
|
|
newMaxRetries,
|
|
|
newThrottleRetries,
|
|
|
- usePathStyleAccess
|
|
|
+ usePathStyleAccess,
|
|
|
+ newDisableChunkedEncoding
|
|
|
);
|
|
|
}
|
|
|
|
|
@@ -282,7 +294,8 @@ final class S3ClientSettings {
|
|
|
Math.toIntExact(getConfigValue(settings, clientName, READ_TIMEOUT_SETTING).millis()),
|
|
|
getConfigValue(settings, clientName, MAX_RETRIES_SETTING),
|
|
|
getConfigValue(settings, clientName, USE_THROTTLE_RETRIES_SETTING),
|
|
|
- getConfigValue(settings, clientName, USE_PATH_STYLE_ACCESS)
|
|
|
+ getConfigValue(settings, clientName, USE_PATH_STYLE_ACCESS),
|
|
|
+ getConfigValue(settings, clientName, DISABLE_CHUNKED_ENCODING)
|
|
|
);
|
|
|
}
|
|
|
}
|
|
@@ -305,13 +318,14 @@ final class S3ClientSettings {
|
|
|
protocol == that.protocol &&
|
|
|
Objects.equals(proxyHost, that.proxyHost) &&
|
|
|
Objects.equals(proxyUsername, that.proxyUsername) &&
|
|
|
- Objects.equals(proxyPassword, that.proxyPassword);
|
|
|
+ Objects.equals(proxyPassword, that.proxyPassword) &&
|
|
|
+ Objects.equals(disableChunkedEncoding, that.disableChunkedEncoding);
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public int hashCode() {
|
|
|
return Objects.hash(credentials, endpoint, protocol, proxyHost, proxyPort, proxyUsername, proxyPassword,
|
|
|
- readTimeoutMillis, maxRetries, throttleRetries);
|
|
|
+ readTimeoutMillis, maxRetries, throttleRetries, disableChunkedEncoding);
|
|
|
}
|
|
|
|
|
|
private static <T> T getConfigValue(Settings settings, String clientName,
|