From 80f2414c1efc7aff156bb08bed5f098693c47643 Mon Sep 17 00:00:00 2001 From: Mikhail Klementyev Date: Mon, 25 Jul 2016 17:50:30 +0300 Subject: [PATCH] Add http protocol scheme if it's not exist --- main.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/main.go b/main.go index 1620eac..f660101 100644 --- a/main.go +++ b/main.go @@ -93,6 +93,10 @@ func parseLinks(db *sql.DB, body []byte, req *http.Request) (htmlPage string, er func cmd_url(db *sql.DB, url string) { client := &http.Client{} + if !strings.Contains(url, "://") { + url = "http://" + url + } + // TODO Full url encoding req, err := http.NewRequest("GET", strings.Replace(url, " ", "%20", -1), nil) if err != nil {