Requests multiplexed over one HTTP/2 connection, and opting a request back to HTTP/1.1 through the .curl() escape hatch.
Requests multiplexed over one HTTP/2 connection, and opting a request back to HTTP/1.1 through the .curl() escape hatch.
#include <asio.hpp>
#include <iostream>
#include <string>
int main() {
asio::io_context io;
const std::string url = "https://postman-echo.com/get";
return res.header_data_.substr(0, res.header_data_.find('\r'));
};
for (int i = 1; i <= 4; ++i) {
http.
async_get(url, [i, status_line](std::error_code ec,
std::cout << "stream #" << i << " "
<< (ec ? ec.message() : status_line(res)) << "\n";
});
}
curl_easy_setopt(h, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1);
})
std::cout << "forced 1.1 " << (ec ? ec.message() : status_line(res))
<< "\n";
});
io.run();
}
RequestBuilder & curl(std::function< void(CURL *)> fn)
Definition cofetch.h:366
RequestBuilder request(std::string url)
Start a fluent request chain: request(url).body(...).post(token).
Definition cofetch.h:412
auto async_get(std::string url, CompletionToken &&token)
Definition cofetch.h:324