mirror of
https://github.com/valyala/fasthttp.git
synced 2026-06-14 15:56:44 +03:00
Copy to the req.Header.userAgent from the defaultUserAgent (#796)
This avoids the req.Header.userAgent sharing an underlying array with the global defaultUserAgent This should fix the #795
This commit is contained in:
committed by
GitHub
parent
32940977fb
commit
dc6b9db734
@@ -1321,7 +1321,7 @@ func (c *HostClient) doNonNilReqResp(req *Request, resp *Response) (bool, error)
|
||||
|
||||
userAgentOld := req.Header.UserAgent()
|
||||
if len(userAgentOld) == 0 {
|
||||
req.Header.userAgent = c.getClientName()
|
||||
req.Header.userAgent = append(req.Header.userAgent[:0], c.getClientName()...)
|
||||
}
|
||||
bw := c.acquireWriter(conn)
|
||||
err = req.Write(bw)
|
||||
|
||||
Reference in New Issue
Block a user