Gorush crashes with a invalid feedback URL (#543)

When url is invalid, NewRequest may nil request with an error.
It can occurs nil-pointer dereference on setting HTTP header.
This commit is contained in:
Shin'ya Ueoka
2020-10-08 08:13:12 +09:00
committed by GitHub
parent 6bfab294cd
commit eb400aa1d3

View File

@@ -22,7 +22,11 @@ func DispatchFeedback(log LogPushEntry, url string, timeout int64) error {
return err
}
req, _ := http.NewRequest("POST", url, bytes.NewBuffer(payload))
req, err := http.NewRequest("POST", url, bytes.NewBuffer(payload))
if err != nil {
return err
}
req.Header.Set("Content-Type", "application/json; charset=utf-8")
var transport = &http.Transport{