Jens Geyer created THRIFT-6296:
----------------------------------

             Summary: Rust: the input protocol factories cannot take a 
TConfiguration
                 Key: THRIFT-6296
                 URL: https://issues.apache.org/jira/browse/THRIFT-6296
             Project: Thrift
          Issue Type: Improvement
          Components: Rust - Library
            Reporter: Jens Geyer


{{TBinaryInputProtocolFactory}} and {{TCompactInputProtocolFactory}} 
({{lib/rs/src/protocol/binary.rs}}, {{compact.rs}}) are unit structs. Their 
{{create}} builds the protocol with {{TConfiguration::default()}}.

{{TServer}} ({{lib/rs/src/server/threaded.rs}}) gets its input protocols from 
such a factory. A server built with the shipped factories therefore cannot 
change any limit the input protocols read from the configuration:
* {{max_message_size}}
* {{max_string_size}}
* {{max_container_size}}
* {{max_recursion_depth}}

Today the only way is a custom {{TInputProtocolFactory}} that calls 
{{with_config}}.

h2. Suggested

Let both factories carry a {{TConfiguration}}, for example through a 
{{with_config(config)}} constructor, with {{new()}} keeping the defaults. 
{{create}} would then pass that configuration to the protocol's 
{{with_config}}. The output protocol factories could get the same, for symmetry.

_Drafted with AI assistance (Claude Opus 5); reviewed and filed by Jens Geyer._



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to