mirror of
https://github.com/ZLMediaKit/ZLMediaKit.git
synced 2024-11-22 10:40:05 +08:00
解决断点续传返回416的问题
This commit is contained in:
parent
ae4c724005
commit
ca54cb9d31
@ -34,6 +34,11 @@ void HttpDownloader::startDownload(const string& url, const string& filePath,boo
|
||||
}
|
||||
if(bAppend){
|
||||
auto currentLen = ftell(_saveFile);
|
||||
if(currentLen){
|
||||
//最少续传一个字节,怕遇到http 416的错误
|
||||
currentLen -= 1;
|
||||
fseek(_saveFile,-1,SEEK_CUR);
|
||||
}
|
||||
addHeader("Range", StrPrinter << "bytes=" << currentLen << "-" << endl);
|
||||
}
|
||||
setMethod("GET");
|
||||
|
@ -16,7 +16,7 @@ namespace Http {
|
||||
class HttpDownloader: public HttpClientImp {
|
||||
public:
|
||||
typedef std::shared_ptr<HttpDownloader> Ptr;
|
||||
typedef std::function<void(int code,const char *errMsg,const char *filePath)> onDownloadResult;
|
||||
typedef std::function<void(ErrCode code,const char *errMsg,const char *filePath)> onDownloadResult;
|
||||
HttpDownloader();
|
||||
virtual ~HttpDownloader();
|
||||
//开始下载文件,默认断点续传方式下载
|
||||
|
Loading…
Reference in New Issue
Block a user