How do I set TIdHTTP to use IE proxy configuration?
It should be compatible with XP/Vista/Win7 and reliable.
How do I set TIdHTTP to use IE proxy configuration? It should be compatible
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Indy doesn’t use Internet Explorer’s proxy settings and so you have to get it by yourself, for instance by using
InternetQueryOptionfunction.Update:
Here is the code using
WinHTTPwhich should try to receive the settings from IE. If they are available and auto-detect proxy settings or auto-config script URL options are set, then the proxy detection will be performed. Auto-detection will also be performed when the IE settings are not available.Disclaimer:
The following code has been tested only for the easiest case, when the IE settings are available and the proxy settings are not configured to be detected automatically (don’t have the environment). Also please note that some of the functions, structures and constant are additional in this unit.
For an alternative Delphi code you can check e.g.
this tip.Here’s an example of how to setup a
TIdHTTPwith obtained proxy settings (actually you just parse the obtained proxy URL and pass it to theProxyServerandProxyPortproperties):