Skip to content

HTTPCLIENT-1482: expect-continue only on reused connections#683

Merged
arturobernalg merged 1 commit into
apache:masterfrom
arturobernalg:HTTPCLIENT-1482
Jul 24, 2025
Merged

HTTPCLIENT-1482: expect-continue only on reused connections#683
arturobernalg merged 1 commit into
apache:masterfrom
arturobernalg:HTTPCLIENT-1482

Conversation

@arturobernalg

Copy link
Copy Markdown
Member

This change introduces an opt-in strategy that limits automatic emission of the Expect: 100-continue header to requests executed over a reused (pooled) connection.
It eliminates “No response from server” ambiguity on non-idempotent requests without imposing the extra RTT on brand-new sockets.
Key points

ExpectContinueTrigger enum – two modes: ALWAYS (default, preserves 5.x behaviour) and IF_REUSED.

RequestConfig extension – new field, getter, and builder setter setExpectContinueTrigger(...).

RequestExpectContinue interceptor – now consults the trigger and skips the header when the connection’s EndpointDetails#getRequestCount() is 0.

No binary incompatibility; existing code continues to operate exactly as before.

Unit tests added for both trigger modes.

The behaviour requested in Jira ticket HTTPCLIENT-1482 is now available to callers while keeping the classic client’s default semantics unchanged.

@arturobernalg arturobernalg requested a review from ok2c July 19, 2025 17:05
@ok2c

ok2c commented Jul 20, 2025

Copy link
Copy Markdown
Member

@arturobernalg It would be good to add tests to TestRequestExpectContinue for the new config options.

… and modified RequestExpectContinue so that Expect: 100-continue is emitted only when the underlying connection has already processed at least one request; default behaviour (ALWAYS) preserved, API remains binary-compatible.
@arturobernalg

Copy link
Copy Markdown
Member Author

TestRequestExpectContinue

@ok2c my bad. I should have added tests Please take a look

@ok2c

ok2c commented Jul 21, 2025

Copy link
Copy Markdown
Member

@arturobernalg Looks good to me.

@arturobernalg arturobernalg merged commit 97fd931 into apache:master Jul 24, 2025
10 checks passed
arturobernalg added a commit to arturobernalg/httpcomponents-client that referenced this pull request Oct 20, 2025
…tConfig, and modified RequestExpectContinue so that Expect: 100-continue is emitted only when the underlying connection has already processed at least one request; default behaviour (ALWAYS) preserved, API remains binary-compatible. (apache#683)"

This reverts commit 97fd931.
arturobernalg added a commit to arturobernalg/httpcomponents-client that referenced this pull request Oct 20, 2025
…tConfig, and modified RequestExpectContinue so that Expect: 100-continue is emitted only when the underlying connection has already processed at least one request; default behaviour (ALWAYS) preserved, API remains binary-compatible. (apache#683)"

This reverts commit 97fd931.
ok2c added a commit that referenced this pull request Oct 21, 2025
…tConfig, and modified RequestExpectContinue so that Expect: 100-continue is emitted only when the underlying connection has already processed at least one request; default behaviour (ALWAYS) preserved, API remains binary-compatible. (#683)"

This reverts commit 97fd931
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants