This commit is contained in:
wjqserver 2025-04-17 22:20:06 +08:00
parent 7e5b12dff8
commit dd2f5b5a12
7 changed files with 50 additions and 8 deletions

View file

@ -246,7 +246,7 @@ func extractParts(rawURL string) (string, string, string, url.Values, error) {
var urlPattern = regexp.MustCompile(`https?://[^\s'"]+`)
// processLinks 处理链接,返回包含处理后数据的 io.Reader
func processLinks(input io.Reader, compress string, host string, cfg *config.Config) (readerOut io.Reader, written int64, err error) {
func processLinks(input io.ReadCloser, compress string, host string, cfg *config.Config) (readerOut io.Reader, written int64, err error) {
pipeReader, pipeWriter := io.Pipe() // 创建 io.Pipe
readerOut = pipeReader
@ -268,6 +268,13 @@ func processLinks(input io.Reader, compress string, host string, cfg *config.Con
}
}()
defer func() {
if err := input.Close(); err != nil {
logError("input close failed: %v", err)
}
}()
var bufReader *bufio.Reader
if compress == "gzip" {