Hi!
I use a custom HTTPS proxy server with my own root certificate. I add this certificate to the Windows certificates store as Trusted Root and everything works ok but only in the case when I configure system proxy via Windows "Proxy Settings" menu.
In the case when I try to configure system proxy by my custom application I got a certificate validation error. I have to enable system proxy "by hand" via Windows "Proxy Settings" menu to resolve this error.
For proxy configuration I use function like this:
BOOL EnableProxy(LPCSTR addr, UINT port)
{
INTERNET_PER_CONN_OPTION_LIST option_list;
INTERNET_PER_CONN_OPTION options[3];
option_list.dwSize = sizeof(option_list);
option_list.pszConnection = NULL;
option_list.dwOptionCount = 3;
option_list.pOptions = options;
options[0].dwOption = INTERNET_PER_CONN_FLAGS;
options[0].Value.dwValue = PROXY_TYPE_DIRECT | PROXY_TYPE_PROXY;
char proxy_server[128];
_snprintf_s(proxy_server, sizeof(proxy_server) - 1, "%s:%d", addr, port);
options[1].dwOption = INTERNET_PER_CONN_PROXY_SERVER;
options[1].Value.pszValue = proxy_server;
options[2].dwOption = INTERNET_PER_CONN_PROXY_BYPASS;
options[2].Value.pszValue = (LPSTR)"localhost";
if (InternetSetOption(NULL, INTERNET_OPTION_PER_CONNECTION_OPTION, &option_list, option_list.dwSize) == TRUE)
{
InternetSetOption(NULL, INTERNET_OPTION_SETTINGS_CHANGED, NULL, 0);
InternetSetOption(NULL, INTERNET_OPTION_REFRESH, NULL, 0);
return TRUE;
}
else { return FALSE; }
}
So, looks like I missed something important in my application and it can't enable system proxy to work with proxy https server.
Could you help me with this issue?
OS: Windows 10