Skip to content

Named Pipe transport support for Windows - #815

Open
arturobernalg wants to merge 15 commits into
apache:masterfrom
arturobernalg:named-pipe-transport
Open

arturobernalg wants to merge 15 commits into
apache:masterfrom
arturobernalg:named-pipe-transport

Conversation

@arturobernalg

Copy link
Copy Markdown
Member

Added Windows Named Pipe transport as the Windows counterpart to Unix Domain Socket support introduced earlier. This enables HttpClient to communicate over Named Pipes such as \.\pipe\docker_engine using the same connection management and request execution infrastructure.

@arturobernalg
arturobernalg requested review from ok2c and rschmitt March 26, 2026 19:09
@rschmitt

Copy link
Copy Markdown
Contributor

We'd be crossing a Rubicon by exposing support for a platform-specific IO primitive via JNI. I don't think we've done that before. I'd rather have a story for improved custom transport support, which I think would be more sustainable than threading through yet more special cases. docker-java implemented both UDS and named pipe transports via DetachedSocketFactory, and the main issue with that approach is that it requires the use of internal/experimental APIs; we would solve more problems by stabilizing that extension point, and offering a similar one in the async client (the java.io.Socket API is itself legacy).

If we were to implement this as a special case/first-class feature, I'd like to consider doing it on top of the Unix domain socket support. As far as I can tell, the named pipe support in docker-java is a legacy feature and an obsolete workaround for the lack of UDS support in Windows. It might be reasonable to add anyway, but it's not obvious that there's a lot of demand for it.

@arturobernalg

Copy link
Copy Markdown
Member Author

We'd be crossing a Rubicon by exposing support for a platform-specific IO primitive via JNI. I don't think we've done that before. I'd rather have a story for improved custom transport support, which I think would be more sustainable than threading through yet more special cases. docker-java implemented both UDS and named pipe transports via DetachedSocketFactory, and the main issue with that approach is that it requires the use of internal/experimental APIs; we would solve more problems by stabilizing that extension point, and offering a similar one in the async client (the java.io.Socket API is itself legacy).

If we were to implement this as a special case/first-class feature, I'd like to consider doing it on top of the Unix domain socket support. As far as I can tell, the named pipe support in docker-java is a legacy feature and an obsolete workaround for the lack of UDS support in Windows. It might be reasonable to add anyway, but it's not obvious that there's a lot of demand for it.

The real issue here is not named pipes per se, but whether HttpClient should grow another transport-specific request option.
I used Unix domain socket support as the closest existing precedent, but a generic transport extension point for both classic and async clients would be cleaner.

I am happy to rework the proposal in that direction if everyone is agree.

arturobernalg and others added 15 commits November 25, 2026 18:46
No notifications block meant issue events defaulted to [email protected]
via the Apache Git Service. Harmless at normal volume, but the Jira
Issues migration (INFRA-28579) is about to import 2347 issues here,
which would flood the list. Point issues at [email protected]
instead, same pattern apache/maven and apache/opennlp use after their
own Jira migrations.
The ASF Git Service's .asf.yaml validator rejected [email protected]:
notifications targets must be the project's real @httpcomponents.apache.org
list, not the hc.apache.org vanity domain used on the website/mail links.
Neither [email protected] nor [email protected]
validated. Infra is creating [email protected] instead
(INFRA-28579, simpler than a new list under httpcomponents.apache.org).
Don't merge until confirmed created.
The mapping was fixed in apache/infrastructure-asfyaml#152 (httpcomponents
-> hc), but issue notifications still went to dev@ after the merge. No
content change, just a fresh push to .asf.yaml to force the Git Service
to re-evaluate the notifications block.
Per Infra (Bob), force a real value-diff push to .asf.yaml so the Git
Service fully reprocesses notifications::issues end to end, rather
than a no-op comment-only re-save. Restored to [email protected]
in a follow-up commit.
Second half of the revert/restore cycle Infra (Bob) asked for, to force
the Git Service to fully reprocess notifications::issues end to end.
Define INTERLEAVE as no-bias and align tests and debug output.
Add manual gated IT to dump DEFAULT vs INTERLEAVE results.
Expand unit coverage for scope mapping and core RFC comparison rules.
…ults.

Tighten resolver semantics and filtering for HTTP/TCP connect targets.
Races connection attempts across a host's resolved addresses instead
of trying them strictly sequentially: first address immediately, each
next one after a configurable delay (250ms default) unless an earlier
one fails first, in which case the next address starts at the RFC
8305 Section 5 minimum spacing (10ms). First success wins; the rest
are cancelled or closed. An attempt cancelled from outside the race is
treated like a failure so the future is never left pending forever.

