Fixed #5 leading to default headers not being set

This commit is contained in:
Ice3man543 2020-04-05 23:58:22 +05:30
parent 4f1b6468cf
commit 042f77c9a0

View File

@ -23,7 +23,10 @@ type Request struct {
Body string `yaml:"body,omitempty"` Body string `yaml:"body,omitempty"`
// Matchers contains the detection mechanism for the request to identify // Matchers contains the detection mechanism for the request to identify
// whether the request was successful // whether the request was successful
Matchers []*matchers.Matcher `yaml:"matchers"` Matchers []*matchers.Matcher `yaml:"matchers,omitempty"`
// Extractors contains the extraction mechanism for the request to identify
// and extract parts of the response.
Extractors []*matchers.Matcher `yaml:"extractors,omitempty"`
} }
// MakeRequest creates a *http.Request from a request template // MakeRequest creates a *http.Request from a request template
@ -63,8 +66,12 @@ func (r *Request) MakeRequest(baseURL string) ([]*retryablehttp.Request, error)
if _, ok := r.Headers["User-Agent"]; !ok { if _, ok := r.Headers["User-Agent"]; !ok {
req.Header.Set("User-Agent", "Nuclei (@pdiscoveryio)") req.Header.Set("User-Agent", "Nuclei (@pdiscoveryio)")
} }
req.Header.Set("Accept", "*/*") if _, ok := r.Headers["Accept"]; !ok {
req.Header.Set("Accept-Language", "en") req.Header.Set("Accept", "*/*")
}
if _, ok := r.Headers["Accept-Language"]; !ok {
req.Header.Set("Accept-Language", "en")
}
req.Header.Set("Connection", "close") req.Header.Set("Connection", "close")
req.Close = true req.Close = true