本文整理汇总了C++中HTTPResponse::source_port方法的典型用法代码示例。如果您正苦于以下问题:C++ HTTPResponse::source_port方法的具体用法?C++ HTTPResponse::source_port怎么用?C++ HTTPResponse::source_port使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类HTTPResponse
的用法示例。
在下文中一共展示了HTTPResponse::source_port方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: printHTTPResponseRecord
void printHTTPResponseRecord(const HTTPResponse &record) {
static size_t index;
static bool match;
/* -cA (client address) option. */
if (clientAddressRanges.size() > 0) {
match = false;
for (index = 0; index < clientAddressRanges.size(); ++index) {
if (record.destination_ip() >= clientAddressRanges[index].first &&
record.destination_ip() <= clientAddressRanges[index].second) {
match = true;
break;
}
}
if (!match) {
return;
}
}
/* -sA (server address) option. */
if (serverAddressRanges.size() > 0) {
match = false;
for (index = 0; index < serverAddressRanges.size(); ++index) {
if (record.source_ip() >= serverAddressRanges[index].first &&
record.source_ip() <= serverAddressRanges[index].second) {
match = true;
break;
}
}
if (!match) {
return;
}
}
cout << left << setw(18) << "Time:"
<< getDisplayTime(record.time()) << endl
<< left << setw(18) << "Source IP:"
<< ipToText(record.source_ip()) << endl
<< left << setw(18) << "Source Port:"
<< record.source_port() << endl
<< left << setw(18) << "Destination IP:"
<< ipToText(record.destination_ip()) << endl
<< left << setw(18) << "Destination Port:"
<< record.destination_port() << endl;
cout << left << setw(18) << "HTTP Version:" << record.version() << endl
<< left << setw(18) << "Status Code:" << record.status() << ' ' << record.reason() << endl;
if (!record.response().empty()) {
cout << left << setw(18) << "Server Type:" << record.response() << endl;
}
if (!record.content_type().empty()) {
cout << left << setw(18) << "Content type:" << record.content_type() << endl;
}
cout << endl;
}