本文整理汇总了C++中PHTTP_BMO_REQ_OBJECT::GetHeaderValueById方法的典型用法代码示例。如果您正苦于以下问题:C++ PHTTP_BMO_REQ_OBJECT::GetHeaderValueById方法的具体用法?C++ PHTTP_BMO_REQ_OBJECT::GetHeaderValueById怎么用?C++ PHTTP_BMO_REQ_OBJECT::GetHeaderValueById使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PHTTP_BMO_REQ_OBJECT
的用法示例。
在下文中一共展示了PHTTP_BMO_REQ_OBJECT::GetHeaderValueById方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: if
ANSC_STATUS
CcspCwmpAcscoHttpBspBrowse
(
ANSC_HANDLE hThisObject,
ANSC_HANDLE hBmoReq,
ANSC_HANDLE hBmoRep,
ANSC_HANDLE hReqContext
)
{
ANSC_STATUS returnStatus = ANSC_STATUS_SUCCESS;
PCCSP_CWMP_ACS_CONNECTION_OBJECT pMyObject = (PCCSP_CWMP_ACS_CONNECTION_OBJECT)hThisObject;
PHTTP_BMO_REQ_OBJECT pHttpBmoReq = (PHTTP_BMO_REQ_OBJECT )hBmoReq;
PHTTP_BMO_REP_OBJECT pHttpBmoRep = (PHTTP_BMO_REP_OBJECT )hBmoRep;
PANSC_ACS_INTERN_HTTP_CONTENT pHttpGetReq = (PANSC_ACS_INTERN_HTTP_CONTENT )hReqContext;
PHTTP_RESPONSE_INFO pHttpRepInfo = (PHTTP_RESPONSE_INFO )pHttpBmoRep->GetRepInfo ((ANSC_HANDLE)pHttpBmoRep);
ULONG ulResponseSize = (ULONG )pHttpBmoRep->GetBodySize((ANSC_HANDLE)pHttpBmoRep);
char* pHttpResponse = (char* )NULL;
char* pHeaderLocation = NULL;
char* pCookie = NULL;
ULONG ulCode = 0;
char* pCookieHeader = NULL;
ULONG ulCookieIndex = 0;
BOOL bCookiesRemoved = FALSE;
if ( pHttpGetReq == NULL)
{
return ANSC_STATUS_FAILURE;
}
ulCode = pHttpBmoRep->GetCode((ANSC_HANDLE)pHttpBmoRep);
if( HTTP_STATUS_NO_CONTENT == ulCode) /* ACS has nothing to say */
{
if( pHttpGetReq != NULL)
{
pHttpGetReq->ulContentSize = 0;
pHttpGetReq->pContent = NULL;
pHttpGetReq->bIsRedirect = FALSE;
}
returnStatus = ANSC_STATUS_SUCCESS;
goto EXIT1;
}
else if( HTTP_STATUS_MOVED_PERMANENTLY != ulCode &&
HTTP_STATUS_FOUND != ulCode &&
HTTP_STATUS_OK != ulCode &&
HTTP_STATUS_UNAUTHORIZED != ulCode &&
HTTP_STATUS_TEMP_REDIRECT != ulCode
)
{
returnStatus = ANSC_STATUS_FAILURE;
CcspTr069PaTraceDebug(("HttpClient returned code: %d\n", (int)ulCode));
goto EXIT1;
}
/* save Authorization header value */
if ( TRUE )
{
char* pAuthHeaderValue = NULL;
/* Authorization header in request */
pAuthHeaderValue = pHttpBmoReq->GetHeaderValueById((ANSC_HANDLE)pHttpBmoReq, HTTP_HEADER_ID_AUTHORIZATION);
if ( pMyObject->AuthHeaderValue ) CcspTr069PaFreeMemory(pMyObject->AuthHeaderValue);
pMyObject->AuthHeaderValue = CcspTr069PaCloneString(pAuthHeaderValue);
}
/* look for Set-Cookie headers */
pCookie = pHttpBmoRep->GetHeaderValueById2((ANSC_HANDLE)pHttpBmoRep, HTTP_HEADER_ID_SET_COOKIE2, ulCookieIndex);
if ( pCookie && AnscSizeOfString(pCookie) > 0 )
{
/*
pMyObject->RemoveCookies((ANSC_HANDLE)pMyObject);
bCookiesRemoved = TRUE;
*/
while ( pCookie != NULL && AnscSizeOfString(pCookie) > 0)
{
pCookieHeader = CcspTr069PaAllocateMemory(AnscSizeOfString(pCookie) + 16);
if ( pCookieHeader )
_ansc_sprintf(pCookieHeader, "Set-Cookie2: %s", pCookie);
pMyObject->AddCookie((ANSC_HANDLE)pMyObject, pCookieHeader);
CcspTr069PaFreeMemory(pCookieHeader);
pCookie = pHttpBmoRep->GetHeaderValueById2((ANSC_HANDLE)pHttpBmoRep, HTTP_HEADER_ID_SET_COOKIE2, ++ulCookieIndex);
}
}
/* If Set-Cookie and Set-Cookie2 co-exist happily, we save them all */
ulCookieIndex = 0;
pCookie = pHttpBmoRep->GetHeaderValueById2((ANSC_HANDLE)pHttpBmoRep, HTTP_HEADER_ID_SET_COOKIE, ulCookieIndex);
if( pCookie != NULL && AnscSizeOfString(pCookie) > 0)
{
//.........这里部分代码省略.........