Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions src/aws-cpp-sdk-core/include/aws/core/client/ClientConfiguration.h
Original file line number Diff line number Diff line change
Expand Up @@ -348,6 +348,16 @@ namespace Aws
*/
bool disableImdsV1 = false;

/**
* Snowflake options. Curl perform callback for header customization.
*/
void* performCallback = NULL;

/**
* Snowflake options. User data pass to Curl perform callback.
*/
void* performCallbackData = NULL;

/**
* A helper function to read config value from env variable or aws profile config
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ class CurlHandleContainer
*/
CurlHandleContainer(unsigned maxSize = 50, long httpRequestTimeout = 0, long connectTimeout = 1000, bool tcpKeepAlive = true,
unsigned long tcpKeepAliveIntervalMs = 30000, long lowSpeedTime = 3000, unsigned long lowSpeedLimit = 1,
Version version = Version::HTTP_VERSION_2TLS);
Version version = Version::HTTP_VERSION_2TLS,
curl_perform_callback performCallback = NULL, void* performCallbackData = NULL);
~CurlHandleContainer();

/**
Expand Down Expand Up @@ -71,6 +72,8 @@ class CurlHandleContainer
unsigned m_poolSize;
std::mutex m_containerLock;
Version m_version;
curl_perform_callback m_performCallback;
void* m_performCallbackData;
};

} // namespace Http
Expand Down
9 changes: 7 additions & 2 deletions src/aws-cpp-sdk-core/source/http/curl/CurlHandleContainer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ static const char* CURL_HANDLE_CONTAINER_TAG = "CurlHandleContainer";

CurlHandleContainer::CurlHandleContainer(unsigned maxSize, long httpRequestTimeout, long connectTimeout, bool enableTcpKeepAlive,
unsigned long tcpKeepAliveIntervalMs, long lowSpeedTime, unsigned long lowSpeedLimit,
Version version) :
Version version, curl_perform_callback performCallback, void* performCallbackData) :
m_maxPoolSize(maxSize), m_httpRequestTimeout(httpRequestTimeout), m_connectTimeout(connectTimeout), m_enableTcpKeepAlive(enableTcpKeepAlive),
m_tcpKeepAliveIntervalMs(tcpKeepAliveIntervalMs), m_lowSpeedTime(lowSpeedTime), m_lowSpeedLimit(lowSpeedLimit), m_poolSize(0),
m_version(version)
m_version(version), m_performCallback(performCallback), m_performCallbackData(performCallbackData)
{
AWS_LOGSTREAM_INFO(CURL_HANDLE_CONTAINER_TAG, "Initializing CurlHandleContainer with size " << maxSize);
}
Expand Down Expand Up @@ -154,6 +154,11 @@ void CurlHandleContainer::SetDefaultOptionsOnHandle(CURL* handle)
curl_easy_setopt(handle, CURLOPT_TCP_KEEPIDLE, m_tcpKeepAliveIntervalMs / 1000);
curl_easy_setopt(handle, CURLOPT_HTTP_VERSION, ConvertHttpVersion(m_version));
curl_easy_setopt(handle, CURLOPT_MAXCONNECTS, m_maxPoolSize);
if (m_performCallback)
{
curl_easy_setopt(handle, CURLOPT_SF_PERFORMFUNC, m_performCallback);
curl_easy_setopt(handle, CURLOPT_SF_PERFORMFUNC_DATA, m_performCallbackData);
}
}

long CurlHandleContainer::ConvertHttpVersion(Version version) {
Expand Down
3 changes: 2 additions & 1 deletion src/aws-cpp-sdk-core/source/http/curl/CurlHttpClient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -586,7 +586,8 @@ int CurlDebugCallback(CURL *handle, curl_infotype type, char *data, size_t size,
CurlHttpClient::CurlHttpClient(const ClientConfiguration& clientConfig) :
Base(),
m_curlHandleContainer(clientConfig.maxConnections, clientConfig.httpRequestTimeoutMs, clientConfig.connectTimeoutMs, clientConfig.enableTcpKeepAlive,
clientConfig.tcpKeepAliveIntervalMs, clientConfig.requestTimeoutMs, clientConfig.lowSpeedLimit, clientConfig.version),
clientConfig.tcpKeepAliveIntervalMs, clientConfig.requestTimeoutMs, clientConfig.lowSpeedLimit, clientConfig.version,
(curl_perform_callback)clientConfig.performCallback, clientConfig.performCallbackData),
m_isAllowSystemProxy(clientConfig.allowSystemProxy), m_isUsingProxy(!clientConfig.proxyHost.empty()), m_proxyUserName(clientConfig.proxyUserName),
m_proxyPassword(clientConfig.proxyPassword), m_proxyScheme(SchemeMapper::ToString(clientConfig.proxyScheme)), m_proxyHost(clientConfig.proxyHost),
m_proxySSLCertPath(clientConfig.proxySSLCertPath), m_proxySSLCertType(clientConfig.proxySSLCertType),
Expand Down
Loading