mirror of
https://github.com/TeaOSLab/EdgeNode.git
synced 2025-12-08 02:40:32 +08:00
根据Accept-Encoding决定是否解压响应内容
This commit is contained in:
@@ -5,6 +5,7 @@ package compressions
|
||||
import (
|
||||
"github.com/andybalholm/brotli"
|
||||
"io"
|
||||
"strings"
|
||||
)
|
||||
|
||||
type BrotliReader struct {
|
||||
@@ -16,7 +17,11 @@ func NewBrotliReader(reader io.Reader) (Reader, error) {
|
||||
}
|
||||
|
||||
func (this *BrotliReader) Read(p []byte) (n int, err error) {
|
||||
return this.reader.Read(p)
|
||||
n, err = this.reader.Read(p)
|
||||
if err != nil && strings.Contains(err.Error(), "excessive") {
|
||||
err = io.EOF
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func (this *BrotliReader) Close() error {
|
||||
|
||||
Reference in New Issue
Block a user