!2 fix:response error

Merge pull request !2 from samwaf/fix_IBU1DX
This commit is contained in:
samwaf
2025-03-19 02:44:05 +00:00
committed by Gitee
+5 -8
View File
@@ -655,16 +655,13 @@ func (waf *WafEngine) modifyResponse() func(*http.Response) error {
}
}
}
//将数据在回写上去
finalCompressBytes, _ := waf.compressContent(resp, orgContentBytes)
resp.Body = io.NopCloser(bytes.NewBuffer(finalCompressBytes))
// head 修改追加内容
resp.ContentLength = int64(len(finalCompressBytes))
resp.Header.Set("Content-Length", strconv.FormatInt(int64(len(finalCompressBytes)), 10))
}
}
//将数据在回写上去
finalCompressBytes, _ := waf.compressContent(resp, orgContentBytes)
resp.Body = io.NopCloser(bytes.NewBuffer(finalCompressBytes))
resp.ContentLength = int64(len(finalCompressBytes))
resp.Header.Set("Content-Length", strconv.FormatInt(int64(len(finalCompressBytes)), 10))
} else {
resp.Body = io.NopCloser(bytes.NewBuffer(orgContentBytes))