Discussion:
What dwAccessType flag for WinHttpOpen after WinHttpGetIEProxyConfigForCurrentUser?
(too old to reply)
Chris Shearer Cooper
2008-08-15 14:03:19 UTC
Permalink
I need to copy the IE proxy settings for use by my WinHTTP-based
application, and I found this web site that describes 90% of what I
need to know ...
http://msdn.microsoft.com/en-us/library/aa384075.aspx
but do I need to change the 'dwAccessType' flag that I pass to
WinHttpOpen? I'm guessing that if either lpszProxy or lpszProxyBypass
is non-NULL in the WINHTTP_CURRENT_USER_IE_PROXY_CONFIG structure, I
need to set the dwAccessType flag to WINHTTP_ACCESS_TYPE_NAMED_PROXY
instead of WINHTTP_ACCESS_TYPE_DEFAULT_PROXY - is that correct?

Thanks,
Chris
Eric Loewenthal
2008-10-07 06:17:02 UTC
Permalink
Hi Chris,

Yes that is correct. However, you should only be using
WINHTTP_ACCESS_TYPE_NAMED_PROXY if you have a Proxy string (non-null and not
empty string). A bypass list by itself does not do anything.

Also - Once you have executed WinHttpGetProxyForUrl (and it succeeds) you
might want to consider using WINHTTP_ACCESS_TYPE_NO_PROXY if there is no
proxy string. WINHTTP_ACCESS_TYPE_DEFAULT is going to give you proxy
settings set via netsh which may not be accurate, especially when roaming.
The empty proxy string from IE is more likely to be valid and as such you
should be able to trust it to be correct.

Let me know if you have any follow up questions.

Thanks,

Eric Loewenthal
Post by Chris Shearer Cooper
I need to copy the IE proxy settings for use by my WinHTTP-based
application, and I found this web site that describes 90% of what I
need to know ...
http://msdn.microsoft.com/en-us/library/aa384075.aspx
but do I need to change the 'dwAccessType' flag that I pass to
WinHttpOpen? I'm guessing that if either lpszProxy or lpszProxyBypass
is non-NULL in the WINHTTP_CURRENT_USER_IE_PROXY_CONFIG structure, I
need to set the dwAccessType flag to WINHTTP_ACCESS_TYPE_NAMED_PROXY
instead of WINHTTP_ACCESS_TYPE_DEFAULT_PROXY - is that correct?
Thanks,
Chris
Loading...