3535import software .amazon .awssdk .services .s3 .model .GetObjectRequest ;
3636import software .amazon .awssdk .services .s3 .model .PutBucketAccelerateConfigurationRequest ;
3737import software .amazon .awssdk .services .s3 .model .PutObjectRequest ;
38+ import software .amazon .awssdk .services .s3 .model .UploadPartRequest ;
3839import software .amazon .awssdk .services .s3 .presigner .S3Presigner ;
3940import software .amazon .awssdk .utils .builder .CopyableBuilder ;
4041import software .amazon .awssdk .utils .builder .ToCopyableBuilder ;
@@ -70,11 +71,17 @@ public final class S3Configuration implements ServiceConfiguration, ToCopyableBu
7071 */
7172 private static final boolean DEFAULT_CHUNKED_ENCODING_ENABLED = true ;
7273
74+ /**
75+ * By default, Expect: 100-continue is sent for {@link PutObjectRequest} and {@link UploadPartRequest}.
76+ */
77+ private static final boolean DEFAULT_DISABLE_EXPECT_100_CONTINUE_FOR_PUTS = false ;
78+
7379 private final FieldWithDefault <Boolean > pathStyleAccessEnabled ;
7480 private final FieldWithDefault <Boolean > accelerateModeEnabled ;
7581 private final FieldWithDefault <Boolean > dualstackEnabled ;
7682 private final FieldWithDefault <Boolean > checksumValidationEnabled ;
7783 private final FieldWithDefault <Boolean > chunkedEncodingEnabled ;
84+ private final FieldWithDefault <Boolean > disableExpect100ContinueForPuts ;
7885 private final Boolean useArnRegionEnabled ;
7986 private final Boolean multiRegionEnabled ;
8087 private final FieldWithDefault <Supplier <ProfileFile >> profileFile ;
@@ -87,6 +94,8 @@ private S3Configuration(DefaultS3ServiceConfigurationBuilder builder) {
8794 this .checksumValidationEnabled = FieldWithDefault .create (builder .checksumValidationEnabled ,
8895 DEFAULT_CHECKSUM_VALIDATION_ENABLED );
8996 this .chunkedEncodingEnabled = FieldWithDefault .create (builder .chunkedEncodingEnabled , DEFAULT_CHUNKED_ENCODING_ENABLED );
97+ this .disableExpect100ContinueForPuts =
98+ FieldWithDefault .create (builder .disableExpect100ContinueForPuts , DEFAULT_DISABLE_EXPECT_100_CONTINUE_FOR_PUTS );
9099 this .profileFile = FieldWithDefault .create (builder .profileFile , ProfileFile ::defaultProfileFile );
91100 this .profileName = FieldWithDefault .create (builder .profileName ,
92101 ProfileFileSystemSetting .AWS_PROFILE .getStringValueOrThrow ());
@@ -216,6 +225,26 @@ public boolean chunkedEncodingEnabled() {
216225 return chunkedEncodingEnabled .value ();
217226 }
218227
228+ /**
229+ * Returns whether the S3 SDK client's explicit setting of the {@code Expect: 100-continue} header is disabled for
230+ * {@link PutObjectRequest} and {@link UploadPartRequest}. This controls whether the SDK adds the header during
231+ * request interceptor processing.
232+ * <p>
233+ * By default, the SDK sends the {@code Expect: 100-continue} header for these operations, allowing the server to
234+ * reject the request before the client sends the full payload. Setting this to {@code true} disables this behavior.
235+ * <p>
236+ * <b>Note:</b> When using the Apache HTTP client, the Apache client also independently adds the
237+ * {@code Expect: 100-continue} header by default via its own {@code expectContinueEnabled} setting. To fully
238+ * suppress the header on the wire, you must also disable it on the Apache HTTP client builder using
239+ * {@code ApacheHttpClient.builder().expectContinueEnabled(false)}.
240+ *
241+ * @return True if the Expect: 100-continue header is disabled for put operations.
242+ * @see S3Configuration.Builder#disableExpect100ContinueForPuts(Boolean)
243+ */
244+ public boolean disableExpect100ContinueForPuts () {
245+ return disableExpect100ContinueForPuts .value ();
246+ }
247+
219248 /**
220249 * Returns whether the client is allowed to make cross-region calls when an S3 Access Point ARN has a different
221250 * region to the one configured on the client.
@@ -246,6 +275,7 @@ public Builder toBuilder() {
246275 .pathStyleAccessEnabled (pathStyleAccessEnabled .valueOrNullIfDefault ())
247276 .checksumValidationEnabled (checksumValidationEnabled .valueOrNullIfDefault ())
248277 .chunkedEncodingEnabled (chunkedEncodingEnabled .valueOrNullIfDefault ())
278+ .disableExpect100ContinueForPuts (disableExpect100ContinueForPuts .valueOrNullIfDefault ())
249279 .useArnRegionEnabled (useArnRegionEnabled )
250280 .profileFile (profileFile .valueOrNullIfDefault ())
251281 .profileName (profileName .valueOrNullIfDefault ());
@@ -355,6 +385,27 @@ public interface Builder extends CopyableBuilder<Builder, S3Configuration> {
355385 */
356386 Builder chunkedEncodingEnabled (Boolean chunkedEncodingEnabled );
357387
388+ Boolean disableExpect100ContinueForPuts ();
389+
390+ /**
391+ * Option to disable the S3 SDK client's explicit setting of the {@code Expect: 100-continue} header for
392+ * {@link PutObjectRequest} and {@link UploadPartRequest}. This controls whether the SDK adds the header
393+ * during request interceptor processing.
394+ * <p>
395+ * By default, the SDK sends the {@code Expect: 100-continue} header for these operations, allowing the server to
396+ * reject the request before the client sends the full payload. Setting this to {@code true} disables this behavior.
397+ * <p>
398+ * <b>Note:</b> When using the Apache HTTP client, the Apache client also independently adds the
399+ * {@code Expect: 100-continue} header by default via its own {@code expectContinueEnabled} setting. To fully
400+ * suppress the header on the wire, you must also disable it on the Apache HTTP client builder using
401+ * {@code ApacheHttpClient.builder().expectContinueEnabled(false)}.
402+ * <p>
403+ * Disabled by default (i.e., the header is sent).
404+ *
405+ * @see S3Configuration#disableExpect100ContinueForPuts()
406+ */
407+ Builder disableExpect100ContinueForPuts (Boolean disableExpect100ContinueForPuts );
408+
358409 Boolean useArnRegionEnabled ();
359410
360411 /**
@@ -423,6 +474,7 @@ static final class DefaultS3ServiceConfigurationBuilder implements Builder {
423474 private Boolean pathStyleAccessEnabled ;
424475 private Boolean checksumValidationEnabled ;
425476 private Boolean chunkedEncodingEnabled ;
477+ private Boolean disableExpect100ContinueForPuts ;
426478 private Boolean useArnRegionEnabled ;
427479 private Boolean multiRegionEnabled ;
428480 private Supplier <ProfileFile > profileFile ;
@@ -500,14 +552,29 @@ public Builder chunkedEncodingEnabled(Boolean chunkedEncodingEnabled) {
500552 }
501553
502554 @ Override
503- public Boolean useArnRegionEnabled () {
504- return useArnRegionEnabled ;
555+ public Boolean disableExpect100ContinueForPuts () {
556+ return disableExpect100ContinueForPuts ;
505557 }
506558
507559 public void setChunkedEncodingEnabled (Boolean chunkedEncodingEnabled ) {
508560 chunkedEncodingEnabled (chunkedEncodingEnabled );
509561 }
510562
563+ @ Override
564+ public Builder disableExpect100ContinueForPuts (Boolean disableExpect100ContinueForPuts ) {
565+ this .disableExpect100ContinueForPuts = disableExpect100ContinueForPuts ;
566+ return this ;
567+ }
568+
569+ public void setDisableExpect100ContinueForPuts (Boolean disableExpect100ContinueForPuts ) {
570+ disableExpect100ContinueForPuts (disableExpect100ContinueForPuts );
571+ }
572+
573+ @ Override
574+ public Boolean useArnRegionEnabled () {
575+ return useArnRegionEnabled ;
576+ }
577+
511578 @ Override
512579 public Builder useArnRegionEnabled (Boolean useArnRegionEnabled ) {
513580 this .useArnRegionEnabled = useArnRegionEnabled ;
0 commit comments