Sample code for 30+ languages & platforms
DataFlex

Setting a HTTP Max Response Size

Demonstrates the MaxResponseSize property.

Chilkat DataFlex Downloads

DataFlex
Use ChilkatAx-win32.pkg

Procedure Test
    Boolean iSuccess
    Handle hoHttp
    UInteger iMaxSz
    String sXmlStr
    String sTemp1
    Boolean bTemp1

    Move False To iSuccess

    Get Create (RefClass(cComChilkatHttp)) To hoHttp
    If (Not(IsComObjectCreated(hoHttp))) Begin
        Send CreateComObject of hoHttp
    End

    Move 16384 To iMaxSz
    Set ComMaxResponseSize Of hoHttp To iMaxSz

    // Try to get something larger, such as hamlet.xml which is 279658 bytes
    Get ComQuickGetStr Of hoHttp "https://chilkatsoft.com/hamlet.xml" To sXmlStr
    Get ComLastMethodSuccess Of hoHttp To bTemp1
    If (bTemp1 = False) Begin
        // 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.
        Get ComLastErrorText Of hoHttp To sTemp1
        Showln sTemp1
        Procedure_Return
    End

    Showln "OK"


End_Procedure