我有一个c ++应用程序,使用http和WinHttpClient发送数据 我想开始打磨https
bool ret = false;
WinHttpClient client(wstring(url.begin(), url.end()));
ret = client.SetAdditionalDataToSend((BYTE *)data.c_str(), (unsigned int)data.length());
if (ret)
{
// Set request headers.
wchar_t szSize[50] = L"";
swprintf_s(szSize, L"%d", data.size());
wstring headers = L"Content-Length: ";
headers += szSize;
headers += L"\r\nContent-Type: application/x-www-form-urlencoded\r\n";
string apiVersion = ...;
headers += L"\r\nAccept-Version: " + wstring(apiVersion.begin(), apiVersion.end()) + L"\r\n";
ret = client.SetAdditionalRequestHeaders(headers);
client.SetUserAgent(L"..." + to_wstring(...));
}
// Send http post request.
if (ret) ret = client.SendHttpRequest(L"POST");
我已经读过我需要添加
client.SetRequireValidSslCertificates(false);
在我创建客户端之后,但是当我尝试注意更改时 所以问题是如何使用https发送它?