Sample code for 30+ languages & platforms
AutoIt

Setting a HTTP Max Response Size

Demonstrates the MaxResponseSize property.

Chilkat AutoIt Downloads

AutoIt
Local $bSuccess = False

$oHttp = ObjCreate("Chilkat.Http")

Local $iMaxSz = 16384
$oHttp.MaxResponseSize = $iMaxSz

; Try to get something larger, such as hamlet.xml which is 279658 bytes
Local $sXmlStr = $oHttp.QuickGetStr("https://chilkatsoft.com/hamlet.xml")
If ($oHttp.LastMethodSuccess = False) Then
    ; 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.
    ConsoleWrite($oHttp.LastErrorText & @CRLF)
    Exit
EndIf

ConsoleWrite("OK" & @CRLF)