go1.8: Changes to support golang 1.8 (#4759)

QuirkConn is added to replace net.Conn as a workaround to a golang bug:
https://github.com/golang/go/issues/21133
This commit is contained in:
A. Elleuch
2017-08-06 19:27:33 +01:00
committed by Harshavardhana
parent 218049300c
commit b4dc6df35c
14 changed files with 96 additions and 59 deletions

View File

@@ -198,18 +198,20 @@ func extractHostPort(hostAddr string) (string, string, error) {
return "", "", errors.New("unable to process empty address")
}
// Simplify the work of url.Parse() and always send a url with
if !strings.HasPrefix(hostAddr, "http://") && !strings.HasPrefix(hostAddr, "https://") {
hostAddr = "//" + hostAddr
}
// Parse address to extract host and scheme field
u, err := url.Parse(hostAddr)
if err != nil {
// Ignore scheme not present error
if !strings.Contains(err.Error(), "missing protocol scheme") {
return "", "", err
}
} else {
addr = u.Host
scheme = u.Scheme
return "", "", err
}
addr = u.Host
scheme = u.Scheme
// Use the given parameter again if url.Parse()
// didn't return any useful result.
if addr == "" {