bug-wget
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Bug-wget] Unit test case for parse_content_range()


From: Darshit Shah
Subject: Re: [Bug-wget] Unit test case for parse_content_range()
Date: Sun, 30 Aug 2015 11:04:09 +0530

On Sun, Aug 30, 2015 at 12:51 AM, Tim Rühsen <address@hidden> wrote:
> Am Samstag, 29. August 2015, 23:13:23 schrieb Darshit Shah:
>> I've written a unit test for the parse_content_range() method.
>> However, I haven't yet populated it with various test cases.
>> Sharing the patch for the unit test here. I will add more test cases
>> for this test later.
>>
>> Kindly do review the patch. If no one complains, I'll push it in a
>> couple of days.
>
> Hi Darshit,
>
> some of the 'valid' tests
>
On closer inspection, some of these are *NOT* valid Header values. But
Wget currently passes them. This is a parsing bug in my opinion.

RFC 7233 states:

 "A Content-Range field value is invalid if it contains a
   byte-range-resp that has a last-byte-pos value less than its
   first-byte-pos value, or a complete-length value less than or equal
   to its last-byte-pos value.  The recipient of an invalid
   Content-Range MUST NOT attempt to recombine the received content with
   a stored representation."

Based on this, the first two examples provided are illegal. Similarly
a header value such as:
{ "bytes 100-99/1000", 100, 99, 1000}
should also be very clearly illegal, but Wget currently allows it. I'm
not sure about the behaviour of the program on receipt of such a
header, but the function should clearly be failing on this test.

> 0-max
> { "bytes 0-1000/1000", 0, 1000, 1000}
> non0-max
> { "bytes 1-1000/1000", 1, 1000, 1000}
> 0-valid
> { "bytes 0-500/1000", 0, 500, 1000}
> non0-valid
> { "bytes 1-500/1000", 1, 500, 1000}
> 0-(max-1)
> { "bytes 0-999/1000", 0, 999, 1000}
> non0-(max-1)
> { "bytes 1-999/1000", 1, 999, 1000}
>
> And please add some tests using >=2^31 and >=2^32 as values.
>
> Regards, Tim



-- 
Thanking You,
Darshit Shah



reply via email to

[Prev in Thread] Current Thread [Next in Thread]