本文整理汇总了C++中NPT_HttpMessage::GetHeaders方法的典型用法代码示例。如果您正苦于以下问题:C++ NPT_HttpMessage::GetHeaders方法的具体用法?C++ NPT_HttpMessage::GetHeaders怎么用?C++ NPT_HttpMessage::GetHeaders使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NPT_HttpMessage
的用法示例。
在下文中一共展示了NPT_HttpMessage::GetHeaders方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: IsConnectionKeepAlive
//////////////////////////////////////////////////////////////////////////
// CHttpHelper
bool CHttpHelper::IsConnectionKeepAlive(NPT_HttpMessage& message)
{
const NPT_String* connection =
message.GetHeaders().GetHeaderValue(NPT_HTTP_HEADER_CONNECTION);
// the DLNA says that all HTTP 1.0 requests should be closed immediately by the server
NPT_String protocol = message.GetProtocol();
if (protocol.Compare(NPT_HTTP_PROTOCOL_1_0, true) == 0) return false;
// all HTTP 1.1 requests without a Connection header
// or with a keep-alive Connection header should be kept alive if possible
return (!connection || connection->Compare("keep-alive", true) == 0);
}
示例2:
/*----------------------------------------------------------------------
| PLT_HttpHelper::IsConnectionKeepAlive
+---------------------------------------------------------------------*/
bool
PLT_HttpHelper::IsConnectionKeepAlive(NPT_HttpMessage& message)
{
const NPT_String* connection =
message.GetHeaders().GetHeaderValue(NPT_HTTP_HEADER_CONNECTION);
// the DLNA says that all HTTP 1.0 requests should be closed immediately by the server
// all HTTP 1.1 requests without a Connection header or with a Connection header
// NOT saying "Close" should be kept alive
NPT_String protocol = message.GetProtocol();
if (!protocol.Compare(NPT_HTTP_PROTOCOL_1_1, true) &&
(!connection || connection->Compare("close", true))) {
return true;
}
return false;
}