Repository navigation
THRIFT-6563: Decode unversioned Ruby binary message names as UTF-8 - #4198
Merged
Merged
Conversation
Client: rb Generated-By: amp/0.0.1794916837-g564d50 (model: anthropic/claude-opus-5-5; operator: kpumuk@apache.org)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
In the old (unversioned) binary message format, accepted when
strict_readis false,Thrift::BinaryProtocol#read_message_beginand the nativeThrift::BinaryProtocolAccelerated#read_message_beginreturned the method name as rawASCII-8BITbytes. The versioned format reads the same name withread_string, which returns UTF-8. A non-ASCII name sent in the old format therefore didn't compare equal to the same name as a string literal, so name-based dispatch or comparison failed.Both implementations now decode the unversioned name the same way their
read_stringdoes:Bytes.convert_to_stringin Ruby andconvert_to_stringin the C extension. Wire bytes and thestrict_readrejection of unversioned headers don't change. A new shared binary-protocol spec reads a UTF-8 name with and without a version header for both protocol classes.Reproduction, run from
lib/rbwith the native extension built (bundle exec ruby -Ilib -Iext old-format-name.rb):Before (master
50242d7ea1, Ruby 4.0.9):After:
The pure-Ruby
BinaryProtocolgives the same results without the native extension.