Ice3man543 2021-02-25 16:25:55 +05:30
parent be08e60ab6
commit 4b21de68c8
1 changed files with 4 additions and 5 deletions

View File

@ -79,11 +79,6 @@ func (r *Request) GetID() string {
// Compile compiles the protocol request for further execution. // Compile compiles the protocol request for further execution.
func (r *Request) Compile(options *protocols.ExecuterOptions) error { 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{ client, err := httpclientpool.Get(options.Options, &httpclientpool.Configuration{
Threads: r.Threads, Threads: r.Threads,
MaxRedirects: r.MaxRedirects, MaxRedirects: r.MaxRedirects,
@ -103,6 +98,10 @@ func (r *Request) Compile(options *protocols.ExecuterOptions) error {
} }
r.customHeaders[parts[0]] = strings.TrimSpace(parts[1]) 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") { if r.Body != "" && !strings.Contains(r.Body, "\r\n") {
r.Body = strings.ReplaceAll(r.Body, "\n", "\r\n") r.Body = strings.ReplaceAll(r.Body, "\n", "\r\n")