rework client using async api

This commit is contained in:
Chunting Gu
2021-04-16 19:07:31 +08:00
parent 7f345b7a4e
commit f5210ba1a2
27 changed files with 855 additions and 522 deletions
+4 -1
View File
@@ -27,7 +27,10 @@ int main(int argc, char* argv[]) {
webcc::ClientSession session;
try {
auto r = session.Send(webcc::RequestBuilder{}.Get(url)(), true);
auto r = session.Send(webcc::RequestBuilder{}.Get(url)(), true,
[](std::size_t length, std::size_t total_length) {
std::cout << "Progress " << length << " / " << total_length << std::endl;
});
if (auto file_body = r->file_body()) {
file_body->Move(path);