| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
Problem with HttpSendRequest
Hi
I want to display to the user if the WEB site,that he is is protected by SSL. For this i want to get from the WEB server the client certificate object. I have a problem to send the request to the server. This is my code HINTERNET hOpen, hConnect, hReq; DWORD dwFlags = INTERNET_FLAG_NO_CACHE_WRITE | INTERNET_FLAG_KEEP_CONNECTION | INTERNET_FLAG_IGNORE_CERT_CN_INVALID | INTERNET_FLAG_IGNORE_CERT_DATE_INVALID| INTERNET_FLAG_PRAGMA_NOCACHE; char *lpBuffer, szData[51]; INTERNET_PORT dwPort; wchar_t* accept[2]={L"*/*",0}; if ( !(hOpen = InternetOpen ( "HeadDump", INTERNET_OPEN_TYPE_PRECONFIG , NULL, NULL, 0) ) ) { ShowError ( GetLastError(), "InternetOpen"); return false; } if ( !(hConnect = InternetConnect ( hOpen, url, dwPort,""/* user*/, ""/* password*/, INTERNET_SERVICE_HTTP, 0 , 1) ) ) { ShowError (GetLastError(), "InternetConnect"); return false; } if ( !(hReq = HttpOpenRequest (hConnect, "GET", url, "HTTP/1.0", "", (const char**) accept, dwFlags ,1 ))) { ShowError (GetLastError(), "HttpOpenRequest"); return false; } again: //Resolver::Trace("Send Request = " + data); std::string header = CONTENT_TYPE_STR; if ( !HttpSendRequest (hReq, // handle from HttpOpenRequest NULL,0, NULL,0) ) { ShowError (GetLastError(), "HttpSendRequest"); dwFlags |= SECURITY_FLAG_IGNORE_UNKNOWN_CA | SECURITY_FLAG_IGNORE_REVOCATION | SECURITY_FLAG_IGNORE_REDIRECT_TO_HTTP | SECURITY_FLAG_IGNORE_REDIRECT_TO_HTTPS | SECURITY_FLAG_IGNORE_CERT_DATE_INVALID | SECURITY_FLAG_IGNORE_CERT_CN_INVALID; if ( !InternetSetOption (hReq, INTERNET_OPTION_SECURITY_FLAGS, &dwFlags, sizeof (dwFlags) ) ) { ShowError(GetLastError(),"InternetSetOptionFailed"); return false; } } I'm new in VC++. URL Help me please with my question |
![]() |
| Viewing: Dev Articles Community Forums > Programming > C/C++ Help > Problem with HttpSendRequest |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|