mirror of https://github.com/daffainfo/nuclei.git
feat: fixed bug due to parallel auto setting in http (#4992)
* feat: fixed bug due to parallel auto setting in http * increased threshold --------- Co-authored-by: sandeep <8293321+ehsandeep@users.noreply.github.com>dev
parent
b86fcb5546
commit
a844e6f7ab
|
@ -20,6 +20,7 @@ import (
|
|||
httputil "github.com/projectdiscovery/nuclei/v3/pkg/protocols/utils/http"
|
||||
"github.com/projectdiscovery/rawhttp"
|
||||
"github.com/projectdiscovery/retryablehttp-go"
|
||||
"github.com/projectdiscovery/utils/env"
|
||||
fileutil "github.com/projectdiscovery/utils/file"
|
||||
)
|
||||
|
||||
|
@ -440,7 +441,11 @@ func (request *Request) Compile(options *protocols.ExecutorOptions) error {
|
|||
request.Threads = protocolstate.GuardThreadsOrDefault(request.Threads)
|
||||
}
|
||||
// if we have payloads, adjust threads if none specified
|
||||
request.Threads = options.GetThreadsForNPayloadRequests(request.Requests(), request.Threads)
|
||||
// We only do this in case we have more payload requests than the
|
||||
// specified concurrency threshold.
|
||||
if request.generator.NewIterator().Total() > PayloadAutoConcurrencyThreshold {
|
||||
request.Threads = options.GetThreadsForNPayloadRequests(request.Requests(), request.Threads)
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
|
@ -467,3 +472,11 @@ func (request *Request) Requests() int {
|
|||
}
|
||||
return len(request.Path)
|
||||
}
|
||||
|
||||
// PayloadAutoConcurrencyThreshold is the threshold for auto adjusting concurrency
|
||||
// for payloads in a template.
|
||||
var PayloadAutoConcurrencyThreshold int
|
||||
|
||||
func init() {
|
||||
PayloadAutoConcurrencyThreshold = env.GetEnvOrDefault[int]("NUCLEI_PAYLOAD_AUTO_CONCURRENCY_THRESHOLD", 100)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue