diff --git a/sockets/sockets_windows.go b/sockets/sockets_windows.go index 7acafc5a..c08613e4 100644 --- a/sockets/sockets_windows.go +++ b/sockets/sockets_windows.go @@ -2,6 +2,7 @@ package sockets import ( "context" + "fmt" "net" "net/http" "time" @@ -10,7 +11,18 @@ import ( ) func configureUnixTransport(tr *http.Transport, proto, addr string) error { - return ErrProtocolNotAvailable + if len(addr) > 260 { + return fmt.Errorf("unix socket path %q is too long", addr) + } + // No need for compression in local communications. + tr.DisableCompression = true + dialer := &net.Dialer{ + Timeout: defaultTimeout, + } + tr.DialContext = func(ctx context.Context, _, _ string) (net.Conn, error) { + return dialer.DialContext(ctx, proto, addr) + } + return nil } func configureNpipeTransport(tr *http.Transport, proto, addr string) error {