mirror of
https://github.com/spring-projects/spring-boot.git
synced 2024-07-15 01:07:30 +08:00
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
This commit is contained in:
parent
98c11bb5df
commit
85f6641a7e
@ -116,6 +116,8 @@ final class LocalHttpClientTransport extends HttpClientTransport {
|
|||||||
*/
|
*/
|
||||||
private static class LocalConnectionSocketFactory implements ConnectionSocketFactory {
|
private static class LocalConnectionSocketFactory implements ConnectionSocketFactory {
|
||||||
|
|
||||||
|
private static final String NPIPE_PREFIX = "npipe://";
|
||||||
|
|
||||||
private final String host;
|
private final String host;
|
||||||
|
|
||||||
LocalConnectionSocketFactory(String host) {
|
LocalConnectionSocketFactory(String host) {
|
||||||
@ -124,10 +126,10 @@ final class LocalHttpClientTransport extends HttpClientTransport {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Socket createSocket(HttpContext context) throws IOException {
|
public Socket createSocket(HttpContext context) throws IOException {
|
||||||
if (Platform.isWindows()) {
|
if (this.host.startsWith(NPIPE_PREFIX)) {
|
||||||
return NamedPipeSocket.get(this.host);
|
return NamedPipeSocket.get(this.host.substring(NPIPE_PREFIX.length()));
|
||||||
}
|
}
|
||||||
return DomainSocket.get(this.host);
|
return (!Platform.isWindows()) ? DomainSocket.get(this.host) : NamedPipeSocket.get(this.host);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
Loading…
Reference in New Issue
Block a user