diff --git a/common/httpx/httpx.go b/common/httpx/httpx.go index 0a322079..68c70f7a 100644 --- a/common/httpx/httpx.go +++ b/common/httpx/httpx.go @@ -288,10 +288,12 @@ get_response: // fill metrics resp.StatusCode = httpresp.StatusCode - // number of words - resp.Words = len(strings.Split(respbodystr, " ")) - // number of lines - resp.Lines = len(strings.Split(respbodystr, "\n")) + if respbodystr != "" { + // number of words + resp.Words = len(strings.Split(respbodystr, " ")) + // number of lines + resp.Lines = len(strings.Split(strings.TrimSpace(respbodystr), "\n")) + } if !h.Options.Unsafe && h.Options.TLSGrab { if h.Options.ZTLS { diff --git a/runner/types.go b/runner/types.go index 37b98c0d..36fdc3b2 100644 --- a/runner/types.go +++ b/runner/types.go @@ -73,7 +73,7 @@ type Result struct { Words int `json:"words" csv:"words"` Lines int `json:"lines" csv:"lines"` StatusCode int `json:"status_code,omitempty" csv:"status_code"` - ContentLength int `json:"content_length,omitempty" csv:"content_length"` + ContentLength int `json:"content_length" csv:"content_length"` Failed bool `json:"failed" csv:"failed"` VHost bool `json:"vhost,omitempty" csv:"vhost"` WebSocket bool `json:"websocket,omitempty" csv:"websocket"`