Skip to content

Commit

Permalink
Copy to the req.Header.userAgent from the defaultUserAgent (#796)
Browse files Browse the repository at this point in the history
This avoids the req.Header.userAgent sharing an underlying array with the
global defaultUserAgent

This should fix the #795
  • Loading branch information
junxiang-viper committed Apr 30, 2020
1 parent 3294097 commit dc6b9db
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion client.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit dc6b9db

Please sign in to comment.