I use the following code successfully to fetch a file via HTTP. However, if
I attempt to fetch from an https address (Secure Connection) it fails with
the following error message after about 60 seconds:
"A connection with the server could not be established".
Is there an additional call I need to make, or change to the existing code
to allow the https file fetch?
Thanks!
------------------------------------------------
LPCTSTR ppszAcceptTypes[2];
ppszAcceptTypes[0] = _T("*/*");
ppszAcceptTypes[1] = NULL;
iEnd = iStart;
session = new CInternetSession();
strServer.MakeLower();
DWORD dwFlags = 0;
INTERNET_PORT nPort = 80;
if (strServer.Find(L"https") != -1)
{
nPort = 443; // SSL Port
dwFlags |= INTERNET_FLAG_SECURE;
}
connection = session->GetHttpConnection( strServer, dwFlags, nPort );
file = connection->OpenRequest(1, strFile, NULL, 1, ppszAcceptTypes,
L"HTTP/1.1", dwFlags);
file->AddRequestHeaders(strRequestHeader);
file->SendRequest();