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
..
2023-03-24 09:08:53 +08:00
2025-07-31 14:26:06 +08:00
2021-05-29 17:11:41 +08:00
2024-11-18 13:33:32 +08:00
2023-03-24 09:08:53 +08:00
2022-02-28 00:21:48 +08:00
2025-07-31 15:27:17 +08:00
2025-07-31 15:27:17 +08:00
2025-07-26 15:14:15 +08:00
2024-05-10 22:23:45 +09:00
2025-06-17 00:17:04 +08:00
2025-02-24 09:12:12 +08:00
2023-03-24 09:08:53 +08:00
2024-11-12 19:52:12 +08:00
2024-09-22 00:43:48 +03:00