void test_o_url_resolve_host_from_path()
{
	char *host;
	int port;
	int ret = o_url_resolve_host_port_from_path("127.0.0.1", &host, &port);
	assert_true(ret == 1, "wrong return value");
	assert_true(strcmp(host, "127.0.0.1") == 0, "wrong host name");
	o_free(host);
}
Beispiel #2
0
struct o_connection * o_connection_new(enum o_url_type type, char * path)
{
	struct o_connection *conn = 0;
	int port;
	char * host;
	switch (type)
	{
	case REMOTE:
		if (o_url_resolve_host_port_from_path(path, &host, &port))
			port = 2424;
		conn = o_connection_remote_new(path, port);
		break;
	case HTTP:
		break;
	case LOCAL:
		break;
	}
	conn->path = path;
	conn->type = type;
	conn->storages = o_map_string_new();
	return conn;
}