Skip to content

fix(downloader): use Reactor Netty directly so the client needs no Spring WebFlux - #117

Merged
alfespa17 merged 1 commit into
masterfrom
fix/client-drop-webflux
Nov 18, 2026
Merged

alfespa17 merged 1 commit into
masterfrom
fix/client-drop-webflux

Conversation

@Macbet

@Macbet Macbet commented Nov 18, 2026

Copy link
Copy Markdown

Problem

TerraformDownloader used Spring WebClient, but spring-boot-starter-webflux is declared provided in terraform-client, so it isn't transitive. Plain users of terraform-client, and of the starter in an app without WebFlux, fail on the first download with NoClassDefFoundError: org/springframework/http/client/reactive/ClientHttpConnector. Reproduced with this repo's RawClientLibSampleApp.

Change

  • terraform-client depends on io.projectreactor.netty:reactor-netty-http (compile scope, version from the Spring Boot parent) instead of the webflux starter.
  • The downloader uses the Reactor Netty HttpClient directly. No Spring class is needed any more.
  • netty-codec-native-quic is excluded (~12 MB of HTTP/3 natives the downloader never uses). netty-codec-http3 and netty-codec-classes-quic have to stay, because HttpClientSecure checks Quic.isAvailable() when it loads.
  • Apps that already have WebFlux get no new artifacts.

Behaviour unchanged

  • Same shared client with followRedirect, 32 KiB max header size and proxyWithSystemProperties(). Proxy handling is identical: http.* fallback for https targets, https.* precedence, Basic auth sent on CONNECT, SOCKS.
  • Same headers, per-request response timeout (idle between reads), whole-download caps, partial-file cleanup, and the release-index cache, locks and fallback.
  • Non-2xx fails with status and URL without touching the target file. An interrupt cancels the download and keeps the interrupt flag.

A first attempt with java.net.http was dropped. Its proxy selector ignores http.proxyHost for https targets, and it refuses Basic proxy auth on CONNECT unless the JVM sets jdk.http.auth.tunneling.disabledSchemes. Both would break authenticated corporate proxies.

Tests

  • 9 new tests in TerraformDownloaderTest: idle timeout, whole-download cap with server-side disconnect, binary stall with partial-zip cleanup, interrupt, redirect, 404 message, and three proxy tests against a CONNECT stub (http.* fallback for https, https.* precedence, preemptive Basic auth). The 12 existing tests are unchanged.
  • Docker verify (temurin 17, --init): green.
  • Downloader tests repeated with --cpus=1 and Netty paranoid leak detection: no leaks.
  • RawClientLibSampleApp with only its declared runtime classpath now downloads terraform over real https.

…ring WebFlux

TerraformDownloader went through Spring WebClient while
spring-boot-starter-webflux was a provided dependency, so plain users of
terraform-client failed with NoClassDefFoundError (TK-143).

terraform-client now depends on reactor-netty-http (compile scope,
version from the Spring Boot parent) instead of the webflux starter, and
the downloader uses the Reactor Netty HttpClient directly, writing the
body to the file from Netty's buffers. It no longer needs any Spring
class.

Behaviour is unchanged: same shared client with followRedirect, 32 KiB
max header size and proxyWithSystemProperties, so proxy handling
(http.* fallback for https, SOCKS, Basic auth on CONNECT) is the same as
before. Same headers, per-request response timeout, whole-download caps,
partial-file cleanup and release cache. Non-2xx responses fail with the
status and URL without touching the target file; interrupts cancel the
download and keep the interrupt flag.
@sonarqubecloud

Copy link
Copy Markdown

@alfespa17
alfespa17 merged commit f993ff9 into master Nov 18, 2026
3 checks passed
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