MCPcopy Index your code
hub / github.com/SummerSec/SpringExploit / InIt

Function InIt

cmd/commons/utils/httpclient.go:9–45  ·  view source on GitHub ↗
(mode int, timeout int, proxy string, retry int, h1 bool, redirect bool)

Source from the content-addressed store, hash-verified

7)
8
9func InIt(mode int, timeout int, proxy string, retry int, h1 bool, redirect bool) (client *req.Client) {
10 log.Debugf("init httpclient")
11 client = req.NewClient()
12 if mode != 0 {
13 client.EnableDumpAll().EnableDebugLog()
14 }
15
16 // TODO client.DisableAutoReadResponse() 不能开启DisableAutoReadResponse 不然CVE-2022-1388 漏洞无法验证
17 if h1 {
18 // TODO 强制开启 EnableForceHTTP1 CVE-2022-1388 漏洞设置http代理的情况下必须强制开启HTTP1 其他情况框架会自动判断使用什么版本http协议
19 client.EnableForceHTTP1()
20 }
21
22 client.SetLogger(log.StandardLogger())
23 // 设置超时时间
24 client.SetTimeout(time.Duration(timeout) * time.Second)
25 client.SetCommonRetryCount(retry)
26
27 client.EnableInsecureSkipVerify()
28 // 重定向设置, 如果不设置, 默认为true 即重定向
29 if !redirect {
30 log.Debug("redirect is false")
31 client.SetRedirectPolicy(req.NoRedirectPolicy())
32 }
33 // 设置代理
34 f := IsProxyUrl(proxy)
35 if f {
36 proxy = GetProxyUrl(proxy)
37 client.SetProxyURL(proxy)
38 } else if proxy == "" {
39
40 } else {
41 log.Error("proxy: " + proxy + " is not a valid url")
42 return nil
43 }
44 return client
45}
46
47func Send(hashmap map[string]interface{}) (resp *req.Response) {
48 log.Debugln("send requesting")

Callers 1

SendFunction · 0.85

Calls 2

IsProxyUrlFunction · 0.85
GetProxyUrlFunction · 0.85

Tested by

no test coverage detected