A winning session can be selected by the race at the same moment the
caller cancels the outer Future directly. ComplexFuture#completed then
returns false; close the session instead of silently dropping it.

Opt-in, off by default; disabled behavior is unchanged.
…ient

Replaces the one-thread-per-address, sleep-based stagger with a single
dispatcher that starts the first address immediately and waits up to
the connection attempt delay for an outstanding attempt to finish
before starting the next; on a failure it advances immediately, at the
RFC 8305 minimum spacing (10ms), instead of waiting out the full delay.
No worker thread ever sleeps a delay itself, bounding concurrency to
the number of resolved addresses actually in flight.

Socket registration goes through a small atomic registry instead of a
bare reference: deciding a winner and a worker registering its socket
can happen at the same instant, and whichever runs second closes the
socket, so nothing registered around that moment survives open
regardless of timing. shutdownNow() alone cannot abort a blocking
Socket#connect; closing the socket is what actually does that, on
every exit path (winner found, every address failed, or interrupted)
via one cleanup call in a finally block.

An interruption during the minimum-spacing wait is now propagated
instead of swallowed, aborting the race immediately like interruption
anywhere else in it. Racing is skipped in favor of the existing
sequential path when a specific, non-ephemeral local port is
requested, since binding several attempts to it concurrently would
trade a real connect failure for a spurious bind conflict.

Public, blocking connect() behavior, TLS, SOCKS and local binding are
otherwise unchanged.
Since the challenge parsing was reworked, a single malformed
WWW-Authenticate or Proxy-Authenticate header causes all challenges in
the response to be discarded, so a valid Basic or Digest challenge in
another header is no longer used and the 401 is returned as is. Before
that change only the malformed header was skipped.

The empty map returned in that case is also immutable, so a response
that carries Authentication-Info together with a malformed challenge
header fails with UnsupportedOperationException.

Parse each header separately again and skip only the ones that fail.
Bumps the all group with 10 updates:

