IE works OK with that setting, and succeeds to fetch and use the proxy, but
when I pass this to WinHttpGetProxyForUrl to get the real proxy server, the
function fails with error 12006 (ERROR_WINHTTP_UNRECOGNIZED_SCHEME).
According to the documentation found here:
http://msdn.microsoft.com/en-us/library/aa384097(VS.85).aspx
this error means: "The URL of the PAC file specified a scheme other than
"http:" or "https:".
So, what other function I can use to get the right proxy server for a given
url from a locally deployed proxy.pac?
Thanks
Unfortunately the error message you are receiving meens exactly what it says
it means. WinHttpGetProxyForUrl and WinINET proxy download are basically
mini file download apps that use the respective stack's functionality. In
this case WinHttpGetProxyForUrl will use WinHttpSendRequest while WinINET
uses InternetOpenUrl. Writing these sample apps you will notice that
WinHttpSendRequest does not support the file:// 'scheme' while
InternetOpenUrl does. As such, WinINET supports local .pac files but WinHTTP
does not. There is no current workaround aside from moving the .pac file
onto a web server or using WinINET as your Http stack.
Let me know if you have any followup questions.
Thanks,
Eric Loewenthal
eri...@microsoft.com
"Eric Loewenthal" wrote:
> Hi Sunny,
>
> Unfortunately the error message you are receiving meens exactly what it says
> it means. WinHttpGetProxyForUrl and WinINET proxy download are basically
> mini file download apps that use the respective stack's functionality. In
> this case WinHttpGetProxyForUrl will use WinHttpSendRequest while WinINET
> uses InternetOpenUrl. Writing these sample apps you will notice that
> WinHttpSendRequest does not support the file:// 'scheme' while
> InternetOpenUrl does. As such, WinINET supports local .pac files but WinHTTP
> does not. There is no current workaround aside from moving the .pac file
> onto a web server or using WinINET as your Http stack.
>
> Let me know if you have any followup questions.
>
> Thanks,
>
> Eric Loewenthal
> eri...@microsoft.com
>
Hi Eric,
thanks for the answer. Anyway, I have no control over client's environment,
and I can not tell them how to deploy their setup. I see that IE can cope
somehow with file:// setting, so is there any other API (even part of the IE
object model) which I can use to get the information needed?
Thanks again
Sunny
Are you running as a client app running as the interactive user or a service
impersonating the caller?
Thanks,
Eric Loewenthal
eri...@microsoft.com
"Eric Loewenthal" wrote:
> Hi Sunny,
>
> Are you running as a client app running as the interactive user or a service
> impersonating the caller?
>
Hi Eric,
this is a client app, running as interactive user.
Thanks
Sunny
Sorry for the delayed response.
If you must find a way to support the local proxy scripts you can use
wininet.dll proxy functionality. As MSDN states, it is recommended you use
WinHTTP and these older wininet APIs are not nearly as feature rich. As
such, I would recommend calling the WinHTTP API first for each URL and only
upon failure for that URL would I call the WinINET version.
The functions you will need are
First call InternetInitializeAutoProxyDll
http://msdn.microsoft.com/en-us/library/aa385093(VS.85).aspx
Second call InternetGetProxyInfo
http://msdn.microsoft.com/en-us/library/aa384726.aspx
Finally call InternetDeInitializeAutoProxyDll
http://msdn.microsoft.com/en-us/library/aa384580(VS.85).aspx
As you see on MSDN you need to LoadLib jsproxy and GetProcAddress these
functions.
There is a sample here:
http://msdn.microsoft.com/en-us/library/aa383910(VS.85).aspx to help you get
started. The sample looks like it is missing an entry in the Vtbl
declaration, there should be 9 functions.
Note that if you need IPv6 support you will need to provide an Ex version of
the IPv4 functions in the sample.
Thanks,
Eric Loewenthal
eri...@microsoft.com
This posting is provided "AS IS" with no warranties, and confers no rights.