connection header logic fix
@@ -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) {
- setHeader(req, "Connection", "close")
- req.Close = true
replacer := newReplacer(values)
// 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)}
}
+ // 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)")
// raw requests are left untouched