| Package | From | To |
| --- | --- | --- |
| [org.conscrypt:conscrypt-openjdk-uber](https://github.com/google/conscrypt) | `2.8.0` | `2.10.0` |
| [org.junit:junit-bom](https://github.com/junit-team/junit-framework) | `5.14.4` | `5.14.5` |
| [com.github.luben:zstd-jni](https://github.com/luben/zstd-jni) | `1.5.7-25` | `1.6.0-1` |
| [io.micrometer:micrometer-core](https://github.com/micrometer-metrics/micrometer) | `1.17.2` | `1.18.0` |
| [io.micrometer:micrometer-observation](https://github.com/micrometer-metrics/micrometer) | `1.17.2` | `1.18.0` |
| [io.micrometer:micrometer-registry-prometheus](https://github.com/micrometer-metrics/micrometer) | `1.17.2` | `1.18.0` |
| [io.micrometer:micrometer-tracing](https://github.com/micrometer-metrics/tracing) | `1.7.2` | `1.8.0` |
| [io.micrometer:micrometer-tracing-bridge-otel](https://github.com/micrometer-metrics/tracing) | `1.7.2` | `1.8.0` |
| [io.opentelemetry:opentelemetry-bom](https://github.com/open-telemetry/opentelemetry-java) | `1.67.0` | `1.68.0` |
| org.apache.maven:apache-maven | `3.10.0` | `3.10.2` |


Updates `org.conscrypt:conscrypt-openjdk-uber` from 2.8.0 to 2.10.0
- [Release notes](https://github.com/google/conscrypt/releases)
- [Commits](google/conscrypt@2.8.0...2.10.0)

Updates `org.junit:junit-bom` from 5.14.4 to 5.14.5
- [Release notes](https://github.com/junit-team/junit-framework/releases)
- [Commits](junit-team/junit-framework@r5.14.4...r5.14.5)

Updates `com.github.luben:zstd-jni` from 1.5.7-25 to 1.6.0-1
- [Commits](luben/zstd-jni@v1.5.7-25...v1.6.0-1)

Updates `io.micrometer:micrometer-core` from 1.17.2 to 1.18.0
- [Release notes](https://github.com/micrometer-metrics/micrometer/releases)
- [Commits](micrometer-metrics/micrometer@v1.17.2...v1.18.0)

Updates `io.micrometer:micrometer-observation` from 1.17.2 to 1.18.0
- [Release notes](https://github.com/micrometer-metrics/micrometer/releases)
- [Commits](micrometer-metrics/micrometer@v1.17.2...v1.18.0)

Updates `io.micrometer:micrometer-registry-prometheus` from 1.17.2 to 1.18.0
- [Release notes](https://github.com/micrometer-metrics/micrometer/releases)
- [Commits](micrometer-metrics/micrometer@v1.17.2...v1.18.0)

Updates `io.micrometer:micrometer-observation` from 1.17.2 to 1.18.0
- [Release notes](https://github.com/micrometer-metrics/micrometer/releases)
- [Commits](micrometer-metrics/micrometer@v1.17.2...v1.18.0)

Updates `io.micrometer:micrometer-registry-prometheus` from 1.17.2 to 1.18.0
- [Release notes](https://github.com/micrometer-metrics/micrometer/releases)
- [Commits](micrometer-metrics/micrometer@v1.17.2...v1.18.0)

Updates `io.micrometer:micrometer-tracing` from 1.7.2 to 1.8.0
- [Release notes](https://github.com/micrometer-metrics/tracing/releases)
- [Commits](micrometer-metrics/tracing@v1.7.2...v1.8.0)

Updates `io.micrometer:micrometer-tracing-bridge-otel` from 1.7.2 to 1.8.0
- [Release notes](https://github.com/micrometer-metrics/tracing/releases)
- [Commits](micrometer-metrics/tracing@v1.7.2...v1.8.0)

Updates `io.micrometer:micrometer-tracing-bridge-otel` from 1.7.2 to 1.8.0
- [Release notes](https://github.com/micrometer-metrics/tracing/releases)
- [Commits](micrometer-metrics/tracing@v1.7.2...v1.8.0)

Updates `io.opentelemetry:opentelemetry-bom` from 1.67.0 to 1.68.0
- [Release notes](https://github.com/open-telemetry/opentelemetry-java/releases)
- [Changelog](https://github.com/open-telemetry/opentelemetry-java/blob/main/CHANGELOG.md)
- [Commits](open-telemetry/opentelemetry-java@v1.67.0...v1.68.0)

Updates `org.apache.maven:apache-maven` from 3.10.0 to 3.10.2

---
updated-dependencies:
- dependency-name: org.conscrypt:conscrypt-openjdk-uber
  dependency-version: 2.10.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: all
- dependency-name: org.junit:junit-bom
  dependency-version: 5.14.5
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: all
- dependency-name: com.github.luben:zstd-jni
  dependency-version: 1.6.0-1
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: all
- dependency-name: io.micrometer:micrometer-core
  dependency-version: 1.18.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: all
- dependency-name: io.micrometer:micrometer-observation
  dependency-version: 1.18.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: all
- dependency-name: io.micrometer:micrometer-registry-prometheus
  dependency-version: 1.18.0
  dependency-type: direct:development
  update-type: version-update:semver-minor
  dependency-group: all
- dependency-name: io.micrometer:micrometer-observation
  dependency-version: 1.18.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: all
- dependency-name: io.micrometer:micrometer-registry-prometheus
  dependency-version: 1.18.0
  dependency-type: direct:development
  update-type: version-update:semver-minor
  dependency-group: all
- dependency-name: io.micrometer:micrometer-tracing
  dependency-version: 1.8.0
  dependency-type: direct:development
  update-type: version-update:semver-minor
  dependency-group: all
- dependency-name: io.micrometer:micrometer-tracing-bridge-otel
  dependency-version: 1.8.0
  dependency-type: direct:development
  update-type: version-update:semver-minor
  dependency-group: all
- dependency-name: io.micrometer:micrometer-tracing-bridge-otel
  dependency-version: 1.8.0
  dependency-type: direct:development
  update-type: version-update:semver-minor
  dependency-group: all
- dependency-name: io.opentelemetry:opentelemetry-bom
  dependency-version: 1.68.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: all
- dependency-name: org.apache.maven:apache-maven
  dependency-version: 3.10.2
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: all
...

Signed-off-by: dependabot[bot] <[email protected]>
Bumps [actions/setup-java](https://github.com/actions/setup-java) from 5.6.0 to 6.3.0.
- [Release notes](https://github.com/actions/setup-java/releases)
- [Commits](actions/setup-java@v5.6.0...v6.3.0)

---
updated-dependencies:
- dependency-name: actions/setup-java
  dependency-version: 6.3.0
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <[email protected]>
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.

3 participants