Skip to content

Commit 0e9845d

Browse files
committed
enable SSL verification by default.
1 parent 2597567 commit 0e9845d

File tree

2 files changed

+8
-7
lines changed

2 files changed

+8
-7
lines changed

sdk/src/client/ClientConfiguration.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ ClientConfiguration::ClientConfiguration() :
107107
retryStrategy(std::make_shared<DefaultRetryStrategy>()),
108108
proxyScheme(Http::Scheme::HTTP),
109109
proxyPort(0),
110-
verifySSL(false),
110+
verifySSL(true),
111111
isCname(false),
112112
enableCrc64(true),
113113
enableDateSkewAdjustment(true),

test/src/Other/HttpsTest.cc

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,9 @@ class HttpsTest : public ::testing::Test {
3737
static void SetUpTestCase()
3838
{
3939
std::string endpoint = TestUtils::GetHTTPSEndpoint(Config::Endpoint);
40-
Client = std::make_shared<OssClient>(endpoint, Config::AccessKeyId, Config::AccessKeySecret, ClientConfiguration());
40+
ClientConfiguration conf;
41+
conf.verifySSL = false;
42+
Client = std::make_shared<OssClient>(endpoint, Config::AccessKeyId, Config::AccessKeySecret, conf);
4143
BucketName = TestUtils::GetBucketName("cpp-sdk-httpstest");
4244
Client->CreateBucket(CreateBucketRequest(BucketName));
4345
}
@@ -373,11 +375,12 @@ TEST_F(HttpsTest, CacertPositiveTest)
373375
SetLogCallback(nullptr);
374376
}
375377

376-
#if _WIN32
377378
TEST_F(HttpsTest, CacertNegativeTest)
378379
{
379380
ClientConfiguration conf;
380381
conf.verifySSL = true;
382+
conf.caFile = "none";
383+
conf.caPath = "none";
381384
std::string endpoint = TestUtils::GetHTTPSEndpoint(Config::Endpoint);
382385
OssClient client(endpoint, Config::AccessKeyId, Config::AccessKeySecret, conf);
383386
SetLogLevel(LogLevel::LogAll);
@@ -387,14 +390,12 @@ TEST_F(HttpsTest, CacertNegativeTest)
387390
auto content = TestUtils::GetRandomStream(1024);
388391
auto outcome = client.PutObject(BucketName, key, content);
389392
EXPECT_EQ(outcome.isSuccess(), false);
390-
EXPECT_EQ(outcome.error().Code(), "ClientError:200060");
391-
EXPECT_EQ(outcome.error().Message(), "Peer certificate cannot be authenticated with given CA certificates");
393+
EXPECT_EQ(outcome.error().Code(), "ClientError:200077");
394+
EXPECT_TRUE(outcome.error().Message().find("Problem with the SSL CA cert") != std::string::npos);
392395

393396
SetLogLevel(LogLevel::LogOff);
394397
SetLogCallback(nullptr);
395398
}
396-
#endif
397-
398399

399400

400401
}

0 commit comments

Comments
 (0)