Eine Redirect-Anforderung ändert eine nicht sichere in eine sichere Verbindung
-
Ich versuche mich mit CHttpFile auf einer Https Seite einzuloggen und erhalte die Fehlermeldung im Titel.Weiss jemand wo ich den Fehler mache?
CInternetSession * session = new CInternetSession("Mozilla/4.0 (compatible; MSIE 5.5; Windows 98; Win 9x 4.90)"); session->SetOption(INTERNET_OPTION_SECURITY_FLAGS,SECURITY_FLAG_IGNORE_WRONG_USAGE|SECURITY_FLAG_IGNORE_REDIRECT_TO_HTTP|SECURITY_FLAG_IGNORE_REDIRECT_TO_HTTPS); CHttpConnection * con = session->GetHttpConnection("meinserver.de",INTERNET_FLAG_TRANSFER_ASCII|INTERNET_FLAG_DONT_CACHE|INTERNET_FLAG_SECURE|INTERNET_FLAG_IGNORE_CERT_CN_INVALID | INTERNET_FLAG_IGNORE_CERT_DATE_INVALID,443,NULL,NULL); CHttpFile * hfile =con->OpenRequest(CHttpConnection::HTTP_VERB_POST,"loginseite"); CString param = "username=username&password=password"; hfile->SetOption(INTERNET_OPTION_SECURITY_FLAGS ,SECURITY_FLAG_SECURE|SECURITY_FLAG_IGNORE_WRONG_USAGE|SECURITY_FLAG_IGNORE_REDIRECT_TO_HTTP|SECURITY_FLAG_IGNORE_REDIRECT_TO_HTTPS); CString strHeaders = "Content-Type: application/x-www-form-urlencoded\r\nAccept: text\r\n"; hfile->AddRequestHeaders(strHeaders); try { hfile->SendRequest(NULL,0,(LPVOID)(LPCTSTR)param, param.GetLength()); } catch(CInternetException * ex) { //Hier tritt der Fehler auf } hfile->Close(); delete hfile; con->Close(); delete con; session->Close(); delete session;