AutoProtocol

Connection type used when the URL should be used to auto detect the protocol.

This struct is used as placeholder for the connection parameter when calling the high level API and the connection type (HTTP/FTP) should be guessed by inspecting the URL parameter.

The rules for guessing the protocol are: 1, if URL starts with ftp://, ftps:// or ftp. then FTP connection is assumed. 2, HTTP connection otherwise.

struct AutoProtocol

Examples

import std.net.curl;
// Two requests below will do the same.
char[] content;

// Explicit connection provided
content = get!HTTP("dlang.org");

// Guess connection type by looking at the URL
content = get!AutoProtocol("ftp://foo.com/file");
// and since AutoProtocol is default this is the same as
content = get("ftp://foo.com/file");
// and will end up detecting FTP from the url and be the same as
content = get!FTP("ftp://foo.com/file");

Meta