Processing HTTP responses

    resp=ua->request(x::http::GET, "https://localhost");

std::cout << resp->message.getStatusCode()
      << " " << resp->message.getReasonPhrase() << std::endl;

for (auto hdr: resp->message)
    std::cout << hdr.first << "="
          << hdr.second.value() << std::endl;

if (resp->has_content())
    std::copy(resp->begin(), resp->end(),
    std::cout << std::flush;

request() returns response to an HTTP request. Note that certain fatal errors, like a failure to connect to the requested server, result in a thrown exception, rather than a response object.

x::http::useragent::base::response is a reference to a reference-counted object that contains the following: