Beispiel #1
0
bool CVFSEntry::Rename(const CURL& url, const CURL& url2)
{
  if (!Initialized())
    return false;

  CVFSURLWrapper url3(url);
  CVFSURLWrapper url4(url2);
  return m_pStruct->Rename(&url3.url, &url4.url);
}
Beispiel #2
0
bool CVFSEntry::Rename(const CURL& url, const CURL& url2)
{
  if (!m_struct.toAddon.rename)
    return false;

  CVFSURLWrapper url3(url);
  CVFSURLWrapper url4(url2);
  return m_struct.toAddon.rename(&m_struct, &url3.url, &url4.url);
}
Beispiel #3
0
// Ensure all functions compile correctly.
void url_compile_test()
{
  // Constructors

  urdl::url url1;
  urdl::url url2("http://foo/bar");
  urdl::url url3(std::string("http://foo/bar"));
  urdl::url url4(url1);
  urdl::url url5 = url1;

  // operator=

  url5 = url2;

  // protocol()

  const urdl::url& const_url1 = url1;
  want<std::string>(const_url1.protocol());

  // user_info()

  want<std::string>(const_url1.user_info());

  // host()

  want<std::string>(const_url1.host());

  // port()

  want<unsigned short>(const_url1.port());

  // path()

  want<std::string>(const_url1.path());

  // query()

  want<std::string>(const_url1.query());

  // fragment()

  want<std::string>(const_url1.fragment());

  // to_string()

  want<std::string>(const_url1.to_string());
  want<std::string>(const_url1.to_string(urdl::url::protocol_component));
  want<std::string>(const_url1.to_string(urdl::url::user_info_component));
  want<std::string>(const_url1.to_string(urdl::url::host_component));
  want<std::string>(const_url1.to_string(urdl::url::port_component));
  want<std::string>(const_url1.to_string(urdl::url::path_component));
  want<std::string>(const_url1.to_string(urdl::url::query_component));
  want<std::string>(const_url1.to_string(urdl::url::fragment_component));
  want<std::string>(const_url1.to_string(urdl::url::all_components));

  // from_string()

  asio::error_code ec;
  want<urdl::url>(urdl::url::from_string("http://foo/bar"));
  want<urdl::url>(urdl::url::from_string("http://foo/bar", ec));
  want<urdl::url>(urdl::url::from_string(std::string("http://foo/bar")));
  want<urdl::url>(urdl::url::from_string(std::string("http://foo/bar"), ec));

  // operator==

  const urdl::url& const_url2 = url2;
  want<bool>(const_url1 == const_url2);

  // operator!=

  want<bool>(const_url1 != const_url2);

  // operator<

  want<bool>(const_url1 < const_url2);
}
Beispiel #4
0
void Test_NetCore::TestSettingUrl ()
{
	string reason;

	std::cout<<"TestSettingUrl\n";

	NetCore _nc (ptr_callback.get(), &journal, ptr_log.get());
	//former _nc.Init (ptr_log.get());

	string url ("ftp://downloads1.kaspersky-labs.com/index.htm");
	string url2 ("ftp://downloads2.kaspersky-labs.com/index.html");
	string url3 ("ftp://downloads1.kaspersky-labs.com:23/index.html");
	string url4 ("ftp://downloads1.kaspersky-labs.com/");
	string url5 ("ftp://downloads1.kaspersky-labs.com:21/rel1/rel2/");
	string url6 ("ftp://downloads1.kaspersky-labs.com:22/rel1/rel2/rel3/index.htm");
	string url7 ("ftp://downloads1.kaspersky-labs.com");

	string url8 ("\\\\avp_server\\common\\file.txt");
	string url9 ("http://10.64.0.5/common:8088/file.txt");

	//case 1
	TD_BOOST_CHECK_MESSAGE (_nc.SetUrl (url.c_str(), false) == NET_NO_ERROR, "Setting URL");
	TD_BOOST_CHECK_MESSAGE (
		AddressInformation_Unit (AddressInformation::Protocol::ftpPassive, url.c_str(), "downloads1.kaspersky-labs.com",
						DOWNLOADS1_IP, "/index.htm/", 0
						) == _nc.m_addressInformation, "Checking NetUrlInfo"
						);

  
	//case 2
	TD_BOOST_CHECK_MESSAGE (_nc.SetUrl (url2.c_str(), false) == NET_NO_ERROR, "Setting URL");
	TD_BOOST_CHECK_MESSAGE (
		AddressInformation_Unit (AddressInformation::Protocol::ftpPassive, url2.c_str(), "downloads2.kaspersky-labs.com",
						DOWNLOADS2_IP, "/index.html/", 0
						) == _nc.m_addressInformation, "Checking NetUrlInfo"
						);

	//case 2a
	TD_BOOST_CHECK_MESSAGE (_nc.SetUrl (url2.c_str(), true) == NET_NO_ERROR, "Setting URL");
	TD_BOOST_CHECK_MESSAGE (
		AddressInformation_Unit (AddressInformation::Protocol::ftpActive, url2.c_str(), "downloads2.kaspersky-labs.com",
						DOWNLOADS2_IP, "/index.html/", 0
						) == _nc.m_addressInformation, "Checking NetUrlInfo"
						);

	//case 3
	TD_BOOST_CHECK_MESSAGE (_nc.SetUrl (url3.c_str(), true) == NET_NO_ERROR, "Setting URL");
	TD_BOOST_CHECK_MESSAGE (
		AddressInformation_Unit (AddressInformation::Protocol::ftpActive, url3.c_str(), "downloads1.kaspersky-labs.com",
						DOWNLOADS1_IP, "/index.html/", 23
						) == _nc.m_addressInformation, "Checking NetUrlInfo"
						);

	//case 4
	TD_BOOST_CHECK_MESSAGE (_nc.SetUrl (url4.c_str(), true) == NET_NO_ERROR, "Setting URL");
	TD_BOOST_CHECK_MESSAGE (
		AddressInformation_Unit (AddressInformation::Protocol::ftpActive, url4.c_str(), "downloads1.kaspersky-labs.com",
						DOWNLOADS1_IP, "/", 0
						) == _nc.m_addressInformation, "Checking NetUrlInfo"
						);

	//case 5
	TD_BOOST_CHECK_MESSAGE (_nc.SetUrl (url5.c_str(), true) == NET_NO_ERROR, "Setting URL");
	TD_BOOST_CHECK_MESSAGE (
		AddressInformation_Unit (AddressInformation::Protocol::ftpActive, url5.c_str(), "downloads1.kaspersky-labs.com",
						DOWNLOADS1_IP, "/rel1/rel2/", 21
						) == _nc.m_addressInformation, "Checking NetUrlInfo"
						);

	//case 6
	TD_BOOST_CHECK_MESSAGE (_nc.SetUrl (url6.c_str(), true) == NET_NO_ERROR, "Setting URL");
	TD_BOOST_CHECK_MESSAGE (
		AddressInformation_Unit (AddressInformation::Protocol::ftpActive, url6.c_str(), "downloads1.kaspersky-labs.com",
						DOWNLOADS1_IP, "/rel1/rel2/rel3/index.htm/", 22
						) == _nc.m_addressInformation, "Checking NetUrlInfo"
						);

	//case 7
	TD_BOOST_CHECK_MESSAGE (_nc.SetUrl (url7.c_str(), true) == NET_NO_ERROR, "Setting URL");
	TD_BOOST_CHECK_MESSAGE (
		AddressInformation_Unit (AddressInformation::Protocol::ftpActive, url7.c_str(), "downloads1.kaspersky-labs.com",
						DOWNLOADS1_IP, "/", 0
						) == _nc.m_addressInformation, "Checking NetUrlInfo"
						);

	//case 8
	TD_BOOST_CHECK_MESSAGE (_nc.SetUrl (url8.c_str(), true) == NET_NO_ERROR, "Setting URL");
	TD_BOOST_CHECK_MESSAGE (
		AddressInformation_Unit (AddressInformation::Protocol::fileProtocol, "", "",
						"", url8.c_str(), 0
						) == _nc.m_addressInformation, "Checking NetUrlInfo"
						);

	//case 9
	TD_BOOST_CHECK_MESSAGE (_nc.SetUrl (url9.c_str(), true) == NET_WRONG_USAGE, "Setting URL");
	/*TD_BOOST_CHECK_MESSAGE (
		AddressInformation_Unit (AddressInformation::Protocol::notDefined, url9.c_str(), "10.64.0.5",
						"10.64.0.5", "common", 8088
						) == _nc.m_addressInformation, "Checking NetUrlInfo"
						);*/

	Step ("TestSettingUrl", reason);
};