2006-07-21 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>

To add the support for Metalink3.0 backward compatible links:
	
	* src/Request.h
	(SAFE_CHARS): Added '#'.
	(METALINK_MARK): New definition.
	* src/Request.cc
	(parseUrl): Added the support for Metalink3.0 backward 
compatible
	links.

	etc

	* src/PeerInteraction.cc
	(MsgPushBack): Removed.
	(sendMessages): Use STL copy and back_inserter.
	(rejectAllPieceMessageInQueue): Use STL copy and back_inserter.
	(rejectPieceMessageInQueue): Use STL copy and back_inserter.
	* src/TorrentMan.h
	(MAX_PEER_LIST_SIZE): Changed to 100 from 250.
This commit is contained in:
Tatsuhiro Tsujikawa 2006-07-20 15:48:12 +00:00
parent 524d664850
commit 7db2b0596d
7 changed files with 68 additions and 20 deletions

View file

@ -23,6 +23,8 @@ class RequestTest:public CppUnit::TestFixture {
CPPUNIT_TEST(testRedirectUrl2);
CPPUNIT_TEST(testResetUrl);
CPPUNIT_TEST(testSafeChar);
CPPUNIT_TEST(testInnerLink);
CPPUNIT_TEST(testMetalink);
CPPUNIT_TEST_SUITE_END();
public:
@ -44,6 +46,8 @@ public:
void testRedirectUrl2();
void testResetUrl();
void testSafeChar();
void testInnerLink();
void testMetalink();
};
@ -270,3 +274,22 @@ void RequestTest::testSafeChar() {
bool v = req.setUrl("http://aria.rednoah.com/|<>");
CPPUNIT_ASSERT(!v);
}
void RequestTest::testInnerLink() {
Request req;
bool v = req.setUrl("http://aria.rednoah.com/index.html#download");
CPPUNIT_ASSERT(v);
CPPUNIT_ASSERT_EQUAL(string("index.html"), req.getFile());
}
void RequestTest::testMetalink() {
Request req;
bool v = req.setUrl("http://aria.rednoah.com/download/aria.tar.bz2#!metalink3!http://aria2.sourceforge.net/download/aria.metalink");
CPPUNIT_ASSERT(v);
CPPUNIT_ASSERT_EQUAL(string("aria2.sourceforge.net"), req.getHost());
CPPUNIT_ASSERT_EQUAL(string("/download"), req.getDir());
CPPUNIT_ASSERT_EQUAL(string("aria.metalink"), req.getFile());
bool v2 = req.setUrl("http://aria.rednoah.com/download/aria.tar.bz2#!metalink3!");
CPPUNIT_ASSERT(!v2);
}