本文整理汇总了C++中HttpHeader::authorizationNeeded方法的典型用法代码示例。如果您正苦于以下问题:C++ HttpHeader::authorizationNeeded方法的具体用法?C++ HttpHeader::authorizationNeeded怎么用?C++ HttpHeader::authorizationNeeded使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类HttpHeader
的用法示例。
在下文中一共展示了HttpHeader::authorizationNeeded方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: convertHttpCodeToUpdaterCode
//.........这里部分代码省略.........
{
TRACE_MESSAGE("Repeating the same request (without authorization switch), because server was reachable, but unexpectedly closed connection");
requestHasAlreadyBeenRepeated = true;
continue;
}
return receiveResponseAndDataResult;
}
previousResponseReceived = true;
requestHasAlreadyBeenRepeated = false;
m_authorizationDriver.authorized(
// authorization information is reset in case connection is to be closed
!needCloseConnection
// authorization success in case file received or successful redirect
&& (httpHeader.isFile()
|| httpHeader.redirectRequired()
|| httpHeader.fileNotFound()));
if(httpHeader.isFile())
{
// in case proxy server by some ocassion desided to close
// connection after successful file receive event
if(needCloseConnection)
m_authorizationDriver.resetNtlmState();
return CORE_NO_ERROR;
}
authorizationTarget = httpHeader.authorizationTarget();
authorizationWasNeededOnProxy = !proxyAuthorizationHeader.empty();
lastHttpCode = httpHeader.httpCode();
// authorization error
if(httpHeader.authorizationNeeded())
{
authorizationWasNeededOnProxy = (authorizationTarget == DownloadProgress::proxyServer);
if(!switchAuthorization(fileName, relativeUrlPath, httpHeader.authorizationTarget(), proxyAddress,
authorizationTypeSwitched, ntlmAuthorizationTriedAlready))
{
return httpHeader.convertHttpCodeToUpdaterCode();
}
}
// redirect needed
else if(httpHeader.redirectRequired())
{
// protection against infinite loop (according to RFC 2616)
if(++infiniteRedirectLoop > 2)
{
TRACE_MESSAGE2("Infinite redirection loop detected for location '%S'",
httpHeader.m_location.toWideChar());
return CORE_NO_SOURCE_FILE;
}
if(httpHeader.m_location.isAbsoluteUri())
serverAddress.parse(httpHeader.m_location);
else
{
serverAddress.parse(toProtocolPrefix(serverAddress.m_protocol) + serverAddress.m_hostname
+ serverAddress.m_path + httpHeader.m_location);
serverAddress.m_path.correctPathDelimiters();
}
fileName = serverAddress.m_fileName;
relativeUrlPath.erase();
TRACE_MESSAGE3("HTTP Redirect to file '%S' on server %S",