DWORD SetChunkSize( DWORD dwNewSize );
Return Value
The previous chunk size.
Parameters
dwNewSize
New chunk size.
Remarks
Call this member function to set the chunk size for the current context. The chunk size is the number of bytes that MFC will send back in an individual write operation when writing data from the body of the stream within the CHttpServerContext object back to the client. The chunk size is initially zero when the context is created. A chunk size of zero means that MFC will attempt to write the entire stream in one operation. Any other value causes the framework to divide the body of the response into chunks no larger than the specified size.
Setting a chunk size is not always necessary, but it can be required when you use HTTPS, because HTTPS is limited to writing 14 kilobytes per operation at a maximum. HTTPS is a variant of the HTTP protocol that uses the secure-sockets layer for its transport protocol.
Example
The following code demonstrates how to check chunk size used by MFC.
void CMfcCookieExtension::Default(CHttpServerContext* pCtxt)
{
DWORD dwChunkOld = pCtxt->SetChunkSize (10);
DWORD dwChunkNew = pCtxt->GetChunkSize();
StartContent(pCtxt);
WriteTitle(pCtxt);
*pCtxt << "Chunk size was changed from: " << (long) dwChunkOld << "<br>";
*pCtxt << "to: " << (long) dwChunkNew << "<br>";
EndContent(pCtxt);
}
CHttpServerContext Overview | Class Members | Hierarchy Chart
See Also CHttpServerContext::GetChunkSize, CHttpServer::OnWriteBody