I am considering using cpp netlib for a new project. All of the examples show reading the body of the response in a blocking manner:
client::response response_ = client_.get(request_);
std::string body_ = body(response_);
If I construct my client object with the async tag:
basic_client<http_async_8bit_udp_resolve_tags, 1, 1> client_();
What affect does that have?
Is it possible to get the results of the body wrapper as a boost::shared_future<std::string>?
Do I just need to wrap the blocking call in it's own thread?
Look at the current http client doc: http://cpp-netlib.org/0.12.0/reference/http_client.html
you have an option to provide a callback function or object in the
getorpostcall:The
client::responseobject already incapsulates thefutureobject: