Skip to content

Commit

Permalink
Fix regression of client offloadNone() strategy
Browse files Browse the repository at this point in the history
Motivation:
The changes in apple#2108 introduced a regression in the handling of
computation of the effective strategy of a client when a
strategy `offloadNone()` (or the deprecated `offloadNever()`) was used
with the  `HttpClientBuilder`. Rather than preventing all offloading,
the computed offloading was used.
Modifications:
If the strategy specified on the `HttpClientBuilder` does not specify
any offloads then no offloading will be used.
Result:
The offloading behavior matches the requested behavior specified on
the  `HttpClientBuilder`.
  • Loading branch information
bondolo committed Apr 15, 2022
1 parent 470759e commit f7cbfe2
Showing 1 changed file with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ void add(StreamingHttpConnectionFilterFactory connectionFilter) {
}
}

HttpExecutionStrategy buildForClient(HttpExecutionStrategy transportStrategy) {
HttpExecutionStrategy buildForClient(HttpExecutionStrategy builderStrategy) {
HttpExecutionStrategy chainStrategy = clientChain;
if (null != connFilterChain) {
chainStrategy = null != chainStrategy ? chainStrategy.merge(connFilterChain) : connFilterChain;
Expand All @@ -138,9 +138,10 @@ HttpExecutionStrategy buildForClient(HttpExecutionStrategy transportStrategy) {
}

return (null == chainStrategy || !chainStrategy.hasOffloads()) ?
transportStrategy :
defaultStrategy() == transportStrategy || !transportStrategy.hasOffloads() ?
chainStrategy : chainStrategy.merge(transportStrategy);
builderStrategy :
defaultStrategy() == builderStrategy ?
chainStrategy : builderStrategy.hasOffloads() ?
chainStrategy.merge(builderStrategy) : builderStrategy;
}

ExecutionStrategy buildForConnectionFactory() {
Expand Down

0 comments on commit f7cbfe2

Please sign in to comment.