Skip to content

Commit

Permalink
Fix keep alive setting on WinHTTP, trace more error codes from WinHTTP
Browse files Browse the repository at this point in the history
  • Loading branch information
Sergey Ryabinin committed Apr 10, 2024
1 parent ed055a8 commit d6b310c
Show file tree
Hide file tree
Showing 6 changed files with 197 additions and 28 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ namespace Aws
bool DoReadData(void* hHttpRequest, char* body, uint64_t size, uint64_t& read) const override;
void* GetClientModule() const override;

const char* GetActualHttpVersionUsed(void* hHttpRequest) const override;

bool m_usingProxy = false;
bool m_verifySSL = true;
Aws::Http::Version m_version = Aws::Http::Version::HTTP_VERSION_2TLS;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ namespace Aws
bool DoReadData(void* hHttpRequest, char* body, uint64_t size, uint64_t& read) const override;
void* GetClientModule() const override;

const char* GetActualHttpVersionUsed(void* hHttpRequest) const override;

WinINetSyncHttpClient &operator =(const WinINetSyncHttpClient &rhs);

bool m_usingProxy;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,8 @@ namespace Aws
*/
bool m_allowRedirects;

bool m_enableHttpClientTrace = false;

private:
virtual void* OpenRequest(const std::shared_ptr<HttpRequest>& request, void* connection, const Aws::StringStream& ss) const = 0;
virtual void DoAddHeaders(void* hHttpRequest, Aws::String& headerStr) const = 0;
Expand All @@ -93,6 +95,8 @@ namespace Aws
virtual bool DoReadData(void* hHttpRequest, char* body, uint64_t size, uint64_t& read) const = 0;
virtual void* GetClientModule() const = 0;

virtual const char* GetActualHttpVersionUsed(void* hHttpRequest) const = 0;

bool StreamPayloadToRequest(const std::shared_ptr<HttpRequest>& request, void* hHttpRequest, Aws::Utils::RateLimits::RateLimiterInterface* writeLimiter) const;
void LogRequestInternalFailure() const;
bool BuildSuccessResponse(const std::shared_ptr<HttpRequest>& request, std::shared_ptr<Aws::Http::HttpResponse>& response, void* hHttpRequest, Aws::Utils::RateLimits::RateLimiterInterface* readLimiter) const;
Expand Down
200 changes: 173 additions & 27 deletions src/aws-cpp-sdk-core/source/http/windows/WinHttpSyncHttpClient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@

#include <Windows.h>
#include <winhttp.h>
#include <mstcpip.h> // for tcp_keepalive
#include <sstream>
#include <iostream>
#include <versionhelpers.h>
Expand Down Expand Up @@ -85,14 +86,109 @@ DWORD ConvertHttpVersionToWinHttpVersion(const Aws::Http::Version version)
#endif
}

