Skip to content

Commit

Permalink
Merge pull request #3 from projectdiscovery/bugfix-null-request
Browse files Browse the repository at this point in the history
adding error check on request
  • Loading branch information
ehsandeep authored May 29, 2020
2 parents 83a5340 + df11fde commit 54221e9
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
3 changes: 1 addition & 2 deletions cmd/httpx/httpx.go
Original file line number Diff line number Diff line change
Expand Up @@ -207,9 +207,8 @@ retry:
builder.WriteString(fmt.Sprintf(" [%d]", resp.ContentLength))
}

title := ""
title := httpx.ExtractTitle(resp)
if scanopts.OutputTitle {
title = httpx.ExtractTitle(resp)
builder.WriteString(fmt.Sprintf(" [%s]", title))
}

Expand Down
4 changes: 3 additions & 1 deletion common/httpx/httpx.go
Original file line number Diff line number Diff line change
Expand Up @@ -146,10 +146,12 @@ func (h *HTTPX) AddFilter(f Filter) {
// NewRequest from url
func (h *HTTPX) NewRequest(method, URL string) (req *retryablehttp.Request, err error) {
req, err = retryablehttp.NewRequest(method, URL, nil)
if err != nil {
return
}

// set default user agent
req.Header.Set("User-Agent", h.Options.DefaultUserAgent)

return
}

Expand Down

0 comments on commit 54221e9

Please sign in to comment.