mirror of
https://github.com/RuoJi6/ARTEX.git
synced 2026-12-04 04:31:51 +08:00
fix: select random browser user agents for outbound HTTP
This commit is contained in:
1 parent
17c2fc5e08
commit
171db405dd
18 files changed
+205
-71
No files matched your search
@@ -122,7 +122,6 @@ func staticAssetExt(rawURL string) string {
|
||||
}
|
||||
|
||||
func webFetchRunner(cfg actool.WebFetchConfig) func(context.Context, json.RawMessage, *actool.ToolContext) (actool.Result, error) {
|
||||
userAgent := httpidentity.UserAgent()
|
||||
client := newFetchClient(cfg)
|
||||
// direct is the no-proxy fallback used when a proxied fetch fails for a
|
||||
// proxy-caused reason (closed tunnel / failed CONNECT / TLS or HTTP2 mismatch):
|
||||
@@ -152,6 +151,7 @@ func webFetchRunner(cfg actool.WebFetchConfig) func(context.Context, json.RawMes
|
||||
if err != nil {
|
||||
return actool.Errorf("Error: " + err.Error()), nil
|
||||
}
|
||||
userAgent := httpidentity.UserAgent()
|
||||
req.Header.Set("User-Agent", userAgent)
|
||||
resp, err := client.Do(req)
|
||||
// One direct retry when the proxied attempt failed for a proxy-caused reason.
|
||||
|
||||
Reference in new issue
Block a user