scanfing / HttpFileServer

http文件服务器 可用于局域网内目录浏览和文件下载、上传。-- http server for browse directory and download / upload files
Other
37 stars 5 forks source link

断点续传有点问题 #4

Closed frozleaf closed 2 years ago

frozleaf commented 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;
...

}

scanfing commented 2 years ago

谢谢