-
Notifications
You must be signed in to change notification settings - Fork 1.6k
gRPC: add the ability to use a custom SSL certificate in integration tests #1942
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
grpc::InsecureChannelCredentials()); | ||
} | ||
|
||
std::fstream cert_file{test_credentials_->certificate_path}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fstream -> ifstream?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
test_credentials_ = new TestCredentials{}; | ||
} | ||
|
||
test_credentials_->certificate_path = certificate_path.data(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this is safe? string_view::data() isn't guaranteed to be null terminated, and I think std::string's operator= assumes the pointer is.
Maybe:
test_credentials_->certificate_path = std::string(cert_path.data(), cert_path.size());
Also immediately below.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
This closely mimics the way it is currently done in Objective-C gRPC client by simply using a static string that contains a file path.