HTTPS 证书处理

 

---------------------------------------华丽的分割线-----------------------------------------

 

 

HttpSendRequest 返回失败时

//-------------------------HTTPS 证书处理-----------------------------------------

 

         if ( ! bResult && GetLastError() == ERROR_INTERNET_INVALID_CA &&

              nPort == INTERNET_DEFAULT_HTTPS_PORT)    
        {   
            DWORD dwFlags;   
            DWORD dwBuffLen = sizeof(dwFlags);   
            InternetQueryOption (hRequestINTERNET_OPTION_SECURITY_FLAGS, (LPVOID)&dwFlags, &dwBuffLen);   
            dwFlags |= SECURITY_FLAG_IGNORE_UNKNOWN_CA;   
            InternetSetOption (hRequestINTERNET_OPTION_SECURITY_FLAGS, &dwFlagssizeof (dwFlags) );   
            bResult = HttpSendRequest(hRequest, szHeaderBuff, nHeaderSize, szReqBuff, nReqSize);   
        }

 

//---------------------------------------------------------------------------------

 

 

 

你可能感兴趣的:(Security)