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
..
2025-05-24 07:49:15 +08:00
2024-11-18 23:50:20 +08:00
2025-12-05 02:10:37 +00:00