Skip to content

Commit 85f6641

Browse files
committed
Allow 'npipe://' prefix in Docker host address
Update `LocalHttpClientTransport` to support explicit `npipe://` prefix in the host name. This is the format used in the Docker config from v4.31.1 onward. Fixes gh-41199
1 parent 98c11bb commit 85f6641

File tree

1 file changed

+5
-3
lines changed
  • spring-boot-project/spring-boot-tools/spring-boot-buildpack-platform/src/main/java/org/springframework/boot/buildpack/platform/docker/transport

1 file changed

+5
-3
lines changed

spring-boot-project/spring-boot-tools/spring-boot-buildpack-platform/src/main/java/org/springframework/boot/buildpack/platform/docker/transport/LocalHttpClientTransport.java

+5-3
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,8 @@ public String resolveCanonicalHostname(String host) throws UnknownHostException
116116
*/
117117
private static class LocalConnectionSocketFactory implements ConnectionSocketFactory {
118118

119+
private static final String NPIPE_PREFIX = "npipe://";
120+
119121
private final String host;
120122

121123
LocalConnectionSocketFactory(String host) {
@@ -124,10 +126,10 @@ private static class LocalConnectionSocketFactory implements ConnectionSocketFac
124126

125127
@Override
126128
public Socket createSocket(HttpContext context) throws IOException {
127-
if (Platform.isWindows()) {
128-
return NamedPipeSocket.get(this.host);
129+
if (this.host.startsWith(NPIPE_PREFIX)) {
130+
return NamedPipeSocket.get(this.host.substring(NPIPE_PREFIX.length()));
129131
}
130-
return DomainSocket.get(this.host);
132+
return (!Platform.isWindows()) ? DomainSocket.get(this.host) : NamedPipeSocket.get(this.host);
131133
}
132134

133135
@Override

0 commit comments

Comments
 (0)