mirror of
https://github.com/WJQSERVER-STUDIO/ghproxy.git
synced 2026-02-03 00:01:10 +08:00
add docs
This commit is contained in:
parent
b02aaeba8a
commit
ff412f94ec
14 changed files with 386 additions and 104 deletions
|
|
@ -17,33 +17,3 @@ func removeWSHeader(req *http.Request) {
|
|||
req.Header.Del("Upgrade")
|
||||
req.Header.Del("Connection")
|
||||
}
|
||||
|
||||
/*
|
||||
func reWriteEncodeHeader(req *http.Request) {
|
||||
|
||||
if isGzipAccepted(req.Header) {
|
||||
req.Header.Set("Content-Encoding", "gzip")
|
||||
req.Header.Set("Accept-Encoding", "gzip")
|
||||
} else {
|
||||
req.Header.Del("Content-Encoding")
|
||||
req.Header.Del("Accept-Encoding")
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// isGzipAccepted 检查 Accept-Encoding 头部中是否包含 gzip
|
||||
func isGzipAccepted(header http.Header) bool {
|
||||
// 获取 Accept-Encoding 的值
|
||||
encodings := header["Accept-Encoding"]
|
||||
for _, encoding := range encodings {
|
||||
// 将 encoding 字符串拆分为多个编码
|
||||
for _, enc := range strings.Split(encoding, ",") {
|
||||
// 去除空格并检查是否为 gzip
|
||||
if strings.TrimSpace(enc) == "gzip" {
|
||||
return true
|
||||
}
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
*/
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue