本文整理汇总了C++中HTTPResponse::getComponents方法的典型用法代码示例。如果您正苦于以下问题:C++ HTTPResponse::getComponents方法的具体用法?C++ HTTPResponse::getComponents怎么用?C++ HTTPResponse::getComponents使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类HTTPResponse
的用法示例。
在下文中一共展示了HTTPResponse::getComponents方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: outputResponse
void SitemonApp::outputResponse(HTTPRequest &request, HTTPResponse &response)
{
std::cout << "Final URL:\t\t" << response.finalURL << "\n";
std::cout << "Respone code:\t\t" << response.responseCode << "\n\n";
std::cout << "DNS Lookup:\t\t" << response.lookupTime << " seconds.\n";
std::cout << "Connection:\t\t" << response.connectTime << " seconds.\n";
std::cout << "Data start:\t\t" << response.dataStartTime << " seconds.\n";
if (response.redirectCount)
{
std::cout << "Redirect count:\t\t" << response.redirectCount << ".\n";
std::cout << "Redirect time:\t\t" << response.redirectTime << " seconds.\n";
}
// std::cout << "Data transfer:\t\t" << response.dataTransferTime << " seconds.\n";
std::cout << "Total time:\t\t" << response.totalTime << " seconds.\n\n";
std::cout << "HTML Content size:\t" << response.contentSize << "\n";
std::cout << "HTML Download size:\t" << response.downloadSize << "\n";
if (response.contentSize > response.downloadSize)
{
int compression = 100 - (int)(((double)response.downloadSize / response.contentSize) * 100.0);
std::cout << "Compression Savings:\t" << compression << "%\n";
std::cout << "Content Encoding:\t" << response.contentEncoding << "\n";
}
if (request.getDownloadContent())
{
std::cout << "Total Content size:\t" << response.totalContentSize << "\n";
std::cout << "Total Download size:\t" << response.totalDownloadSize << "\n";
if (response.componentProblem)
{
std::cout << "Issues downloading one or more components:\n";
const std::vector<HTTPComponentResponse> &components = response.getComponents();
std::vector<HTTPComponentResponse>::const_iterator it = components.begin();
for (; it != components.end(); ++it)
{
const HTTPComponentResponse &compResponse = *it;
if (compResponse.errorCode != HTTP_OK || compResponse.responseCode != 200)
{
printf("%i\t%ld\t%s\n", compResponse.errorCode, compResponse.responseCode, compResponse.requestedURL.c_str());
}
}
}
}
}