HTTPClientSettings

Defines an HTTP/HTTPS proxy request or a connection timeout for an HTTPClient.

Members

Variables

defaultKeepAliveTimeout
Duration defaultKeepAliveTimeout;
Undocumented in source.
dnsAddressFamily
AddressFamily dnsAddressFamily;

Can be used to force looking up IPv4/IPv6 addresses for host names.

networkInterface
NetworkAddress networkInterface;

Forces a specific network interface to use for outgoing connections.

proxyURL
URL proxyURL;
Undocumented in source.

Examples

void test() {

	HTTPClientSettings settings = new HTTPClientSettings;
	settings.proxyURL = URL.parse("http://proxyuser:proxypass@192.168.2.50:3128");
	settings.defaultKeepAliveTimeout = 0.seconds; // closes connection immediately after receiving the data.
	requestHTTP("http://www.example.org",
				(scope req){
		req.method = HTTPMethod.GET;
	},
	(scope res){
		logInfo("Headers:");
		foreach(key, ref value; res.headers) {
			logInfo("%s: %s", key, value);
		}
		logInfo("Response: %s", res.bodyReader.readAllUTF8());
	}, settings);

}

Meta