Merge pull request #3 from projectdiscovery/bugfix-null-request

adding error check on request
This commit is contained in:
bauthard 2020-05-30 01:51:31 +05:30 committed by GitHub
commit 54221e9dec
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 3 deletions

View File

@ -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))
}

View File

@ -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
}