tools
/
wi
1
0
Fork 0

Add http protocol scheme if it's not exist

master
dump_stack() 2016-07-25 17:50:30 +03:00
parent d4a5ae0b1b
commit 80f2414c1e
1 changed files with 4 additions and 0 deletions

View File

@ -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 {