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,18 @@ public final class S3Configuration implements ServiceConfiguration, ToCopyableBu
7071 */
7172 private static final boolean DEFAULT_CHUNKED_ENCODING_ENABLED = true ;
7273
74+ /**
75+ * By default, the SDK sends the {@code Expect: 100-continue} header for {@link PutObjectRequest}
76+ * and {@link UploadPartRequest}.
77+ */
78+ private static final boolean DEFAULT_EXPECT_CONTINUE_ENABLED = true ;
79+
7380 private final FieldWithDefault <Boolean > pathStyleAccessEnabled ;
7481 private final FieldWithDefault <Boolean > accelerateModeEnabled ;
7582 private final FieldWithDefault <Boolean > dualstackEnabled ;
7683 private final FieldWithDefault <Boolean > checksumValidationEnabled ;
7784 private final FieldWithDefault <Boolean > chunkedEncodingEnabled ;
85+ private final FieldWithDefault <Boolean > expectContinueEnabled ;
7886 private final Boolean useArnRegionEnabled ;
7987 private final Boolean multiRegionEnabled ;
8088 private final FieldWithDefault <Supplier <ProfileFile >> profileFile ;
@@ -87,6 +95,8 @@ private S3Configuration(DefaultS3ServiceConfigurationBuilder builder) {
8795 this .checksumValidationEnabled = FieldWithDefault .create (builder .checksumValidationEnabled ,
8896 DEFAULT_CHECKSUM_VALIDATION_ENABLED );
8997 this .chunkedEncodingEnabled = FieldWithDefault .create (builder .chunkedEncodingEnabled , DEFAULT_CHUNKED_ENCODING_ENABLED );
98+ this .expectContinueEnabled = FieldWithDefault .create (builder .expectContinueEnabled ,
99+ DEFAULT_EXPECT_CONTINUE_ENABLED );
90100 this .profileFile = FieldWithDefault .create (builder .profileFile , ProfileFile ::defaultProfileFile );
91101 this .profileName = FieldWithDefault .create (builder .profileName ,
92102 ProfileFileSystemSetting .AWS_PROFILE .getStringValueOrThrow ());
@@ -216,6 +226,26 @@ public boolean chunkedEncodingEnabled() {
216226 return chunkedEncodingEnabled .value ();
217227 }
218228
229+ /**
230+ * Returns whether the S3 SDK client's explicit setting of the {@code Expect: 100-continue} header is enabled for
231+ * {@link PutObjectRequest} and {@link UploadPartRequest}. This controls whether the SDK adds the header during
232+ * request interceptor processing.
233+ * <p>
234+ * By default, the SDK sends the {@code Expect: 100-continue} header for these operations, allowing the server to
235+ * reject the request before the client sends the full payload. Setting this to {@code false} disables this behavior.
236+ * <p>
237+ * <b>Note:</b> When using the Apache HTTP client, the Apache client also independently adds the
238+ * {@code Expect: 100-continue} header by default via its own {@code expectContinueEnabled} setting. To fully
239+ * suppress the header on the wire, you must also disable it on the Apache HTTP client builder using
240+ * {@code ApacheHttpClient.builder().expectContinueEnabled(false)}.
241+ *
242+ * @return True if the Expect: 100-continue header is enabled.
243+ * @see S3Configuration.Builder#expectContinueEnabled(Boolean)
244+ */
245+ public boolean expectContinueEnabled () {
246+ return expectContinueEnabled .value ();
247+ }
248+
219249 /**
220250 * Returns whether the client is allowed to make cross-region calls when an S3 Access Point ARN has a different
221251 * region to the one configured on the client.
@@ -246,6 +276,7 @@ public Builder toBuilder() {
246276 .pathStyleAccessEnabled (pathStyleAccessEnabled .valueOrNullIfDefault ())
247277 .checksumValidationEnabled (checksumValidationEnabled .valueOrNullIfDefault ())
248278 .chunkedEncodingEnabled (chunkedEncodingEnabled .valueOrNullIfDefault ())
279+ .expectContinueEnabled (expectContinueEnabled .valueOrNullIfDefault ())
249280 .useArnRegionEnabled (useArnRegionEnabled )
250281 .profileFile (profileFile .valueOrNullIfDefault ())
251282 .profileName (profileName .valueOrNullIfDefault ());
@@ -355,6 +386,26 @@ public interface Builder extends CopyableBuilder<Builder, S3Configuration> {
355386 */
356387 Builder chunkedEncodingEnabled (Boolean chunkedEncodingEnabled );
357388
389+ Boolean expectContinueEnabled ();
390+
391+ /**
392+ * Option to enable or disable the S3 SDK client's explicit setting of the {@code Expect: 100-continue} header
393+ * for {@link PutObjectRequest} and {@link UploadPartRequest}.
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 false} 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+ * Enabled by default (i.e., the header is sent).
404+ *
405+ * @see S3Configuration#expectContinueEnabled()
406+ */
407+ Builder expectContinueEnabled (Boolean expectContinueEnabled );
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 expectContinueEnabled ;
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 expectContinueEnabled () {
556+ return expectContinueEnabled ;
505557 }
506558
507559 public void setChunkedEncodingEnabled (Boolean chunkedEncodingEnabled ) {
508560 chunkedEncodingEnabled (chunkedEncodingEnabled );
509561 }
510562
563+ @ Override
564+ public Builder expectContinueEnabled (Boolean expectContinueEnabled ) {
565+ this .expectContinueEnabled = expectContinueEnabled ;
566+ return this ;
567+ }
568+
569+ public void setExpectContinueEnabled (Boolean expectContinueEnabled ) {
570+ expectContinueEnabled (expectContinueEnabled );
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