Skip to content

Conversation

cretz
Copy link
Member

@cretz cretz commented Oct 2, 2025

What was changed

Need to support -bin values as binary values in gRPC

Checklist

  1. Closes [Feature Request] Ensure gRPC binary metadata headers are supported #329

@cretz cretz requested a review from a team as a code owner October 2, 2025 21:09
format!("Value for metadata key {key} must be ASCII-8BIT"),
));
}
binary_headers.insert(key, unsafe { value.as_slice() }.to_vec());
Copy link
Member

@chris-olszewski chris-olszewski Oct 3, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It might make sense to move to_vec into unsafe block to prevent ever accidentally holding onto the slice reference.

Suggested change
binary_headers.insert(key, unsafe { value.as_slice() }.to_vec());
binary_headers.insert(key, unsafe { value.as_slice().to_vec() });

Copy link
Member Author

@cretz cretz Oct 3, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense. I tend to take the "smallest amount of unsafe possible" approach, but it makes sense here to not carry a ref over the boundary. If I need another commit, I'll make this change too.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated

Copy link
Member

@Sushisource Sushisource left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would definitely apply Chris' suggestion

@cretz cretz merged commit 8e57847 into temporalio:main Oct 6, 2025
13 of 15 checks passed
@cretz cretz deleted the grpc-binary-metadata branch October 6, 2025 19:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Feature Request] Ensure gRPC binary metadata headers are supported
3 participants