Sample code for 30+ languages & platforms
Xbase++

Setting a HTTP Max Response Size

Demonstrates the MaxResponseSize property.

Chilkat Xbase++ Downloads

Xbase++
LOCAL nSuccess
LOCAL oHttp
LOCAL nMaxSz
LOCAL cXmlStr

nSuccess := 0

oHttp := CreateObject("Chilkat.Http")

nMaxSz := 16384
oHttp:MaxResponseSize := nMaxSz

//  Try to get something larger, such as hamlet.xml which is 279658 bytes
cXmlStr := oHttp:QuickGetStr("https://chilkatsoft.com/hamlet.xml")
IF (oHttp:LastMethodSuccess == 0)
    //  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.
    ? oHttp:LastErrorText
    oHttp:destroy()
    RETURN
ENDIF

? "OK"

oHttp:destroy()