mirror of
https://github.com/woodchen-ink/proxy-go.git
synced 2025-07-19 17:01:56 +08:00
优化Accept-Encoding请求头的设置逻辑,确保在存在该头时使用其值,否则删除该头,以提高代理请求的兼容性和稳定性。
This commit is contained in:
parent
4156b64ac6
commit
0335640df5
@ -288,8 +288,10 @@ func (h *ProxyHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 确保设置Accept-Encoding - 避免冗余字符串操作
|
// 确保设置Accept-Encoding - 避免冗余字符串操作
|
||||||
if r.Header.Get("Accept-Encoding") == "" {
|
if ae := r.Header.Get("Accept-Encoding"); ae != "" {
|
||||||
proxyReq.Header.Set("Accept-Encoding", "gzip, deflate, br")
|
proxyReq.Header.Set("Accept-Encoding", ae)
|
||||||
|
} else {
|
||||||
|
proxyReq.Header.Del("Accept-Encoding")
|
||||||
}
|
}
|
||||||
|
|
||||||
// 特别处理图片请求
|
// 特别处理图片请求
|
||||||
|
Loading…
x
Reference in New Issue
Block a user