cavaliergopher / grab

A download manager package for Go
BSD 3-Clause "New" or "Revised" License
1.39k stars 150 forks source link

download file from go-fastdfs #66

Closed fcddk closed 4 years ago

fcddk commented 5 years ago

no filename could be determined 2019/09/29 16:44:31 E! DownloadFile client connect error: no filename could be determined

code:

func main() { err := downloadFile("http://10.110.18.101:30039/group1/agent/ecs-monitor-03-linux64-amd64.tar.gz") if err != nil { fmt.Println(err) } }

func downloadFile(httpUrl string) error { //client := grab.NewClient()

_, err := grab.Get(".", httpUrl)
if err != nil {
    log.Printf("E! DownloadFile new Request error: %s", err.Error())
    return err
}

//resp := client.Do(req)
//if err = resp.Err(); err != nil {
//  log.Printf("E! DownloadFile client connect error: %s", err.Error())
//  return err
//}
//defer resp.Cancel()

return nil

}

riyaz-ali commented 4 years ago

This looks related to #64 .. if the server at http://10.110.18.101 is returning Content-Disposition without a filename directive grab would (currently) fail to determine the name and return an error.. this should be fixed by #67 ..

You can check it by

curl -I http://10.110.18.101:30039/group1/agent/ecs-monitor-03-linux64-amd64.tar.gz