void AzWinHttpLogLastError(const char* FuncName)
{
#define AZ_WINHTTP_ERROR(win_http_error) \
{win_http_error, #win_http_error}

static const std::pair<DWORD, const char*> WIN_HTTP_ERRORS[] = {
AZ_WINHTTP_ERROR(ERROR_WINHTTP_OUT_OF_HANDLES),
AZ_WINHTTP_ERROR(ERROR_WINHTTP_TIMEOUT),
AZ_WINHTTP_ERROR(ERROR_WINHTTP_INTERNAL_ERROR),
AZ_WINHTTP_ERROR(ERROR_WINHTTP_INVALID_URL),
AZ_WINHTTP_ERROR(ERROR_WINHTTP_UNRECOGNIZED_SCHEME),
AZ_WINHTTP_ERROR(ERROR_WINHTTP_NAME_NOT_RESOLVED),
AZ_WINHTTP_ERROR(ERROR_WINHTTP_INVALID_OPTION),
AZ_WINHTTP_ERROR(ERROR_WINHTTP_OPTION_NOT_SETTABLE),
AZ_WINHTTP_ERROR(ERROR_WINHTTP_SHUTDOWN),
AZ_WINHTTP_ERROR(ERROR_WINHTTP_LOGIN_FAILURE),
AZ_WINHTTP_ERROR(ERROR_WINHTTP_OPERATION_CANCELLED),
AZ_WINHTTP_ERROR(ERROR_WINHTTP_INCORRECT_HANDLE_TYPE),
AZ_WINHTTP_ERROR(ERROR_WINHTTP_INCORRECT_HANDLE_STATE),
AZ_WINHTTP_ERROR(ERROR_WINHTTP_CANNOT_CONNECT),
AZ_WINHTTP_ERROR(ERROR_WINHTTP_CONNECTION_ERROR),
AZ_WINHTTP_ERROR(ERROR_WINHTTP_RESEND_REQUEST),
AZ_WINHTTP_ERROR(ERROR_WINHTTP_CLIENT_AUTH_CERT_NEEDED),
AZ_WINHTTP_ERROR(ERROR_WINHTTP_CANNOT_CALL_BEFORE_OPEN),
AZ_WINHTTP_ERROR(ERROR_WINHTTP_CANNOT_CALL_BEFORE_SEND),
AZ_WINHTTP_ERROR(ERROR_WINHTTP_CANNOT_CALL_AFTER_SEND),
AZ_WINHTTP_ERROR(ERROR_WINHTTP_CANNOT_CALL_AFTER_OPEN),
AZ_WINHTTP_ERROR(ERROR_WINHTTP_HEADER_NOT_FOUND),
AZ_WINHTTP_ERROR(ERROR_WINHTTP_INVALID_SERVER_RESPONSE),
AZ_WINHTTP_ERROR(ERROR_WINHTTP_INVALID_HEADER),
AZ_WINHTTP_ERROR(ERROR_WINHTTP_INVALID_QUERY_REQUEST),
AZ_WINHTTP_ERROR(ERROR_WINHTTP_HEADER_ALREADY_EXISTS),
AZ_WINHTTP_ERROR(ERROR_WINHTTP_REDIRECT_FAILED),
AZ_WINHTTP_ERROR(ERROR_WINHTTP_AUTO_PROXY_SERVICE_ERROR),
AZ_WINHTTP_ERROR(ERROR_WINHTTP_BAD_AUTO_PROXY_SCRIPT),
AZ_WINHTTP_ERROR(ERROR_WINHTTP_UNABLE_TO_DOWNLOAD_SCRIPT),
AZ_WINHTTP_ERROR(ERROR_WINHTTP_UNHANDLED_SCRIPT_TYPE),
AZ_WINHTTP_ERROR(ERROR_WINHTTP_SCRIPT_EXECUTION_ERROR),
AZ_WINHTTP_ERROR(ERROR_WINHTTP_NOT_INITIALIZED),
AZ_WINHTTP_ERROR(ERROR_WINHTTP_SECURE_FAILURE),
AZ_WINHTTP_ERROR(ERROR_WINHTTP_SECURE_CERT_DATE_INVALID),
AZ_WINHTTP_ERROR(ERROR_WINHTTP_SECURE_CERT_CN_INVALID),
AZ_WINHTTP_ERROR(ERROR_WINHTTP_SECURE_INVALID_CA),
AZ_WINHTTP_ERROR(ERROR_WINHTTP_SECURE_CERT_REV_FAILED),
AZ_WINHTTP_ERROR(ERROR_WINHTTP_SECURE_CHANNEL_ERROR),
AZ_WINHTTP_ERROR(ERROR_WINHTTP_SECURE_INVALID_CERT),
AZ_WINHTTP_ERROR(ERROR_WINHTTP_SECURE_CERT_REVOKED),
AZ_WINHTTP_ERROR(ERROR_WINHTTP_SECURE_CERT_WRONG_USAGE),
AZ_WINHTTP_ERROR(ERROR_WINHTTP_AUTODETECTION_FAILED),
AZ_WINHTTP_ERROR(ERROR_WINHTTP_HEADER_COUNT_EXCEEDED),
AZ_WINHTTP_ERROR(ERROR_WINHTTP_HEADER_SIZE_OVERFLOW),
AZ_WINHTTP_ERROR(ERROR_WINHTTP_CHUNKED_ENCODING_HEADER_SIZE_OVERFLOW),
AZ_WINHTTP_ERROR(ERROR_WINHTTP_RESPONSE_DRAIN_OVERFLOW),
AZ_WINHTTP_ERROR(ERROR_WINHTTP_CLIENT_CERT_NO_PRIVATE_KEY),
AZ_WINHTTP_ERROR(ERROR_WINHTTP_CLIENT_CERT_NO_ACCESS_PRIVATE_KEY),
AZ_WINHTTP_ERROR(ERROR_WINHTTP_CLIENT_AUTH_CERT_NEEDED_PROXY),
AZ_WINHTTP_ERROR(ERROR_WINHTTP_SECURE_FAILURE_PROXY),
AZ_WINHTTP_ERROR(ERROR_WINHTTP_RESERVED_189),
AZ_WINHTTP_ERROR(ERROR_WINHTTP_HTTP_PROTOCOL_MISMATCH),
AZ_WINHTTP_ERROR(ERROR_WINHTTP_GLOBAL_CALLBACK_FAILED),
AZ_WINHTTP_ERROR(ERROR_WINHTTP_FEATURE_DISABLED),
AZ_WINHTTP_ERROR(ERROR_INVALID_PARAMETER),
AZ_WINHTTP_ERROR(ERROR_NOT_ENOUGH_MEMORY)
};
#undef AZ_WINHTTP_ERROR

static const size_t WIN_HTTP_ERRORS_SZ = sizeof(WIN_HTTP_ERRORS) / sizeof(WIN_HTTP_ERRORS[0]);

const auto lastError = GetLastError();
size_t errorIdx = 0;
for(; errorIdx < WIN_HTTP_ERRORS_SZ; ++errorIdx)
{
if(WIN_HTTP_ERRORS[errorIdx].first == lastError)
{
AWS_LOGSTREAM_ERROR("WinHttp", "Failed to " << FuncName << " with an error code: " << WIN_HTTP_ERRORS[errorIdx].second);
break;
}
}
if (errorIdx == WIN_HTTP_ERRORS_SZ)
{
AWS_LOGSTREAM_ERROR("WinHttp", "Failed to " << FuncName << " with an unknown error code: " << lastError);
}
}

template<typename WinHttpFunc, typename... Args>
bool AzCallWinHttp(const char* FuncName, WinHttpFunc func, Args &&... args)
{
bool success = func(std::forward<Args>(args)...);
if (!success)
{
AzWinHttpLogLastError(FuncName);
}
return success;
}

static void WinHttpSetHttpVersion(void* handle, const Aws::Http::Version version)
{
DWORD winHttpVersion = ConvertHttpVersionToWinHttpVersion(version);
if (winHttpVersion == 0x0)
{
return;
}
if (!WinHttpSetOption(handle, WINHTTP_OPTION_ENABLE_HTTP_PROTOCOL, &winHttpVersion, sizeof(winHttpVersion)))
if (!AzCallWinHttp("WinHttpSetOption", WinHttpSetOption, handle, WINHTTP_OPTION_ENABLE_HTTP_PROTOCOL, &winHttpVersion, sizeof(winHttpVersion)))
{
AWS_LOGSTREAM_ERROR("WinHttpHttp2", "Failed to set WINHTTP_OPTION_ENABLE_HTTP_PROTOCOL to " << winHttpVersion << " on WinHttp handle: " << handle);
}
Expand Down Expand Up @@ -282,7 +378,7 @@ static void CALLBACK WinHttpSyncLogCallback(HINTERNET hInternet,
}
else
{
AWS_LOGSTREAM_TRACE("WinHttp", data->statusString);
AWS_LOGSTREAM_TRACE("WinHttp", data->statusString);
}
found = true;
}//found handler
Expand All @@ -299,6 +395,8 @@ WinHttpSyncHttpClient::WinHttpSyncHttpClient(const ClientConfiguration& config)
m_verifySSL(config.verifySSL),
m_version(config.version)
{
m_enableHttpClientTrace = config.enableHttpClientTrace;

AWS_LOGSTREAM_INFO(GetLogTag(), "Creating http client with user agent " << config.userAgent << " with max connections " << config.maxConnections
<< " request timeout " << config.requestTimeoutMs << ",and connect timeout " << config.connectTimeoutMs);

Expand Down Expand Up @@ -349,19 +447,21 @@ WinHttpSyncHttpClient::WinHttpSyncHttpClient(const ClientConfiguration& config)
Aws::WString openString = StringUtils::ToWString(config.userAgent.c_str());
// WinhttpOpen will create a session handle
HINTERNET hHttpSession = WinHttpOpen(openString.c_str(), winhttpFlags, proxyString.c_str(), nullptr, 0);
if (!hHttpSession)
{
AWS_LOGSTREAM_FATAL(GetLogTag(), "Failed to open WinHttp session, last error: " << GetLastError());
}

if (config.enableHttpClientTrace)
if (m_enableHttpClientTrace)
{
AWS_LOGSTREAM_DEBUG(GetLogTag(), "Enabling WinHttp traces");
WinHttpSetStatusCallback(hHttpSession, WinHttpSyncLogCallback, WINHTTP_CALLBACK_FLAG_ALL_NOTIFICATIONS, (DWORD_PTR)NULL);
}

SetOpenHandle(hHttpSession);

if (!WinHttpSetTimeouts(GetOpenHandle(), config.connectTimeoutMs, config.connectTimeoutMs, -1, config.requestTimeoutMs))
{
AWS_LOGSTREAM_WARN(GetLogTag(), "Error setting timeouts " << GetLastError());
}
AzCallWinHttp("WinHttpSetTimeouts", WinHttpSetTimeouts,
GetOpenHandle(), config.connectTimeoutMs, config.connectTimeoutMs, -1, config.requestTimeoutMs);
WinHttpSetHttpVersion(GetOpenHandle(), m_version);
if (m_verifySSL)
{
Expand All @@ -384,12 +484,26 @@ WinHttpSyncHttpClient::WinHttpSyncHttpClient(const ClientConfiguration& config)
WINHTTP_FLAG_SECURE_PROTOCOL_TLS1_2;
#endif

if (!WinHttpSetOption(GetOpenHandle(), WINHTTP_OPTION_SECURE_PROTOCOLS, &flags, sizeof(flags)))
if (!AzCallWinHttp("WinHttpSetOption", WinHttpSetOption, GetOpenHandle(), WINHTTP_OPTION_SECURE_PROTOCOLS, &flags, sizeof(flags)))
{
AWS_LOGSTREAM_FATAL(GetLogTag(), "Failed setting secure crypto protocols with error code: " << GetLastError());
}
}

if (config.enableTcpKeepAlive)
{
tcp_keepalive keepAlive = {};
keepAlive.onoff = 1;
// Default 3000 and 30000 ms according to our ClientConfig doc
keepAlive.keepalivetime = config.requestTimeoutMs ? config.requestTimeoutMs : 3000;
keepAlive.keepaliveinterval = config.tcpKeepAliveIntervalMs ? config.tcpKeepAliveIntervalMs : 30000;

if (!AzCallWinHttp("WinHttpSetOption", WinHttpSetOption, hHttpSession, WINHTTP_OPTION_TCP_KEEPALIVE, &keepAlive, sizeof(keepAlive)))
{
AWS_LOGSTREAM_WARN(GetLogTag(), "Failed setting TCP keep-alive config on WinHttpSession");
}
}

AWS_LOGSTREAM_DEBUG(GetLogTag(), "API handle " << GetOpenHandle());
SetConnectionPoolManager(Aws::New<WinHttpConnectionPoolMgr>(GetLogTag(),
GetOpenHandle(), config.maxConnections, config.requestTimeoutMs, config.connectTimeoutMs, config.enableTcpKeepAlive, config.tcpKeepAliveIntervalMs));
Expand Down Expand Up @@ -427,37 +541,41 @@ void* WinHttpSyncHttpClient::OpenRequest(const std::shared_ptr<HttpRequest>& req
//add proxy auth credentials to everything using this handle.
if (m_usingProxy)
{
if (!m_proxyUserName.empty() && !WinHttpSetOption(hHttpRequest, WINHTTP_OPTION_PROXY_USERNAME, (LPVOID)m_proxyUserName.c_str(), (DWORD)m_proxyUserName.length()))
if (!m_proxyUserName.empty() && !AzCallWinHttp("WinHttpSetOption", WinHttpSetOption, hHttpRequest, WINHTTP_OPTION_PROXY_USERNAME, (LPVOID)m_proxyUserName.c_str(), (DWORD)m_proxyUserName.length()))
{
AWS_LOGSTREAM_FATAL(GetLogTag(), "Failed setting username for proxy with error code: " << GetLastError());
if (!m_proxyPassword.empty() && !WinHttpSetOption(hHttpRequest, WINHTTP_OPTION_PROXY_PASSWORD, (LPVOID)m_proxyPassword.c_str(), (DWORD)m_proxyPassword.length()))
}
if (!m_proxyPassword.empty() && !AzCallWinHttp("WinHttpSetOption", WinHttpSetOption, hHttpRequest, WINHTTP_OPTION_PROXY_PASSWORD, (LPVOID)m_proxyPassword.c_str(), (DWORD)m_proxyPassword.length()))
{
AWS_LOGSTREAM_FATAL(GetLogTag(), "Failed setting password for proxy with error code: " << GetLastError());
}
}

if (!m_verifySSL) // Turning ssl unknown ca verification off
{
DWORD flags = SECURITY_FLAG_IGNORE_UNKNOWN_CA | SECURITY_FLAG_IGNORE_CERT_CN_INVALID;
if (!WinHttpSetOption(hHttpRequest, WINHTTP_OPTION_SECURITY_FLAGS, &flags, sizeof(flags)))
if (!AzCallWinHttp("WinHttpSetOption", WinHttpSetOption, hHttpRequest, WINHTTP_OPTION_SECURITY_FLAGS, &flags, sizeof(flags)))
{
AWS_LOGSTREAM_FATAL(GetLogTag(), "Failed to turn ssl cert ca verification off.");
}
}

// WinHTTP doesn't have the option to turn off keep-alive, so we will only set the value if keep-alive is turned on.
// see https://docs.microsoft.com/en-us/windows/desktop/winhttp/option-flags for more information on default values.
if (GetConnectionPoolManager()->GetEnableTcpKeepAlive())
if (!GetConnectionPoolManager()->GetEnableTcpKeepAlive())
{
DWORD keepAliveIntervalMs = GetConnectionPoolManager()->GetTcpKeepAliveInterval();
if (!WinHttpSetOption(hHttpRequest, WINHTTP_OPTION_WEB_SOCKET_KEEPALIVE_INTERVAL, &keepAliveIntervalMs, sizeof(keepAliveIntervalMs)))
{
AWS_LOGSTREAM_WARN(GetLogTag(), "Failed setting TCP keep-alive interval with error code: " << GetLastError());
}
DWORD keepAliveDisable = WINHTTP_DISABLE_KEEP_ALIVE;
AzCallWinHttp("WinHttpSetOption:WINHTTP_DISABLE_KEEP_ALIVE", WinHttpSetOption,
hHttpRequest, WINHTTP_OPTION_DISABLE_FEATURE, &keepAliveDisable, sizeof(keepAliveDisable));
}

//DISABLE_FEATURE settings need to be made after OpenRequest but before SendRequest
if (!m_allowRedirects)
{
requestFlags = WINHTTP_DISABLE_REDIRECTS;

if (!WinHttpSetOption(hHttpRequest, WINHTTP_OPTION_DISABLE_FEATURE, &requestFlags, sizeof(requestFlags)))
if (!AzCallWinHttp("WinHttpSetOption", WinHttpSetOption, hHttpRequest, WINHTTP_OPTION_DISABLE_FEATURE, &requestFlags, sizeof(requestFlags)))
{
AWS_LOGSTREAM_FATAL(GetLogTag(), "Failed to turn off redirects!");
}
}

WinHttpSetHttpVersion(hHttpRequest, m_version);
Expand All @@ -469,8 +587,11 @@ void WinHttpSyncHttpClient::DoAddHeaders(void* hHttpRequest, Aws::String& header

Aws::WString wHeaderString = StringUtils::ToWString(headerStr.c_str());

if (!WinHttpAddRequestHeaders(hHttpRequest, wHeaderString.c_str(), (DWORD)wHeaderString.length(), WINHTTP_ADDREQ_FLAG_REPLACE | WINHTTP_ADDREQ_FLAG_ADD))
if (!AzCallWinHttp("WinHttpAddRequestHeaders", WinHttpAddRequestHeaders,
hHttpRequest, wHeaderString.c_str(), (DWORD)wHeaderString.length(), WINHTTP_ADDREQ_FLAG_REPLACE | WINHTTP_ADDREQ_FLAG_ADD))
{
AWS_LOGSTREAM_ERROR(GetLogTag(), "Failed to add HTTP request headers: " << headerStr << ", with error code: " << GetLastError());
}
}

uint64_t WinHttpSyncHttpClient::DoWriteData(void* hHttpRequest, char* streamBuffer, uint64_t bytesRead, bool isChunked) const
Expand All @@ -483,25 +604,25 @@ uint64_t WinHttpSyncHttpClient::DoWriteData(void* hHttpRequest, char* streamBuff
{
Aws::String chunkSizeHexString = StringUtils::ToHexString(bytesRead) + CRLF;

if (!WinHttpWriteData(hHttpRequest, chunkSizeHexString.c_str(), (DWORD)chunkSizeHexString.size(), &bytesWritten))
if (!AzCallWinHttp("WinHttpWriteData", WinHttpWriteData, hHttpRequest, chunkSizeHexString.c_str(), (DWORD)chunkSizeHexString.size(), &bytesWritten))
{
return totalBytesWritten;
}
totalBytesWritten += bytesWritten;
if (!WinHttpWriteData(hHttpRequest, streamBuffer, (DWORD)bytesRead, &bytesWritten))
if (!AzCallWinHttp("WinHttpWriteData", WinHttpWriteData, hHttpRequest, streamBuffer, (DWORD)bytesRead, &bytesWritten))
{
return totalBytesWritten;
}
totalBytesWritten += bytesWritten;
if (!WinHttpWriteData(hHttpRequest, CRLF, (DWORD)(sizeof(CRLF) - 1), &bytesWritten))
if (!AzCallWinHttp("WinHttpWriteData", WinHttpWriteData, hHttpRequest, CRLF, (DWORD)(sizeof(CRLF) - 1), &bytesWritten))
{
return totalBytesWritten;
}
totalBytesWritten += bytesWritten;
}
else
{
if (!WinHttpWriteData(hHttpRequest, streamBuffer, (DWORD)bytesRead, &bytesWritten))
if (!AzCallWinHttp("WinHttpWriteData", WinHttpWriteData, hHttpRequest, streamBuffer, (DWORD)bytesRead, &bytesWritten))
{
return totalBytesWritten;
}
Expand All @@ -515,7 +636,7 @@ uint64_t WinHttpSyncHttpClient::FinalizeWriteData(void* hHttpRequest) const
{
DWORD bytesWritten = 0;
const char trailingCRLF[] = "0\r\n\r\n";
if (!WinHttpWriteData(hHttpRequest, trailingCRLF, (DWORD)(sizeof(trailingCRLF) - 1), &bytesWritten))
if (!AzCallWinHttp("WinHttpWriteData", WinHttpWriteData, hHttpRequest, trailingCRLF, (DWORD)(sizeof(trailingCRLF) - 1), &bytesWritten))
{
return 0;
}
Expand Down Expand Up @@ -575,14 +696,39 @@ bool WinHttpSyncHttpClient::DoQueryHeaders(void* hHttpRequest, std::shared_ptr<H

bool WinHttpSyncHttpClient::DoSendRequest(void* hHttpRequest) const
{
return (WinHttpSendRequest(hHttpRequest, NULL, NULL, 0, 0, 0, NULL) != 0);
bool success = WinHttpSendRequest(hHttpRequest, NULL, NULL, 0, 0, 16 * 1024, NULL) != 0;
if (!success)
{
AzWinHttpLogLastError("WinHttpSendRequest");
}
return success;
}

bool WinHttpSyncHttpClient::DoReadData(void* hHttpRequest, char* body, uint64_t size, uint64_t& read) const
{
return (WinHttpReadData(hHttpRequest, body, (DWORD)size, (LPDWORD)&read) != 0);
}

const char* WinHttpSyncHttpClient::GetActualHttpVersionUsed(void* hHttpRequest) const
{
DWORD httpVersion = 0xFFF;
DWORD ioLen = sizeof(httpVersion);
AzCallWinHttp("WinHttpSetOption", WinHttpQueryOption, hHttpRequest, WINHTTP_OPTION_HTTP_PROTOCOL_USED, &httpVersion, &ioLen);

switch (httpVersion)
{
case 0x0:
return "1.1 or 1.0";
case 0x1:
return "2.0";
case 0x2:
return "3.0";
default:
break;
}
return "Unknown";
}

void* WinHttpSyncHttpClient::GetClientModule() const
{
return GetModuleHandle(TEXT("winhttp.dll"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,12 @@ bool WinINetSyncHttpClient::DoReadData(void* hHttpRequest, char* body, uint64_t
return (InternetReadFile(hHttpRequest, body, (DWORD)size, (LPDWORD)&read) != 0);
}

const char* WinINetSyncHttpClient::GetActualHttpVersionUsed(void* hHttpRequest) const
{
AWS_UNREFERENCED_PARAM(hHttpRequest);
return "Unknown";
}

void* WinINetSyncHttpClient::GetClientModule() const
{
return GetModuleHandle(TEXT("wininet.dll"));
Expand Down
Loading

0 comments on commit d6b310c

Please sign in to comment.