Skip to content

Commit a7fce30

Browse files
Added caPath for curl clients.
1 parent eab46cc commit a7fce30

File tree

7 files changed

+14
-844
lines changed

7 files changed

+14
-844
lines changed

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -273,6 +273,7 @@ struct AWS_CORE_API ClientConfiguration
273273
Aws::String proxyPassword;
274274
std::shared_ptr<Aws::Utils::Threading::Executor> executor;
275275
bool verifySSL;
276+
Aws::String caPath;
276277
std::shared_ptr<Aws::Utils::RateLimits::RateLimiterInterface> writeRateLimiter;
277278
std::shared_ptr<Aws::Utils::RateLimits::RateLimiterInterface> readRateLimiter;
278279
};
@@ -311,6 +312,9 @@ The default behavior for the executor is to create and detach a thread for each
311312
#####Verify SSL
312313
If necessary, you can disable SSL certificate verification by setting the verify SSL value to false.
313314

315+
#####CA Path
316+
You can tell the http client where to find your certificate trust store ( e.g. a directory prepared with OpenSSL c_rehash utility). This should not be necessary unless you are doing some weird symlink farm stuff for your environment. This has no effect on Windows or OSX.
317+
314318
#####Write Rate Limiter and Read Rate Limiter
315319
The write and read rate limiters are used to throttle the bandwidth used by the transport layer. The default for these limiters is open. You can use the default implementation with your desired rates, or you can create your own instance by implementing a subclass of RateLimiterInterface.
316320

aws-cpp-sdk-core/include/aws/core/client/ClientConfiguration.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,8 @@ struct AWS_CORE_API ClientConfiguration
7272
Aws::String proxyPassword;
7373
std::shared_ptr<Aws::Utils::Threading::Executor> executor;
7474
bool verifySSL;
75+
//this is currently only used for libcurl. This should be unnecessary for windows.
76+
Aws::String caPath;
7577
std::shared_ptr<Aws::Utils::RateLimits::RateLimiterInterface> writeRateLimiter;
7678
std::shared_ptr<Aws::Utils::RateLimits::RateLimiterInterface> readRateLimiter;
7779
Aws::Http::TransferLibType httpLibOverride;

aws-cpp-sdk-core/include/aws/core/http/curl/CurlHttpClient.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ class CurlHttpClient: public HttpClient
4747
Aws::String m_proxyHost;
4848
unsigned m_proxyPort;
4949
bool m_verifySSL;
50+
Aws::String m_caPath;
5051
bool m_allowRedirects;
5152

5253
//Callback to read the content from the content body of the request

aws-cpp-sdk-core/source/http/curl/CurlHttpClient.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ CurlHttpClient::CurlHttpClient(const ClientConfiguration& clientConfig) :
106106
m_curlHandleContainer(clientConfig.maxConnections, clientConfig.requestTimeoutMs, clientConfig.connectTimeoutMs),
107107
m_isUsingProxy(!clientConfig.proxyHost.empty()), m_proxyUserName(clientConfig.proxyUserName),
108108
m_proxyPassword(clientConfig.proxyPassword), m_proxyHost(clientConfig.proxyHost),
109-
m_proxyPort(clientConfig.proxyPort), m_verifySSL(clientConfig.verifySSL), m_allowRedirects(clientConfig.followRedirects)
109+
m_proxyPort(clientConfig.proxyPort), m_verifySSL(clientConfig.verifySSL), m_caPath(clientConfig.caPath), m_allowRedirects(clientConfig.followRedirects)
110110
{
111111
}
112112

@@ -170,6 +170,12 @@ std::shared_ptr<HttpResponse> CurlHttpClient::MakeRequest(HttpRequest& request,
170170
curl_easy_setopt(connectionHandle, CURLOPT_HEADERFUNCTION, &CurlHttpClient::WriteHeader);
171171
curl_easy_setopt(connectionHandle, CURLOPT_HEADERDATA, response.get());
172172

173+
//we only want to override the default path if someone has explicitly told us to.
174+
if(!m_caPath.empty())
175+
{
176+
curl_easy_setopt(connectionHandle, CURLOPT_CAPATH, m_caPath.c_str());
177+
}
178+
173179
// only set by android test builds because the emulator is missing a cert needed for aws services
174180
#ifdef TEST_CERT_PATH
175181
curl_easy_setopt(connectionHandle, CURLOPT_CAPATH, TEST_CERT_PATH);

aws-cpp-sdk-wininet-winhttp-test/CMakeLists.txt

Lines changed: 0 additions & 31 deletions
This file was deleted.

aws-cpp-sdk-wininet-winhttp-test/RunTests.cpp

Lines changed: 0 additions & 35 deletions
This file was deleted.

0 commit comments

Comments
 (0)