mirror of
https://github.com/TeaOSLab/EdgeCommon.git
synced 2026-02-02 17:15:48 +08:00
支持ZSTD压缩
This commit is contained in:
@@ -49,6 +49,7 @@ type HTTPCompressionConfig struct {
|
||||
supportGzip bool
|
||||
supportDeflate bool
|
||||
supportBrotli bool
|
||||
supportZSTD bool
|
||||
}
|
||||
|
||||
// Init 初始化
|
||||
@@ -133,6 +134,8 @@ func (this *HTTPCompressionConfig) Init() error {
|
||||
if this.BrotliRef == nil || (this.BrotliRef != nil && this.BrotliRef.IsOn && this.Brotli != nil && this.Brotli.IsOn) {
|
||||
this.supportBrotli = true
|
||||
}
|
||||
case HTTPCompressionTypeZSTD:
|
||||
this.supportZSTD = true
|
||||
}
|
||||
}
|
||||
|
||||
@@ -244,6 +247,10 @@ func (this *HTTPCompressionConfig) MatchAcceptEncoding(acceptEncodings string) (
|
||||
if this.supportBrotli && lists.ContainsString(encodings, "br") {
|
||||
return HTTPCompressionTypeBrotli, "br", true
|
||||
}
|
||||
case HTTPCompressionTypeZSTD:
|
||||
if this.supportZSTD && lists.ContainsString(encodings, "zstd") {
|
||||
return HTTPCompressionTypeZSTD, "zstd", true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -8,4 +8,5 @@ const (
|
||||
HTTPCompressionTypeGzip HTTPCompressionType = "gzip"
|
||||
HTTPCompressionTypeDeflate HTTPCompressionType = "deflate"
|
||||
HTTPCompressionTypeBrotli HTTPCompressionType = "brotli"
|
||||
HTTPCompressionTypeZSTD HTTPCompressionType = "zstd"
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user