本文整理汇总了C++中CUrl::GetHttpAll方法的典型用法代码示例。如果您正苦于以下问题:C++ CUrl::GetHttpAll方法的具体用法?C++ CUrl::GetHttpAll怎么用?C++ CUrl::GetHttpAll使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CUrl
的用法示例。
在下文中一共展示了CUrl::GetHttpAll方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ExecuteGet
//.........这里部分代码省略.........
Trace(tagHttp, levInfo, ("CHttpRequest - ExecuteGet {%d/%d}", Result, m_RStatusValue));
if (! Result) {
return -1;
}
CString l_RedirectLoc;
CUrl ResolvedUrl;
switch(m_RStatusValue) {
case 407:
// $(TODO)
break;
case 401:
// any valid authentication stage
if (m_ServerAuthState.GetLeg() == AUTHENTICATION_STATE_NONE) {
// we need to send credentials
m_ServerAuthState.SetLeg(AUTHENTICATION_STATE_PRECHALENGE);
bContinueExecuteGet = true;
} else if (m_ServerAuthState.GetLeg() == AUTHENTICATION_STATE_CHALENGE) {
nCredentialsIndex ++;
// equal, because we do want to run once without username/password credentials
if (nCredentialsIndex <= m_ServerAuthState.GetSize()) {
bContinueExecuteGet = true;
}
m_ServerAuthState.SetLeg(AUTHENTICATION_STATE_PRECHALENGE);
bKeepAlive = false;
} else if (m_ServerAuthState.GetLeg() == AUTHENTICATION_STATE_PRECHALENGE) {
m_ServerAuthState.SetLeg(AUTHENTICATION_STATE_CHALENGE);
bContinueExecuteGet = true;
bKeepAlive = true;
}
break;
case 301: /* redirections */
case 302:
case 303:
case 307:
l_RedirectLoc = m_RFields.FindElement(g_strHttpLocation).GetValue(g_strHttpLocation);
if (! l_RedirectLoc.GetLength()) {
Trace(tagHttp, levInfo, ("CHttpRequest - GetHTTP - %d redirection without a Location: header.", m_RStatusValue));
break;
}
// HTTP 1.1 - Temporary Redirect is 302 and 307
// m_RRedirections is relevant for final URL address
// that could be retrieved
ResolvedUrl = m_Url.Resolve(l_RedirectLoc);
l_RedirectLoc = ResolvedUrl.GetHttpAll();
if (m_FollowRedirections && m_RRedirections.Contains(l_RedirectLoc)) {
// avoid circular redirections
Trace(tagHttp, levInfo, ("CHttpRequest - GetHTTP - circular redirection %s", l_RedirectLoc.GetBuffer()));
return m_RStatusValue;
} else m_RRedirections.Add(l_RedirectLoc);
if (!m_FollowRedirections)
return m_RStatusValue;
if (m_ClientSocket.GetVerbose())
cout << "\n\t[" << l_RedirectLoc << "]";
ClearResults(false);
m_Url.SetUrl(l_RedirectLoc);
bContinueExecuteGet = true;
break;
case 305: /* use proxy */
l_RedirectLoc = m_RFields.FindElement(g_strHttpLocation).GetValue(g_strHttpLocation);
if (! l_RedirectLoc.GetLength())
break;
// HTTP 1.1 - Temporary Redirect is 302 and 307
// m_RRedirections is relevant for final URL address
// that could be retrieved
ClearResults(false);
m_Proxy.SetUrl(l_RedirectLoc);
bContinueExecuteGet = true;
break;
};
Trace(tagHttp, levInfo, ("CHttpRequest - GetHTTP - %d", m_RStatusValue));
} while (bContinueExecuteGet);
return m_RStatusValue;
}