Closed frozleaf closed 2 years ago
// 文件 https://github.com/scanfing/HttpFileServer/blob/main/src/HttpFileServer/Handlers/HttpGetHandler.cs
/// /// 断点续传响应支持 /// /// protected async Task ResponseContentPartial(string path, HttpListenerRequest request, HttpListenerResponse response, bool onlyHead = false) { ... response.AddHeader("Content-Range", $"bytes {range.Item1}-{range.Item2}/{stream.Length}");
var buff = new byte[81920]; var rangeEnd = range.Item2 > range.Item1 ? range.Item2 : stream.Length - 1; // 此处应该为 // var bytesNeeds = rangeEnd + 1 - range.Item1; var bytesNeeds = rangeEnd - range.Item1; ...
}
谢谢
// 文件 https://github.com/scanfing/HttpFileServer/blob/main/src/HttpFileServer/Handlers/HttpGetHandler.cs
///
/// 断点续传响应支持
///
///
protected async Task ResponseContentPartial(string path, HttpListenerRequest request, HttpListenerResponse response, bool onlyHead = false)
{
...
response.AddHeader("Content-Range", $"bytes {range.Item1}-{range.Item2}/{stream.Length}");
}