curl-library
Re: Patch to get Windows proxy settings
Date: Mon, 28 Jan 2013 14:10:46 +0100
Hi all,
> Well, I'm not a Windows developer too... So anyone with better expertise
> on the topic is welcomed to some help ;)
I have been doing something similar for an unrelated project and
supporting all variants of Windows proxy settings, including automatic
settings retrieval, is quite complex.
Basically WinHttpGetIEProxyConfigForCurrentUser() returns the list of
proxy servers, bypassed addresses and which automatic methods to try,
then you are supposed to try them using WinHttpGetProxyForUrl(), or
even retry, in case of failed authentication. Also the full
autodetection takes a few seconds (if there is nothing to detect in
the end, otherwise it's fast, probably cached) and therefore some
mechanism to not try it again during the same session (or good amount
of time) needs to be introduced.
I've attached the related code I wrote based on this experience. It is
C++, but can be useful for reference nevertheless.
It compiles into a stand-alone Windows application which can be used
to print the current proxy settings and test the algorithms on entered
URLs.
Hope that helps,
Jiri
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
- text/x-c++src attachment: proxy.cpp