Skip to content

Commit

Permalink
Fix content rel issues (#1630)
Browse files Browse the repository at this point in the history
* do not omit content length

* fix words and lines len
  • Loading branch information
dogancanbakir authored Mar 20, 2024
1 parent a0169c8 commit a4b0261
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
10 changes: 6 additions & 4 deletions common/httpx/httpx.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion runner/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"`
Expand Down

0 comments on commit a4b0261

Please sign in to comment.