@@ -12,8 +12,6 @@ import (
1212 "io"
1313 "net"
1414 "net/http"
15- "net/http/cookiejar"
16- "net/url"
1715 "regexp"
1816 "runtime"
1917 "strconv"
@@ -83,20 +81,22 @@ type BasicAuth struct {
8381}
8482
8583func init () {
86- jar , _ := cookiejar .New (nil )
8784 DefaultClient = & http.Client {
8885 Timeout : httpTimeout ,
8986 Transport : & http.Transport {
9087 Proxy : http .ProxyFromEnvironment ,
9188 DialContext : amassnet .DialContext ,
92- MaxIdleConns : 200 ,
93- MaxConnsPerHost : 50 ,
89+ ForceAttemptHTTP2 : false ,
90+ MaxIdleConns : 128 ,
91+ MaxConnsPerHost : 8 ,
92+ MaxIdleConnsPerHost : 1 ,
9493 IdleConnTimeout : 10 * time .Second ,
9594 TLSHandshakeTimeout : handshakeTimeout ,
96- ExpectContinueTimeout : 5 * time .Second ,
95+ ResponseHeaderTimeout : 5 * time .Second ,
96+ ExpectContinueTimeout : 1 * time .Second ,
9797 TLSClientConfig : & tls.Config {InsecureSkipVerify : true },
9898 },
99- Jar : jar ,
99+ Jar : nil ,
100100 }
101101
102102 switch runtime .GOOS {
@@ -170,28 +170,6 @@ func RespToAmassResponse(resp *http.Response) *Response {
170170 }
171171}
172172
173- // CopyCookies copies cookies from one domain to another. Some of our data
174- // sources rely on shared auth tokens and this avoids sending extra requests
175- // to have the site reissue cookies for the other domains.
176- func CopyCookies (src string , dest string ) {
177- srcURL , _ := url .Parse (src )
178- destURL , _ := url .Parse (dest )
179- DefaultClient .Jar .SetCookies (destURL , DefaultClient .Jar .Cookies (srcURL ))
180- }
181-
182- // CheckCookie checks if a cookie exists in the cookie jar for a given host
183- func CheckCookie (urlString string , cookieName string ) bool {
184- cookieURL , _ := url .Parse (urlString )
185- found := false
186- for _ , cookie := range DefaultClient .Jar .Cookies (cookieURL ) {
187- if cookie .Name == cookieName {
188- found = true
189- break
190- }
191- }
192- return found
193- }
194-
195173// RequestWebPage returns the response headers, body, and status code for the provided URL when successful.
196174func RequestWebPage (ctx context.Context , r * Request ) (* Response , error ) {
197175 if r == nil {
0 commit comments