本文整理汇总了C++中CComPtr::AbortRequest方法的典型用法代码示例。如果您正苦于以下问题:C++ CComPtr::AbortRequest方法的具体用法?C++ CComPtr::AbortRequest怎么用?C++ CComPtr::AbortRequest使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CComPtr
的用法示例。
在下文中一共展示了CComPtr::AbortRequest方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: OnSendResponse
//.........这里部分代码省略.........
{
// allocate the memory block
BYTE* pbyData = (BYTE*) pHttpContext->AllocateRequestMemory(dwContentLength);
if (pbyData != NULL)
{
// copy the response data
memcpy(pbyData, pEntityChunk->FromMemory.pBuffer, pEntityChunk->FromMemory.BufferLength);
// change the buffer pointer
pEntityChunk->FromMemory.pBuffer = pbyData;
}
else
{
hr = E_OUTOFMEMORY;
}
}
// allocate the response stream
CComPtr<IStream> pStream;
CComObject<CResponseStream>* pResponseStream = NULL;
if (hr == S_OK)
{
hr = CComObject<CResponseStream>::CreateInstance(&pResponseStream);
if (hr == S_OK)
{
pStream = pResponseStream;
}
}
// catch any memory issues
if (FAILED(hr) == TRUE)
{
// abort the compression
pIISxpressHTTPRequest->AbortRequest(dwFilterContext);
// TODO: need to handle generic HRs
PerfCountersAddRejectedResponse(hr);
AppendLogMessage(IISXPRESS_LOGGINGLEVEL_BASIC, pszMethodName, pHttpContext, _T("won't handle response (0x%08x)\n"), hr);
return RQ_NOTIFICATION_CONTINUE;
}
pResponseStream->AttachBuffer(pEntityChunk->FromMemory.pBuffer, dwContentLength, 0);
char szContentEncoding[32] = "";
hr = pIISxpressHTTPRequest->OnSendRawData(dwFilterContext, pStream, dwContentLength, FALSE, (signed char*) szContentEncoding, _countof(szContentEncoding));
if (hr == S_OK)
{
DWORD dwOriginalSize = dwContentLength;
DWORD dwCompressedSize = pResponseStream->GetOffset();
// set the new content length into the header
CAtlStringA sContentLength;
sContentLength.Format("%u", dwCompressedSize);
pHttpResponse->SetHeader(HttpHeaderContentLength, sContentLength, (USHORT) sContentLength.GetLength(), TRUE);
// set the new size into the buffer
pRawResponse->pEntityChunks->FromMemory.BufferLength = dwCompressedSize;
pHttpResponse->SetHeader(HttpHeaderContentEncoding, szContentEncoding, (USHORT) strlen(szContentEncoding), TRUE);
// add the item to the cache if we have a key (it means the data is cachable)
if (dwCompressedSize < dwOriginalSize &&
m_nCacheEnabled != 0 && sCacheKey.GetLength() > 0)
{