Capture BodyTextLength
This commit is contained in:
förälder
a7ad9a27d2
incheckning
fc82b6b673
|
@ -63,6 +63,8 @@ type Response struct {
|
|||
// BodyHash is the hash digest hex of the decoded http body, formatted `<kind>:<hex>`
|
||||
// e.g. `sha256:deadbeef100020003000400050006000700080009000a000b000c000d000e000`
|
||||
BodyHash string `json:"body_hash,omitempty"`
|
||||
// Number of bytes read from the server and encoded into BodyText
|
||||
BodyTextLength int64 `json:"body_length,omitempty"`
|
||||
|
||||
// ContentLength records the length of the associated content. The
|
||||
// value -1 indicates that the length is unknown. Unless Request.Method
|
||||
|
|
|
@ -415,7 +415,8 @@ func (scan *scan) Grab() *zgrab2.ScanError {
|
|||
if resp.ContentLength >= 0 && resp.ContentLength < maxReadLen {
|
||||
readLen = resp.ContentLength
|
||||
}
|
||||
io.CopyN(buf, resp.Body, readLen)
|
||||
// EOF ignored here because that's the way it was, CopyN goes up to readLen bytes
|
||||
scan.results.Response.BodyTextLength, _ = io.CopyN(buf, resp.Body, readLen)
|
||||
bufAsString := buf.String()
|
||||
|
||||
// do best effort attempt to determine the response's encoding
|
||||
|
|
Laddar…
Referens i nytt ärende