Created
September 25, 2012 13:25
-
-
Save deanberris/3781810 to your computer and use it in GitHub Desktop.
HTTP Client Requests with streaming data.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace http = network::http; | |
namespace util = network::util; | |
http::client client; | |
auto fr = client.get( | |
{"https://www.myservice.com/", | |
util::gzip_encode(new file_byte_source{"/tmp/data"})} | |
); // we're gzip encoding the request body | |
auto r = fr.get(); | |
std::string data = r.read(getpagesize()).get(); | |
while (!data.empty()) { | |
std::cout << data; | |
data = r.read(getpagesize()).get(); | |
} // will print data as it comes |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment