aws / aws-sdk-cpp

AWS SDK for C++
Apache License 2.0
1.91k stars 1.04k forks source link

aws-sdk-cpp-1.11.323 curlcode:35 SSL connect error #2992

Open txh1873749380 opened 3 weeks ago

txh1873749380 commented 3 weeks ago

Describe the bug

In the aws-sdk-cpp-1.11.323 version, curlcode: 35 ssl connect error occurred while verifying a small demo, and verifySSL was disabled. Here is the demo code: 截屏2024-06-07 10 46 26 截屏2024-06-07 10 47 54

Expected Behavior

It is expected that the execution will be successful and the size will be calculated as follows:

截屏2024-06-07 10 50 24

Current Behavior

截屏2024-06-07 10 53 47

Reproduction Steps

截屏2024-06-07 10 46 26 截屏2024-06-07 10 47 54

Possible Solution

No response

Additional Information/Context

demo g++ compilation command: 截屏2024-06-07 11 03 19

AWS CPP SDK version used

aws-sdk-cpp-1.11.323

Compiler and Version used

g++ 8.3.1

Operating System and version

Kernel :linux Kernel version:5.14.21 x86_64 centos7

jmklix commented 2 weeks ago

How are you building this sdk? and can you paste your code snippets in code block rather then in screenshots?

github-actions[bot] commented 5 days ago

Greetings! It looks like this issue hasn’t been active in longer than a week. We encourage you to check if this is still an issue in the latest release. Because it has been longer than a week since the last update on this, and in the absence of more information, we will be closing this issue soon. If you find that this is still a problem, please feel free to provide a comment or add an upvote to prevent automatic closure, or if the issue is already closed, please feel free to open a new one.

txh1873749380 commented 5 days ago

How are you building this sdk? and can you paste your code snippets in code block rather then in screenshots?

This error occurred when I was accessing minio's bucket in this demo:

#include <iostream>
#include <fstream>
#include <aws/s3/S3Client.h>
#include <aws/core/Aws.h>
#include <aws/core/auth/AWSCredentialsProvider.h>
#include <aws/transfer/TransferManager.h>
#include <aws/s3/model/HeadObjectRequest.h>
#include <aws/s3/model/HeadBucketRequest.h>

#include<sys/types.h> 
#include<sys/stat.h>
#include<fcntl.h>

static const char* const ALLOCATION_TAG = "S3_HEADOBJECT";

int main(int argc, char* argv[]) {
  Aws::SDKOptions options;
  Aws::InitAPI(options);
  {
    // S3 End Point
    const Aws::String endPoint = "172.16.10.115:9000";
    const Aws::String bucketName = "hcc-bucket";
    //const Aws::String objectName = "project_id_1";
    const Aws::String objectName = argv[1];
    const Aws::String region = "us-west-2";
    // 
    const Aws::String accessKey = "minioadmin";
    const Aws::String secretKey = "minioadmin";
    bool using_virtual_address = false;

    // S3 Client
    Aws::Client::ClientConfiguration config;
    config.verifySSL = false;
    config.scheme = Aws::Http::Scheme::HTTP;
    config.region = region;

    //bool using_virtual_address = bucket_cfg.s3_uri_style == 0 ? true : false;
    Aws::Auth::AWSCredentials cred(accessKey, secretKey);

    auto s3Client = Aws::MakeShared<Aws::S3::S3Client>(
                 ALLOCATION_TAG,
                 cred,
                 config,
                 Aws::Client::AWSAuthV4Signer::PayloadSigningPolicy::Never,
                 using_virtual_address);
    s3Client->OverrideEndpoint(endPoint);

    // aws request
    Aws::S3::Model::HeadObjectRequest aws_req;
    aws_req.SetBucket(bucketName);
    aws_req.SetKey(objectName);

    Aws::S3::Model::HeadObjectOutcome aws_resp = s3Client->HeadObject(aws_req);
    if (aws_resp.IsSuccess()) {
        long long size_total = aws_resp.GetResult().GetContentLength();
        std::cout << "objectName:" << objectName << ", size:" << size_total << std::endl;
    } else {
        // has error
        auto err = aws_resp.GetError();
        std::cout << "head object error, objectName:"<< objectName << ", errno:" << (int)err.GetErrorType() << ", errmsg:" << err.GetMessage()<< std::endl;
    }
  }

  Aws::ShutdownAPI(options);
  return 0;
}
jmklix commented 1 day ago

Can you reproduce this error when using AWS s3 buckets? We can't guarantee that this sdk will work with third party buckets (i.e. minio). If you can reproduce this with an s3 bucket then we can take a closer look.