win: Pass WINHTTP_FLAG_SECURE when necessary

Otherwise the server drops us when connecting to an https endpoint,
and WinHttpReceiveResponse fails with an obscure error.

R=mark@chromium.org
BUG=crashpad:1

Review URL: https://codereview.chromium.org/1317023003 .
This commit is contained in:
Scott Graham 2015-08-31 13:29:00 -07:00
parent f21b740171
commit 78bba8808b

View File

@ -119,6 +119,8 @@ bool HTTPTransportWin::ExecuteSynchronously(std::string* response_body) {
LogErrorWinHttpMessage("WinHttpCrackUrl");
return false;
}
DCHECK(url_components.nScheme == INTERNET_SCHEME_HTTP ||
url_components.nScheme == INTERNET_SCHEME_HTTPS);
std::wstring host_name(url_components.lpszHostName,
url_components.dwHostNameLength);
std::wstring url_path(url_components.lpszUrlPath,
@ -133,14 +135,15 @@ bool HTTPTransportWin::ExecuteSynchronously(std::string* response_body) {
return false;
}
ScopedHINTERNET request(
WinHttpOpenRequest(connect.get(),
base::UTF8ToUTF16(method()).c_str(),
url_path.c_str(),
nullptr,
WINHTTP_NO_REFERER,
WINHTTP_DEFAULT_ACCEPT_TYPES,
0));
ScopedHINTERNET request(WinHttpOpenRequest(
connect.get(),
base::UTF8ToUTF16(method()).c_str(),
url_path.c_str(),
nullptr,
WINHTTP_NO_REFERER,
WINHTTP_DEFAULT_ACCEPT_TYPES,
url_components.nScheme == INTERNET_SCHEME_HTTPS ? WINHTTP_FLAG_SECURE
: 0));
if (!request.get()) {
LogErrorWinHttpMessage("WinHttpOpenRequest");
return false;