mirror of https://github.com/daffainfo/nuclei.git
Merge pull request #343 from projectdiscovery/bugfix-connection-header
connection header logic fixdev
commit
551d0307d7
|
@ -240,8 +240,6 @@ func (r *BulkHTTPRequest) handleRawWithPaylods(ctx context.Context, raw, baseURL
|
||||||
}
|
}
|
||||||
|
|
||||||
func (r *BulkHTTPRequest) fillRequest(req *http.Request, values map[string]interface{}) (*retryablehttp.Request, error) {
|
func (r *BulkHTTPRequest) fillRequest(req *http.Request, values map[string]interface{}) (*retryablehttp.Request, error) {
|
||||||
setHeader(req, "Connection", "close")
|
|
||||||
req.Close = true
|
|
||||||
replacer := newReplacer(values)
|
replacer := newReplacer(values)
|
||||||
|
|
||||||
// Check if the user requested a request body
|
// Check if the user requested a request body
|
||||||
|
@ -254,6 +252,13 @@ func (r *BulkHTTPRequest) fillRequest(req *http.Request, values map[string]inter
|
||||||
req.Header[header] = []string{replacer.Replace(value)}
|
req.Header[header] = []string{replacer.Replace(value)}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// if the user specified a Connection header we don't alter it
|
||||||
|
if req.Header.Get("Connection") == "" {
|
||||||
|
// Otherwise we set it to "Connection: close" - The instruction is redundant, but it ensures that internally net/http don't miss the header/internal flag
|
||||||
|
setHeader(req, "Connection", "close")
|
||||||
|
req.Close = true
|
||||||
|
}
|
||||||
|
|
||||||
setHeader(req, "User-Agent", "Nuclei - Open-source project (github.com/projectdiscovery/nuclei)")
|
setHeader(req, "User-Agent", "Nuclei - Open-source project (github.com/projectdiscovery/nuclei)")
|
||||||
|
|
||||||
// raw requests are left untouched
|
// raw requests are left untouched
|
||||||
|
|
Loading…
Reference in New Issue