2021-02-21 11:01:34 +00:00
|
|
|
package engine
|
|
|
|
|
|
|
|
import (
|
|
|
|
"crypto/tls"
|
|
|
|
"net/http"
|
|
|
|
"time"
|
|
|
|
|
2021-04-18 09:57:43 +00:00
|
|
|
"github.com/projectdiscovery/nuclei/v2/pkg/protocols/common/protocolstate"
|
2021-02-21 11:01:34 +00:00
|
|
|
"github.com/projectdiscovery/nuclei/v2/pkg/types"
|
|
|
|
)
|
|
|
|
|
|
|
|
// newhttpClient creates a new http client for headless communication with a timeout
|
2021-04-18 19:25:33 +00:00
|
|
|
func newhttpClient(options *types.Options) *http.Client {
|
2021-04-18 09:57:43 +00:00
|
|
|
dialer := protocolstate.Dialer
|
2021-02-21 11:01:34 +00:00
|
|
|
transport := &http.Transport{
|
|
|
|
DialContext: dialer.Dial,
|
|
|
|
MaxIdleConns: 500,
|
|
|
|
MaxIdleConnsPerHost: 500,
|
|
|
|
MaxConnsPerHost: 500,
|
|
|
|
TLSClientConfig: &tls.Config{
|
|
|
|
Renegotiation: tls.RenegotiateOnceAsClient,
|
|
|
|
InsecureSkipVerify: true,
|
|
|
|
},
|
|
|
|
}
|
2021-04-18 19:25:33 +00:00
|
|
|
return &http.Client{Transport: transport, Timeout: time.Duration(options.Timeout*3) * time.Second}
|
2021-02-21 11:01:34 +00:00
|
|
|
}
|