Skip to content

Commit 22c9410

Browse files
authored
Disable Expect 100-Continue by default in Apache 5 HTTP client (#6828)
* Disable Expect 100-Continue by default in Apache 5 HTTP client * Fix docs * Update changelog catagory
1 parent ba64ad5 commit 22c9410

File tree

4 files changed

+13
-5
lines changed

4 files changed

+13
-5
lines changed
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"type": "feature",
3+
"category": "Apache 5 HTTP Client",
4+
"contributor": "",
5+
"description": "Disable Expect 100-Continue by default in the Apache5 HTTP Client."
6+
}

http-clients/apache5-client/src/main/java/software/amazon/awssdk/http/apache5/Apache5HttpClient.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -454,7 +454,8 @@ public interface Builder extends SdkHttpClient.Builder<Apache5HttpClient.Builder
454454
Builder localAddress(InetAddress localAddress);
455455

456456
/**
457-
* Configure whether the client should send an HTTP expect-continue handshake before each request.
457+
* Configure whether the client should send an HTTP expect-continue handshake before each request. By default
458+
* this is disabled.
458459
*/
459460
Builder expectContinueEnabled(Boolean expectContinueEnabled);
460461

http-clients/apache5-client/src/main/java/software/amazon/awssdk/http/apache5/internal/DefaultConfiguration.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
*/
2323
@SdkInternalApi
2424
public final class DefaultConfiguration {
25-
public static final Boolean EXPECT_CONTINUE_ENABLED = Boolean.TRUE;
25+
public static final Boolean EXPECT_CONTINUE_ENABLED = Boolean.FALSE;
2626

2727
private DefaultConfiguration() {
2828
}

services/s3/src/main/java/software/amazon/awssdk/services/s3/S3Configuration.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -234,10 +234,11 @@ public boolean chunkedEncodingEnabled() {
234234
* By default, the SDK sends the {@code Expect: 100-continue} header for these operations, allowing the server to
235235
* reject the request before the client sends the full payload. Setting this to {@code false} disables this behavior.
236236
* <p>
237-
* <b>Note:</b> When using the Apache HTTP client, the Apache client also independently adds the
237+
* <b>Note:</b> When using the {@code ApacheHttpClient} (Apache 4), the Apache 4 client also independently adds the
238238
* {@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)}.
239+
* suppress the header on the wire, you must also disable it on the Apache4 HTTP client builder using
240+
* {@code ApacheHttpClient.builder().expectContinueEnabled(false)}. This does NOT apply to the {@code Apache5HttpClient}
241+
* which defaults {@code expectContinueEnabled} to false.
241242
*
242243
* @return True if the Expect: 100-continue header is enabled.
243244
* @see S3Configuration.Builder#expectContinueEnabled(Boolean)

0 commit comments

Comments
 (0)