diff options
| author | chrislusf <chris.lu@gmail.com> | 2015-04-16 10:02:53 -0700 |
|---|---|---|
| committer | chrislusf <chris.lu@gmail.com> | 2015-04-16 10:02:53 -0700 |
| commit | 087b839354d3d5d3376e87b919b46595548cbe53 (patch) | |
| tree | 5530370c429df9bbdaeec774c3ee1eb0cea73e5b /go/util/http_util.go | |
| parent | 67146ffa785fa35e216f603bcb80fb65c69f088c (diff) | |
| download | seaweedfs-087b839354d3d5d3376e87b919b46595548cbe53.tar.xz seaweedfs-087b839354d3d5d3376e87b919b46595548cbe53.zip | |
Nomalize url before redirecting.
Diffstat (limited to 'go/util/http_util.go')
| -rw-r--r-- | go/util/http_util.go | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/go/util/http_util.go b/go/util/http_util.go index 52579d746..e2391887e 100644 --- a/go/util/http_util.go +++ b/go/util/http_util.go @@ -104,3 +104,10 @@ func DownloadUrl(fileUrl string) (filename string, content []byte, e error) { func Do(req *http.Request) (resp *http.Response, err error) { return client.Do(req) } + +func NormalizeUrl(url string) string { + if strings.HasPrefix(url, "http://") || strings.HasPrefix(url, "https://") { + return url + } + return "http://" + url +} |
