checker: don't validate http challenge if error status returns

This commit is contained in:
nemunaire 2021-03-04 02:01:26 +01:00
parent 9cd237daff
commit efab34d551
1 changed files with 10 additions and 0 deletions

View File

@ -110,6 +110,11 @@ func check_http(ip string) (err error) {
return
}
defer resp.Body.Close()
if resp.StatusCode >= 400 {
return fmt.Errorf("Bad status, got: %d (%s)", resp.StatusCode, resp.Status)
}
_, err = ioutil.ReadAll(resp.Body)
return
}
@ -123,6 +128,11 @@ func check_https(domain, ip string) (err error) {
return
}
defer resp.Body.Close()
if resp.StatusCode >= 300 {
return fmt.Errorf("Bad status, got: %d (%s)", resp.StatusCode, resp.Status)
}
_, err = ioutil.ReadAll(resp.Body)
return
}