[
https://issues.apache.org/jira/browse/THRIFT-6283?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Jens Geyer resolved THRIFT-6283.
--------------------------------
Fix Version/s: 0.25.0
Assignee: Jens Geyer
Resolution: Fixed
> Erlang: bound the size of a reply the HTTP transport reads
> ----------------------------------------------------------
>
> Key: THRIFT-6283
> URL: https://issues.apache.org/jira/browse/THRIFT-6283
> Project: Thrift
> Issue Type: Sub-task
> Components: Erlang - Library
> Reporter: Jens Geyer
> Assignee: Jens Geyer
> Priority: Minor
> Fix For: 0.25.0
>
> Time Spent: 20m
> Remaining Estimate: 0h
>
> Split out of THRIFT-6268 (third point). The first point, a failed request, is
> PR #3866.
> {{thrift_http_transport:flush/1}} calls {{httpc:request/4}} in the mode that
> returns the whole reply in memory, with no limit, so the size of a reply is
> whatever the server sends.
> h2. What httpc offers
> * {{max_body_size}} is a documented request option from OTP 27 on. It refuses
> a reply whose {{Content-Length}} exceeds the limit. OTP 25 and 26, both in
> the CI matrix, have no such option.
> * Streaming ({{stream}}) hands over the body in parts, but only for 200 and
> 206 replies; any other reply is still read whole.
> h2. Suggested
> * A limit for the transport, defaulting to 100 MB, the default maximum
> message size the other bindings' TConfiguration uses. It is a new constant
> next to {{DEFAULT_MAX_FRAME_SIZE}} in {{thrift_constants.hrl}}, overridable
> per transport and application-wide the way {{max_frame_size}} is.
> * For 200 replies, stream the body and cancel the request once the limit is
> passed, which works on every supported OTP release. On OTP 27 and later, also
> pass {{max_body_size}}, which covers the replies that are not streamed.
> * Tests: a reply at the limit is read; one byte more is refused before the
> whole reply has been received, with and without {{Content-Length}}.
> _Drafted with AI assistance (Claude Opus 5); reviewed and filed by Jens
> Geyer._
--
This message was sent by Atlassian Jira
(v8.20.10#820010)