Sample code for 30+ languages & platforms
Tcl

Setting a HTTP Max Response Size

Demonstrates the MaxResponseSize property.

Chilkat Tcl Downloads

Tcl

load ./chilkat.dll

set success 0

set http [new_CkHttp]

set maxSz 16384
CkHttp_put_MaxResponseSize $http $maxSz

# Try to get something larger, such as hamlet.xml which is 279658 bytes
set xmlStr [CkHttp_quickGetStr $http "https://chilkatsoft.com/hamlet.xml"]
if {[CkHttp_get_LastMethodSuccess $http] == 0} 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.
    puts [CkHttp_lastErrorText $http]
    delete_CkHttp $http
    exit
}

puts "OK"

delete_CkHttp $http