aboutsummaryrefslogtreecommitdiff
path: root/client.go
diff options
context:
space:
mode:
Diffstat (limited to 'client.go')
-rw-r--r--client.go12
1 files changed, 2 insertions, 10 deletions
diff --git a/client.go b/client.go
index 7b85b33..a8f97ec 100644
--- a/client.go
+++ b/client.go
@@ -50,7 +50,8 @@ type Request struct {
// Hostname returns the request host without the port.
func (r *Request) Hostname() string {
- return hostname(r.Host)
+ host, _ := splitHostPort(r.Host)
+ return host
}
// NewRequest returns a new request. The host is inferred from the provided URL.
@@ -300,12 +301,3 @@ func validCertificate(cert *x509.Certificate) bool {
// No need to check hash algorithms, hopefully tls has checked for us already
return true
}
-
-// hostname extracts the host name from a valid host or host:port
-func hostname(host string) string {
- i := strings.LastIndexByte(host, ':')
- if i != -1 {
- return host[:i]
- }
- return host
-}