rpc: url.Parse can't parse filepath in windows

This commit is contained in:
Delweng Zheng 2018-07-09 20:28:01 +08:00
parent 30bdf817a0
commit 55c20d2872

View file

@ -27,6 +27,7 @@ import (
"net/url"
"os"
"reflect"
"runtime"
"strconv"
"strings"
"sync"
@ -177,6 +178,13 @@ func DialContext(ctx context.Context, rawurl string) (*Client, error) {
case "":
return DialIPC(ctx, rawurl)
default:
if runtime.GOOS == "windows" && len(u.Scheme) == 1 {
for s := 'a'; s <= 'z'; s++ {
if rune(u.Scheme[0]) == s {
return DialIPC(ctx, rawurl)
}
}
}
return nil, fmt.Errorf("no known transport for URL scheme %q", u.Scheme)
}
}