This commit is contained in:
gospider
2025-03-01 16:04:10 +08:00
parent 16b6ba7442
commit 8585173795
10 changed files with 60 additions and 78 deletions

View File

@@ -12,7 +12,6 @@ import (
"net/http"
"github.com/gospider007/gtls"
"github.com/gospider007/re"
"github.com/gospider007/tools"
"github.com/gospider007/websocket"
@@ -194,22 +193,11 @@ func (obj *Client) request(ctx *Response) (err error) {
ctx.option.TlsHandshakeTimeout = time.Second * 15
}
//init proxy
if ctx.option.Proxy != "" {
tempProxy, err := gtls.VerifyProxy(ctx.option.Proxy)
if ctx.option.Proxy != nil {
ctx.proxys, err = parseProxy(ctx.option.Proxy)
if err != nil {
return tools.WrapError(errFatal, errors.New("tempRequest init proxy error"), err)
}
ctx.proxys = []*url.URL{tempProxy}
}
if l := len(ctx.option.Proxys); l > 0 {
ctx.proxys = make([]*url.URL, l)
for i, proxy := range ctx.option.Proxys {
tempProxy, err := gtls.VerifyProxy(proxy)
if err != nil {
return tools.WrapError(errFatal, errors.New("tempRequest init proxy error"), err)
}
ctx.proxys[i] = tempProxy
}
}
//init ctx,cnl
if ctx.option.Timeout > 0 { //超时