kuaifan
9be6265220
fix(download): 大文件下载改用 BinaryFileResponse 走 sendfile
StreamedResponse 在 LaravelS/Swoole 下被 DynamicResponse 用 ob_start/
ob_get_clean 整体缓冲进 PHP 内存,约 700MB 文件会撞 memory_limit 导致
下载失败;且每次请求对整文件 md5_file 生成 ETag 开销巨大。
改为返回 BinaryFileResponse,由 LaravelS StaticResponse 走 Swoole 原生
sendfile(),OS 级零拷贝、不占 PHP 内存,可支持任意大小文件。去掉 ETag
全文件哈希改用 mtime。Swoole 环境下关闭 Range 分段(sendfile 只能整文件
发送,避免 206 头与整文件 body 错位),非 Swoole 环境保留原生 Range。
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-02 10:37:52 +00:00
..
2026-01-15 08:28:55 +00:00
2025-03-28 15:45:13 +08:00
2025-05-24 07:49:15 +08:00
2024-11-18 23:50:20 +08:00
2026-06-02 06:09:50 +00:00
2026-04-17 02:05:14 +00:00
2026-06-02 05:49:33 +00:00
2026-06-02 10:37:52 +00:00
2026-05-03 00:05:31 +00:00
2026-01-04 07:24:36 +00:00
2025-12-05 02:10:37 +00:00
2026-06-02 06:10:02 +00:00