Browse Source

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

ithewei 2 years ago
parent
commit
da91850b4c
1 changed files with 3 additions and 1 deletions
  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());
         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) {
             progress_cb(from, content_length);