mirror of
https://github.com/aria2/aria2.git
synced 2025-04-05 21:47:37 +03:00
Suppress content-range error when 'Content-Range' response header doesn't contains bytes-unit specifier 'bytes' * src/HttpHeader.cc (getRange) * test/HttpHeaderTest.cc
47 lines
1.2 KiB
C++
47 lines
1.2 KiB
C++
#include "HttpHeader.h"
|
|
#include "Range.h"
|
|
#include <cppunit/extensions/HelperMacros.h>
|
|
|
|
namespace aria2 {
|
|
|
|
class HttpHeaderTest:public CppUnit::TestFixture {
|
|
|
|
CPPUNIT_TEST_SUITE(HttpHeaderTest);
|
|
CPPUNIT_TEST(testGetRange);
|
|
CPPUNIT_TEST_SUITE_END();
|
|
|
|
public:
|
|
void testGetRange();
|
|
|
|
};
|
|
|
|
|
|
CPPUNIT_TEST_SUITE_REGISTRATION( HttpHeaderTest );
|
|
|
|
void HttpHeaderTest::testGetRange()
|
|
{
|
|
{
|
|
HttpHeader httpHeader;
|
|
httpHeader.put("Content-Range",
|
|
"9223372036854775800-9223372036854775801/9223372036854775807");
|
|
|
|
SharedHandle<Range> range = httpHeader.getRange();
|
|
|
|
CPPUNIT_ASSERT_EQUAL(9223372036854775800LL, range->getStartByte());
|
|
CPPUNIT_ASSERT_EQUAL(9223372036854775801LL, range->getEndByte());
|
|
CPPUNIT_ASSERT_EQUAL(9223372036854775807ULL, range->getEntityLength());
|
|
}
|
|
{
|
|
HttpHeader httpHeader;
|
|
httpHeader.put("Content-Range",
|
|
"9223372036854775800-9223372036854775801/9223372036854775807");
|
|
|
|
SharedHandle<Range> range = httpHeader.getRange();
|
|
|
|
CPPUNIT_ASSERT_EQUAL(9223372036854775800LL, range->getStartByte());
|
|
CPPUNIT_ASSERT_EQUAL(9223372036854775801LL, range->getEndByte());
|
|
CPPUNIT_ASSERT_EQUAL(9223372036854775807ULL, range->getEntityLength());
|
|
}
|
|
}
|
|
|
|
} // namespace aria2
|