From 4b21de68c8ba3d5eb64a009896d7f6fd027cc792 Mon Sep 17 00:00:00 2001 From: Ice3man543 Date: Thu, 25 Feb 2021 16:25:55 +0530 Subject: [PATCH] Misc --- v2/pkg/protocols/http/http.go | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/v2/pkg/protocols/http/http.go b/v2/pkg/protocols/http/http.go index 94d02412..53916f77 100644 --- a/v2/pkg/protocols/http/http.go +++ b/v2/pkg/protocols/http/http.go @@ -79,11 +79,6 @@ func (r *Request) GetID() string { // Compile compiles the protocol request for further execution. func (r *Request) Compile(options *protocols.ExecuterOptions) error { - // Add User-Agent value randomly to the customHeaders slice if `random-agent` flag is given - if r.options.Options.RandomAgent { - r.customHeaders["User-Agent"] = uarand.GetRandom() - } - client, err := httpclientpool.Get(options.Options, &httpclientpool.Configuration{ Threads: r.Threads, MaxRedirects: r.MaxRedirects, @@ -103,6 +98,10 @@ func (r *Request) Compile(options *protocols.ExecuterOptions) error { } r.customHeaders[parts[0]] = strings.TrimSpace(parts[1]) } + // Add User-Agent value randomly to the customHeaders slice if `random-agent` flag is given + if r.options.Options.RandomAgent { + r.customHeaders["User-Agent"] = uarand.GetRandom() + } if r.Body != "" && !strings.Contains(r.Body, "\r\n") { r.Body = strings.ReplaceAll(r.Body, "\n", "\r\n")