iterate_response_headers.cpp
// 応答を読み取り、解析
beast::flat_buffer buffer;
http::response<http::dynamic_body> res;
http::read(stream, buffer, res);
// 応答ヘッダーを反復処理
for (auto it = res.begin(); it != res.end(); ++it) {
std::cout << it->name_string() << ": " << it->value() << "\n";
}
// ... または特定のヘッダーを取得
cout << res["Content-Length"] << endl;この記事が役に立った場合は、TechOverflow での新しい記事の調査と公開を支援するため、「Buy Me a Coffee」でのご支援、または PayPal 経由でのご寄付をご検討ください