Petar Popara
2005-07-04 08:39:42 UTC
I have this code:
while (!HttpSendRequest(...))
{
dwError = GetLastError();
if ( dwError == ERROR_INTERNET_CLIENT_AUTH_CERT_NEEDED )
{
//Return ERROR_SUCCESS regardless of clicking on OK or Cancel
if( InternetErrorDlg( GetDesktopWindow(),
hHttpFile,
ERROR_INTERNET_CLIENT_AUTH_CERT_NEEDED,
FLAGS_ERROR_UI_FILTER_FOR_ERRORS |
FLAGS_ERROR_UI_FLAGS_GENERATE_DATA |
FLAGS_ERROR_UI_FLAGS_CHANGE_OPTIONS,
NULL) != ERROR_SUCCESS )
{
throw "Unable to make SSL connection";
}
}
else if ( dwError == ERROR_INTERNET_INVALID_CA )
{
//Return ERROR_SUCCESS regardless of clicking on OK or Cancel
if( InternetErrorDlg( GetDesktopWindow(),
hHttpFile,
ERROR_INTERNET_INVALID_CA,
FLAGS_ERROR_UI_FILTER_FOR_ERRORS |
FLAGS_ERROR_UI_FLAGS_GENERATE_DATA |
FLAGS_ERROR_UI_FLAGS_CHANGE_OPTIONS,
NULL) != ERROR_SUCCESS )
{
throw "Invalid server cert for SSL";
}
}
if (iCounter++>25)
break;//throw "Time out waiting for file to be sent";
}
Well, it "works fine". Almost. I just wouldn't like to show dialog
(InternetErrorDlg()) where user can choose cert or click "Yes" when warned
that something is wrong with CA cert. My app is server side app, and nobody
will be there to click on those dialogs/buttons. It should work silently.
What should I do? :(
while (!HttpSendRequest(...))
{
dwError = GetLastError();
if ( dwError == ERROR_INTERNET_CLIENT_AUTH_CERT_NEEDED )
{
//Return ERROR_SUCCESS regardless of clicking on OK or Cancel
if( InternetErrorDlg( GetDesktopWindow(),
hHttpFile,
ERROR_INTERNET_CLIENT_AUTH_CERT_NEEDED,
FLAGS_ERROR_UI_FILTER_FOR_ERRORS |
FLAGS_ERROR_UI_FLAGS_GENERATE_DATA |
FLAGS_ERROR_UI_FLAGS_CHANGE_OPTIONS,
NULL) != ERROR_SUCCESS )
{
throw "Unable to make SSL connection";
}
}
else if ( dwError == ERROR_INTERNET_INVALID_CA )
{
//Return ERROR_SUCCESS regardless of clicking on OK or Cancel
if( InternetErrorDlg( GetDesktopWindow(),
hHttpFile,
ERROR_INTERNET_INVALID_CA,
FLAGS_ERROR_UI_FILTER_FOR_ERRORS |
FLAGS_ERROR_UI_FLAGS_GENERATE_DATA |
FLAGS_ERROR_UI_FLAGS_CHANGE_OPTIONS,
NULL) != ERROR_SUCCESS )
{
throw "Invalid server cert for SSL";
}
}
if (iCounter++>25)
break;//throw "Time out waiting for file to be sent";
}
Well, it "works fine". Almost. I just wouldn't like to show dialog
(InternetErrorDlg()) where user can choose cert or click "Yes" when warned
that something is wrong with CA cert. My app is server side app, and nobody
will be there to click on those dialogs/buttons. It should work silently.
What should I do? :(