VBScript
VBScript
Setting a HTTP Max Response Size
Demonstrates theMaxResponseSize property.
Chilkat VBScript Downloads
Dim fso, outFile
Set fso = CreateObject("Scripting.FileSystemObject")
'Create a Unicode (utf-16) output text file.
Set outFile = fso.CreateTextFile("output.txt", True, True)
success = 0
set http = CreateObject("Chilkat.Http")
maxSz = 16384
http.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.LastMethodSuccess = 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.
outFile.WriteLine(http.LastErrorText)
WScript.Quit
End If
outFile.WriteLine("OK")
outFile.Close