Show/Hide Toolbars

TMS Sparkle Documentation

Navigation: Http Client

Proxy configuration on Windows

Scroll Prev Top Next More

When on Windows, you can configure the proxy used for connections. There are three modes for using proxies:



This is the default mode. Sparkle http client on Windows is based on WinHttp library. When proxy is set to this mode, Sparkle will use the default proxy settings for WinHttp library. Note that this is not the default proxy used by Internet Explorer. The proxy for WinHttp is set using specific code, using netsh command-line (you can find an example here: Netsh Commands for WINHTTP)



In this mode, it's you that manually define the proxy address.



Proxy settings will be detected automatically based on current Windows settings (Internet Explorer and other global settings). Supported on Windows 8.1 and later only. If your application is running on a Windows version below 8.1, the mode will automatically switch to Default mode.


The following code illustrates how to use each mode, from an existing THttpClient instance (represented here by FClient variable):


uses {...}, Sparkle.WinHttp.Engine;
  Engine: TWinHttpEngine;
  Engine := TWinHttpEngine(FClient.Engine);
  // Option 1: Current behavior
  Engine.ProxyMode = THttpProxyMode.Default;
  // Option 2: Get proxy settings automatically (windows 8.1 and later only)
  Engine.ProxyMode := THttpProxyMode.Auto;
  // Option 3: Custom proxy settings
  Engine.ProxyMode := THttpProxyMode.Custom;
  Engine.ProxyName := 'localhost:8888';
  // Force a new session to use new proxy settings