From c6168d3511f17e5e5cc57331c3600c4eaf2d5ee7 Mon Sep 17 00:00:00 2001 From: "Anand Babu (AB) Periasamy" Date: Sat, 16 May 2015 12:43:18 -0700 Subject: [PATCH] reduce url.Parse dependency --- Makefile | 2 +- hostconfig.go | 9 ++------- 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/Makefile b/Makefile index 2c86b629..dc5ee13d 100644 --- a/Makefile +++ b/Makefile @@ -66,4 +66,4 @@ install: test-all clean: @rm -fv cover.out @rm -fv mc - @find Godeps -name "*.a" -type f -exec rm -vf {} + + @find Godeps -name "*.a" -type f -exec rm -vf {} \+ diff --git a/hostconfig.go b/hostconfig.go index e65e427d..9abf26f7 100644 --- a/hostconfig.go +++ b/hostconfig.go @@ -30,11 +30,6 @@ type hostConfig struct { SecretAccessKey string } -// getHostURL - -func getHostURL(u *url.URL) string { - return u.Scheme + "://" + u.Host -} - // getHostConfigs retrieves host specific configuration such as access keys, certs for a list of URLs func getHostConfigs(URLs []string) (hostConfigs map[string]*hostConfig, err error) { hostConfigs = make(map[string]*hostConfig) @@ -67,7 +62,7 @@ func getHostConfig(URL string) (*hostConfig, error) { } // No host matching or keys needed for localhost and 127.0.0.1 URL's skip them - if strings.Contains(getHostURL(u), "localhost") || strings.Contains(getHostURL(u), "127.0.0.1") { + if strings.Contains(u.Host, "localhost") || strings.Contains(u.Host, "127.0.0.1") { hostCfg := &hostConfig{ AccessKeyID: "", SecretAccessKey: "", @@ -75,7 +70,7 @@ func getHostConfig(URL string) (*hostConfig, error) { return hostCfg, nil } for globURL, hostCfg := range config.Hosts { - match, err := filepath.Match(globURL, getHostURL(u)) + match, err := filepath.Match(globURL, u.Host) if err != nil { return nil, iodine.New(errInvalidGlobURL{glob: globURL, request: URL}, nil) }