2010-10-31 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>

Return empty range if byte-range-resp-spec or instance-length is
	"*" in Content-Range header to prevent aria2 from emitting error
	failing to convert "*" to a integer.
	* src/HttpHeader.cc
	* test/HttpHeaderTest.cc
This commit is contained in:
Tatsuhiro Tsujikawa 2010-10-31 07:56:01 +00:00
parent 2b458da480
commit 35cc4ed1e7
3 changed files with 36 additions and 0 deletions

View file

@ -45,6 +45,26 @@ void HttpHeaderTest::testGetRange()
CPPUNIT_ASSERT_EQUAL((off_t)9223372036854775801LL, range->getEndByte());
CPPUNIT_ASSERT_EQUAL((uint64_t)9223372036854775807ULL, range->getEntityLength());
}
{
HttpHeader httpHeader;
httpHeader.put("Content-Range", "bytes */1024");
SharedHandle<Range> range = httpHeader.getRange();
CPPUNIT_ASSERT_EQUAL((off_t)0, range->getStartByte());
CPPUNIT_ASSERT_EQUAL((off_t)0, range->getEndByte());
CPPUNIT_ASSERT_EQUAL((uint64_t)0, range->getEntityLength());
}
{
HttpHeader httpHeader;
httpHeader.put("Content-Range", "bytes 0-9/*");
SharedHandle<Range> range = httpHeader.getRange();
CPPUNIT_ASSERT_EQUAL((off_t)0, range->getStartByte());
CPPUNIT_ASSERT_EQUAL((off_t)0, range->getEndByte());
CPPUNIT_ASSERT_EQUAL((uint64_t)0, range->getEntityLength());
}
}
void HttpHeaderTest::testGet()