C/C++ Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsProgrammingC/C++ Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old January 1st, 2005, 05:18 AM
sinale sinale is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jan 2005
Posts: 2 sinale User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 m 32 sec
Reputation Power: 0
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

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingC/C++ Help > Problem with HttpSendRequest


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway
Stay green...Green IT