Add to history after success request

This commit is contained in:
Mikhail Klementyev 2016-07-25 17:47:19 +03:00
parent 6c56bb9e2f
commit d4a5ae0b1b

View File

@ -91,8 +91,6 @@ func parseLinks(db *sql.DB, body []byte, req *http.Request) (htmlPage string, er
} }
func cmd_url(db *sql.DB, url string) { func cmd_url(db *sql.DB, url string) {
storage.AddHistoryURL(db, url)
client := &http.Client{} client := &http.Client{}
// TODO Full url encoding // TODO Full url encoding
@ -108,6 +106,8 @@ func cmd_url(db *sql.DB, url string) {
log.Fatalln(err) log.Fatalln(err)
} }
storage.AddHistoryURL(db, url)
defer resp.Body.Close() defer resp.Body.Close()
utf8, err := charset.NewReader(resp.Body, resp.Header.Get("Content-Type")) utf8, err := charset.NewReader(resp.Body, resp.Header.Get("Content-Type"))