試圖列出谷歌存盤桶中的所有物件 - 此代碼在 UNIX 系統(centos 7/Mac)中運行良好,但是當從 Windows 服務器 2012/16 Vm 運行時,我在 ListObjects 中得到永久錯誤:EasyPerform() - CURL 錯誤 [ 77]=SSL CA 證書問題(路徑?訪問權限?)[未知]
void gcpFileDialog::getListOfObjectsInBucket()
{
QString bucket = "exampleBucketName";///_gcpBucketLineEdit->text();
if ((bucket.isNull()) || (bucket.isEmpty()))
{
QMessageBox::critical(this, tr("Error"), tr("GCP Bucket is invalid"));
return;
}
namespace gcs = ::google::cloud::storage;
// Create a client to communicate with Google Cloud Storage. This client
// uses the default configuration for authentication and project id.
google::cloud::StatusOr<gcs::ClientOptions> options = gcs::ClientOptions::CreateDefaultClientOptions();
google::cloud::StatusOr<gcs::Client> client = gcs::Client::CreateDefaultClient();
if (!client)
{
QMessageBox::critical(this, tr("Error"), tr("Failed to create Storage Client.\n\n%1").arg(QString::fromStdString(client.status().message())));
return;
}
QStringList objectsInBucketList;
for (auto&& object_metadata : client->ListObjects(bucket.toStdString()))
{
if (!object_metadata)
{
QMessageBox::critical(this, tr("Error"), tr("There was an Error listing the objects.\n\n%1").arg(QString::fromStdString(object_metadata.status().message())));
client->ListObjects
return;
}
objectsInBucketList.append(QString::fromStdString(object_metadata->name()));
}
if (objectsInBucketList.isEmpty())
{
QMessageBox::critical(this, tr("Error"), tr("No Objects found in bucket"));
return;
}
for (QString& object : objectsInBucketList)
{
///list of bucket object _gcpBucketObjectListTextEdit->append(object);
}
}
我對 curl / open ssl 證書幾乎一無所知(我也不認為這與谷歌管理的 ssl 證書有關)我使用 Choco 在主機 vm 上安裝 openssl 和 curl 并添加了很多服務器角色和功能.
從 Google Cloud SDK Shell 呼叫該命令時有效 - GSUTIL 任何幫助追蹤該問題將不勝感激。
uj5u.com熱心網友回復:
我認為您需要按照以下說明安裝證書包:
https://curl.se/docs/sslcerts.html
使用較新版本的google-cloud-cpp您可以使用CARootsFilePathOption覆寫 CA 證書檔案的默認位置。
轉載請註明出處,本文鏈接:https://www.uj5u.com/ruanti/484411.html
下一篇:curl到python腳本問題
