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:
parent
6bfab294cd
commit
eb400aa1d3
|
@ -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{
|
||||
|
|
Loading…
Reference in New Issue