Add 2xx checks for mirror.list and repomd.xml
This commit is contained in:
parent
803cf4a29e
commit
8e98ee878a
@ -173,6 +173,11 @@ func (u *updater) getUpdateInfoURI() (updateInfoURI string, err error) {
|
||||
}
|
||||
defer mirrorListResponse.Body.Close()
|
||||
|
||||
if !httputil.Status2xx(mirrorListResponse) {
|
||||
log.WithField("StatusCode", mirrorListResponse.StatusCode).Error("could not download mirror list")
|
||||
return updateInfoURI, commonerr.ErrCouldNotDownload
|
||||
}
|
||||
|
||||
// Parse the URI of the first mirror.
|
||||
scanner := bufio.NewScanner(mirrorListResponse.Body)
|
||||
success := scanner.Scan()
|
||||
@ -190,6 +195,11 @@ func (u *updater) getUpdateInfoURI() (updateInfoURI string, err error) {
|
||||
}
|
||||
defer repoMdResponse.Body.Close()
|
||||
|
||||
if !httputil.Status2xx(repoMdResponse) {
|
||||
log.WithField("StatusCode", repoMdResponse.StatusCode).Error("could not download repomd.xml")
|
||||
return updateInfoURI, commonerr.ErrCouldNotDownload
|
||||
}
|
||||
|
||||
// Decode repomd.xml.
|
||||
var repoMd RepoMd
|
||||
err = xml.NewDecoder(repoMdResponse.Body).Decode(&repoMd)
|
||||
|
Loading…
Reference in New Issue
Block a user