Skip to content

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

Merged
merged 5 commits into from
Oct 15, 2018

Conversation

var-const
Copy link
Contributor

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.

grpc::InsecureChannelCredentials());
}

std::fstream cert_file{test_credentials_->certificate_path};
Copy link
Member

Choose a reason for hiding this comment

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

fstream -> ifstream?

Copy link
Contributor Author

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();
Copy link
Member

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

@rsgowman rsgowman assigned var-const and unassigned rsgowman Oct 15, 2018
@zxu123 zxu123 removed their assignment Oct 15, 2018
@var-const var-const merged commit 24b147d into master Oct 15, 2018
@paulb777 paulb777 deleted the varconst/grpc-test-certificate branch May 26, 2019 20:48
@firebase firebase locked and limited conversation to collaborators Oct 26, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants