Sample code for 30+ languages & platforms
Unicode C++

Setting a HTTP Max Response Size

Demonstrates the MaxResponseSize property.

Chilkat Unicode C++ Downloads

Unicode C++
#include <CkHttpW.h>

void ChilkatSample(void)
    {
    bool success = false;

    CkHttpW http;

    unsigned long maxSz = 16384;
    http.put_MaxResponseSize(maxSz);

    //  Try to get something larger, such as hamlet.xml which is 279658 bytes
    const wchar_t *xmlStr = http.quickGetStr(L"https://chilkatsoft.com/hamlet.xml");
    if (http.get_LastMethodSuccess() == false) {
        //  If the LastErrorText contains the string "MaxResponseSize",
        //  then the HTTP request failed because the response body would've been larger than the max allowed response size.
        wprintf(L"%s\n",http.lastErrorText());
        return;
    }

    wprintf(L"OK\n");
    }