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:
@@ -22,7 +22,11 @@ func DispatchFeedback(log LogPushEntry, url string, timeout int64) error {
|
|||||||
return err
|
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")
|
req.Header.Set("Content-Type", "application/json; charset=utf-8")
|
||||||
|
|
||||||
var transport = &http.Transport{
|
var transport = &http.Transport{
|
||||||
|
|||||||
Reference in New Issue
Block a user