Hi All,

I am using following code to establish a secure connection. But WinHttpSenRequest() fails. The error number returned by GetLastError() is 87, which dont seems to have relation with WinHttpSendRequest().

hSession = WinHttpOpen( L"OFX Download", WINHTTP_ACCESS_TYPE_NAMED_PROXY,
L"192.168.0.48:1749", L"<local>", 0);

if (!hSession)
{
ATLTRACE("Internet Open Failed");
return false;
}

hConnect = WinHttpConnect( hSession,L"ofxServer.com" , INTERNET_DEFAULT_HTTPS_PORT , 0);

if ( !hConnect )
{
DWORD nErr = GetLastError();
WinHttpCloseHandle(hSession);
return false;
}
hRequest = WinHttpOpenRequest( hConnect, L"GET", L"/ofxproxy/ofx_proxy.dll", NULL, WINHTTP_NO_REFERER, NULL, WINHTTP_FLAG_SECURE);

if ( !hRequest )
{
WinHttpCloseHandle(hConnect);
WinHttpCloseHandle(hSession);
return false;
}


CA2W qry(csPostString.GetBuffer()) ;

bResults = WinHttpSendRequest( hRequest, qry, wcslen(qry), WINHTTP_NO_REQUEST_DATA ,0, 0 , 0);

if (!bResults)
{
DWORD dwError = GetLastError();
WinHttpCloseHandle(hRequest);
(hConnect) WinHttpCloseHandle(hConnect);
(hSession) WinHttpCloseHandle(hSession);
return false;
}


Same task is being done very efficiently using WinInet. But due to some reasons I have to move towards WinHTTP.