Amazon recently turned off SSL support for S3 codes, and it seems to be causing problems with Windows XP SP3. I am using this code
hSession = WinHttpOpen(L"MySession", WINHTTP_ACCESS_TYPE_DEFAULT_PROXY, WINHTTP_NO_PROXY_NAME, WINHTTP_NO_PROXY_BYPASS, 0); if (bHTTPS) { DWORD flags = WINHTTP_FLAG_SECURE_PROTOCOL_TLS1; WinHttpSetOption(hSession, WINHTTP_OPTION_SECURE_PROTOCOLS, &flags, sizeof(flags)); } port = bHTTPS ? INTERNET_DEFAULT_HTTPS_PORT : INTERNET_DEFAULT_HTTP_PORT; hConnect = WinHttpConnect(hSession, srv_w, port, 0); hRequest = WinHttpOpenRequest(hConnect, vrb_w, adr_w, NULL, WINHTTP_NO_REFERER, NULL, WINHTTP_FLAG_REFRESH | (bHTTPS ? WINHTTP_FLAG_SECURE : 0)); if (bHTTPS) { DWORD dwSecFlag = SECURITY_FLAG_IGNORE_CERT_CN_INVALID | SECURITY_FLAG_IGNORE_CERT_DATE_INVALID | SECURITY_FLAG_IGNORE_UNKNOWN_CA | SECURITY_FLAG_IGNORE_CERT_WRONG_USAGE; WinHttpSetOption(hRequest, WINHTTP_OPTION_SECURITY_FLAGS, &dwSecFlag, sizeof(dwSecFlag)); } WinHttpSendRequest(hRequest, hdr_w, (headers != NULL) ? -1 : 0, data, size, size, 0); WinHttpReceiveResponse(hRequest, NULL);
This works on Win7 and works about a month ago on WinXP. But now I get WinHttp error 12152: the server returned an invalid or unrecognized response. I turned on tracing and the log file has a different error:
17:47:47.057 ::*0000001* :: WinHttpSendRequest(0x10a0000, "", 0, 0x0, 0, 0, 0) 17:47:47.135 ::*0000001* :: "s3.amazonaws.com" resolved 17:47:47.307 ::*0000001* :: Winsock/RPC/SSL/Transport error: 0x90312 [SEC_I_CONTINUE_NEEDED]
Is there a way to fix this problem without using third-party libraries? (browsers, including IE, download files without problems).