vibe.d beta banner
get vibe.d
0.7.30

Class HTTPClientSettings

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

Inherits from

  • Object (base class)

Fields

Name Type Description
defaultKeepAliveTimeout core.time.Duration
dnsAddressFamily std.socket.AddressFamily Can be used to force looking up IPv4/IPv6 addresses for host names.
networkInterface NetworkAddress Forces a specific network interface to use for outgoing connections.
proxyURL URL

Example

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);

}
Authors

Sönke Ludwig, Jan Krüger

Copyright

© 2012-2014 RejectedSoftware e.K.

License

Subject to the terms of the MIT license, as written in the included LICENSE.txt file.