Skip to content

Commit 08ce95b

Browse files
committed
fix: check pool net set headers
1 parent c746c26 commit 08ce95b

File tree

3 files changed

+9
-9
lines changed

3 files changed

+9
-9
lines changed

core/pool/brutepool.go

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -107,14 +107,6 @@ type BrutePool struct {
107107
}
108108

109109
func (pool *BrutePool) Init() error {
110-
if pool.Headers.Get("User-Agent") == "" {
111-
pool.Headers.Set("User-Agent", pkg.DefaultUserAgent)
112-
}
113-
114-
if pool.Headers.Get("Accept") == "" {
115-
pool.Headers.Set("Accept", "*/*")
116-
}
117-
118110
pool.initwg.Add(2)
119111
if pool.Index != "/" {
120112
logs.Log.Logf(pkg.LogVerbose, "custom index url: %s", pkg.BaseURL(pool.url)+pkg.FormatURL(pkg.BaseURL(pool.url), pool.Index))

core/pool/checkpool.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ func NewCheckPool(ctx context.Context, config *Config) (*CheckPool, error) {
3636
processCh: make(chan *baseline.Baseline, config.Thread),
3737
},
3838
}
39-
pool.Headers = map[string]string{"Connection": "close"}
39+
pool.Headers.Set("Connection", "close")
4040
p, _ := ants.NewPoolWithFunc(config.Thread, pool.Invoke)
4141

4242
pool.Pool = p

core/runner.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,14 @@ func (r *Runner) PrepareConfig() *pool.Config {
114114
config.Headers.Set(k, v)
115115
}
116116

117+
if config.Headers.Get("User-Agent") == "" {
118+
config.Headers.Set("User-Agent", pkg.DefaultUserAgent)
119+
}
120+
121+
if config.Headers.Get("Accept") == "" {
122+
config.Headers.Set("Accept", "*/*")
123+
}
124+
117125
return config
118126
}
119127

0 commit comments

Comments
 (0)