Perl
Perl
Setting a HTTP Max Response Size
Demonstrates theMaxResponseSize property.
Chilkat Perl Downloads
use chilkat();
$success = 0;
$http = chilkat::CkHttp->new();
$maxSz = 16384;
$http->put_MaxResponseSize($maxSz);
# Try to get something larger, such as hamlet.xml which is 279658 bytes
$xmlStr = $http->quickGetStr("https://chilkatsoft.com/hamlet.xml");
if ($http->get_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.
print $http->lastErrorText() . "\r\n";
exit;
}
print "OK" . "\r\n";