TsgcHTTP3Client › Properties › MaxResponseSize

MaxResponseSize Property

Maximum number of response body bytes accepted per request, or 0 for no limit.

Syntax

property MaxResponseSize: Int64 read FMaxResponseSize write FMaxResponseSize;

Type

Int64

Default

0 (unlimited)

Remarks

MaxResponseSize caps the total number of body bytes the client will accumulate for a single request. When a response grows beyond the limit the request is terminated and an exception is raised, which surfaces on OnHTTP3Exception for a synchronous call and on OnError for an asynchronous one.

The default of 0 means unlimited. Set a limit when talking to servers you do not control, so a hostile or malfunctioning peer cannot exhaust memory by streaming an unbounded body into the client.

The limit counts body bytes only and applies per request, not per connection. To download something legitimately large without buffering it in memory, use the stream overload of the verb, for example Get with a TFileStream.

This client does not follow redirects automatically, so the cross-host credential-strip and insecure-downgrade options found on other HTTP clients do not apply here: a 3xx status is returned to the caller to handle.

This member is currently available in the Delphi/C++Builder implementation only.

Example



// refuse any response body larger than 10 MB

oClient.MaxResponseSize := 10 * 1024 * 1024;

Back to Properties