Lua
Lua
Setting a HTTP Max Response Size
Demonstrates theMaxResponseSize property.
Chilkat Lua Downloads
local chilkat = require("chilkat")
local success = false
local http = chilkat.Http.new()
local maxSz = 16384
http.max_response_size = maxSz
-- Try to get something larger, such as hamlet.xml which is 279658 bytes
local xmlStr = http:quick_get_str("https://chilkatsoft.com/hamlet.xml")
if not http.last_method_success 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.
print(http.last_error_text)
return
end
print("OK")