浏览代码

fix #350: if resp.body.size != range_bytes

ithewei 2 年之前
父节点
当前提交
da91850b4c
共有 1 个文件被更改,包括 3 次插入1 次删除
  1. 3 1
      examples/wget.cpp

+ 3 - 1
examples/wget.cpp

@@ -104,7 +104,9 @@ static int wget(const char* url, const char* filepath, wget_progress_cb progress
         }
         }
         printd("%s", resp.Dump(true, false).c_str());
         printd("%s", resp.Dump(true, false).c_str());
         file.write(resp.body.data(), resp.body.size());
         file.write(resp.body.data(), resp.body.size());
-        from = to + 1;
+        // fix: resp.body.size != range_bytes on some server
+        // from = to + 1;
+        from += resp.body.size();
 
 
         if (progress_cb) {
         if (progress_cb) {
             progress_cb(from, content_length);
             progress_cb(from, content_length);