mirror of
https://github.com/chainreactors/spray.git
synced 2025-09-15 11:40:13 +00:00
fix: map panic, https://github.com/chainreactors/spray/issues/93
This commit is contained in:
parent
0e9d094dd1
commit
b13903ea98
@ -32,16 +32,8 @@ type Request struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (r *Request) SetHeaders(header map[string]string, RandomUA bool) {
|
func (r *Request) SetHeaders(header map[string]string, RandomUA bool) {
|
||||||
if header["User-Agent"] == "" {
|
if RandomUA {
|
||||||
if RandomUA {
|
r.SetHeader("User-Agent", pkg.RandomUA())
|
||||||
header["User-Agent"] = pkg.RandomUA()
|
|
||||||
} else {
|
|
||||||
header["User-Agent"] = pkg.DefaultUserAgent
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if header["Accept"] == "" {
|
|
||||||
header["Accept"] = "*/*"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if r.StandardRequest != nil {
|
if r.StandardRequest != nil {
|
||||||
|
@ -107,6 +107,14 @@ type BrutePool struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (pool *BrutePool) Init() error {
|
func (pool *BrutePool) Init() error {
|
||||||
|
if pool.Headers["User-Agent"] == "" {
|
||||||
|
pool.Headers["User-Agent"] = pkg.DefaultUserAgent
|
||||||
|
}
|
||||||
|
|
||||||
|
if pool.Headers["Accept"] == "" {
|
||||||
|
pool.Headers["Accept"] = "*/*"
|
||||||
|
}
|
||||||
|
|
||||||
pool.initwg.Add(2)
|
pool.initwg.Add(2)
|
||||||
if pool.Index != "/" {
|
if pool.Index != "/" {
|
||||||
logs.Log.Logf(pkg.LogVerbose, "custom index url: %s", pkg.BaseURL(pool.url)+pkg.FormatURL(pkg.BaseURL(pool.url), pool.Index))
|
logs.Log.Logf(pkg.LogVerbose, "custom index url: %s", pkg.BaseURL(pool.url)+pkg.FormatURL(pkg.BaseURL(pool.url), pool.Index))
|
||||||
@ -394,7 +402,6 @@ func (pool *BrutePool) NoScopeInvoke(v interface{}) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
req.SetHeaders(pool.Headers, pool.RandomUserAgent)
|
req.SetHeaders(pool.Headers, pool.RandomUserAgent)
|
||||||
req.SetHeader("User-Agent", pkg.RandomUA())
|
|
||||||
resp, reqerr := pool.client.Do(req)
|
resp, reqerr := pool.client.Do(req)
|
||||||
if pool.ClientType == ihttp.FAST {
|
if pool.ClientType == ihttp.FAST {
|
||||||
defer fasthttp.ReleaseResponse(resp.FastResponse)
|
defer fasthttp.ReleaseResponse(resp.FastResponse)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user