Discussion:
InternetSetOption Question
(too old to reply)
jeffromiller
2004-07-13 23:53:01 UTC
Permalink
I am trying to pull data off of a website that just started using SSL (previously we were pulling data off the site just using http). The old site had url, say, "www.url.com" where the certificate was issued. The new site is "www.urlnew.com" but is using the cert from the old site. I'm pretty sure I can use InternetSetOption to set the INTERNET_FLAG_IGNORE_CERT_CN_INVALID to ignore this "error"...but every time I try to set the option it doesn't actually set anything.

I figure the only values you can set this to are true or false (1 or 0). Here's my line of code:

intRetVal = InternetSetOption(hHttpOpenRequest, INTERNET_FLAG_IGNORE_CERT_CN_INVALID, 1, 1)

What am I doing wrong? Thanks alot!
Jeff M.
Stephen Sulzer
2004-07-14 00:44:17 UTC
Permalink
INTERNET_FLAG_IGNORE_CERT_CN_INVALID is a flag you give to the
HttpOpenRequest API (2nd-last parameter). It is not a WinInet API option.
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wininet/wininet/httpopenrequest.asp

Btw, the syntax of your call to InternetSetOption isn't correct. The 3rd
parameter is a pointer to the buffer containing the option value, and the
4th parameter is a DWORD specifying the length of the value.


Stephen
Post by jeffromiller
I am trying to pull data off of a website that just started using SSL
(previously we were pulling data off the site just using http). The old
site had url, say, "www.url.com" where the certificate was issued. The new
site is "www.urlnew.com" but is using the cert from the old site. I'm
pretty sure I can use InternetSetOption to set the
INTERNET_FLAG_IGNORE_CERT_CN_INVALID to ignore this "error"...but every time
I try to set the option it doesn't actually set anything.
Post by jeffromiller
I figure the only values you can set this to are true or false (1 or 0).
intRetVal = InternetSetOption(hHttpOpenRequest,
INTERNET_FLAG_IGNORE_CERT_CN_INVALID, 1, 1)
Post by jeffromiller
What am I doing wrong? Thanks alot!
Jeff M.
jeffromiller
2004-07-14 16:06:04 UTC
Permalink
Thanks. I understand all that (I have been looking at this code way too long...).

I'm still having problems though - even when I put that FLAG in my HttpOpenRequest. Basically, I'm trying to pull data off a site that uses https - but the site certificate domain does not match the url I am trying to access...

Can anyone provide me some code examples on how you can get around that dumb certificate error?

Thanks!
Post by Stephen Sulzer
INTERNET_FLAG_IGNORE_CERT_CN_INVALID is a flag you give to the
HttpOpenRequest API (2nd-last parameter). It is not a WinInet API option.
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wininet/wininet/httpopenrequest.asp
Btw, the syntax of your call to InternetSetOption isn't correct. The 3rd
parameter is a pointer to the buffer containing the option value, and the
4th parameter is a DWORD specifying the length of the value.
Stephen
Post by jeffromiller
I am trying to pull data off of a website that just started using SSL
(previously we were pulling data off the site just using http). The old
site had url, say, "www.url.com" where the certificate was issued. The new
site is "www.urlnew.com" but is using the cert from the old site. I'm
pretty sure I can use InternetSetOption to set the
INTERNET_FLAG_IGNORE_CERT_CN_INVALID to ignore this "error"...but every time
I try to set the option it doesn't actually set anything.
Post by jeffromiller
I figure the only values you can set this to are true or false (1 or 0).
intRetVal = InternetSetOption(hHttpOpenRequest,
INTERNET_FLAG_IGNORE_CERT_CN_INVALID, 1, 1)
Post by jeffromiller
What am I doing wrong? Thanks alot!
Jeff M.
jeffromiller
2004-07-14 16:06:01 UTC
Permalink
Thanks. I understand all that (I have been looking at this code way too long...).

I'm still having problems though - even when I put that FLAG in my HttpOpenRequest. Basically, I'm trying to pull data off a site that uses https - but the site certificate domain does not match the url I am trying to access...

Can anyone provide me some code examples on how you can get around that dumb certificate error?

Thanks!
Post by Stephen Sulzer
INTERNET_FLAG_IGNORE_CERT_CN_INVALID is a flag you give to the
HttpOpenRequest API (2nd-last parameter). It is not a WinInet API option.
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wininet/wininet/httpopenrequest.asp
Btw, the syntax of your call to InternetSetOption isn't correct. The 3rd
parameter is a pointer to the buffer containing the option value, and the
4th parameter is a DWORD specifying the length of the value.
Stephen
Post by jeffromiller
I am trying to pull data off of a website that just started using SSL
(previously we were pulling data off the site just using http). The old
site had url, say, "www.url.com" where the certificate was issued. The new
site is "www.urlnew.com" but is using the cert from the old site. I'm
pretty sure I can use InternetSetOption to set the
INTERNET_FLAG_IGNORE_CERT_CN_INVALID to ignore this "error"...but every time
I try to set the option it doesn't actually set anything.
Post by jeffromiller
I figure the only values you can set this to are true or false (1 or 0).
intRetVal = InternetSetOption(hHttpOpenRequest,
INTERNET_FLAG_IGNORE_CERT_CN_INVALID, 1, 1)
Post by jeffromiller
What am I doing wrong? Thanks alot!
Jeff M.
jeffromiller
2004-07-14 16:06:05 UTC
Permalink
Thanks. I understand all that (I have been looking at this code way too long...).

I'm still having problems though - even when I put that FLAG in my HttpOpenRequest. Basically, I'm trying to pull data off a site that uses https - but the site certificate domain does not match the url I am trying to access...

Can anyone provide me some code examples on how you can get around that dumb certificate error?

Thanks!
Post by Stephen Sulzer
INTERNET_FLAG_IGNORE_CERT_CN_INVALID is a flag you give to the
HttpOpenRequest API (2nd-last parameter). It is not a WinInet API option.
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wininet/wininet/httpopenrequest.asp
Btw, the syntax of your call to InternetSetOption isn't correct. The 3rd
parameter is a pointer to the buffer containing the option value, and the
4th parameter is a DWORD specifying the length of the value.
Stephen
Post by jeffromiller
I am trying to pull data off of a website that just started using SSL
(previously we were pulling data off the site just using http). The old
site had url, say, "www.url.com" where the certificate was issued. The new
site is "www.urlnew.com" but is using the cert from the old site. I'm
pretty sure I can use InternetSetOption to set the
INTERNET_FLAG_IGNORE_CERT_CN_INVALID to ignore this "error"...but every time
I try to set the option it doesn't actually set anything.
Post by jeffromiller
I figure the only values you can set this to are true or false (1 or 0).
intRetVal = InternetSetOption(hHttpOpenRequest,
INTERNET_FLAG_IGNORE_CERT_CN_INVALID, 1, 1)
Post by jeffromiller
What am I doing wrong? Thanks alot!
Jeff M.
Loading...