mirror of
https://github.com/projectdiscovery/nuclei.git
synced 2025-12-17 17:35:28 +00:00
refactor: use the built-in max/min to simplify the code (#6272)
Signed-off-by: xiaoxiangirl <caojiaqiao@outlook.com>
This commit is contained in:
parent
695a7520b9
commit
4ff80784ae
@ -829,10 +829,7 @@ func (h *httpPaths) Execute(filepath string) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if len(expected) > len(actual) {
|
if len(expected) > len(actual) {
|
||||||
actualValuesIndex := len(actual) - 1
|
actualValuesIndex := max(len(actual)-1, 0)
|
||||||
if actualValuesIndex < 0 {
|
|
||||||
actualValuesIndex = 0
|
|
||||||
}
|
|
||||||
return fmt.Errorf("missing values : %v", expected[actualValuesIndex:])
|
return fmt.Errorf("missing values : %v", expected[actualValuesIndex:])
|
||||||
} else if len(expected) < len(actual) {
|
} else if len(expected) < len(actual) {
|
||||||
return fmt.Errorf("unexpected values : %v", actual[len(expected)-1:])
|
return fmt.Errorf("unexpected values : %v", actual[len(expected)-1:])
|
||||||
|
|||||||
@ -336,11 +336,8 @@ func (request *Request) executeTurboHTTP(input *contextargs.Context, dynamicValu
|
|||||||
pipeClient := rawhttp.NewPipelineClient(pipeOptions)
|
pipeClient := rawhttp.NewPipelineClient(pipeOptions)
|
||||||
|
|
||||||
// defaultMaxWorkers should be a sufficient value to keep queues always full
|
// defaultMaxWorkers should be a sufficient value to keep queues always full
|
||||||
maxWorkers := defaultMaxWorkers
|
|
||||||
// in case the queue is bigger increase the workers
|
// in case the queue is bigger increase the workers
|
||||||
if pipeOptions.MaxPendingRequests > maxWorkers {
|
maxWorkers := max(pipeOptions.MaxPendingRequests, defaultMaxWorkers)
|
||||||
maxWorkers = pipeOptions.MaxPendingRequests
|
|
||||||
}
|
|
||||||
|
|
||||||
// Stop-at-first-match logic while executing requests
|
// Stop-at-first-match logic while executing requests
|
||||||
// parallely using threads
|
// parallely using threads
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user