Skip to content

Commit c991e09

Browse files
committed
demo fix
1 parent cf7f18b commit c991e09

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

demo/object_op_demo/multi_put_object_demo.cpp

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
#include "cos_api.h"
99
#include "cos_sys_config.h"
1010
#include "util/auth_tool.h"
11+
// #include <openssl/ssl.h> // 双向认证引用头
1112

1213
/**
1314
* 本样例演示了如何使用 COS C++ SDK 进行对象的高级上传
@@ -47,10 +48,27 @@ void PrintResult(const qcloud_cos::CosResult& result, const qcloud_cos::BaseResp
4748
qcloud_cos::CosAPI InitCosAPI() {
4849
qcloud_cos::CosConfig config(appid, tmp_secret_id, tmp_secret_key, region);
4950
config.SetTmpToken(tmp_token); // 推荐使用临时密钥初始化 CosAPI 对象, 如果您使用永久密钥初始化 CosAPI 对象,请注释
51+
// config.SetDestDomain("xxx.xxxx.com"); // 配置自定义域名
52+
// config.SetDomainSameToHost(true); // 配置自定义域名签名
5053
qcloud_cos::CosAPI cos_tmp(config);
5154
return cos_tmp;
5255
}
5356

57+
/**
58+
* 本方法为 SSL_CTX 的回调方法,用户可以在此方法中配置 SSL_CTX 信息
59+
*/
60+
// int SslCtxCallback(void *ssl_ctx, void *data) {
61+
// std::cout << "ssl_ctx: " << ssl_ctx << " data: " << data << std::endl;
62+
63+
// SSL_CTX *ctx = (SSL_CTX *)ssl_ctx;
64+
// std::cout << "ssl_ctx in" << std::endl;
65+
// SSL_CTX_use_PrivateKey_file(ctx, "/data/cert/client.key", SSL_FILETYPE_PEM);
66+
// SSL_CTX_use_certificate_chain_file(ctx, "/data/cert/client.crt");
67+
// std::cout << "ssl_ctx out" << std::endl;
68+
69+
// return 0;
70+
// }
71+
5472
/*
5573
* 该 Demo 示范如何使用高级上传接口进行对象上传
5674
* 仅支持文件上传,不支持流式上传,封装了分块上传的各接口
@@ -64,6 +82,8 @@ void MultiUploadObjectDemo(qcloud_cos::CosAPI& cos) {
6482
CosSysConfig::SetUploadPartSize(10 * 1024 * 1024); // 上传分块大小 默认10M
6583

6684
qcloud_cos::MultiPutObjectReq req(bucket_name, object_name, local_file);
85+
// req.SetHttps(); // 设置 https 请求
86+
// req.SetSSLCtxCallback(SslCtxCallback, nullptr); //双向认证回调
6787
qcloud_cos::MultiPutObjectResp resp;
6888
qcloud_cos::CosResult result = cos.MultiPutObject(req, &resp);
6989

0 commit comments

Comments
 (0)