diff --git a/internal/protocol/http/fetcher.go b/internal/protocol/http/fetcher.go index 5369bc1b..bda1a457 100644 --- a/internal/protocol/http/fetcher.go +++ b/internal/protocol/http/fetcher.go @@ -451,10 +451,11 @@ func (f *Fetcher) splitChunk() (chunks []*chunk) { } func (f *Fetcher) buildClient() *http.Client { - transport := &http.Transport{} + transport := &http.Transport{ + Proxy: f.ctl.ProxyConfig.ToHandler(), + } // Cookie handle jar, _ := cookiejar.New(nil) - transport.Proxy = f.ctl.ProxyConfig.ToHandler() return &http.Client{ Transport: transport, Jar: jar, diff --git a/pkg/download/engine/inject/xhr/module.go b/pkg/download/engine/inject/xhr/module.go index d43491a2..dd6e0a77 100644 --- a/pkg/download/engine/inject/xhr/module.go +++ b/pkg/download/engine/inject/xhr/module.go @@ -203,11 +203,8 @@ func (xhr *XMLHttpRequest) Send(data goja.Value) { for k, v := range xhr.requestHeaders { req.Header.Set(k, v) } - var transport *http.Transport - if xhr.proxyHandler != nil { - transport = &http.Transport{ - Proxy: xhr.proxyHandler, - } + transport := &http.Transport{ + Proxy: xhr.proxyHandler, } client := &http.Client{ Transport: transport,