本文整理汇总了C++中HttpHeader::redirectRequired方法的典型用法代码示例。如果您正苦于以下问题:C++ HttpHeader::redirectRequired方法的具体用法?C++ HttpHeader::redirectRequired怎么用?C++ HttpHeader::redirectRequired使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类HttpHeader
的用法示例。
在下文中一共展示了HttpHeader::redirectRequired方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: convertHttpCodeToUpdaterCode
//.........这里部分代码省略.........
const bool needCloseConnection = httpHeader.needCloseConnection(useProxy)
|| (receiveResponseAndDataResult != CORE_NO_ERROR);
if(needCloseConnection)
{
TRACE_MESSAGE2("Closing connection to HTTP server, get file result %S",
toString(receiveResponseAndDataResult).toWideChar());
closeSession();
}
if(receiveResponseAndDataResult != CORE_NO_ERROR)
{
TRACE_MESSAGE2("Failed to receive HTTP response, error %S",
toString(receiveResponseAndDataResult).toWideChar());
if((receiveResponseAndDataResult == CORE_REMOTE_HOST_CLOSED_CONNECTION)
&& previousResponseReceived && authorizationTypeSwitched && !requestHasAlreadyBeenRepeated)
{
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)
{