Use hash setting on getCheckRedirect

This commit is contained in:
Tim Schumacher 2020-09-17 17:14:23 -04:00
parent fc82b6b673
commit c034bb26a1

View File

@ -306,9 +306,13 @@ func (scan *scan) getCheckRedirect() func(*http.Request, *http.Response, []*http
io.CopyN(b, res.Body, readLen)
res.BodyText = b.String()
if len(res.BodyText) > 0 {
m := sha256.New()
m.Write(b.Bytes())
res.BodySHA256 = m.Sum(nil)
if scan.scanner.decodedHashFn != nil {
res.BodyHash = scan.scanner.decodedHashFn([]byte(res.BodyText))
} else {
m := sha256.New()
m.Write(b.Bytes())
res.BodySHA256 = m.Sum(nil)
}
}
if len(via) > scan.scanner.config.MaxRedirects {