1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2024-12-30 05:56:54 -05:00

Prevent UA from being set to golang's default ones

Go automatically sets HTTP header `User-Agent' to `Go-http-client/1.1'
if it hasn't been set before, which in some cases breaks the
transparency of proxy.

Such behavior can be prevented by setting it to an empty string.
This commit is contained in:
Valture 2017-11-05 19:24:26 +00:00
parent e60de73c70
commit 973378d610

View File

@ -212,6 +212,11 @@ func StripHopByHopHeaders(header http.Header) {
for _, h := range strings.Split(connections, ",") {
header.Del(strings.TrimSpace(h))
}
// Prevent UA from being set to golang's default ones
if len(header.Get("User-Agent")) == 0 {
header.Set("User-Agent", "")
}
}
var errWaitAnother = newError("keep alive")