Copilot commented on code in PR #3630:
URL: https://github.com/apache/thrift/pull/3630#discussion_r3564411587


##########
test/cpp/src/TestClient.cpp:
##########
@@ -322,12 +317,24 @@ int main(int argc, char** argv) {
   std::shared_ptr<TProtocol> protocol2;  // SecondService for multiplexed
 
   if (ssl) {
+    boost::filesystem::path testDir = 
boost::filesystem::system_complete(argv[0]).parent_path();
+    while (!boost::filesystem::exists(testDir / "keys" / "CA.pem")) {

Review Comment:
   The key directory search stops as soon as it finds `CA.pem`, but then 
assumes `client.crt` and `client.key` exist in the same directory. If a 
directory contains `CA.pem` but not the client cert/key, the loop will stop 
early and the failure will be deferred to `loadCertificate`/`loadPrivateKey` 
with a less direct error.



##########
test/cpp/src/TestServer.cpp:
##########
@@ -768,6 +764,17 @@ int main(int argc, char** argv) {
   std::shared_ptr<TServerSocket> serverSocket;
 
   if (ssl) {
+    boost::filesystem::path testDir = 
boost::filesystem::system_complete(argv[0]).parent_path();
+    while (!boost::filesystem::exists(testDir / "keys" / "server.crt")) {

Review Comment:
   The key directory search stops as soon as it finds `server.crt`, but then 
immediately assumes `server.key` exists in the same directory. If a directory 
contains `server.crt` but not the private key, the loop will stop early and the 
failure will be deferred to `loadPrivateKey` with a less direct error.



##########
test/cpp/src/TestClient.cpp:
##########
@@ -322,12 +317,24 @@ int main(int argc, char** argv) {
   std::shared_ptr<TProtocol> protocol2;  // SecondService for multiplexed
 
   if (ssl) {
+    boost::filesystem::path testDir = 
boost::filesystem::system_complete(argv[0]).parent_path();
+    while (!boost::filesystem::exists(testDir / "keys" / "CA.pem")) {
+      boost::filesystem::path parent = testDir.parent_path();
+      if (parent == testDir) {
+        throw runtime_error("Unable to locate test/keys from " + 
string(argv[0]));

Review Comment:
   `runtime_error` is used here, but this file does not include `<stdexcept>`. 
Relying on transitive includes can break compilation on some 
platforms/toolchains; add the missing header (or otherwise ensure 
`std::runtime_error` is declared).



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to